@visma-swno/gaia-chat-ui 2.1.0 → 2.1.2
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/dist/da-DB2G9hr9.js +45 -0
- package/dist/da-DB2G9hr9.js.map +1 -0
- package/dist/{index-C0BXTIwR.js → index-BvrLe6Am.js} +239 -219
- package/dist/{index-C0BXTIwR.js.map → index-BvrLe6Am.js.map} +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +58 -58
- package/dist/index.umd.js.map +1 -1
- package/dist/{nb-Dw8N0Ba1.js → nb-CAH8MMZb.js} +2 -2
- package/dist/nb-CAH8MMZb.js.map +1 -0
- package/dist/package.json.d.ts +1 -1
- package/dist/src/app/app.d.ts.map +1 -1
- package/dist/src/app/localization.d.ts +1 -1
- package/dist/src/app/localization.d.ts.map +1 -1
- package/dist/src/generated/locale-codes.d.ts +2 -2
- package/dist/src/generated/locale-codes.d.ts.map +1 -1
- package/dist/src/generated/locales/da.d.ts +41 -0
- package/dist/src/generated/locales/da.d.ts.map +1 -0
- package/dist/src/generated/locales/sv.d.ts +41 -0
- package/dist/src/generated/locales/sv.d.ts.map +1 -0
- package/dist/src/infra/http/api-client.d.ts +1 -0
- package/dist/src/infra/http/api-client.d.ts.map +1 -1
- package/dist/sv-DpmOrP-S.js +45 -0
- package/dist/sv-DpmOrP-S.js.map +1 -0
- package/package.json +1 -1
- package/dist/nb-Dw8N0Ba1.js.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(C,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("lit"),require("lit/decorators.js"),require("lit/directives/live.js"),require("lit/directives/unsafe-svg.js"),require("lit/directives/unsafe-html.js"),require("lit/directives/repeat.js"),require("lit/directives/map.js"),require("lit/directives/ref.js"),require("lit/directives/guard.js")):typeof define=="function"&&define.amd?define(["exports","lit","lit/decorators.js","lit/directives/live.js","lit/directives/unsafe-svg.js","lit/directives/unsafe-html.js","lit/directives/repeat.js","lit/directives/map.js","lit/directives/ref.js","lit/directives/guard.js"],g):(C=typeof globalThis<"u"?globalThis:C||self,g(C["gaia-chat-ui"]={},C.Lit,C.decorators_js,C.live_js,C.unsafeSvg_js,C.unsafeHtml_js,C.repeat_js,C.map_js,C.ref_js,C.guard_js))})(this,(function(C,g,w,Gn,P,
|
|
1
|
+
(function(C,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("lit"),require("lit/decorators.js"),require("lit/directives/live.js"),require("lit/directives/unsafe-svg.js"),require("lit/directives/unsafe-html.js"),require("lit/directives/repeat.js"),require("lit/directives/map.js"),require("lit/directives/ref.js"),require("lit/directives/guard.js")):typeof define=="function"&&define.amd?define(["exports","lit","lit/decorators.js","lit/directives/live.js","lit/directives/unsafe-svg.js","lit/directives/unsafe-html.js","lit/directives/repeat.js","lit/directives/map.js","lit/directives/ref.js","lit/directives/guard.js"],g):(C=typeof globalThis<"u"?globalThis:C||self,g(C["gaia-chat-ui"]={},C.Lit,C.decorators_js,C.live_js,C.unsafeSvg_js,C.unsafeHtml_js,C.repeat_js,C.map_js,C.ref_js,C.guard_js))})(this,(function(C,g,w,Gn,P,Kr,Jr,Qr,es,ts){"use strict";function Yn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var qt={exports:{}};/*!
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
|
-
*/var
|
|
5
|
+
*/var rs;function Xn(){return rs||(rs=1,(function(r){(function(){var e={}.hasOwnProperty;function t(){for(var o="",i=0;i<arguments.length;i++){var a=arguments[i];a&&(o=s(o,n(a)))}return o}function n(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return t.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var i="";for(var a in o)e.call(o,a)&&o[a]&&(i=s(i,a));return i}function s(o,i){return i?o?o+" "+i:o+i:o}r.exports?(t.default=t,r.exports=t):window.classNames=t})()})(qt)),qt.exports}var Zn=Xn();const _e=Yn(Zn);class Kn{constructor(e={}){this.listeners=e,this.strategy=null,this.kind=null,this.expiringLeadMs=null}setStrategy(e,t){this.kind=e,this.strategy=t,this.strategy.setListeners(this.listeners),this.expiringLeadMs!==null&&this.strategy.setExpiringBufferMs(this.expiringLeadMs),this.strategy.init()}get strategyKind(){return this.kind}setExpiringLeadMs(e){const t=Number.isFinite(e)&&e>=0?Math.floor(e):1e4;this.expiringLeadMs=t,this.strategy?.setExpiringBufferMs(t)}getIdentifier(){return this.requireStrategy().getIdentifier()}async getAccessToken(){return this.requireStrategy().getAccessToken()}async clear(){await this.strategy?.clear()}requireStrategy(){if(!this.strategy)throw new Error("Auth not configured");return this.strategy}}class xe extends Error{constructor(e,t,n,s,o,i){super(e),this.status=t,this.url=n,this.innerError=s,this.bodyText=o,this.problem=i,this.name="ApiError"}get isUnauthorized(){return this.status===401}get isForbidden(){return this.status===403}get isNotFound(){return this.status===404}get isServerError(){return this.status>=500}get isNetworkError(){return this.status===0}}async function Jn(r){let e,t;try{e=await r.clone().text()}catch{e=void 0}try{const s=r.headers.get("content-type")||"";(s.includes("application/problem+json")||s.includes("application/json"))&&(t=JSON.parse(e||"{}"))}catch{t=void 0}const n=t?.detail||t?.title||e&&e.slice(0,200)||`HTTP ${r.status} ${r.statusText}`;return new xe(n,r.status,r.url,void 0,e,t)}async function ss(r){if(!r.ok)throw await Jn(r)}function Wt(r){if(!r.body)throw new xe("No response body",r.status,r.url);return r.body}async function Vt(r){try{return await r.json()}catch(e){throw new xe("Failed to parse response body as JSON",r.status,r.url,e)}}class Qn{constructor(){this.key="gaia-chat:visitor-token"}load(){const e=localStorage.getItem(this.key);return e||null}save(e){localStorage.setItem(this.key,e)}clear(){localStorage.removeItem(this.key)}}class qe extends Error{constructor(e){super(e),this.name="AuthError"}}class ns extends qe{constructor(){super("Token expired"),this.name="TokenExpiredError"}}class We extends qe{constructor(){super("Token invalid"),this.name="TokenInvalidError"}}class Ve extends qe{constructor(){super("Token required"),this.name="TokenRequiredError"}}class Ge extends Error{}Ge.prototype.name="InvalidTokenError";function eo(r){return decodeURIComponent(atob(r).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function to(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return eo(e)}catch{return atob(e)}}function os(r,e){if(typeof r!="string")throw new Ge("Invalid token specified: must be a string");e||(e={});const t=e.header===!0?0:1,n=r.split(".")[t];if(typeof n!="string")throw new Ge(`Invalid token specified: missing part #${t+1}`);let s;try{s=to(n)}catch(o){throw new Ge(`Invalid token specified: invalid base64 for part #${t+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new Ge(`Invalid token specified: invalid json for part #${t+1} (${o.message})`)}}class is{constructor(e=1e4){this._token=null,this.expiringTimer=null,this.expiredTimer=null,this.hasEmittedExpiring=!1,this.hasEmittedExpired=!1,this.listeners={},this._expiringBufferMs=e}init(){this.onInit()}clear(){return this.token=null,this.onClear()}setListeners(e){this.listeners=e}async getIdentifier(){const e=await this.getAccessToken(!0);if(!e)throw new Ve;return os(e).sub}setExpiringBufferMs(e){const t=Number.isFinite(e)&&e>=0?Math.floor(e):12e4;this._expiringBufferMs=t,this.armTimers()}get expiringBufferMs(){return this._expiringBufferMs}set token(e){typeof e=="string"?this._token=this.getDecodedAccessToken(e):this._token=e,this.hasEmittedExpiring=!1,this.hasEmittedExpired=!1,this.listeners.onUpdated?.(this._token?.exp??null,e),this.armTimers()}get token(){return this._token?.value??null}isExpiring(){if(!this._token?.exp)throw new Ve;return this._token.exp<Date.now()+this.expiringBufferMs}isExpired(){if(!this._token?.exp)throw new Ve;return this._token.exp<Date.now()}clearTimers(){this.expiringTimer&&clearTimeout(this.expiringTimer),this.expiredTimer&&clearTimeout(this.expiredTimer),this.expiringTimer=null,this.expiredTimer=null}armTimers(){if(this.clearTimers(),!this._token?.exp)return;const e=Date.now(),t=this._token.exp-e;if(t<=0)return this.emitExpired();t<=this.expiringBufferMs&&!this.hasEmittedExpiring&&this.emitExpiring(t),this.hasEmittedExpiring||(this.expiringTimer=window.setTimeout(()=>{this._token?.exp&&this.emitExpiring(this._token.exp-Date.now())},Math.max(0,t-this.expiringBufferMs))),this.expiredTimer=window.setTimeout(()=>{this.emitExpired()},Math.max(0,t))}emitExpiring(e){this.hasEmittedExpiring||!this._token?.exp||(this.hasEmittedExpiring=!0,this.listeners.onExpiring?.(this._token.exp,e))}emitExpired(){this.hasEmittedExpired||!this._token?.exp||(this.hasEmittedExpired=!0,this.listeners.onExpired?.(this._token.exp))}getDecodedAccessToken(e){try{const t=os(e);return{value:e,exp:t.exp?t.exp*1e3:void 0}}catch{throw new We}}}class ro extends is{constructor(e,t=new Qn,n=fetch){super(),this.baseUrl=e,this.storage=t,this.fetchImpl=n}onInit(){try{this.token=this.storage.load()}catch(e){if(e instanceof We)this.storage.clear(),this.token=null;else throw e}}async getAccessToken(e){if(!this.token){const t=await this.requestVisitorToken();return this.storage.save(t),this.token=t,this.token}if(this.isExpiring()&&!e){const t=await this.refreshVisitorToken();this.storage.save(t),this.token=t}return this.token}async onClear(){this.storage.clear()}async requestVisitorToken(){const e=await(this.fetchImpl??fetch)(`${this.baseUrl}/api/v1/auth/visitor`,{method:"GET",headers:{"Content-Type":"application/json"}});return ss(e),(await Vt(e)).accessToken}async refreshVisitorToken(){return await this.requestVisitorToken()}}class so extends is{constructor(e=null){super(),this.initialToken=e}onInit(){try{this.token=this.initialToken}catch(e){if(e instanceof We)this.token=null;else throw e}}async getAccessToken(e){if(!this.token)throw new Ve;if(this.isExpired()&&!e)throw new ns;return this.token}setToken(e){try{this.token=e}catch(t){if(t instanceof We){this.token=null;return}throw t}}async onClear(){}}function Gt(r,e){return e?{kind:"visma",strategy:new so(e)}:{kind:"visitor",strategy:new ro(r)}}/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2021 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const
|
|
9
|
+
*/const Yt="lit-localize-status";/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2021 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
13
|
+
*/const ft=(r,...e)=>({strTag:!0,strings:r,values:e}),no=r=>typeof r!="string"&&"strTag"in r,as=(r,e,t)=>{let n=r[0];for(let s=1;s<r.length;s++)n+=e[t?t[s-1]:s-1],n+=r[s];return n};/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2021 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* @license
|
|
19
19
|
* Copyright 2021 Google LLC
|
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
-
*/class io{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(
|
|
21
|
+
*/class io{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(Yt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Yt,this.__litLocalizeEventHandler)}}const ao=r=>r.addController(new io(r));/**
|
|
22
22
|
* @license
|
|
23
23
|
* Copyright 2021 Google LLC
|
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2014 Travis Webb
|
|
32
32
|
* SPDX-License-Identifier: MIT
|
|
33
|
-
*/const ce=[];for(let r=0;r<256;r++)ce[r]=(r>>4&15).toString(16)+(r&15).toString(16);function co(r){let e=0,t=8997,n=0,s=33826,o=0,i=40164,a=0,c=52210;for(let
|
|
33
|
+
*/const ce=[];for(let r=0;r<256;r++)ce[r]=(r>>4&15).toString(16)+(r&15).toString(16);function co(r){let e=0,t=8997,n=0,s=33826,o=0,i=40164,a=0,c=52210;for(let d=0;d<r.length;d++)t^=r.charCodeAt(d),e=t*435,n=s*435,o=i*435,a=c*435,o+=t<<8,a+=s<<8,n+=e>>>16,t=e&65535,o+=n>>>16,s=n&65535,c=a+(o>>>16)&65535,i=o&65535;return ce[c>>8]+ce[c&255]+ce[i>>8]+ce[i&255]+ce[s>>8]+ce[s&255]+ce[t>>8]+ce[t&255]}/**
|
|
34
34
|
* @license
|
|
35
35
|
* Copyright 2020 Google LLC
|
|
36
36
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
* @license
|
|
39
39
|
* Copyright 2021 Google LLC
|
|
40
40
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
|
-
*/const
|
|
41
|
+
*/const ds=new WeakMap,ps=new Map;function fo(r,e,t){if(r){const n=t?.id??mo(e),s=r[n];if(s){if(typeof s=="string")return s;if("strTag"in s)return as(s.strings,e.values,s.values);{let o=ds.get(s);return o===void 0&&(o=s.values,ds.set(s,o)),{...s,values:o.map(i=>e.values[i])}}}}return ls(e)}function mo(r){const e=typeof r=="string"?r:r.strings;let t=ps.get(e);return t===void 0&&(t=go(e,typeof r!="string"&&!("strTag"in r)),ps.set(e,t)),t}/**
|
|
42
42
|
* @license
|
|
43
43
|
* Copyright 2021 Google LLC
|
|
44
44
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
|
-
*/function Gt(r){window.dispatchEvent(new CustomEvent(Vt,{detail:r}))}let ft="",Yt,us,mt,Xt,gs,Se=new hs;Se.resolve();let wt=0;const wo=r=>(oo(((e,t)=>fo(gs,e,t))),ft=us=r.sourceLocale,mt=new Set(r.targetLocales),mt.add(r.sourceLocale),Xt=r.loadLocale,{getLocale:bo,setLocale:vo}),bo=()=>ft,vo=r=>{if(r===(Yt??ft))return Se.promise;if(!mt||!Xt)throw new Error("Internal error");if(!mt.has(r))throw new Error("Invalid locale code");wt++;const e=wt;return Yt=r,Se.settled&&(Se=new hs),Gt({status:"loading",loadingLocale:r}),(r===us?Promise.resolve({templates:void 0}):Xt(r)).then(n=>{wt===e&&(ft=r,Yt=void 0,gs=n.templates,Gt({status:"ready",readyLocale:r}),Se.resolve())},n=>{wt===e&&(Gt({status:"error",errorLocale:r,errorMessage:n.toString()}),Se.reject(n))}),Se.promise},yo=`/*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:#fcf1ee;--color-red-600:#cc453e;--color-green-100:#eef5ee;--color-green-600:#448548;--color-blue-100:#edf4fe;--color-gray-200:oklch(92.8% .006 264.531);--color-gray-500:oklch(55.1% .027 264.364);--color-neutral-100:#f2f3f5;--color-neutral-200:#e2e4e9;--color-neutral-300:#cccfd7;--color-neutral-600:#6f7687;--color-neutral-700:oklch(37.1% 0 0);--spacing: 4px ;--container-2xl:(42*16px);--text-xs: 12px ;--text-xs--line-height:calc(1/.75);--text-sm: 14px ;--text-sm--line-height:calc(1.25/.875);--text-lg: 18px ;--text-lg--line-height:calc(1.75/1.125);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-sm: 4px ;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:"Inter",sans-serif;--default-mono-font-family:var(--font-mono);--color-primary-600:#377ea0;--color-primary-800:#1f4e66;--color-primary-900:#133445;--color-secondary-100:#fcf0e7;--color-secondary-200:#fae0ce;--color-utility-gray:#b9b9b9;--scrollbar-color-default:var(--color-neutral-300);--scrollbar-color-hover:var(--color-neutral-600);--tw-inset-shadow:0 0 #0000;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-outline-style:solid}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root,:host,html{font-size:16px}[role=button]:not(:disabled),button:not(:disabled){cursor:pointer}}@layer components{.btn{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:0;cursor:pointer;outline-offset:4px;border-radius:4px;outline-width:2px;justify-content:center;align-items:center;transition:all .2s ease-in-out;display:flex;position:relative}.btn:disabled{pointer-events:none}.btn-primary{background-color:var(--color-primary-800);color:var(--color-secondary-100);outline-color:var(--color-primary-800)}@media (hover:hover){.btn-primary:hover{background-color:var(--color-primary-900)}}.btn-primary:disabled{background-color:var(--color-gray-200);color:var(--color-gray-500)}.btn-primary svg{color:var(--color-secondary-200)}.btn-primary:disabled{border-color:var(--color-neutral-200);background-color:var(--color-neutral-200);color:var(--color-neutral-600)}.btn-primary:disabled svg{color:var(--color-neutral-600)}.btn-secondary{border-style:var(--tw-border-style);--tw-border-style:solid;border-style:solid;border-width:1px;border-color:var(--color-primary-800);color:var(--color-primary-800);outline-color:var(--color-primary-800)}@media (hover:hover){.btn-secondary:hover{background-color:var(--color-secondary-200);color:var(--color-primary-900)}}.btn-secondary svg{color:var(--color-primary-800)}@media (hover:hover){.btn-secondary:hover svg{color:var(--color-primary-600)}}.btn-secondary:disabled{border-color:var(--color-neutral-300);background-color:var(--color-neutral-100);color:var(--color-utility-gray)}.btn-secondary:disabled svg{color:var(--color-neutral-600)}.btn-ghost{border-style:var(--tw-border-style);--tw-border-style:solid;outline-color:var(--color-primary-800);background-color:#0000;border:1px solid #0000}@media (hover:hover){.btn-ghost:hover{border-color:var(--color-primary-600);color:var(--color-primary-900);background-color:#0000}}.btn-ghost svg{color:var(--color-primary-800)}@media (hover:hover){.btn-ghost:hover svg{color:var(--color-primary-600)}}.btn-ghost:disabled{color:var(--color-utility-gray)}.btn-ghost:disabled svg{color:var(--color-neutral-300)}.prose>:last-child,.prose>:last-child table,.prose>:last-child pre{margin-bottom:0!important}.text-shimmer-primary{--shimmer-color:var(--color-primary-900);--shimmer-contrast:oklch(60% 0 0)}.text-shimmer{color:#0000;-webkit-text-fill-color:transparent;background:var(--shimmer-color)linear-gradient(to right,var(--shimmer-color)0,var(--shimmer-contrast)40%,var(--shimmer-contrast)60%,var(--shimmer-color)100%);background:var(--shimmer-color)-webkit-gradient(linear,100% 0,0 0,from(var(--shimmer-color)),color-stop(.4,var(--shimmer-contrast)),color-stop(.6,var(--shimmer-contrast)),to(var(--shimmer-color)));background-repeat:no-repeat;background-size:50% 200%;-webkit-background-clip:text;background-clip:text;animation-name:loading-shimmer;animation-duration:3s;animation-iteration-count:infinite;animation-delay:.1s;display:inline-block}.animate-grow{opacity:.3;animation-name:grow;animation-duration:1.5s;animation-timing-function:ease-in-out;animation-iteration-count:infinite;animation-delay:0s}.skeleton{animation:var(--animate-pulse);border-radius:var(--radius-sm);background-color:var(--color-neutral-200)}}@layer utilities{.\\@container\\/main{container:main/inline-size}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-1\\/2{left:50%}.z-50{z-index:50}.m-0{margin:calc(var(--spacing)*0)}.m-4{margin:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing)*1)}.my-auto{margin-block:auto}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);margin-top:1.2em;margin-bottom:1.2em;font-size:1.25em;line-height:1.6}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);font-weight:500;text-decoration:underline}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:decimal}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:disc}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-counters);font-weight:400}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.25em;font-weight:600}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em;font-style:italic;font-weight:500}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:0;margin-bottom:.888889em;font-size:2.25em;font-weight:800;line-height:1.11111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:900}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:2em;margin-bottom:1em;font-size:1.5em;font-weight:700;line-height:1.33333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:800}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.6em;margin-bottom:.6em;font-size:1.25em;font-weight:600;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.5em;margin-bottom:.5em;font-weight:600;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em;display:block}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows)/10%),0 3px rgb(var(--tw-prose-kbd-shadows)/10%);padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;border-radius:.3125rem;padding-inline-start:.375em;font-family:inherit;font-size:.875em;font-weight:500}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-size:.875em;font-weight:600}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"\`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);padding-top:.857143em;padding-inline-end:1.14286em;padding-bottom:.857143em;border-radius:.375rem;margin-top:1.71429em;margin-bottom:1.71429em;padding-inline-start:1.14286em;font-size:.875em;font-weight:400;line-height:1.71429;overflow-x:auto}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit;background-color:#0000;border-width:0;border-radius:0;padding:0}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){table-layout:auto;width:100%;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.71429}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);vertical-align:bottom;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em;font-weight:600}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);margin-top:.857143em;font-size:.875em;line-height:1.42857}.prose{--tw-prose-body:oklch(37.3% .034 259.733);--tw-prose-headings:oklch(21% .034 264.665);--tw-prose-lead:oklch(44.6% .03 256.802);--tw-prose-links:oklch(21% .034 264.665);--tw-prose-bold:oklch(21% .034 264.665);--tw-prose-counters:oklch(55.1% .027 264.364);--tw-prose-bullets:oklch(87.2% .01 258.338);--tw-prose-hr:oklch(92.8% .006 264.531);--tw-prose-quotes:oklch(21% .034 264.665);--tw-prose-quote-borders:oklch(92.8% .006 264.531);--tw-prose-captions:oklch(55.1% .027 264.364);--tw-prose-kbd:oklch(21% .034 264.665);--tw-prose-kbd-shadows:NaN NaN NaN;--tw-prose-code:oklch(21% .034 264.665);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:oklch(87.2% .01 258.338);--tw-prose-td-borders:oklch(92.8% .006 264.531);--tw-prose-invert-body:oklch(87.2% .01 258.338);--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:oklch(70.7% .022 261.325);--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:oklch(70.7% .022 261.325);--tw-prose-invert-bullets:oklch(44.6% .03 256.802);--tw-prose-invert-hr:oklch(37.3% .034 259.733);--tw-prose-invert-quotes:oklch(96.7% .003 264.542);--tw-prose-invert-quote-borders:oklch(37.3% .034 259.733);--tw-prose-invert-captions:oklch(70.7% .022 261.325);--tw-prose-invert-kbd:#fff;--tw-prose-invert-kbd-shadows:255 255 255;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:oklch(87.2% .01 258.338);--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:oklch(44.6% .03 256.802);--tw-prose-invert-td-borders:oklch(37.3% .034 259.733);font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.571429em;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mr-4{margin-right:calc(var(--spacing)*4)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.aspect-square{aspect-ratio:1}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.h-0{height:calc(var(--spacing)*0)}.h-2{height:calc(var(--spacing)*2)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-14{height:calc(var(--spacing)*14)}.h-24{height:calc(var(--spacing)*24)}.h-\\[18\\.4px\\]{height:18.4px}.h-auto{height:auto}.h-full{height:100%}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-9{min-height:calc(var(--spacing)*9)}.min-h-full{min-height:100%}.w-2{width:calc(var(--spacing)*2)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\\[90\\%\\]{max-width:90%}.max-w-\\[calc\\(100\\%-80px\\)\\]{max-width:calc(100% - 80px)}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-grow-1{flex-grow:1}.basis-auto{flex-basis:auto}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.resize-none{resize:none}.grid-cols-\\[auto_1fr_auto\\]{grid-template-columns:auto 1fr auto}.\\[grid-template-rows\\:auto_1fr_auto\\]{grid-template-rows:auto 1fr auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-4{gap:calc(var(--spacing)*4)}.gap-x-2{column-gap:calc(var(--spacing)*2)}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*1)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-x-reverse)))}.gap-y-1{row-gap:calc(var(--spacing)*1)}.gap-y-4{row-gap:calc(var(--spacing)*4)}.gap-y-8{row-gap:calc(var(--spacing)*8)}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-clip{overflow-x:clip}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-solid{--tw-border-style:solid;border-style:solid}.border-green-600{border-color:var(--color-green-600)}.border-neutral-300{border-color:var(--color-neutral-300)}.border-neutral-600{border-color:var(--color-neutral-600)}.border-red-600{border-color:var(--color-red-600)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-green-100{background-color:var(--color-green-100)}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-neutral-600{background-color:var(--color-neutral-600)}.bg-red-100{background-color:var(--color-red-100)}.bg-secondary-200{background-color:var(--color-secondary-200)}.object-cover{object-fit:cover}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-4{padding:calc(var(--spacing)*4)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.pt-2{padding-top:calc(var(--spacing)*2)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.text-center{text-align:center}.text-start{text-align:start}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.whitespace-normal{white-space:normal}.whitespace-pre-wrap{white-space:pre-wrap}.text-neutral-600{color:var(--color-neutral-600)}.text-neutral-700{color:var(--color-neutral-700)}.text-primary-800{color:var(--color-primary-800)}.text-primary-900{color:var(--color-primary-900)}.text-red-600{color:var(--color-red-600)}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-primary-800{outline-color:var(--color-primary-800)}.transition-\\[transform\\,opacity\\,height\\,visibility\\]{transition-property:transform,opacity,height,visibility;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\\[-webkit-mask\\:radial-gradient\\(farthest-side\\,transparent_calc\\(100\\%-3px\\)\\,\\#000_0\\)\\]{-webkit-mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0)}.\\[animation-delay\\:0\\.3s\\]{animation-delay:.3s}.\\[animation-delay\\:0\\.6s\\]{animation-delay:.6s}.\\[background\\:conic-gradient\\(theme\\(colors\\.primary-600\\)_0_30\\%\\,transparent_30\\%_100\\%\\)\\]{background:conic-gradient(#377ea0 0 30%,transparent 30% 100%)}.\\[grid-area\\:content\\]{grid-area:content}.\\[grid-area\\:footer\\]{grid-area:footer}.\\[grid-area\\:header\\]{grid-area:header}.\\[grid-area\\:leading\\]{grid-area:leading}.\\[grid-area\\:primary\\]{grid-area:primary}.\\[grid-area\\:trailing\\]{grid-area:trailing}.\\[grid-template-areas\\:\\'header\\'\\'content\\'\\'footer\\'\\]{grid-template-areas:"header""content""footer"}.\\[grid-template-areas\\:\\'header_header_header\\'_\\'leading_primary_trailing\\'_\\'\\._footer_\\.\\'\\]{grid-template-areas:"header header header""leading primary trailing"".footer."}.\\[grid-template-areas\\:\\'leading_primary\\'\\]{grid-template-areas:"leading primary"}.\\[grid-template-areas\\:\\'leading_primary_trailing\\'\\]{grid-template-areas:"leading primary trailing"}.\\[mask\\:radial-gradient\\(farthest-side\\,transparent_calc\\(100\\%-3px\\)\\,\\#000_0\\)\\]{-webkit-mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0);mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0)}.not-group-aria-expanded\\:-rotate-90:not(:is(:where(.group)[aria-expanded=true] *)){rotate:-90deg}.group-focus-within\\/composer\\:outline-solid:is(:where(.group\\/composer):focus-within *){--tw-outline-style:solid;outline-style:solid}.group-data-expanded\\/composer\\:\\[grid-template-areas\\:\\'header_header_header\\'_\\'primary_primary_primary\\'_\\'leading_footer_trailing\\'\\]:is(:where(.group\\/composer)[data-expanded] *){grid-template-areas:"header header header""primary primary primary""leading footer trailing"}.group-data-\\[error\\=true\\]\\/composer\\:border-red-600:is(:where(.group\\/composer)[data-error=true] *){border-color:var(--color-red-600)}.group-data-\\[error\\=true\\]\\/composer\\:bg-red-100:is(:where(.group\\/composer)[data-error=true] *){background-color:var(--color-red-100)}.group-data-\\[error\\=true\\]\\/composer\\:outline-red-600:is(:where(.group\\/composer)[data-error=true] *){outline-color:var(--color-red-600)}.placeholder\\:text-utility-gray::placeholder{color:var(--color-utility-gray)}.empty\\:hidden:empty{display:none}@media (hover:hover){.hover\\:text-primary-900:hover{color:var(--color-primary-900)}.hover\\:underline:hover{text-decoration-line:underline}}.active\\:outline-2:active{outline-style:var(--tw-outline-style);outline-width:2px}.data-\\[loading\\=true\\]\\:bg-transparent[data-loading=true]{background-color:#0000}.data-\\[selected\\=true\\]\\:bg-secondary-200[data-selected=true]{background-color:var(--color-secondary-200)}.data-\\[selected\\=true\\]\\:text-primary-900[data-selected=true]{color:var(--color-primary-900)}@container (min-width:20rem){.\\@xs\\:flex{display:flex}}@container (min-width:28rem){.\\@md\\:w-1\\/2{width:50%}.\\@md\\:w-36{width:calc(var(--spacing)*36)}.\\@md\\:w-\\[90\\%\\]{width:90%}.\\@md\\:flex-row{flex-direction:row}}@container main (min-width:32rem){.\\@lg\\/main\\:px-4{padding-inline:calc(var(--spacing)*4)}}@container (min-width:36rem){.\\@xl\\:grid{display:grid}.\\@xl\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.prose-table\\:min-w-max :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){min-width:max-content}.\\[\\&_svg\\]\\:text-green-600 svg{color:var(--color-green-600)}.\\[\\&_svg\\]\\:text-red-600 svg{color:var(--color-red-600)}.text-message{font-size:14px;line-height:1.71429}}@layer scroll{.overflow-auto:hover,.overflow-scroll:hover,.overflow-x-auto:hover,.overflow-y-auto:hover,textarea:hover{scrollbar-color:var(--scrollbar-color-hover)transparent}.overflow-auto,.overflow-scroll,.overflow-x-auto,.overflow-y-auto,textarea{scrollbar-width:thin;scrollbar-gutter:stable both-edges;scrollbar-color:var(--scrollbar-color-default)transparent;padding-inline:4px}:host-context([data-platform="windows"]) .overflow-scroll{padding-inline:0}:host-context([data-platform="windows"]) .overflow-x-auto{padding-inline:0}:host-context([data-platform="windows"]) .overflow-y-auto{padding-inline:0}:host-context([data-platform="windows"]) textarea{padding-inline:0}}@keyframes loading-shimmer{0%{background-position:-100% 0}to{background-position:250% 0}}@keyframes grow{0%{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}80%{opacity:.3;transform:scale(.8)}to{opacity:.3;transform:scale(.8)}}:host{box-sizing:border-box}.prose-gaia{--tw-prose-body:var(--color-primary-900);--tw-prose-headings:var(--color-primary-900);--tw-prose-lead:var(--color-primary-900);--tw-prose-links:var(--color-primary-800);--tw-prose-bold:var(--color-primary-900);--tw-prose-counters:var(--color-primary-900);--tw-prose-bullets:var(--color-primary-900);--tw-prose-hr:var(--color-neutral-300);--tw-prose-quotes:var(--color-primary-800);--tw-prose-quote-borders:var(--color-neutral-300);--tw-prose-captions:var(--color-primary-900);--tw-prose-kbd:var(--color-primary-900);--tw-prose-kbd-shadows:0 0 0;--tw-prose-code:var(--color-primary-900);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:var(--color-neutral-300);--tw-prose-td-borders:var(--color-neutral-200);max-width:unset;overflow-wrap:break-word;width:100%;font-size:14px;line-height:1.71429}svg{width:inherit;height:inherit}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`;var ko=Object.getOwnPropertyDescriptor,_o=(r,e,t,n)=>{for(var s=n>1?void 0:n?ko(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let te=class extends g.LitElement{connectedCallback(){super.connectedCallback(),this.shadowRoot&&g.adoptStyles(this.shadowRoot,[g.unsafeCSS(yo),...this.shadowRoot.adoptedStyleSheets])}};te=_o([lo()],te);const xo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-icon lucide-arrow-up"><path d="m5 12 7-7 7 7"/><path d="M12 19V5"/></svg>',Zt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-alert-icon lucide-circle-alert"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>';class So extends CustomEvent{constructor(e){super("send-message",{detail:{message:e},composed:!0})}}class Eo extends CustomEvent{constructor(e,t){super("approve-tool-call",{detail:{turnId:e,messageId:t},composed:!0})}}class To extends CustomEvent{constructor(e,t){super("decline-tool-call",{detail:{turnId:e,messageId:t},composed:!0})}}class Co extends CustomEvent{constructor(e,t,n){super("submit-feedback",{detail:{target:e,rating:t,comment:n},composed:!0})}}class Kt extends CustomEvent{constructor(e){super("toggle-feedback-form",{detail:{target:e},composed:!0})}}class Jt extends CustomEvent{constructor(){super("clear-conversation",{composed:!0})}}class Io extends CustomEvent{constructor(){super("clear-error",{composed:!0})}}class Ao extends CustomEvent{constructor(){super("send-typing",{composed:!0})}}class Ro extends CustomEvent{constructor(){super("close-chat",{composed:!0})}}var $o=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,Ee=(r,e,t,n)=>{for(var s=n>1?void 0:n?Po(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&$o(e,t,s),s};let be=class extends te{constructor(){super(...arguments),this.maxHeightPx=192,this.typingThrottleMs=2e3,this.lastTypingSent=0,this.maxInputLength=100,this.disabled=!1,this.loading=!1,this.text="",this.error=""}get canSubmit(){return this.text.trim()!==""&&!this.loading&&!this.hasError&&!this.disabled}get hasError(){return this.error.length>0}validateInput(){this.text.length>this.maxInputLength?this.error=y("Character limit exceeded.",{id:"composer-error-character-limit"}):this.error=""}sendMessage(){this.canSubmit&&(this.dispatchEvent(new So(this.text)),this.text="",this.textarea.style.height="auto")}onKeyDown(r){r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),this.sendMessage())}onInput(){this.text=this.textarea.value,this.maybeEmitTyping(),this.textarea.style.height="auto",this.textarea.style.height=Math.min(this.textarea.scrollHeight,this.maxHeightPx)+"px",this.textarea.style.overflowY=this.textarea.scrollHeight>this.maxHeightPx?"auto":"hidden",this.validateInput()}maybeEmitTyping(){if(this.disabled)return;const r=Date.now();r-this.lastTypingSent>=this.typingThrottleMs&&(this.dispatchEvent(new Ao),this.lastTypingSent=r)}render(){return g.html` <div class="group/composer w-full p-4 max-w-2xl mx-auto" data-error=${this.hasError}>
|
|
45
|
+
*/function Xt(r){window.dispatchEvent(new CustomEvent(Yt,{detail:r}))}let mt="",Zt,us,wt,Kt,gs,Se=new hs;Se.resolve();let bt=0;const wo=r=>(oo(((e,t)=>fo(gs,e,t))),mt=us=r.sourceLocale,wt=new Set(r.targetLocales),wt.add(r.sourceLocale),Kt=r.loadLocale,{getLocale:bo,setLocale:vo}),bo=()=>mt,vo=r=>{if(r===(Zt??mt))return Se.promise;if(!wt||!Kt)throw new Error("Internal error");if(!wt.has(r))throw new Error("Invalid locale code");bt++;const e=bt;return Zt=r,Se.settled&&(Se=new hs),Xt({status:"loading",loadingLocale:r}),(r===us?Promise.resolve({templates:void 0}):Kt(r)).then(n=>{bt===e&&(mt=r,Zt=void 0,gs=n.templates,Xt({status:"ready",readyLocale:r}),Se.resolve())},n=>{bt===e&&(Xt({status:"error",errorLocale:r,errorMessage:n.toString()}),Se.reject(n))}),Se.promise},yo=`/*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:#fcf1ee;--color-red-600:#cc453e;--color-green-100:#eef5ee;--color-green-600:#448548;--color-blue-100:#edf4fe;--color-gray-200:oklch(92.8% .006 264.531);--color-gray-500:oklch(55.1% .027 264.364);--color-neutral-100:#f2f3f5;--color-neutral-200:#e2e4e9;--color-neutral-300:#cccfd7;--color-neutral-600:#6f7687;--color-neutral-700:oklch(37.1% 0 0);--spacing: 4px ;--container-2xl:(42*16px);--text-xs: 12px ;--text-xs--line-height:calc(1/.75);--text-sm: 14px ;--text-sm--line-height:calc(1.25/.875);--text-lg: 18px ;--text-lg--line-height:calc(1.75/1.125);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-sm: 4px ;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:"Inter",sans-serif;--default-mono-font-family:var(--font-mono);--color-primary-600:#377ea0;--color-primary-800:#1f4e66;--color-primary-900:#133445;--color-secondary-100:#fcf0e7;--color-secondary-200:#fae0ce;--color-utility-gray:#b9b9b9;--scrollbar-color-default:var(--color-neutral-300);--scrollbar-color-hover:var(--color-neutral-600);--tw-inset-shadow:0 0 #0000;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-outline-style:solid}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root,:host,html{font-size:16px}[role=button]:not(:disabled),button:not(:disabled){cursor:pointer}}@layer components{.btn{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:0;cursor:pointer;outline-offset:4px;border-radius:4px;outline-width:2px;justify-content:center;align-items:center;transition:all .2s ease-in-out;display:flex;position:relative}.btn:disabled{pointer-events:none}.btn-primary{background-color:var(--color-primary-800);color:var(--color-secondary-100);outline-color:var(--color-primary-800)}@media (hover:hover){.btn-primary:hover{background-color:var(--color-primary-900)}}.btn-primary:disabled{background-color:var(--color-gray-200);color:var(--color-gray-500)}.btn-primary svg{color:var(--color-secondary-200)}.btn-primary:disabled{border-color:var(--color-neutral-200);background-color:var(--color-neutral-200);color:var(--color-neutral-600)}.btn-primary:disabled svg{color:var(--color-neutral-600)}.btn-secondary{border-style:var(--tw-border-style);--tw-border-style:solid;border-style:solid;border-width:1px;border-color:var(--color-primary-800);color:var(--color-primary-800);outline-color:var(--color-primary-800)}@media (hover:hover){.btn-secondary:hover{background-color:var(--color-secondary-200);color:var(--color-primary-900)}}.btn-secondary svg{color:var(--color-primary-800)}@media (hover:hover){.btn-secondary:hover svg{color:var(--color-primary-600)}}.btn-secondary:disabled{border-color:var(--color-neutral-300);background-color:var(--color-neutral-100);color:var(--color-utility-gray)}.btn-secondary:disabled svg{color:var(--color-neutral-600)}.btn-ghost{border-style:var(--tw-border-style);--tw-border-style:solid;outline-color:var(--color-primary-800);background-color:#0000;border:1px solid #0000}@media (hover:hover){.btn-ghost:hover{border-color:var(--color-primary-600);color:var(--color-primary-900);background-color:#0000}}.btn-ghost svg{color:var(--color-primary-800)}@media (hover:hover){.btn-ghost:hover svg{color:var(--color-primary-600)}}.btn-ghost:disabled{color:var(--color-utility-gray)}.btn-ghost:disabled svg{color:var(--color-neutral-300)}.prose>:last-child,.prose>:last-child table,.prose>:last-child pre{margin-bottom:0!important}.text-shimmer-primary{--shimmer-color:var(--color-primary-900);--shimmer-contrast:oklch(60% 0 0)}.text-shimmer{color:#0000;-webkit-text-fill-color:transparent;background:var(--shimmer-color)linear-gradient(to right,var(--shimmer-color)0,var(--shimmer-contrast)40%,var(--shimmer-contrast)60%,var(--shimmer-color)100%);background:var(--shimmer-color)-webkit-gradient(linear,100% 0,0 0,from(var(--shimmer-color)),color-stop(.4,var(--shimmer-contrast)),color-stop(.6,var(--shimmer-contrast)),to(var(--shimmer-color)));background-repeat:no-repeat;background-size:50% 200%;-webkit-background-clip:text;background-clip:text;animation-name:loading-shimmer;animation-duration:3s;animation-iteration-count:infinite;animation-delay:.1s;display:inline-block}.animate-grow{opacity:.3;animation-name:grow;animation-duration:1.5s;animation-timing-function:ease-in-out;animation-iteration-count:infinite;animation-delay:0s}.skeleton{animation:var(--animate-pulse);border-radius:var(--radius-sm);background-color:var(--color-neutral-200)}}@layer utilities{.\\@container\\/main{container:main/inline-size}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-1\\/2{left:50%}.z-50{z-index:50}.m-0{margin:calc(var(--spacing)*0)}.m-4{margin:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing)*1)}.my-auto{margin-block:auto}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);margin-top:1.2em;margin-bottom:1.2em;font-size:1.25em;line-height:1.6}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);font-weight:500;text-decoration:underline}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:decimal}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:disc}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-counters);font-weight:400}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.25em;font-weight:600}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em;font-style:italic;font-weight:500}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:0;margin-bottom:.888889em;font-size:2.25em;font-weight:800;line-height:1.11111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:900}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:2em;margin-bottom:1em;font-size:1.5em;font-weight:700;line-height:1.33333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:800}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.6em;margin-bottom:.6em;font-size:1.25em;font-weight:600;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.5em;margin-bottom:.5em;font-weight:600;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em;display:block}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows)/10%),0 3px rgb(var(--tw-prose-kbd-shadows)/10%);padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;border-radius:.3125rem;padding-inline-start:.375em;font-family:inherit;font-size:.875em;font-weight:500}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-size:.875em;font-weight:600}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"\`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);padding-top:.857143em;padding-inline-end:1.14286em;padding-bottom:.857143em;border-radius:.375rem;margin-top:1.71429em;margin-bottom:1.71429em;padding-inline-start:1.14286em;font-size:.875em;font-weight:400;line-height:1.71429;overflow-x:auto}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit;background-color:#0000;border-width:0;border-radius:0;padding:0}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){table-layout:auto;width:100%;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.71429}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);vertical-align:bottom;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em;font-weight:600}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);margin-top:.857143em;font-size:.875em;line-height:1.42857}.prose{--tw-prose-body:oklch(37.3% .034 259.733);--tw-prose-headings:oklch(21% .034 264.665);--tw-prose-lead:oklch(44.6% .03 256.802);--tw-prose-links:oklch(21% .034 264.665);--tw-prose-bold:oklch(21% .034 264.665);--tw-prose-counters:oklch(55.1% .027 264.364);--tw-prose-bullets:oklch(87.2% .01 258.338);--tw-prose-hr:oklch(92.8% .006 264.531);--tw-prose-quotes:oklch(21% .034 264.665);--tw-prose-quote-borders:oklch(92.8% .006 264.531);--tw-prose-captions:oklch(55.1% .027 264.364);--tw-prose-kbd:oklch(21% .034 264.665);--tw-prose-kbd-shadows:NaN NaN NaN;--tw-prose-code:oklch(21% .034 264.665);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:oklch(87.2% .01 258.338);--tw-prose-td-borders:oklch(92.8% .006 264.531);--tw-prose-invert-body:oklch(87.2% .01 258.338);--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:oklch(70.7% .022 261.325);--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:oklch(70.7% .022 261.325);--tw-prose-invert-bullets:oklch(44.6% .03 256.802);--tw-prose-invert-hr:oklch(37.3% .034 259.733);--tw-prose-invert-quotes:oklch(96.7% .003 264.542);--tw-prose-invert-quote-borders:oklch(37.3% .034 259.733);--tw-prose-invert-captions:oklch(70.7% .022 261.325);--tw-prose-invert-kbd:#fff;--tw-prose-invert-kbd-shadows:255 255 255;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:oklch(87.2% .01 258.338);--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:oklch(44.6% .03 256.802);--tw-prose-invert-td-borders:oklch(37.3% .034 259.733);font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.571429em;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mr-4{margin-right:calc(var(--spacing)*4)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.aspect-square{aspect-ratio:1}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.h-0{height:calc(var(--spacing)*0)}.h-2{height:calc(var(--spacing)*2)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-14{height:calc(var(--spacing)*14)}.h-24{height:calc(var(--spacing)*24)}.h-\\[18\\.4px\\]{height:18.4px}.h-auto{height:auto}.h-full{height:100%}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-9{min-height:calc(var(--spacing)*9)}.min-h-full{min-height:100%}.w-2{width:calc(var(--spacing)*2)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\\[90\\%\\]{max-width:90%}.max-w-\\[calc\\(100\\%-80px\\)\\]{max-width:calc(100% - 80px)}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-grow-1{flex-grow:1}.basis-auto{flex-basis:auto}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.resize-none{resize:none}.grid-cols-\\[auto_1fr_auto\\]{grid-template-columns:auto 1fr auto}.\\[grid-template-rows\\:auto_1fr_auto\\]{grid-template-rows:auto 1fr auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-4{gap:calc(var(--spacing)*4)}.gap-x-2{column-gap:calc(var(--spacing)*2)}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*1)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-x-reverse)))}.gap-y-1{row-gap:calc(var(--spacing)*1)}.gap-y-4{row-gap:calc(var(--spacing)*4)}.gap-y-8{row-gap:calc(var(--spacing)*8)}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-clip{overflow-x:clip}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-solid{--tw-border-style:solid;border-style:solid}.border-green-600{border-color:var(--color-green-600)}.border-neutral-300{border-color:var(--color-neutral-300)}.border-neutral-600{border-color:var(--color-neutral-600)}.border-red-600{border-color:var(--color-red-600)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-green-100{background-color:var(--color-green-100)}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-neutral-600{background-color:var(--color-neutral-600)}.bg-red-100{background-color:var(--color-red-100)}.bg-secondary-200{background-color:var(--color-secondary-200)}.object-cover{object-fit:cover}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-4{padding:calc(var(--spacing)*4)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.pt-2{padding-top:calc(var(--spacing)*2)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.text-center{text-align:center}.text-start{text-align:start}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.whitespace-normal{white-space:normal}.whitespace-pre-wrap{white-space:pre-wrap}.text-neutral-600{color:var(--color-neutral-600)}.text-neutral-700{color:var(--color-neutral-700)}.text-primary-800{color:var(--color-primary-800)}.text-primary-900{color:var(--color-primary-900)}.text-red-600{color:var(--color-red-600)}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-primary-800{outline-color:var(--color-primary-800)}.transition-\\[transform\\,opacity\\,height\\,visibility\\]{transition-property:transform,opacity,height,visibility;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\\[-webkit-mask\\:radial-gradient\\(farthest-side\\,transparent_calc\\(100\\%-3px\\)\\,\\#000_0\\)\\]{-webkit-mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0)}.\\[animation-delay\\:0\\.3s\\]{animation-delay:.3s}.\\[animation-delay\\:0\\.6s\\]{animation-delay:.6s}.\\[background\\:conic-gradient\\(theme\\(colors\\.primary-600\\)_0_30\\%\\,transparent_30\\%_100\\%\\)\\]{background:conic-gradient(#377ea0 0 30%,transparent 30% 100%)}.\\[grid-area\\:content\\]{grid-area:content}.\\[grid-area\\:footer\\]{grid-area:footer}.\\[grid-area\\:header\\]{grid-area:header}.\\[grid-area\\:leading\\]{grid-area:leading}.\\[grid-area\\:primary\\]{grid-area:primary}.\\[grid-area\\:trailing\\]{grid-area:trailing}.\\[grid-template-areas\\:\\'header\\'\\'content\\'\\'footer\\'\\]{grid-template-areas:"header""content""footer"}.\\[grid-template-areas\\:\\'header_header_header\\'_\\'leading_primary_trailing\\'_\\'\\._footer_\\.\\'\\]{grid-template-areas:"header header header""leading primary trailing"".footer."}.\\[grid-template-areas\\:\\'leading_primary\\'\\]{grid-template-areas:"leading primary"}.\\[grid-template-areas\\:\\'leading_primary_trailing\\'\\]{grid-template-areas:"leading primary trailing"}.\\[mask\\:radial-gradient\\(farthest-side\\,transparent_calc\\(100\\%-3px\\)\\,\\#000_0\\)\\]{-webkit-mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0);mask:radial-gradient(farthest-side,#0000 calc(100% - 3px),#000 0)}.not-group-aria-expanded\\:-rotate-90:not(:is(:where(.group)[aria-expanded=true] *)){rotate:-90deg}.group-focus-within\\/composer\\:outline-solid:is(:where(.group\\/composer):focus-within *){--tw-outline-style:solid;outline-style:solid}.group-data-expanded\\/composer\\:\\[grid-template-areas\\:\\'header_header_header\\'_\\'primary_primary_primary\\'_\\'leading_footer_trailing\\'\\]:is(:where(.group\\/composer)[data-expanded] *){grid-template-areas:"header header header""primary primary primary""leading footer trailing"}.group-data-\\[error\\=true\\]\\/composer\\:border-red-600:is(:where(.group\\/composer)[data-error=true] *){border-color:var(--color-red-600)}.group-data-\\[error\\=true\\]\\/composer\\:bg-red-100:is(:where(.group\\/composer)[data-error=true] *){background-color:var(--color-red-100)}.group-data-\\[error\\=true\\]\\/composer\\:outline-red-600:is(:where(.group\\/composer)[data-error=true] *){outline-color:var(--color-red-600)}.placeholder\\:text-utility-gray::placeholder{color:var(--color-utility-gray)}.empty\\:hidden:empty{display:none}@media (hover:hover){.hover\\:text-primary-900:hover{color:var(--color-primary-900)}.hover\\:underline:hover{text-decoration-line:underline}}.active\\:outline-2:active{outline-style:var(--tw-outline-style);outline-width:2px}.data-\\[loading\\=true\\]\\:bg-transparent[data-loading=true]{background-color:#0000}.data-\\[selected\\=true\\]\\:bg-secondary-200[data-selected=true]{background-color:var(--color-secondary-200)}.data-\\[selected\\=true\\]\\:text-primary-900[data-selected=true]{color:var(--color-primary-900)}@container (min-width:20rem){.\\@xs\\:flex{display:flex}}@container (min-width:28rem){.\\@md\\:w-1\\/2{width:50%}.\\@md\\:w-36{width:calc(var(--spacing)*36)}.\\@md\\:w-\\[90\\%\\]{width:90%}.\\@md\\:flex-row{flex-direction:row}}@container main (min-width:32rem){.\\@lg\\/main\\:px-4{padding-inline:calc(var(--spacing)*4)}}@container (min-width:36rem){.\\@xl\\:grid{display:grid}.\\@xl\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.prose-table\\:min-w-max :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){min-width:max-content}.\\[\\&_svg\\]\\:text-green-600 svg{color:var(--color-green-600)}.\\[\\&_svg\\]\\:text-red-600 svg{color:var(--color-red-600)}.text-message{font-size:14px;line-height:1.71429}}@layer scroll{.overflow-auto:hover,.overflow-scroll:hover,.overflow-x-auto:hover,.overflow-y-auto:hover,textarea:hover{scrollbar-color:var(--scrollbar-color-hover)transparent}.overflow-auto,.overflow-scroll,.overflow-x-auto,.overflow-y-auto,textarea{scrollbar-width:thin;scrollbar-gutter:stable both-edges;scrollbar-color:var(--scrollbar-color-default)transparent;padding-inline:4px}:host-context([data-platform="windows"]) .overflow-scroll{padding-inline:0}:host-context([data-platform="windows"]) .overflow-x-auto{padding-inline:0}:host-context([data-platform="windows"]) .overflow-y-auto{padding-inline:0}:host-context([data-platform="windows"]) textarea{padding-inline:0}}@keyframes loading-shimmer{0%{background-position:-100% 0}to{background-position:250% 0}}@keyframes grow{0%{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}80%{opacity:.3;transform:scale(.8)}to{opacity:.3;transform:scale(.8)}}:host{box-sizing:border-box}.prose-gaia{--tw-prose-body:var(--color-primary-900);--tw-prose-headings:var(--color-primary-900);--tw-prose-lead:var(--color-primary-900);--tw-prose-links:var(--color-primary-800);--tw-prose-bold:var(--color-primary-900);--tw-prose-counters:var(--color-primary-900);--tw-prose-bullets:var(--color-primary-900);--tw-prose-hr:var(--color-neutral-300);--tw-prose-quotes:var(--color-primary-800);--tw-prose-quote-borders:var(--color-neutral-300);--tw-prose-captions:var(--color-primary-900);--tw-prose-kbd:var(--color-primary-900);--tw-prose-kbd-shadows:0 0 0;--tw-prose-code:var(--color-primary-900);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:var(--color-neutral-300);--tw-prose-td-borders:var(--color-neutral-200);max-width:unset;overflow-wrap:break-word;width:100%;font-size:14px;line-height:1.71429}svg{width:inherit;height:inherit}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`;var ko=Object.getOwnPropertyDescriptor,_o=(r,e,t,n)=>{for(var s=n>1?void 0:n?ko(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let te=class extends g.LitElement{connectedCallback(){super.connectedCallback(),this.shadowRoot&&g.adoptStyles(this.shadowRoot,[g.unsafeCSS(yo),...this.shadowRoot.adoptedStyleSheets])}};te=_o([lo()],te);const xo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-icon lucide-arrow-up"><path d="m5 12 7-7 7 7"/><path d="M12 19V5"/></svg>',Jt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-alert-icon lucide-circle-alert"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>';class So extends CustomEvent{constructor(e){super("send-message",{detail:{message:e},composed:!0})}}class Eo extends CustomEvent{constructor(e,t){super("approve-tool-call",{detail:{turnId:e,messageId:t},composed:!0})}}class To extends CustomEvent{constructor(e,t){super("decline-tool-call",{detail:{turnId:e,messageId:t},composed:!0})}}class Co extends CustomEvent{constructor(e,t,n){super("submit-feedback",{detail:{target:e,rating:t,comment:n},composed:!0})}}class Qt extends CustomEvent{constructor(e){super("toggle-feedback-form",{detail:{target:e},composed:!0})}}class er extends CustomEvent{constructor(){super("clear-conversation",{composed:!0})}}class Io extends CustomEvent{constructor(){super("clear-error",{composed:!0})}}class Ao extends CustomEvent{constructor(){super("send-typing",{composed:!0})}}class $o extends CustomEvent{constructor(){super("close-chat",{composed:!0})}}var Ro=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,Ee=(r,e,t,n)=>{for(var s=n>1?void 0:n?Po(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Ro(e,t,s),s};let be=class extends te{constructor(){super(...arguments),this.maxHeightPx=192,this.typingThrottleMs=2e3,this.lastTypingSent=0,this.maxInputLength=100,this.disabled=!1,this.loading=!1,this.text="",this.error=""}get canSubmit(){return this.text.trim()!==""&&!this.loading&&!this.hasError&&!this.disabled}get hasError(){return this.error.length>0}validateInput(){this.text.length>this.maxInputLength?this.error=y("Character limit exceeded.",{id:"composer-error-character-limit"}):this.error=""}sendMessage(){this.canSubmit&&(this.dispatchEvent(new So(this.text)),this.text="",this.textarea.style.height="auto")}onKeyDown(r){r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),this.sendMessage())}onInput(){this.text=this.textarea.value,this.maybeEmitTyping(),this.textarea.style.height="auto",this.textarea.style.height=Math.min(this.textarea.scrollHeight,this.maxHeightPx)+"px",this.textarea.style.overflowY=this.textarea.scrollHeight>this.maxHeightPx?"auto":"hidden",this.validateInput()}maybeEmitTyping(){if(this.disabled)return;const r=Date.now();r-this.lastTypingSent>=this.typingThrottleMs&&(this.dispatchEvent(new Ao),this.lastTypingSent=r)}render(){return g.html` <div class="group/composer w-full p-4 max-w-2xl mx-auto" data-error=${this.hasError}>
|
|
46
46
|
<div
|
|
47
47
|
class="outline-primary-800 rounded-sm outline-none border border-solid border-neutral-600 px-2 outline-2 group-focus-within/composer:outline-solid group-data-[error=true]/composer:border-red-600 group-data-[error=true]/composer:bg-red-100 group-data-[error=true]/composer:outline-red-600"
|
|
48
48
|
>
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
<div class="flex max-w-[calc(100%-80px)] flex-row items-center gap-x-2 overflow-x-clip">
|
|
97
97
|
${this.hasError?g.html`
|
|
98
98
|
<div class="flex size-4 items-center justify-center text-red-600">
|
|
99
|
-
${P.unsafeSVG(
|
|
99
|
+
${P.unsafeSVG(Jt)}
|
|
100
100
|
</div>
|
|
101
101
|
<span class="text-primary-900 truncate text-xs">${this.error}</span>
|
|
102
102
|
`:g.nothing}
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
</div>
|
|
109
109
|
</div>
|
|
110
110
|
</div>
|
|
111
|
-
</div>`}};Ee([w.property({type:Number,attribute:"max-input-length"})],be.prototype,"maxInputLength",2),Ee([w.property({attribute:!1})],be.prototype,"disabled",2),Ee([w.property({attribute:!1})],be.prototype,"loading",2),Ee([w.state()],be.prototype,"text",2),Ee([w.state()],be.prototype,"error",2),Ee([w.query('textarea[name="composer-textarea"]')],be.prototype,"textarea",2),be=Ee([w.customElement("gaia-chat-composer")],be);const fs='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-megaphone-icon lucide-megaphone"><path d="M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z"/><path d="M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14"/><path d="M8 6v8"/></svg>',Mo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-minimize2-icon lucide-minimize-2"><path d="m14 10 7-7"/><path d="M20 10h-6V4"/><path d="m3 21 7-7"/><path d="M4 14h6v6"/></svg>',ms='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-pen-icon lucide-square-pen"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/></svg>';var Do=Object.defineProperty,Oo=Object.getOwnPropertyDescriptor,
|
|
111
|
+
</div>`}};Ee([w.property({type:Number,attribute:"max-input-length"})],be.prototype,"maxInputLength",2),Ee([w.property({attribute:!1})],be.prototype,"disabled",2),Ee([w.property({attribute:!1})],be.prototype,"loading",2),Ee([w.state()],be.prototype,"text",2),Ee([w.state()],be.prototype,"error",2),Ee([w.query('textarea[name="composer-textarea"]')],be.prototype,"textarea",2),be=Ee([w.customElement("gaia-chat-composer")],be);const fs='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-megaphone-icon lucide-megaphone"><path d="M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z"/><path d="M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14"/><path d="M8 6v8"/></svg>',Mo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-minimize2-icon lucide-minimize-2"><path d="m14 10 7-7"/><path d="M20 10h-6V4"/><path d="m3 21 7-7"/><path d="M4 14h6v6"/></svg>',ms='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-pen-icon lucide-square-pen"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/></svg>';var Do=Object.defineProperty,Oo=Object.getOwnPropertyDescriptor,vt=(r,e,t,n)=>{for(var s=n>1?void 0:n?Oo(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Do(e,t,s),s};let Ye=class extends te{constructor(){super(...arguments),this.hasEmptyMessages=!0,this.disabled=!1,this.closeable=!0}clearConversation(){this.dispatchEvent(new er)}openFeedbackForm(){this.dispatchEvent(new Qt("assistant"))}closeChat(){this.dispatchEvent(new $o)}render(){return g.html` <div class="relative w-full border-b border-solid border-neutral-300 p-4">
|
|
112
112
|
<div class="flex items-center justify-between">
|
|
113
113
|
<div class="flex">
|
|
114
114
|
<h2 class="text-primary-900 text-sm font-bold">GAiA</h2>
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
@click=${this.openFeedbackForm}
|
|
120
120
|
?disabled=${this.hasEmptyMessages||this.disabled}
|
|
121
121
|
>
|
|
122
|
-
<div class="flex size-4 items-center justify-center">${
|
|
122
|
+
<div class="flex size-4 items-center justify-center">${Kr.unsafeHTML(fs)}</div>
|
|
123
123
|
</button>
|
|
124
124
|
<button
|
|
125
125
|
class="btn btn-ghost p-1"
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
`:g.nothing}
|
|
138
138
|
</div>
|
|
139
139
|
</div>
|
|
140
|
-
</div>`}};
|
|
140
|
+
</div>`}};vt([w.property({attribute:!1})],Ye.prototype,"hasEmptyMessages",2),vt([w.property({attribute:!1})],Ye.prototype,"disabled",2),vt([w.property({attribute:!1})],Ye.prototype,"closeable",2),Ye=vt([w.customElement("gaia-chat-menu")],Ye);const Lo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>';var No=Object.defineProperty,zo=Object.getOwnPropertyDescriptor,ws=(r,e,t,n)=>{for(var s=n>1?void 0:n?zo(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&No(e,t,s),s};let tr=class extends te{clearError(){this.dispatchEvent(new Io)}render(){return this.error?g.html` <div
|
|
141
141
|
role="alert"
|
|
142
142
|
aria-live="assertive"
|
|
143
143
|
class="absolute bottom-0 left-1/2 z-50 flex w-full items-center justify-center"
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
</div>
|
|
152
152
|
<div class="flex [grid-area:leading]">
|
|
153
153
|
<div class="flex size-5 items-center justify-center text-red-600">
|
|
154
|
-
${P.unsafeSVG(
|
|
154
|
+
${P.unsafeSVG(Jt)}
|
|
155
155
|
</div>
|
|
156
156
|
</div>
|
|
157
157
|
<div class="flex [grid-area:trailing]">
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
</button>
|
|
163
163
|
</div>
|
|
164
164
|
</div>
|
|
165
|
-
</div>`:g.nothing}};ws([w.property({attribute:!1})],
|
|
165
|
+
</div>`:g.nothing}};ws([w.property({attribute:!1})],tr.prototype,"error",2),tr=ws([w.customElement("gaia-chat-error")],tr);const Fo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-send-icon lucide-send"><path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/></svg>';var Uo=Object.defineProperty,Bo=Object.getOwnPropertyDescriptor,rr=(r,e,t,n)=>{for(var s=n>1?void 0:n?Bo(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Uo(e,t,s),s};let yt=class extends te{constructor(){super(...arguments),this.ratings=[1,2,3,4,5],this.target="assistant",this.textareaRef=es.createRef(),this.selectedRating=0,this.onSubmit=()=>{const r=this.textareaRef.value?.value??null;this.isValid&&(this.dispatchEvent(new Co(this.target,this.selectedRating,r)),this.target==="support"&&this.dispatchEvent(new er))},this.onCancel=()=>{this.dispatchEvent(new Qt(null))}}onRatingClick(r){this.selectedRating=r}get isValid(){return this.selectedRating>0&&this.selectedRating<=5}render(){return g.html` <div class="relative w-full px-2 py-3">
|
|
166
166
|
<div
|
|
167
167
|
class="text-primary-900 flex flex-col gap-y-4 rounded-sm border border-solid border-neutral-600 p-4"
|
|
168
168
|
>
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
${this.target==="support"?y("How satisfied are you with the help you received?",{id:"feedback-form-satisfaction-title--support"}):y("How satisfied are you with the assistant?",{id:"feedback-form-satisfaction-title--assistant"})}
|
|
178
178
|
</h4>
|
|
179
179
|
<div class="flex items-center gap-x-2">
|
|
180
|
-
${
|
|
180
|
+
${Qr.map(this.ratings,r=>g.html`
|
|
181
181
|
<button
|
|
182
182
|
class="btn btn-secondary data-[selected=true]:text-primary-900 data-[selected=true]:bg-secondary-200 size-8"
|
|
183
183
|
@click=${()=>this.onRatingClick(r)}
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
${y("Any additional comments?",{id:"feedback-form-comments-title"})}
|
|
194
194
|
</h4>
|
|
195
195
|
<textarea
|
|
196
|
-
${
|
|
196
|
+
${es.ref(this.textareaRef)}
|
|
197
197
|
name="feedback-comment"
|
|
198
198
|
class="text-primary-900 placeholder:text-utility-gray outline-primary-800 h-24 w-full resize-none rounded-sm border border-solid border-neutral-600 p-2 text-sm active:outline-2"
|
|
199
199
|
spellcheck="false"
|
|
@@ -218,33 +218,33 @@
|
|
|
218
218
|
</button>
|
|
219
219
|
</div>
|
|
220
220
|
</div>
|
|
221
|
-
</div>`}};er([w.property({type:String,attribute:"target"})],vt.prototype,"target",2),er([w.state()],vt.prototype,"selectedRating",2),vt=er([w.customElement("gaia-chat-feedback-form")],vt);const Ho='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check-icon lucide-check"><path d="M20 6 9 17l-5-5"/></svg>',jo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down-icon lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>',qo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-x-icon lucide-circle-x"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>',Wo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-icon lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',Xe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sparkles-icon lucide-sparkles"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"/><path d="M20 2v4"/><path d="M22 4h-4"/><circle cx="4" cy="20" r="2"/></svg>';/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:bs,setPrototypeOf:vs,isFrozen:Vo,getPrototypeOf:Go,getOwnPropertyDescriptor:Yo}=Object;let{freeze:W,seal:J,create:ys}=Object,{apply:tr,construct:rr}=typeof Reflect<"u"&&Reflect;W||(W=function(e){return e}),J||(J=function(e){return e}),tr||(tr=function(e,t,n){return e.apply(t,n)}),rr||(rr=function(e,t){return new e(...t)});const yt=G(Array.prototype.forEach),Xo=G(Array.prototype.lastIndexOf),ks=G(Array.prototype.pop),Ze=G(Array.prototype.push),Zo=G(Array.prototype.splice),kt=G(String.prototype.toLowerCase),sr=G(String.prototype.toString),_s=G(String.prototype.match),Ke=G(String.prototype.replace),Ko=G(String.prototype.indexOf),Jo=G(String.prototype.trim),re=G(Object.prototype.hasOwnProperty),V=G(RegExp.prototype.test),Je=Qo(TypeError);function G(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return tr(r,e,n)}}function Qo(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return rr(r,t)}}function k(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:kt;vs&&vs(r,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const o=t(s);o!==s&&(Vo(e)||(e[n]=o),s=o)}r[s]=!0}return r}function ei(r){for(let e=0;e<r.length;e++)re(r,e)||(r[e]=null);return r}function he(r){const e=ys(null);for(const[t,n]of bs(r))re(r,t)&&(Array.isArray(n)?e[t]=ei(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=he(n):e[t]=n);return e}function Qe(r,e){for(;r!==null;){const n=Yo(r,e);if(n){if(n.get)return G(n.get);if(typeof n.value=="function")return G(n.value)}r=Go(r)}function t(){return null}return t}const xs=W(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),nr=W(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),or=W(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ti=W(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ir=W(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ri=W(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ss=W(["#text"]),Es=W(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ar=W(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ts=W(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),_t=W(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),si=J(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ni=J(/<%[\w\W]*|[\w\W]*%>/gm),oi=J(/\$\{[\w\W]*/gm),ii=J(/^data-[\-\w.\u00B7-\uFFFF]+$/),ai=J(/^aria-[\-\w]+$/),Cs=J(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),li=J(/^(?:\w+script|data):/i),ci=J(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Is=J(/^html$/i),hi=J(/^[a-z][.\w]*(-[.\w]+)+$/i);var As=Object.freeze({__proto__:null,ARIA_ATTR:ai,ATTR_WHITESPACE:ci,CUSTOM_ELEMENT:hi,DATA_ATTR:ii,DOCTYPE_NAME:Is,ERB_EXPR:ni,IS_ALLOWED_URI:Cs,IS_SCRIPT_OR_DATA:li,MUSTACHE_EXPR:si,TMPLIT_EXPR:oi});const et={element:1,text:3,progressingInstruction:7,comment:8,document:9},pi=function(){return typeof window>"u"?null:window},di=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(n=t.getAttribute(s));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Rs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function $s(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pi();const e=m=>$s(m);if(e.version="3.2.6",e.removed=[],!r||!r.document||r.document.nodeType!==et.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const n=t,s=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:a,Element:c,NodeFilter:p,NamedNodeMap:u=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:v,DOMParser:_,trustedTypes:$}=r,T=c.prototype,x=Qe(T,"cloneNode"),M=Qe(T,"remove"),ee=Qe(T,"nextSibling"),ke=Qe(T,"childNodes"),oe=Qe(T,"parentNode");if(typeof i=="function"){const m=t.createElement("template");m.content&&m.content.ownerDocument&&(t=m.content.ownerDocument)}let z,$e="";const{implementation:Pe,createNodeIterator:Me,createDocumentFragment:Kl,getElementsByTagName:Jl}=t,{importNode:Ql}=n;let X=Rs();e.isSupported=typeof bs=="function"&&typeof oe=="function"&&Pe&&Pe.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Mr,ERB_EXPR:Dr,TMPLIT_EXPR:Or,DATA_ATTR:ec,ARIA_ATTR:tc,IS_SCRIPT_OR_DATA:rc,ATTR_WHITESPACE:_n,CUSTOM_ELEMENT:sc}=As;let{IS_ALLOWED_URI:xn}=As,F=null;const Sn=k({},[...xs,...nr,...or,...ir,...Ss]);let U=null;const En=k({},[...Es,...ar,...Ts,..._t]);let D=Object.seal(ys(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),pt=null,Lr=null,Tn=!0,Nr=!0,Cn=!1,In=!0,Ne=!1,Lt=!0,De=!1,zr=!1,Fr=!1,ze=!1,Nt=!1,zt=!1,An=!0,Rn=!1;const nc="user-content-";let Br=!0,dt=!1,Fe={},Be=null;const $n=k({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Pn=null;const Mn=k({},["audio","video","img","source","image","track"]);let Ur=null;const Dn=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ft="http://www.w3.org/1998/Math/MathML",Bt="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let Ue=fe,Hr=!1,jr=null;const oc=k({},[Ft,Bt,fe],sr);let Ut=k({},["mi","mo","mn","ms","mtext"]),Ht=k({},["annotation-xml"]);const ic=k({},["title","style","font","a","script"]);let ut=null;const ac=["application/xhtml+xml","text/html"],lc="text/html";let B=null,He=null;const cc=t.createElement("form"),On=function(l){return l instanceof RegExp||l instanceof Function},qr=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(He&&He===l)){if((!l||typeof l!="object")&&(l={}),l=he(l),ut=ac.indexOf(l.PARSER_MEDIA_TYPE)===-1?lc:l.PARSER_MEDIA_TYPE,B=ut==="application/xhtml+xml"?sr:kt,F=re(l,"ALLOWED_TAGS")?k({},l.ALLOWED_TAGS,B):Sn,U=re(l,"ALLOWED_ATTR")?k({},l.ALLOWED_ATTR,B):En,jr=re(l,"ALLOWED_NAMESPACES")?k({},l.ALLOWED_NAMESPACES,sr):oc,Ur=re(l,"ADD_URI_SAFE_ATTR")?k(he(Dn),l.ADD_URI_SAFE_ATTR,B):Dn,Pn=re(l,"ADD_DATA_URI_TAGS")?k(he(Mn),l.ADD_DATA_URI_TAGS,B):Mn,Be=re(l,"FORBID_CONTENTS")?k({},l.FORBID_CONTENTS,B):$n,pt=re(l,"FORBID_TAGS")?k({},l.FORBID_TAGS,B):he({}),Lr=re(l,"FORBID_ATTR")?k({},l.FORBID_ATTR,B):he({}),Fe=re(l,"USE_PROFILES")?l.USE_PROFILES:!1,Tn=l.ALLOW_ARIA_ATTR!==!1,Nr=l.ALLOW_DATA_ATTR!==!1,Cn=l.ALLOW_UNKNOWN_PROTOCOLS||!1,In=l.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=l.SAFE_FOR_TEMPLATES||!1,Lt=l.SAFE_FOR_XML!==!1,De=l.WHOLE_DOCUMENT||!1,ze=l.RETURN_DOM||!1,Nt=l.RETURN_DOM_FRAGMENT||!1,zt=l.RETURN_TRUSTED_TYPE||!1,Fr=l.FORCE_BODY||!1,An=l.SANITIZE_DOM!==!1,Rn=l.SANITIZE_NAMED_PROPS||!1,Br=l.KEEP_CONTENT!==!1,dt=l.IN_PLACE||!1,xn=l.ALLOWED_URI_REGEXP||Cs,Ue=l.NAMESPACE||fe,Ut=l.MATHML_TEXT_INTEGRATION_POINTS||Ut,Ht=l.HTML_INTEGRATION_POINTS||Ht,D=l.CUSTOM_ELEMENT_HANDLING||{},l.CUSTOM_ELEMENT_HANDLING&&On(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(D.tagNameCheck=l.CUSTOM_ELEMENT_HANDLING.tagNameCheck),l.CUSTOM_ELEMENT_HANDLING&&On(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(D.attributeNameCheck=l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),l.CUSTOM_ELEMENT_HANDLING&&typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(D.allowCustomizedBuiltInElements=l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(Nr=!1),Nt&&(ze=!0),Fe&&(F=k({},Ss),U=[],Fe.html===!0&&(k(F,xs),k(U,Es)),Fe.svg===!0&&(k(F,nr),k(U,ar),k(U,_t)),Fe.svgFilters===!0&&(k(F,or),k(U,ar),k(U,_t)),Fe.mathMl===!0&&(k(F,ir),k(U,Ts),k(U,_t))),l.ADD_TAGS&&(F===Sn&&(F=he(F)),k(F,l.ADD_TAGS,B)),l.ADD_ATTR&&(U===En&&(U=he(U)),k(U,l.ADD_ATTR,B)),l.ADD_URI_SAFE_ATTR&&k(Ur,l.ADD_URI_SAFE_ATTR,B),l.FORBID_CONTENTS&&(Be===$n&&(Be=he(Be)),k(Be,l.FORBID_CONTENTS,B)),Br&&(F["#text"]=!0),De&&k(F,["html","head","body"]),F.table&&(k(F,["tbody"]),delete pt.tbody),l.TRUSTED_TYPES_POLICY){if(typeof l.TRUSTED_TYPES_POLICY.createHTML!="function")throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof l.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=l.TRUSTED_TYPES_POLICY,$e=z.createHTML("")}else z===void 0&&(z=di($,s)),z!==null&&typeof $e=="string"&&($e=z.createHTML(""));W&&W(l),He=l}},Ln=k({},[...nr,...or,...ti]),Nn=k({},[...ir,...ri]),hc=function(l){let d=oe(l);(!d||!d.tagName)&&(d={namespaceURI:Ue,tagName:"template"});const f=kt(l.tagName),A=kt(d.tagName);return jr[l.namespaceURI]?l.namespaceURI===Bt?d.namespaceURI===fe?f==="svg":d.namespaceURI===Ft?f==="svg"&&(A==="annotation-xml"||Ut[A]):!!Ln[f]:l.namespaceURI===Ft?d.namespaceURI===fe?f==="math":d.namespaceURI===Bt?f==="math"&&Ht[A]:!!Nn[f]:l.namespaceURI===fe?d.namespaceURI===Bt&&!Ht[A]||d.namespaceURI===Ft&&!Ut[A]?!1:!Nn[f]&&(ic[f]||!Ln[f]):!!(ut==="application/xhtml+xml"&&jr[l.namespaceURI]):!1},le=function(l){Ze(e.removed,{element:l});try{oe(l).removeChild(l)}catch{M(l)}},je=function(l,d){try{Ze(e.removed,{attribute:d.getAttributeNode(l),from:d})}catch{Ze(e.removed,{attribute:null,from:d})}if(d.removeAttribute(l),l==="is")if(ze||Nt)try{le(d)}catch{}else try{d.setAttribute(l,"")}catch{}},zn=function(l){let d=null,f=null;if(Fr)l="<remove></remove>"+l;else{const N=_s(l,/^[\r\n\t ]+/);f=N&&N[0]}ut==="application/xhtml+xml"&&Ue===fe&&(l='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+l+"</body></html>");const A=z?z.createHTML(l):l;if(Ue===fe)try{d=new _().parseFromString(A,ut)}catch{}if(!d||!d.documentElement){d=Pe.createDocument(Ue,"template",null);try{d.documentElement.innerHTML=Hr?$e:A}catch{}}const j=d.body||d.documentElement;return l&&f&&j.insertBefore(t.createTextNode(f),j.childNodes[0]||null),Ue===fe?Jl.call(d,De?"html":"body")[0]:De?d.documentElement:j},Fn=function(l){return Me.call(l.ownerDocument||l,l,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Wr=function(l){return l instanceof v&&(typeof l.nodeName!="string"||typeof l.textContent!="string"||typeof l.removeChild!="function"||!(l.attributes instanceof u)||typeof l.removeAttribute!="function"||typeof l.setAttribute!="function"||typeof l.namespaceURI!="string"||typeof l.insertBefore!="function"||typeof l.hasChildNodes!="function")},Bn=function(l){return typeof a=="function"&&l instanceof a};function me(m,l,d){yt(m,f=>{f.call(e,l,d,He)})}const Un=function(l){let d=null;if(me(X.beforeSanitizeElements,l,null),Wr(l))return le(l),!0;const f=B(l.nodeName);if(me(X.uponSanitizeElement,l,{tagName:f,allowedTags:F}),Lt&&l.hasChildNodes()&&!Bn(l.firstElementChild)&&V(/<[/\w!]/g,l.innerHTML)&&V(/<[/\w!]/g,l.textContent)||l.nodeType===et.progressingInstruction||Lt&&l.nodeType===et.comment&&V(/<[/\w]/g,l.data))return le(l),!0;if(!F[f]||pt[f]){if(!pt[f]&&jn(f)&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,f)||D.tagNameCheck instanceof Function&&D.tagNameCheck(f)))return!1;if(Br&&!Be[f]){const A=oe(l)||l.parentNode,j=ke(l)||l.childNodes;if(j&&A){const N=j.length;for(let Z=N-1;Z>=0;--Z){const we=x(j[Z],!0);we.__removalCount=(l.__removalCount||0)+1,A.insertBefore(we,ee(l))}}}return le(l),!0}return l instanceof c&&!hc(l)||(f==="noscript"||f==="noembed"||f==="noframes")&&V(/<\/no(script|embed|frames)/i,l.innerHTML)?(le(l),!0):(Ne&&l.nodeType===et.text&&(d=l.textContent,yt([Mr,Dr,Or],A=>{d=Ke(d,A," ")}),l.textContent!==d&&(Ze(e.removed,{element:l.cloneNode()}),l.textContent=d)),me(X.afterSanitizeElements,l,null),!1)},Hn=function(l,d,f){if(An&&(d==="id"||d==="name")&&(f in t||f in cc))return!1;if(!(Nr&&!Lr[d]&&V(ec,d))){if(!(Tn&&V(tc,d))){if(!U[d]||Lr[d]){if(!(jn(l)&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,l)||D.tagNameCheck instanceof Function&&D.tagNameCheck(l))&&(D.attributeNameCheck instanceof RegExp&&V(D.attributeNameCheck,d)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(d))||d==="is"&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,f)||D.tagNameCheck instanceof Function&&D.tagNameCheck(f))))return!1}else if(!Ur[d]){if(!V(xn,Ke(f,_n,""))){if(!((d==="src"||d==="xlink:href"||d==="href")&&l!=="script"&&Ko(f,"data:")===0&&Pn[l])){if(!(Cn&&!V(rc,Ke(f,_n,"")))){if(f)return!1}}}}}}return!0},jn=function(l){return l!=="annotation-xml"&&_s(l,sc)},qn=function(l){me(X.beforeSanitizeAttributes,l,null);const{attributes:d}=l;if(!d||Wr(l))return;const f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0};let A=d.length;for(;A--;){const j=d[A],{name:N,namespaceURI:Z,value:we}=j,gt=B(N),Vr=we;let q=N==="value"?Vr:Jo(Vr);if(f.attrName=gt,f.attrValue=q,f.keepAttr=!0,f.forceKeepAttr=void 0,me(X.uponSanitizeAttribute,l,f),q=f.attrValue,Rn&&(gt==="id"||gt==="name")&&(je(N,l),q=nc+q),Lt&&V(/((--!?|])>)|<\/(style|title)/i,q)){je(N,l);continue}if(f.forceKeepAttr)continue;if(!f.keepAttr){je(N,l);continue}if(!In&&V(/\/>/i,q)){je(N,l);continue}Ne&&yt([Mr,Dr,Or],Vn=>{q=Ke(q,Vn," ")});const Wn=B(l.nodeName);if(!Hn(Wn,gt,q)){je(N,l);continue}if(z&&typeof $=="object"&&typeof $.getAttributeType=="function"&&!Z)switch($.getAttributeType(Wn,gt)){case"TrustedHTML":{q=z.createHTML(q);break}case"TrustedScriptURL":{q=z.createScriptURL(q);break}}if(q!==Vr)try{Z?l.setAttributeNS(Z,N,q):l.setAttribute(N,q),Wr(l)?le(l):ks(e.removed)}catch{je(N,l)}}me(X.afterSanitizeAttributes,l,null)},pc=function m(l){let d=null;const f=Fn(l);for(me(X.beforeSanitizeShadowDOM,l,null);d=f.nextNode();)me(X.uponSanitizeShadowNode,d,null),Un(d),qn(d),d.content instanceof o&&m(d.content);me(X.afterSanitizeShadowDOM,l,null)};return e.sanitize=function(m){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=null,f=null,A=null,j=null;if(Hr=!m,Hr&&(m="<!-->"),typeof m!="string"&&!Bn(m))if(typeof m.toString=="function"){if(m=m.toString(),typeof m!="string")throw Je("dirty is not a string, aborting")}else throw Je("toString is not a function");if(!e.isSupported)return m;if(zr||qr(l),e.removed=[],typeof m=="string"&&(dt=!1),dt){if(m.nodeName){const we=B(m.nodeName);if(!F[we]||pt[we])throw Je("root node is forbidden and cannot be sanitized in-place")}}else if(m instanceof a)d=zn("<!---->"),f=d.ownerDocument.importNode(m,!0),f.nodeType===et.element&&f.nodeName==="BODY"||f.nodeName==="HTML"?d=f:d.appendChild(f);else{if(!ze&&!Ne&&!De&&m.indexOf("<")===-1)return z&&zt?z.createHTML(m):m;if(d=zn(m),!d)return ze?null:zt?$e:""}d&&Fr&&le(d.firstChild);const N=Fn(dt?m:d);for(;A=N.nextNode();)Un(A),qn(A),A.content instanceof o&&pc(A.content);if(dt)return m;if(ze){if(Nt)for(j=Kl.call(d.ownerDocument);d.firstChild;)j.appendChild(d.firstChild);else j=d;return(U.shadowroot||U.shadowrootmode)&&(j=Ql.call(n,j,!0)),j}let Z=De?d.outerHTML:d.innerHTML;return De&&F["!doctype"]&&d.ownerDocument&&d.ownerDocument.doctype&&d.ownerDocument.doctype.name&&V(Is,d.ownerDocument.doctype.name)&&(Z="<!DOCTYPE "+d.ownerDocument.doctype.name+`>
|
|
222
|
-
`+Z),Ne&&
|
|
223
|
-
]`).replace("lheading",Os).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ei=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ti=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zs=/^( {2,}|\\)\n(?!\s*$)/,Ci=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
221
|
+
</div>`}};rr([w.property({type:String,attribute:"target"})],yt.prototype,"target",2),rr([w.state()],yt.prototype,"selectedRating",2),yt=rr([w.customElement("gaia-chat-feedback-form")],yt);const Ho='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check-icon lucide-check"><path d="M20 6 9 17l-5-5"/></svg>',jo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down-icon lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>',qo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-x-icon lucide-circle-x"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>',Wo='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-icon lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',Xe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sparkles-icon lucide-sparkles"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"/><path d="M20 2v4"/><path d="M22 4h-4"/><circle cx="4" cy="20" r="2"/></svg>';/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:bs,setPrototypeOf:vs,isFrozen:Vo,getPrototypeOf:Go,getOwnPropertyDescriptor:Yo}=Object;let{freeze:W,seal:J,create:ys}=Object,{apply:sr,construct:nr}=typeof Reflect<"u"&&Reflect;W||(W=function(e){return e}),J||(J=function(e){return e}),sr||(sr=function(e,t,n){return e.apply(t,n)}),nr||(nr=function(e,t){return new e(...t)});const kt=G(Array.prototype.forEach),Xo=G(Array.prototype.lastIndexOf),ks=G(Array.prototype.pop),Ze=G(Array.prototype.push),Zo=G(Array.prototype.splice),_t=G(String.prototype.toLowerCase),or=G(String.prototype.toString),_s=G(String.prototype.match),Ke=G(String.prototype.replace),Ko=G(String.prototype.indexOf),Jo=G(String.prototype.trim),re=G(Object.prototype.hasOwnProperty),V=G(RegExp.prototype.test),Je=Qo(TypeError);function G(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return sr(r,e,n)}}function Qo(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return nr(r,t)}}function k(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_t;vs&&vs(r,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const o=t(s);o!==s&&(Vo(e)||(e[n]=o),s=o)}r[s]=!0}return r}function ei(r){for(let e=0;e<r.length;e++)re(r,e)||(r[e]=null);return r}function he(r){const e=ys(null);for(const[t,n]of bs(r))re(r,t)&&(Array.isArray(n)?e[t]=ei(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=he(n):e[t]=n);return e}function Qe(r,e){for(;r!==null;){const n=Yo(r,e);if(n){if(n.get)return G(n.get);if(typeof n.value=="function")return G(n.value)}r=Go(r)}function t(){return null}return t}const xs=W(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ir=W(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ar=W(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ti=W(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),lr=W(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ri=W(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ss=W(["#text"]),Es=W(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),cr=W(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ts=W(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xt=W(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),si=J(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ni=J(/<%[\w\W]*|[\w\W]*%>/gm),oi=J(/\$\{[\w\W]*/gm),ii=J(/^data-[\-\w.\u00B7-\uFFFF]+$/),ai=J(/^aria-[\-\w]+$/),Cs=J(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),li=J(/^(?:\w+script|data):/i),ci=J(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Is=J(/^html$/i),hi=J(/^[a-z][.\w]*(-[.\w]+)+$/i);var As=Object.freeze({__proto__:null,ARIA_ATTR:ai,ATTR_WHITESPACE:ci,CUSTOM_ELEMENT:hi,DATA_ATTR:ii,DOCTYPE_NAME:Is,ERB_EXPR:ni,IS_ALLOWED_URI:Cs,IS_SCRIPT_OR_DATA:li,MUSTACHE_EXPR:si,TMPLIT_EXPR:oi});const et={element:1,text:3,progressingInstruction:7,comment:8,document:9},di=function(){return typeof window>"u"?null:window},pi=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(n=t.getAttribute(s));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},$s=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rs(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:di();const e=m=>Rs(m);if(e.version="3.2.6",e.removed=[],!r||!r.document||r.document.nodeType!==et.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const n=t,s=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:a,Element:c,NodeFilter:d,NamedNodeMap:u=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:v,DOMParser:_,trustedTypes:R}=r,T=c.prototype,x=Qe(T,"cloneNode"),M=Qe(T,"remove"),ee=Qe(T,"nextSibling"),ke=Qe(T,"childNodes"),oe=Qe(T,"parentNode");if(typeof i=="function"){const m=t.createElement("template");m.content&&m.content.ownerDocument&&(t=m.content.ownerDocument)}let z,Re="";const{implementation:Pe,createNodeIterator:Me,createDocumentFragment:sc,getElementsByTagName:nc}=t,{importNode:oc}=n;let X=$s();e.isSupported=typeof bs=="function"&&typeof oe=="function"&&Pe&&Pe.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Or,ERB_EXPR:Lr,TMPLIT_EXPR:Nr,DATA_ATTR:ic,ARIA_ATTR:ac,IS_SCRIPT_OR_DATA:lc,ATTR_WHITESPACE:_n,CUSTOM_ELEMENT:cc}=As;let{IS_ALLOWED_URI:xn}=As,F=null;const Sn=k({},[...xs,...ir,...ar,...lr,...Ss]);let B=null;const En=k({},[...Es,...cr,...Ts,...xt]);let D=Object.seal(ys(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),dt=null,zr=null,Tn=!0,Fr=!0,Cn=!1,In=!0,Ne=!1,Nt=!0,De=!1,Ur=!1,Br=!1,ze=!1,zt=!1,Ft=!1,An=!0,$n=!1;const hc="user-content-";let Hr=!0,pt=!1,Fe={},Ue=null;const Rn=k({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Pn=null;const Mn=k({},["audio","video","img","source","image","track"]);let jr=null;const Dn=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ut="http://www.w3.org/1998/Math/MathML",Bt="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let Be=fe,qr=!1,Wr=null;const dc=k({},[Ut,Bt,fe],or);let Ht=k({},["mi","mo","mn","ms","mtext"]),jt=k({},["annotation-xml"]);const pc=k({},["title","style","font","a","script"]);let ut=null;const uc=["application/xhtml+xml","text/html"],gc="text/html";let U=null,He=null;const fc=t.createElement("form"),On=function(l){return l instanceof RegExp||l instanceof Function},Vr=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(He&&He===l)){if((!l||typeof l!="object")&&(l={}),l=he(l),ut=uc.indexOf(l.PARSER_MEDIA_TYPE)===-1?gc:l.PARSER_MEDIA_TYPE,U=ut==="application/xhtml+xml"?or:_t,F=re(l,"ALLOWED_TAGS")?k({},l.ALLOWED_TAGS,U):Sn,B=re(l,"ALLOWED_ATTR")?k({},l.ALLOWED_ATTR,U):En,Wr=re(l,"ALLOWED_NAMESPACES")?k({},l.ALLOWED_NAMESPACES,or):dc,jr=re(l,"ADD_URI_SAFE_ATTR")?k(he(Dn),l.ADD_URI_SAFE_ATTR,U):Dn,Pn=re(l,"ADD_DATA_URI_TAGS")?k(he(Mn),l.ADD_DATA_URI_TAGS,U):Mn,Ue=re(l,"FORBID_CONTENTS")?k({},l.FORBID_CONTENTS,U):Rn,dt=re(l,"FORBID_TAGS")?k({},l.FORBID_TAGS,U):he({}),zr=re(l,"FORBID_ATTR")?k({},l.FORBID_ATTR,U):he({}),Fe=re(l,"USE_PROFILES")?l.USE_PROFILES:!1,Tn=l.ALLOW_ARIA_ATTR!==!1,Fr=l.ALLOW_DATA_ATTR!==!1,Cn=l.ALLOW_UNKNOWN_PROTOCOLS||!1,In=l.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=l.SAFE_FOR_TEMPLATES||!1,Nt=l.SAFE_FOR_XML!==!1,De=l.WHOLE_DOCUMENT||!1,ze=l.RETURN_DOM||!1,zt=l.RETURN_DOM_FRAGMENT||!1,Ft=l.RETURN_TRUSTED_TYPE||!1,Br=l.FORCE_BODY||!1,An=l.SANITIZE_DOM!==!1,$n=l.SANITIZE_NAMED_PROPS||!1,Hr=l.KEEP_CONTENT!==!1,pt=l.IN_PLACE||!1,xn=l.ALLOWED_URI_REGEXP||Cs,Be=l.NAMESPACE||fe,Ht=l.MATHML_TEXT_INTEGRATION_POINTS||Ht,jt=l.HTML_INTEGRATION_POINTS||jt,D=l.CUSTOM_ELEMENT_HANDLING||{},l.CUSTOM_ELEMENT_HANDLING&&On(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(D.tagNameCheck=l.CUSTOM_ELEMENT_HANDLING.tagNameCheck),l.CUSTOM_ELEMENT_HANDLING&&On(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(D.attributeNameCheck=l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),l.CUSTOM_ELEMENT_HANDLING&&typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(D.allowCustomizedBuiltInElements=l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(Fr=!1),zt&&(ze=!0),Fe&&(F=k({},Ss),B=[],Fe.html===!0&&(k(F,xs),k(B,Es)),Fe.svg===!0&&(k(F,ir),k(B,cr),k(B,xt)),Fe.svgFilters===!0&&(k(F,ar),k(B,cr),k(B,xt)),Fe.mathMl===!0&&(k(F,lr),k(B,Ts),k(B,xt))),l.ADD_TAGS&&(F===Sn&&(F=he(F)),k(F,l.ADD_TAGS,U)),l.ADD_ATTR&&(B===En&&(B=he(B)),k(B,l.ADD_ATTR,U)),l.ADD_URI_SAFE_ATTR&&k(jr,l.ADD_URI_SAFE_ATTR,U),l.FORBID_CONTENTS&&(Ue===Rn&&(Ue=he(Ue)),k(Ue,l.FORBID_CONTENTS,U)),Hr&&(F["#text"]=!0),De&&k(F,["html","head","body"]),F.table&&(k(F,["tbody"]),delete dt.tbody),l.TRUSTED_TYPES_POLICY){if(typeof l.TRUSTED_TYPES_POLICY.createHTML!="function")throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof l.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=l.TRUSTED_TYPES_POLICY,Re=z.createHTML("")}else z===void 0&&(z=pi(R,s)),z!==null&&typeof Re=="string"&&(Re=z.createHTML(""));W&&W(l),He=l}},Ln=k({},[...ir,...ar,...ti]),Nn=k({},[...lr,...ri]),mc=function(l){let p=oe(l);(!p||!p.tagName)&&(p={namespaceURI:Be,tagName:"template"});const f=_t(l.tagName),A=_t(p.tagName);return Wr[l.namespaceURI]?l.namespaceURI===Bt?p.namespaceURI===fe?f==="svg":p.namespaceURI===Ut?f==="svg"&&(A==="annotation-xml"||Ht[A]):!!Ln[f]:l.namespaceURI===Ut?p.namespaceURI===fe?f==="math":p.namespaceURI===Bt?f==="math"&&jt[A]:!!Nn[f]:l.namespaceURI===fe?p.namespaceURI===Bt&&!jt[A]||p.namespaceURI===Ut&&!Ht[A]?!1:!Nn[f]&&(pc[f]||!Ln[f]):!!(ut==="application/xhtml+xml"&&Wr[l.namespaceURI]):!1},le=function(l){Ze(e.removed,{element:l});try{oe(l).removeChild(l)}catch{M(l)}},je=function(l,p){try{Ze(e.removed,{attribute:p.getAttributeNode(l),from:p})}catch{Ze(e.removed,{attribute:null,from:p})}if(p.removeAttribute(l),l==="is")if(ze||zt)try{le(p)}catch{}else try{p.setAttribute(l,"")}catch{}},zn=function(l){let p=null,f=null;if(Br)l="<remove></remove>"+l;else{const N=_s(l,/^[\r\n\t ]+/);f=N&&N[0]}ut==="application/xhtml+xml"&&Be===fe&&(l='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+l+"</body></html>");const A=z?z.createHTML(l):l;if(Be===fe)try{p=new _().parseFromString(A,ut)}catch{}if(!p||!p.documentElement){p=Pe.createDocument(Be,"template",null);try{p.documentElement.innerHTML=qr?Re:A}catch{}}const j=p.body||p.documentElement;return l&&f&&j.insertBefore(t.createTextNode(f),j.childNodes[0]||null),Be===fe?nc.call(p,De?"html":"body")[0]:De?p.documentElement:j},Fn=function(l){return Me.call(l.ownerDocument||l,l,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Gr=function(l){return l instanceof v&&(typeof l.nodeName!="string"||typeof l.textContent!="string"||typeof l.removeChild!="function"||!(l.attributes instanceof u)||typeof l.removeAttribute!="function"||typeof l.setAttribute!="function"||typeof l.namespaceURI!="string"||typeof l.insertBefore!="function"||typeof l.hasChildNodes!="function")},Un=function(l){return typeof a=="function"&&l instanceof a};function me(m,l,p){kt(m,f=>{f.call(e,l,p,He)})}const Bn=function(l){let p=null;if(me(X.beforeSanitizeElements,l,null),Gr(l))return le(l),!0;const f=U(l.nodeName);if(me(X.uponSanitizeElement,l,{tagName:f,allowedTags:F}),Nt&&l.hasChildNodes()&&!Un(l.firstElementChild)&&V(/<[/\w!]/g,l.innerHTML)&&V(/<[/\w!]/g,l.textContent)||l.nodeType===et.progressingInstruction||Nt&&l.nodeType===et.comment&&V(/<[/\w]/g,l.data))return le(l),!0;if(!F[f]||dt[f]){if(!dt[f]&&jn(f)&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,f)||D.tagNameCheck instanceof Function&&D.tagNameCheck(f)))return!1;if(Hr&&!Ue[f]){const A=oe(l)||l.parentNode,j=ke(l)||l.childNodes;if(j&&A){const N=j.length;for(let Z=N-1;Z>=0;--Z){const we=x(j[Z],!0);we.__removalCount=(l.__removalCount||0)+1,A.insertBefore(we,ee(l))}}}return le(l),!0}return l instanceof c&&!mc(l)||(f==="noscript"||f==="noembed"||f==="noframes")&&V(/<\/no(script|embed|frames)/i,l.innerHTML)?(le(l),!0):(Ne&&l.nodeType===et.text&&(p=l.textContent,kt([Or,Lr,Nr],A=>{p=Ke(p,A," ")}),l.textContent!==p&&(Ze(e.removed,{element:l.cloneNode()}),l.textContent=p)),me(X.afterSanitizeElements,l,null),!1)},Hn=function(l,p,f){if(An&&(p==="id"||p==="name")&&(f in t||f in fc))return!1;if(!(Fr&&!zr[p]&&V(ic,p))){if(!(Tn&&V(ac,p))){if(!B[p]||zr[p]){if(!(jn(l)&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,l)||D.tagNameCheck instanceof Function&&D.tagNameCheck(l))&&(D.attributeNameCheck instanceof RegExp&&V(D.attributeNameCheck,p)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(p))||p==="is"&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&V(D.tagNameCheck,f)||D.tagNameCheck instanceof Function&&D.tagNameCheck(f))))return!1}else if(!jr[p]){if(!V(xn,Ke(f,_n,""))){if(!((p==="src"||p==="xlink:href"||p==="href")&&l!=="script"&&Ko(f,"data:")===0&&Pn[l])){if(!(Cn&&!V(lc,Ke(f,_n,"")))){if(f)return!1}}}}}}return!0},jn=function(l){return l!=="annotation-xml"&&_s(l,cc)},qn=function(l){me(X.beforeSanitizeAttributes,l,null);const{attributes:p}=l;if(!p||Gr(l))return;const f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let A=p.length;for(;A--;){const j=p[A],{name:N,namespaceURI:Z,value:we}=j,gt=U(N),Yr=we;let q=N==="value"?Yr:Jo(Yr);if(f.attrName=gt,f.attrValue=q,f.keepAttr=!0,f.forceKeepAttr=void 0,me(X.uponSanitizeAttribute,l,f),q=f.attrValue,$n&&(gt==="id"||gt==="name")&&(je(N,l),q=hc+q),Nt&&V(/((--!?|])>)|<\/(style|title)/i,q)){je(N,l);continue}if(f.forceKeepAttr)continue;if(!f.keepAttr){je(N,l);continue}if(!In&&V(/\/>/i,q)){je(N,l);continue}Ne&&kt([Or,Lr,Nr],Vn=>{q=Ke(q,Vn," ")});const Wn=U(l.nodeName);if(!Hn(Wn,gt,q)){je(N,l);continue}if(z&&typeof R=="object"&&typeof R.getAttributeType=="function"&&!Z)switch(R.getAttributeType(Wn,gt)){case"TrustedHTML":{q=z.createHTML(q);break}case"TrustedScriptURL":{q=z.createScriptURL(q);break}}if(q!==Yr)try{Z?l.setAttributeNS(Z,N,q):l.setAttribute(N,q),Gr(l)?le(l):ks(e.removed)}catch{je(N,l)}}me(X.afterSanitizeAttributes,l,null)},wc=function m(l){let p=null;const f=Fn(l);for(me(X.beforeSanitizeShadowDOM,l,null);p=f.nextNode();)me(X.uponSanitizeShadowNode,p,null),Bn(p),qn(p),p.content instanceof o&&m(p.content);me(X.afterSanitizeShadowDOM,l,null)};return e.sanitize=function(m){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=null,f=null,A=null,j=null;if(qr=!m,qr&&(m="<!-->"),typeof m!="string"&&!Un(m))if(typeof m.toString=="function"){if(m=m.toString(),typeof m!="string")throw Je("dirty is not a string, aborting")}else throw Je("toString is not a function");if(!e.isSupported)return m;if(Ur||Vr(l),e.removed=[],typeof m=="string"&&(pt=!1),pt){if(m.nodeName){const we=U(m.nodeName);if(!F[we]||dt[we])throw Je("root node is forbidden and cannot be sanitized in-place")}}else if(m instanceof a)p=zn("<!---->"),f=p.ownerDocument.importNode(m,!0),f.nodeType===et.element&&f.nodeName==="BODY"||f.nodeName==="HTML"?p=f:p.appendChild(f);else{if(!ze&&!Ne&&!De&&m.indexOf("<")===-1)return z&&Ft?z.createHTML(m):m;if(p=zn(m),!p)return ze?null:Ft?Re:""}p&&Br&&le(p.firstChild);const N=Fn(pt?m:p);for(;A=N.nextNode();)Bn(A),qn(A),A.content instanceof o&&wc(A.content);if(pt)return m;if(ze){if(zt)for(j=sc.call(p.ownerDocument);p.firstChild;)j.appendChild(p.firstChild);else j=p;return(B.shadowroot||B.shadowrootmode)&&(j=oc.call(n,j,!0)),j}let Z=De?p.outerHTML:p.innerHTML;return De&&F["!doctype"]&&p.ownerDocument&&p.ownerDocument.doctype&&p.ownerDocument.doctype.name&&V(Is,p.ownerDocument.doctype.name)&&(Z="<!DOCTYPE "+p.ownerDocument.doctype.name+`>
|
|
222
|
+
`+Z),Ne&&kt([Or,Lr,Nr],we=>{Z=Ke(Z,we," ")}),z&&Ft?z.createHTML(Z):Z},e.setConfig=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vr(m),Ur=!0},e.clearConfig=function(){He=null,Ur=!1},e.isValidAttribute=function(m,l,p){He||Vr({});const f=U(m),A=U(l);return Hn(f,A,p)},e.addHook=function(m,l){typeof l=="function"&&Ze(X[m],l)},e.removeHook=function(m,l){if(l!==void 0){const p=Xo(X[m],l);return p===-1?void 0:Zo(X[m],p,1)[0]}return ks(X[m])},e.removeHooks=function(m){X[m]=[]},e.removeAllHooks=function(){X=$s()},e}var Ps=Rs();function hr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Te=hr();function Ms(r){Te=r}var tt={exec:()=>null};function E(r,e=""){let t=typeof r=="string"?r:r.source,n={replace:(s,o)=>{let i=typeof o=="string"?o:o.source;return i=i.replace(Y.caret,"$1"),t=t.replace(s,i),n},getRegex:()=>new RegExp(t,e)};return n}var Y={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i")},ui=/^(?:[ \t]*(?:\n|$))+/,gi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,rt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,mi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,dr=/(?:[*+-]|\d{1,9}[.)])/,Ds=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Os=E(Ds).replace(/bull/g,dr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),wi=E(Ds).replace(/bull/g,dr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),pr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,bi=/^[^\n]+/,ur=/(?!\s*\])(?:\\.|[^\[\]\\])+/,vi=E(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ur).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yi=E(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,dr).getRegex(),St="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",gr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ki=E("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",gr).replace("tag",St).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ls=E(pr).replace("hr",rt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",St).getRegex(),_i=E(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ls).getRegex(),fr={blockquote:_i,code:gi,def:vi,fences:fi,heading:mi,hr:rt,html:ki,lheading:Os,list:yi,newline:ui,paragraph:Ls,table:tt,text:bi},Ns=E("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",rt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",St).getRegex(),xi={...fr,lheading:wi,table:Ns,paragraph:E(pr).replace("hr",rt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ns).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",St).getRegex()},Si={...fr,html:E(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",gr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:tt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:E(pr).replace("hr",rt).replace("heading",` *#{1,6} *[^
|
|
223
|
+
]`).replace("lheading",Os).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ei=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ti=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zs=/^( {2,}|\\)\n(?!\s*$)/,Ci=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Et=/[\p{P}\p{S}]/u,mr=/[\s\p{P}\p{S}]/u,Fs=/[^\s\p{P}\p{S}]/u,Ii=E(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,mr).getRegex(),Us=/(?!~)[\p{P}\p{S}]/u,Ai=/(?!~)[\s\p{P}\p{S}]/u,$i=/(?:[^\s\p{P}\p{S}]|~)/u,Ri=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,Bs=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Pi=E(Bs,"u").replace(/punct/g,Et).getRegex(),Mi=E(Bs,"u").replace(/punct/g,Us).getRegex(),Hs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Di=E(Hs,"gu").replace(/notPunctSpace/g,Fs).replace(/punctSpace/g,mr).replace(/punct/g,Et).getRegex(),Oi=E(Hs,"gu").replace(/notPunctSpace/g,$i).replace(/punctSpace/g,Ai).replace(/punct/g,Us).getRegex(),Li=E("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Fs).replace(/punctSpace/g,mr).replace(/punct/g,Et).getRegex(),Ni=E(/\\(punct)/,"gu").replace(/punct/g,Et).getRegex(),zi=E(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Fi=E(gr).replace("(?:-->|$)","-->").getRegex(),Ui=E("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Fi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Tt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Bi=E(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Tt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),js=E(/^!?\[(label)\]\[(ref)\]/).replace("label",Tt).replace("ref",ur).getRegex(),qs=E(/^!?\[(ref)\](?:\[\])?/).replace("ref",ur).getRegex(),Hi=E("reflink|nolink(?!\\()","g").replace("reflink",js).replace("nolink",qs).getRegex(),wr={_backpedal:tt,anyPunctuation:Ni,autolink:zi,blockSkip:Ri,br:zs,code:Ti,del:tt,emStrongLDelim:Pi,emStrongRDelimAst:Di,emStrongRDelimUnd:Li,escape:Ei,link:Bi,nolink:qs,punctuation:Ii,reflink:js,reflinkSearch:Hi,tag:Ui,text:Ci,url:tt},ji={...wr,link:E(/^!?\[(label)\]\((.*?)\)/).replace("label",Tt).getRegex(),reflink:E(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Tt).getRegex()},br={...wr,emStrongRDelimAst:Oi,emStrongLDelim:Mi,url:E(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},qi={...br,br:E(zs).replace("{2,}","*").getRegex(),text:E(br.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ct={normal:fr,gfm:xi,pedantic:Si},st={normal:wr,gfm:br,breaks:qi,pedantic:ji},Wi={"&":"&","<":"<",">":">",'"':""","'":"'"},Ws=r=>Wi[r];function ie(r,e){if(e){if(Y.escapeTest.test(r))return r.replace(Y.escapeReplace,Ws)}else if(Y.escapeTestNoEncode.test(r))return r.replace(Y.escapeReplaceNoEncode,Ws);return r}function Vs(r){try{r=encodeURI(r).replace(Y.percentDecode,"%")}catch{return null}return r}function Gs(r,e){let t=r.replace(Y.findPipe,(o,i,a)=>{let c=!1,d=i;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),n=t.split(Y.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(Y.slashPipe,"|");return n}function nt(r,e,t){let n=r.length;if(n===0)return"";let s=0;for(;s<n&&r.charAt(n-s-1)===e;)s++;return r.slice(0,n-s)}function Vi(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===e[0])t++;else if(r[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function Ys(r,e,t,n,s){let o=e.href,i=e.title||null,a=r[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let c={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:o,title:i,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,c}function Gi(r,e,t){let n=r.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
|
|
224
224
|
`).map(o=>{let i=o.match(t.other.beginningSpace);if(i===null)return o;let[a]=i;return a.length>=s.length?o.slice(s.length):o}).join(`
|
|
225
|
-
`)}var
|
|
225
|
+
`)}var It=class{options;rules;lexer;constructor(r){this.options=r||Te}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:nt(t,`
|
|
226
226
|
`)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],n=Gi(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=nt(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:nt(e[0],`
|
|
227
227
|
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=nt(e[0],`
|
|
228
228
|
`).split(`
|
|
229
|
-
`),n="",s="",o=[];for(;t.length>0;){let i=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),i=!0;else if(!i)a.push(t[c]);else break;t=t.slice(c);let
|
|
230
|
-
`),u=
|
|
229
|
+
`),n="",s="",o=[];for(;t.length>0;){let i=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),i=!0;else if(!i)a.push(t[c]);else break;t=t.slice(c);let d=a.join(`
|
|
230
|
+
`),u=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
231
231
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
232
|
-
${
|
|
233
|
-
${u}`:u;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,o,!0),this.lexer.state.top=v,t.length===0)break;let _=o.at(-1);if(_?.type==="code")break;if(_?.type==="blockquote"){let
|
|
232
|
+
${d}`:d,s=s?`${s}
|
|
233
|
+
${u}`:u;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,o,!0),this.lexer.state.top=v,t.length===0)break;let _=o.at(-1);if(_?.type==="code")break;if(_?.type==="blockquote"){let R=_,T=R.raw+`
|
|
234
234
|
`+t.join(`
|
|
235
|
-
`),x=this.blockquote(T);o[o.length-1]=x,n=n.substring(0,n.length
|
|
235
|
+
`),x=this.blockquote(T);o[o.length-1]=x,n=n.substring(0,n.length-R.raw.length)+x.raw,s=s.substring(0,s.length-R.text.length)+x.text;break}else if(_?.type==="list"){let R=_,T=R.raw+`
|
|
236
236
|
`+t.join(`
|
|
237
|
-
`),x=this.list(T);o[o.length-1]=x,n=n.substring(0,n.length-_.raw.length)+x.raw,s=s.substring(0,s.length
|
|
238
|
-
`);continue}}return{type:"blockquote",raw:n,tokens:o,text:s}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),n=t.length>1,s={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let o=this.rules.other.listItemRegex(t),i=!1;for(;r;){let c=!1,
|
|
237
|
+
`),x=this.list(T);o[o.length-1]=x,n=n.substring(0,n.length-_.raw.length)+x.raw,s=s.substring(0,s.length-R.raw.length)+x.raw,t=T.substring(o.at(-1).raw.length).split(`
|
|
238
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:o,text:s}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),n=t.length>1,s={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let o=this.rules.other.listItemRegex(t),i=!1;for(;r;){let c=!1,d="",u="";if(!(e=o.exec(r))||this.rules.block.hr.test(r))break;d=e[0],r=r.substring(d.length);let v=e[2].split(`
|
|
239
239
|
`,1)[0].replace(this.rules.other.listReplaceTabs,ee=>" ".repeat(3*ee.length)),_=r.split(`
|
|
240
|
-
`,1)[0]
|
|
241
|
-
`,r=r.substring(_.length+1),c=!0),!c){let ee=this.rules.other.nextBulletRegex(T),ke=this.rules.other.hrRegex(T),oe=this.rules.other.fencesBeginRegex(T),z=this.rules.other.headingBeginRegex(T)
|
|
242
|
-
`,1)[0],Me;if(_=Pe,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),Me=_):Me=_.replace(this.rules.other.tabCharGlobal," "),oe.test(_)||z.test(_)
|
|
243
|
-
`+Me.slice(T);else{if(
|
|
244
|
-
`+_}
|
|
245
|
-
`,r=r.substring(Pe.length+1),v=Me.slice(T)}}s.loose||(i?s.loose=!0:this.rules.other.doubleBlankLine.test(
|
|
240
|
+
`,1)[0],R=!v.trim(),T=0;if(this.options.pedantic?(T=2,u=v.trimStart()):R?T=e[1].length+1:(T=e[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,u=v.slice(T),T+=e[1].length),R&&this.rules.other.blankLine.test(_)&&(d+=_+`
|
|
241
|
+
`,r=r.substring(_.length+1),c=!0),!c){let ee=this.rules.other.nextBulletRegex(T),ke=this.rules.other.hrRegex(T),oe=this.rules.other.fencesBeginRegex(T),z=this.rules.other.headingBeginRegex(T),Re=this.rules.other.htmlBeginRegex(T);for(;r;){let Pe=r.split(`
|
|
242
|
+
`,1)[0],Me;if(_=Pe,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),Me=_):Me=_.replace(this.rules.other.tabCharGlobal," "),oe.test(_)||z.test(_)||Re.test(_)||ee.test(_)||ke.test(_))break;if(Me.search(this.rules.other.nonSpaceChar)>=T||!_.trim())u+=`
|
|
243
|
+
`+Me.slice(T);else{if(R||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||oe.test(v)||z.test(v)||ke.test(v))break;u+=`
|
|
244
|
+
`+_}!R&&!_.trim()&&(R=!0),d+=Pe+`
|
|
245
|
+
`,r=r.substring(Pe.length+1),v=Me.slice(T)}}s.loose||(i?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(i=!0));let x=null,M;this.options.gfm&&(x=this.rules.other.listIsTask.exec(u),x&&(M=x[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:d,task:!!x,checked:M,loose:!1,text:u,tokens:[]}),s.raw+=d}let a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){let d=s.items[c].tokens.filter(v=>v.type==="space"),u=d.length>0&&d.some(v=>this.rules.other.anyLine.test(v.raw));s.loose=u}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].loose=!0;return s}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:s}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Gs(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
246
246
|
`):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let i of n)this.rules.other.tableAlignRight.test(i)?o.align.push("right"):this.rules.other.tableAlignCenter.test(i)?o.align.push("center"):this.rules.other.tableAlignLeft.test(i)?o.align.push("left"):o.align.push(null);for(let i=0;i<t.length;i++)o.header.push({text:t[i],tokens:this.lexer.inline(t[i]),header:!0,align:o.align[i]});for(let i of s)o.rows.push(Gs(i,o.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:o.align[c]})));return o}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
247
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let o=nt(t.slice(0,-1),"\\");if((t.length-o.length)%2===0)return}else{let o=Vi(e[2],"()");if(o===-2)return;if(o>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(n);o&&(n=o[1],s=o[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),Ys(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){let o=t[0].charAt(0);return{type:"text",raw:o,text:o}}return Ys(t,s,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(r);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let s=[...n[0]].length-1,o,i,a=s,c=0,
|
|
247
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let o=nt(t.slice(0,-1),"\\");if((t.length-o.length)%2===0)return}else{let o=Vi(e[2],"()");if(o===-2)return;if(o>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(n);o&&(n=o[1],s=o[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),Ys(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){let o=t[0].charAt(0);return{type:"text",raw:o,text:o}}return Ys(t,s,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(r);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let s=[...n[0]].length-1,o,i,a=s,c=0,d=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*r.length+s);(n=d.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(i=[...o].length,n[3]||n[4]){a+=i;continue}else if((n[5]||n[6])&&s%3&&!((s+i)%3)){c+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+c);let u=[...n[0]][0].length,v=r.slice(0,s+n.index+u+i);if(Math.min(s,i)%2){let R=v.slice(1,-1);return{type:"em",raw:v,text:R,tokens:this.lexer.inlineTokens(R)}}let _=v.slice(2,-2);return{type:"strong",raw:v,text:_,tokens:this.lexer.inlineTokens(_)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r){let e=this.rules.inline.del.exec(r);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},de=class Xr{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Te,this.options.tokenizer=this.options.tokenizer||new It,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Y,block:Ct.normal,inline:st.normal};this.options.pedantic?(t.block=Ct.pedantic,t.inline=st.pedantic):this.options.gfm&&(t.block=Ct.gfm,this.options.breaks?t.inline=st.breaks:t.inline=st.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ct,inline:st}}static lex(e,t){return new Xr(t).lex(e)}static lexInline(e,t){return new Xr(t).inlineTokens(e)}lex(e){e=e.replace(Y.carriageReturn,`
|
|
248
248
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Y.tabCharGlobal," ").replace(Y.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(i=>(s=i.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let i=t.at(-1);s.raw.length===1&&i!==void 0?i.raw+=`
|
|
249
249
|
`:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
250
250
|
`)?"":`
|
|
@@ -252,13 +252,13 @@ ${u}`:u;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
252
252
|
`+s.text,this.inlineQueue.at(-1).src=i.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
253
253
|
`)?"":`
|
|
254
254
|
`)+s.raw,i.text+=`
|
|
255
|
-
`+s.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},t.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let o=e;if(this.options.extensions?.startBlock){let i=1/0,a=e.slice(1),c;this.options.extensions.startBlock.forEach(
|
|
255
|
+
`+s.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},t.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let o=e;if(this.options.extensions?.startBlock){let i=1/0,a=e.slice(1),c;this.options.extensions.startBlock.forEach(d=>{c=d.call({lexer:this},a),typeof c=="number"&&c>=0&&(i=Math.min(i,c))}),i<1/0&&i>=0&&(o=e.substring(0,i+1))}if(this.state.top&&(s=this.tokenizer.paragraph(o))){let i=t.at(-1);n&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
|
|
256
256
|
`)?"":`
|
|
257
257
|
`)+s.raw,i.text+=`
|
|
258
258
|
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s),n=o.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let i=t.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
259
259
|
`)?"":`
|
|
260
260
|
`)+s.raw,i.text+=`
|
|
261
|
-
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,i="";for(;e;){o||(i=""),o=!1;let a;if(this.options.extensions?.inline?.some(
|
|
261
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,i="";for(;e;){o||(i=""),o=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,n,i)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let d=1/0,u=e.slice(1),v;this.options.extensions.startInline.forEach(_=>{v=_.call({lexer:this},u),typeof v=="number"&&v>=0&&(d=Math.min(d,v))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),o=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){let d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}},At=class{options;parser;constructor(r){this.options=r||Te}space(r){return""}code({text:r,lang:e,escaped:t}){let n=(e||"").match(Y.notSpaceStart)?.[0],s=r.replace(Y.endingNewline,"")+`
|
|
262
262
|
`;return n?'<pre><code class="language-'+ie(n)+'">'+(t?s:ie(s,!0))+`</code></pre>
|
|
263
263
|
`:"<pre><code>"+(t?s:ie(s,!0))+`</code></pre>
|
|
264
264
|
`}blockquote({tokens:r}){return`<blockquote>
|
|
@@ -276,9 +276,9 @@ ${this.parser.parse(r)}</blockquote>
|
|
|
276
276
|
`}tablerow({text:r}){return`<tr>
|
|
277
277
|
${r}</tr>
|
|
278
278
|
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
279
|
-
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${ie(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let n=this.parser.parseInline(t),s=Vs(r);if(s===null)return n;r=s;let o='<a href="'+r+'"';return e&&(o+=' title="'+ie(e)+'"'),o+=">"+n+"</a>",o}image({href:r,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let s=Vs(r);if(s===null)return ie(t);r=s;let o=`<img src="${r}" alt="${t}"`;return e&&(o+=` title="${ie(e)}"`),o+=">",o}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:ie(r.text)}},
|
|
280
|
-
`+this.renderer.text(a);t?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):n+=c;continue}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){let o=e[s];if(this.options.extensions?.renderers?.[o.type]){let a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=a||"";continue}}let i=o;switch(i.type){case"escape":{n+=t.text(i);break}case"html":{n+=t.html(i);break}case"link":{n+=t.link(i);break}case"image":{n+=t.image(i);break}case"strong":{n+=t.strong(i);break}case"em":{n+=t.em(i);break}case"codespan":{n+=t.codespan(i);break}case"br":{n+=t.br(i);break}case"del":{n+=t.del(i);break}case"text":{n+=t.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}}
|
|
281
|
-
Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error occurred:</p><pre>"+ie(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},Ce=new Yi;function S(r,e){return Ce.parse(r,e)}S.options=S.setOptions=function(r){return Ce.setOptions(r),S.defaults=Ce.defaults,Ms(S.defaults),S},S.getDefaults=
|
|
279
|
+
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${ie(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let n=this.parser.parseInline(t),s=Vs(r);if(s===null)return n;r=s;let o='<a href="'+r+'"';return e&&(o+=' title="'+ie(e)+'"'),o+=">"+n+"</a>",o}image({href:r,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let s=Vs(r);if(s===null)return ie(t);r=s;let o=`<img src="${r}" alt="${t}"`;return e&&(o+=` title="${ie(e)}"`),o+=">",o}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:ie(r.text)}},vr=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}},pe=class Zr{options;renderer;textRenderer;constructor(e){this.options=e||Te,this.options.renderer=this.options.renderer||new At,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new vr}static parse(e,t){return new Zr(t).parse(e)}static parseInline(e,t){return new Zr(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){let o=e[s];if(this.options.extensions?.renderers?.[o.type]){let a=o,c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=c||"";continue}}let i=o;switch(i.type){case"space":{n+=this.renderer.space(i);continue}case"hr":{n+=this.renderer.hr(i);continue}case"heading":{n+=this.renderer.heading(i);continue}case"code":{n+=this.renderer.code(i);continue}case"table":{n+=this.renderer.table(i);continue}case"blockquote":{n+=this.renderer.blockquote(i);continue}case"list":{n+=this.renderer.list(i);continue}case"html":{n+=this.renderer.html(i);continue}case"def":{n+=this.renderer.def(i);continue}case"paragraph":{n+=this.renderer.paragraph(i);continue}case"text":{let a=i,c=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],c+=`
|
|
280
|
+
`+this.renderer.text(a);t?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):n+=c;continue}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){let o=e[s];if(this.options.extensions?.renderers?.[o.type]){let a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=a||"";continue}}let i=o;switch(i.type){case"escape":{n+=t.text(i);break}case"html":{n+=t.html(i);break}case"link":{n+=t.link(i);break}case"image":{n+=t.image(i);break}case"strong":{n+=t.strong(i);break}case"em":{n+=t.em(i);break}case"codespan":{n+=t.codespan(i);break}case"br":{n+=t.br(i);break}case"del":{n+=t.del(i);break}case"text":{n+=t.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},$t=class{options;block;constructor(r){this.options=r||Te}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}provideLexer(){return this.block?de.lex:de.lexInline}provideParser(){return this.block?pe.parse:pe.parseInline}},Yi=class{defaults=hr();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=pe;Renderer=At;TextRenderer=vr;Lexer=de;Tokenizer=It;Hooks=$t;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let n of r)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let s=n;for(let o of s.header)t=t.concat(this.walkTokens(o.tokens,e));for(let o of s.rows)for(let i of o)t=t.concat(this.walkTokens(i.tokens,e));break}case"list":{let s=n;t=t.concat(this.walkTokens(s.items,e));break}default:{let s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(o=>{let i=s[o].flat(1/0);t=t.concat(this.walkTokens(i,e))}):s.tokens&&(t=t.concat(this.walkTokens(s.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=e.renderers[s.name];o?e.renderers[s.name]=function(...i){let a=s.renderer.apply(this,i);return a===!1&&(a=o.apply(this,i)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[s.level];o?o.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),t.renderer){let s=this.defaults.renderer||new At(this.defaults);for(let o in t.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,a=t.renderer[i],c=s[i];s[i]=(...d)=>{let u=a.apply(s,d);return u===!1&&(u=c.apply(s,d)),u||""}}n.renderer=s}if(t.tokenizer){let s=this.defaults.tokenizer||new It(this.defaults);for(let o in t.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,a=t.tokenizer[i],c=s[i];s[i]=(...d)=>{let u=a.apply(s,d);return u===!1&&(u=c.apply(s,d)),u}}n.tokenizer=s}if(t.hooks){let s=this.defaults.hooks||new $t;for(let o in t.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,a=t.hooks[i],c=s[i];$t.passThroughHooks.has(o)?s[i]=d=>{if(this.defaults.async)return Promise.resolve(a.call(s,d)).then(v=>c.call(s,v));let u=a.call(s,d);return c.call(s,u)}:s[i]=(...d)=>{let u=a.apply(s,d);return u===!1&&(u=c.apply(s,d)),u}}n.hooks=s}if(t.walkTokens){let s=this.defaults.walkTokens,o=t.walkTokens;n.walkTokens=function(i){let a=[];return a.push(o.call(this,i)),s&&(a=a.concat(s.call(this,i))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return de.lex(r,e??this.defaults)}parser(r,e){return pe.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let n={...t},s={...this.defaults,...n},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=r);let i=s.hooks?s.hooks.provideLexer():r?de.lex:de.lexInline,a=s.hooks?s.hooks.provideParser():r?pe.parse:pe.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(c=>i(c,s)).then(c=>s.hooks?s.hooks.processAllTokens(c):c).then(c=>s.walkTokens?Promise.all(this.walkTokens(c,s.walkTokens)).then(()=>c):c).then(c=>a(c,s)).then(c=>s.hooks?s.hooks.postprocess(c):c).catch(o);try{s.hooks&&(e=s.hooks.preprocess(e));let c=i(e,s);s.hooks&&(c=s.hooks.processAllTokens(c)),s.walkTokens&&this.walkTokens(c,s.walkTokens);let d=a(c,s);return s.hooks&&(d=s.hooks.postprocess(d)),d}catch(c){return o(c)}}}onError(r,e){return t=>{if(t.message+=`
|
|
281
|
+
Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error occurred:</p><pre>"+ie(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},Ce=new Yi;function S(r,e){return Ce.parse(r,e)}S.options=S.setOptions=function(r){return Ce.setOptions(r),S.defaults=Ce.defaults,Ms(S.defaults),S},S.getDefaults=hr,S.defaults=Te,S.use=function(...r){return Ce.use(...r),S.defaults=Ce.defaults,Ms(S.defaults),S},S.walkTokens=function(r,e){return Ce.walkTokens(r,e)},S.parseInline=Ce.parseInline,S.Parser=pe,S.parser=pe.parse,S.Renderer=At,S.TextRenderer=vr,S.Lexer=de,S.lexer=de.lex,S.Tokenizer=It,S.Hooks=$t,S.parse=S,S.options,S.setOptions,S.use,S.walkTokens,S.parseInline,pe.parse,de.lex;const Oe=new S.Renderer,Xs=r=>`<div class="overflow-x-auto"><div class="flex w-fit flex-col-reverse mr-4">${r}</div></div>`;Oe.code=r=>Xs(S.Renderer.prototype.code.call(Oe,r)),Oe.table=r=>Xs(S.Renderer.prototype.table.call(Oe,r)),Oe.link=r=>`<a href="${r.href}" target="_blank" rel="noopener noreferrer">${r.text}</a>`,S.setOptions({gfm:!0,breaks:!1,renderer:Oe});let Zs=!1;Zs||(Ps.addHook("afterSanitizeAttributes",r=>{r.tagName==="A"&&(r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer"))}),Zs=!0);function Xi(r){const e=S.parse(r,{async:!1});return Ps.sanitize(e,{USE_PROFILES:{html:!0}})}var Zi=Object.defineProperty,Ki=(r,e,t,n)=>{for(var s=void 0,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(e,t,s)||s);return s&&Zi(e,t,s),s};class ot extends te{constructor(){super(...arguments),this.position="left"}connectedCallback(){super.connectedCallback(),this.setAttribute("role","message")}isHidden(){return!1}renderHeader(){return g.nothing}renderBody(){return g.nothing}renderFooter(){return g.nothing}render(){return this.isHidden()?g.nothing:g.html`<div class="relative w-full py-3 text-sm">
|
|
282
282
|
<div class="group/message mx-auto my-auto px-3">
|
|
283
283
|
<div class="flex max-w-full min-w-0 flex-grow-1 flex-col">
|
|
284
284
|
<div
|
|
@@ -302,11 +302,11 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
302
302
|
${this.renderFooter()}
|
|
303
303
|
</div>
|
|
304
304
|
</div>
|
|
305
|
-
</div>`}}Ki([w.property({attribute:!1})],ot.prototype,"message");var Ji=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Ks=(r,e,t,n)=>{for(var s=n>1?void 0:n?Qi(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Ji(e,t,s),s};let
|
|
305
|
+
</div>`}}Ki([w.property({attribute:!1})],ot.prototype,"message");var Ji=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Ks=(r,e,t,n)=>{for(var s=n>1?void 0:n?Qi(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Ji(e,t,s),s};let yr=class extends ot{constructor(){super(...arguments),this.citationsExpanded=!1}toggleCitations(){this.citationsExpanded=!this.citationsExpanded}approveToolCall(){this.message.role==="assistant"&&this.dispatchEvent(new Eo(this.message.turnId,this.message.messageId))}declineToolCall(){this.message.role==="assistant"&&this.dispatchEvent(new To(this.message.turnId,this.message.messageId))}isHidden(){return!("content"in this.message)||!this.message.content}renderHeader(){return g.html`<div class="text-primary-900 mb-1 flex h-6 items-center gap-x-2">
|
|
306
306
|
<div class="flex size-4 items-center justify-center">${P.unsafeSVG(Xe)}</div>
|
|
307
307
|
<span class="text-sm font-medium">GAiA</span>
|
|
308
308
|
</div>
|
|
309
|
-
${
|
|
309
|
+
${ts.guard([this.message.citations.length,this.citationsExpanded],()=>this.message.citations.length?g.html`<div class="text-primary-800 hover:text-primary-900 text-xs font-semibold">
|
|
310
310
|
<a
|
|
311
311
|
role="button"
|
|
312
312
|
class="group flex items-center gap-2 select-none"
|
|
@@ -318,13 +318,13 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
318
318
|
>
|
|
319
319
|
${P.unsafeSVG(jo)}
|
|
320
320
|
</div>
|
|
321
|
-
${y(
|
|
321
|
+
${y(ft`Used ${this.message.citations.length} sources`,{id:"assistant-message-citations-length"})}
|
|
322
322
|
</a>
|
|
323
323
|
<section
|
|
324
324
|
role="region"
|
|
325
325
|
class=${_e("relative grid gap-2 transition-[transform,opacity,height,visibility] duration-200 ease-in-out overflow-hidden",{"h-0 invisible opacity-0":!this.citationsExpanded,"h-auto py-2 visible opacity-100":this.citationsExpanded})}
|
|
326
326
|
>
|
|
327
|
-
${
|
|
327
|
+
${Jr.repeat(this.message.citations,r=>r.url,r=>g.html`<div class="flex min-w-0 items-center gap-2 overflow-x-clip">
|
|
328
328
|
<div class="flex size-4 items-center justify-center">
|
|
329
329
|
${P.unsafeSVG(Wo)}
|
|
330
330
|
</div>
|
|
@@ -339,8 +339,8 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
339
339
|
</a>
|
|
340
340
|
</div>`)}
|
|
341
341
|
</section>
|
|
342
|
-
</div>`:g.nothing)}`}renderBody(){return
|
|
343
|
-
${
|
|
342
|
+
</div>`:g.nothing)}`}renderBody(){return ts.guard(this.message.content.length,()=>g.html` <div class="prose prose-gaia prose-table:min-w-max">
|
|
343
|
+
${Kr.unsafeHTML(Xi(this.message.content))}
|
|
344
344
|
</div>`)}renderFooter(){return this.message.approvalStatus?g.html`
|
|
345
345
|
<div
|
|
346
346
|
class="mt-2 flex items-center justify-center gap-x-2"
|
|
@@ -368,7 +368,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
368
368
|
</div>
|
|
369
369
|
</button>
|
|
370
370
|
</div>
|
|
371
|
-
`:g.nothing}};Ks([w.state()],
|
|
371
|
+
`:g.nothing}};Ks([w.state()],yr.prototype,"citationsExpanded",2),yr=Ks([w.customElement("gaia-chat-assistant-message")],yr);const Js='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-headset-icon lucide-headset"><path d="M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z"/><path d="M21 16v2a4 4 0 0 1-4 4h-5"/></svg>';var ea=Object.getOwnPropertyDescriptor,ta=(r,e,t,n)=>{for(var s=n>1?void 0:n?ea(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let Qs=class extends ot{renderHeader(){return g.html`<div class="flex items-center gap-1 pb-1">
|
|
372
372
|
<div class="relative size-6 p-0.5">
|
|
373
373
|
<div class="aspect-square h-full w-full overflow-hidden rounded-full">
|
|
374
374
|
${this.message.operator.pictureUrl?g.html`<img
|
|
@@ -393,7 +393,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
393
393
|
class="animate-grow h-2 w-2 rounded-full bg-neutral-600 [animation-delay:0.6s]"
|
|
394
394
|
></span>
|
|
395
395
|
</div> `:g.html`<div class="text-primary-900 whitespace-pre-wrap">${this.message.content}</div>`}
|
|
396
|
-
</div>`}};Qs=ta([w.customElement("gaia-chat-operator-message")],Qs);var ra=Object.getOwnPropertyDescriptor,sa=(r,e,t,n)=>{for(var s=n>1?void 0:n?ra(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let en=class extends ot{constructor(){super(...arguments),this.position="center"}isHidden(){return this.message.isVisuallyHidden}clearConversation(){this.dispatchEvent(new
|
|
396
|
+
</div>`}};Qs=ta([w.customElement("gaia-chat-operator-message")],Qs);var ra=Object.getOwnPropertyDescriptor,sa=(r,e,t,n)=>{for(var s=n>1?void 0:n?ra(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let en=class extends ot{constructor(){super(...arguments),this.position="center"}isHidden(){return this.message.isVisuallyHidden}clearConversation(){this.dispatchEvent(new er)}openFeedbackForm(){this.dispatchEvent(new Qt("support"))}renderBody(){return this.message.isSupportStartedMarker?g.html`<div
|
|
397
397
|
class="m-0 grid w-full grid-cols-[auto_1fr_auto] gap-2 rounded-sm border border-solid border-neutral-600 p-4 [grid-template-areas:'leading_primary']"
|
|
398
398
|
>
|
|
399
399
|
<div class="text-primary-900 flex flex-col gap-2 text-sm [grid-area:primary]">
|
|
@@ -438,7 +438,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
438
438
|
</div>
|
|
439
439
|
<div class="flex [grid-area:leading]">
|
|
440
440
|
<div class="text-primary-900 flex size-5 items-center justify-center">
|
|
441
|
-
${P.unsafeSVG(
|
|
441
|
+
${P.unsafeSVG(Jt)}
|
|
442
442
|
</div>
|
|
443
443
|
</div>
|
|
444
444
|
</div>`:g.nothing}};en=sa([w.customElement("gaia-chat-system-message")],en);var na=Object.getOwnPropertyDescriptor,oa=(r,e,t,n)=>{for(var s=n>1?void 0:n?na(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=i(s)||s);return s};let tn=class extends ot{constructor(){super(...arguments),this.position="right"}renderBody(){return!("content"in this.message)||!this.message.content?null:g.html` <div class="relative max-w-[90%] rounded-sm bg-blue-100 px-4 py-1.5">
|
|
@@ -454,7 +454,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
454
454
|
</div>
|
|
455
455
|
</div>
|
|
456
456
|
</div>
|
|
457
|
-
`}};rn=aa([w.customElement("gaia-chat-thinking-indicator")],rn);const la='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-lightbulb-icon lucide-lightbulb"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></svg>',ca='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-circle-icon lucide-message-circle"><path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/></svg>';var ha=Object.defineProperty,
|
|
457
|
+
`}};rn=aa([w.customElement("gaia-chat-thinking-indicator")],rn);const la='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-lightbulb-icon lucide-lightbulb"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></svg>',ca='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-circle-icon lucide-message-circle"><path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/></svg>';var ha=Object.defineProperty,da=Object.getOwnPropertyDescriptor,kr=(r,e,t,n)=>{for(var s=n>1?void 0:n?da(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&ha(e,t,s),s};const pa={SparklesIcon:Xe,LightBulbIcon:la,MessageCircleIcon:ca};let Rt=class extends te{constructor(){super(...arguments),this.isInitialized=!1}renderSkeleton(){return g.html`
|
|
458
458
|
<div>
|
|
459
459
|
<div class="skeleton my-1 h-6 w-full @md:w-36"></div>
|
|
460
460
|
<div class="flex flex-col gap-y-1">
|
|
@@ -480,7 +480,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
480
480
|
<p>${r.body}</p>
|
|
481
481
|
</div>
|
|
482
482
|
<div class="hidden flex-col gap-2 @xs:flex @xl:grid @xl:grid-cols-2">
|
|
483
|
-
${
|
|
483
|
+
${Qr.map(r.blocks,e=>this.renderMessageBlock(e))}
|
|
484
484
|
</div>
|
|
485
485
|
|
|
486
486
|
<p class="font-semibold">${r.callToAction}</p>
|
|
@@ -489,7 +489,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
489
489
|
<div class="flex size-5 items-center justify-center">${P.unsafeSVG(Xe)}</div>
|
|
490
490
|
<p class="text-shimmer text-shimmer-primary text-lg font-semibold">Hello!</p>
|
|
491
491
|
</div>
|
|
492
|
-
`}renderMessageBlock(r){const e=
|
|
492
|
+
`}renderMessageBlock(r){const e=pa[r.icon];return g.html`
|
|
493
493
|
<div class="flex items-center gap-x-2 rounded-sm border border-solid border-neutral-300 p-2">
|
|
494
494
|
<div class="text-primary-800 flex size-6 items-center justify-center">
|
|
495
495
|
${P.unsafeSVG(e)}
|
|
@@ -515,7 +515,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
515
515
|
</div>
|
|
516
516
|
</div>
|
|
517
517
|
</div>
|
|
518
|
-
`}};
|
|
518
|
+
`}};kr([w.property({attribute:!1})],Rt.prototype,"isInitialized",2),kr([w.property({attribute:!1})],Rt.prototype,"welcomeMessages",2),Rt=kr([w.customElement("gaia-chat-welcome-message")],Rt);var ua=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,ae=(r,e,t,n)=>{for(var s=n>1?void 0:n?ga(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&ua(e,t,s),s};let se=class extends te{constructor(){super(...arguments),this.isInitialized=!1,this.isThinking=!1,this.feedbackFormOpen=!1,this.feedbackFormTarget="assistant",this.error=null,this.isConnectedToSupport=!1,this.messages=[]}get latestMessage(){return this.messages.length===0?null:this.messages[this.messages.length-1]}updated(r){super.updated(r),r.has("messages")&&requestAnimationFrame(()=>this.handleScrollMessages(r.get("messages"))),r.has("feedbackFormOpen")&&this.feedbackFormOpen&&requestAnimationFrame(()=>this.scrollFeedbackFormIntoView())}handleScrollMessages(r){const e=r?.length??0,t=this.messages.length===e;if(!r&&!t)return;const n=this.messages.length>e;if(this.messages.length===0)return this.resetScroll();if(n&&this.latestMessage?.role==="system")return this.latestMessage.isSupportStartedMarker?this.scrollLatestMessageToTop():this.scrollLatestMessageIntoView();if(this.isConnectedToSupport)return this.scrollLatestMessageIntoView();if(n&&this.latestMessage?.role==="user")return this.scrollLatestMessageToTop();if(e===0&&n)return this.scrollLatestMessageIntoView()}resetScroll(){const r=this.$scrollView.parentElement;r&&(r.scrollTop=0,this.$scrollView.style.height=`${r.getBoundingClientRect().height}px`)}scrollLatestMessageToTop(){const r=this.$scrollView.parentElement;if(!r)return;const e=this.renderRoot.querySelectorAll('[role="message"]');if(e.length<1)return;const t=e[e.length-1];this.$scrollView.style.height=`${r.getBoundingClientRect().height+t.offsetTop}px`,t.scrollIntoView({behavior:"smooth",block:"start"})}scrollLatestMessageIntoView(){const r=this.renderRoot.querySelectorAll('[role="message"]');if(r.length<1)return;r[r.length-1].scrollIntoView({behavior:"smooth",block:"start"})}scrollFeedbackFormIntoView(){const r=this.$scrollView.parentElement;r&&r.scrollTo({top:this.$scrollView.scrollHeight,behavior:"smooth"})}render(){return g.html` <div class="relative flex h-full">
|
|
519
519
|
<div class="relative flex min-w-0 flex-grow-1 basis-auto flex-col">
|
|
520
520
|
<div class="relative h-full overflow-y-auto">
|
|
521
521
|
<div
|
|
@@ -527,7 +527,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
527
527
|
.isInitialized=${this.isInitialized}
|
|
528
528
|
.welcomeMessages=${this.welcomeMessages}
|
|
529
529
|
></gaia-chat-welcome-message>`:g.nothing}
|
|
530
|
-
${
|
|
530
|
+
${Jr.repeat(this.messages,r=>r.messageId,r=>{switch(r.role){case"assistant":return g.html`<gaia-chat-assistant-message
|
|
531
531
|
.message=${r}
|
|
532
532
|
></gaia-chat-assistant-message>`;case"user":return g.html`<gaia-chat-user-message
|
|
533
533
|
.message=${r}
|
|
@@ -544,11 +544,11 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
544
544
|
</div>
|
|
545
545
|
</div>
|
|
546
546
|
${this.error?g.html`<gaia-chat-error .error=${this.error}></gaia-chat-error>`:g.nothing}
|
|
547
|
-
</div>`}};ae([w.query("#scroll-view")],se.prototype,"$scrollView",2),ae([w.property({attribute:!1})],se.prototype,"isInitialized",2),ae([w.property({attribute:!1})],se.prototype,"welcomeMessages",2),ae([w.property({attribute:!1})],se.prototype,"isThinking",2),ae([w.property({attribute:!1})],se.prototype,"feedbackFormOpen",2),ae([w.property({attribute:!1})],se.prototype,"feedbackFormTarget",2),ae([w.property({attribute:!1})],se.prototype,"error",2),ae([w.property({attribute:!1})],se.prototype,"isConnectedToSupport",2),ae([w.property({attribute:!1})],se.prototype,"messages",2),se=ae([w.customElement("gaia-chat-message-list")],se);class sn extends Error{constructor(e,t){super(e),this.innerError=t,this.name="SignalRError"}}class yr extends Error{constructor(e,t,n){super(t),this.innerError=e,this.errorType=n}}function it(r){if(r instanceof DOMException&&r.name==="AbortError")return{code:"CANCELED",message:y("Request canceled.",{id:"error-request-canceled"}),retryable:!1,source:"ui",cause:r};if(r instanceof qe){const e={code:"UNAUTHORIZED",retryable:!1,source:"auth",cause:r};return r instanceof rs?{...e,message:y("Your access token has expired.",{id:"error-token-expired"})}:r instanceof We?{...e,message:y("Your access token is invalid.",{id:"error-token-invalid"})}:r instanceof Ve?{...e,message:y("You need to provide an access token to continue.",{id:"error-token-required"})}:{...e,message:y("Authentication error. Please authenticate again.",{id:"error-auth-generic"})}}return r instanceof xe?r.isNetworkError?{code:"NETWORK",message:y("Network error. Check your connection.",{id:"error-network-error"}),retryable:!0,source:"http",http:{status:0,url:r.url},cause:r}:r.isUnauthorized?{code:"UNAUTHORIZED",message:y("Your session expired. Please sign in again.",{id:"error-session-expired"}),retryable:!1,source:"http",http:{status:401,url:r.url},cause:r}:r.isForbidden?{code:"FORBIDDEN",message:y("You don't have access to this action.",{id:"error-forbidden"}),retryable:!1,source:"http",http:{status:403,url:r.url},cause:r}:r.isNotFound?{code:"NOT_FOUND",message:y("Not found.",{id:"error-not-found"}),retryable:!1,source:"http",http:{status:404,url:r.url},cause:r}:r.status===429?{code:"RATE_LIMIT",message:y("Too many requests. Please slow down.",{id:"error-rate-limit"}),retryable:!0,source:"http",http:{status:429,url:r.url},cause:r}:r.isServerError?{code:"SERVER",message:y("The server had a problem. Please try again.",{id:"error-server-error"}),retryable:!0,source:"http",http:{status:r.status,url:r.url},cause:r}:{code:"UNKNOWN",message:y("Something went wrong.",{id:"error-something-went-wrong"}),retryable:!0,source:"http",http:{status:r.status,url:r.url},cause:r}:r instanceof yr?r.errorType&&r.errorType==="ProfileNotFoundException"?{code:"NOT_FOUND",message:y("Failed to load the current profile. Are you using the correct profile?",{id:"error-profile-not-found"}),retryable:!1}:{code:"SSE",message:y("Live response stream interrupted. Try again.",{id:"error-sse-error"}),retryable:!0,source:"sse",cause:r}:r instanceof sn?{code:"WS",message:y("Live chat connection error. Reconnecting might help.",{id:"error-ws-error"}),retryable:!0,source:"ws",cause:r}:{code:"UNKNOWN",message:y("Unexpected error. Please try again.",{id:"error-unexpected-error"}),retryable:!0,source:"unknown",cause:r}}const nn={initialized:!1,maxInputLength:2e3,welcomeMessages:{}},fa=()=>({type:"config/setInitialized"}),ma=r=>({type:"config/set",payload:r}),wa=()=>({type:"config/clear"});function ba(r=nn,e){switch(e.type){case"config/setInitialized":return{...r,initialized:!0};case"config/set":return{...r,...e.payload,initialized:!0};case"config/clear":return{...r,initialized:!1,welcomeMessages:{}};default:return r}}const on={entities:{},ids:[]},va=r=>({type:"messages/set",payload:r}),ve=r=>({type:"messages/add",payload:r}),ya=r=>({type:"messages/delete",payload:r}),ue=(r,e)=>({type:"messages/patch",payload:{id:r,patch:e}}),ka=(r,e)=>({type:"messages/add-delta",payload:{id:r,delta:e}});function _a(r=on,e){switch(e.type){case"messages/set":return{...r,ids:e.payload.map(t=>t.messageId),entities:e.payload.reduce((t,n)=>({...t,[n.messageId]:n}),{})};case"messages/add":{const t=e.payload;return{...r,ids:[...r.ids,t.messageId],entities:{...r.entities,[t.messageId]:t}}}case"messages/delete":{const t={...r.entities};return delete t[e.payload],{...r,ids:r.ids.filter(n=>n!==e.payload),entities:t}}case"messages/patch":{const{id:t,patch:n}=e.payload,s=r.entities[t];return s?{...r,entities:{...r.entities,[t]:{...s,...n}}}:r}case"messages/add-delta":{const{id:t,delta:n}=e.payload,s=r.entities[t];if(!s)return r;const o=("content"in s?s.content:"")+n;return{...r,entities:{...r.entities,[t]:{...s,content:o}}}}default:return r}}const an={conversationId:null,cursorId:null,channel:"assistant",isActive:!0,isThinking:!1,isBusy:!1},$t=r=>({type:"session/set-conversation-id",payload:r}),at=r=>({type:"session/set-cursor-id",payload:r}),kr=r=>({type:"session/set-channel",payload:r}),_r=r=>({type:"session/set-thinking",payload:r}),Pt=r=>({type:"session/set-busy",payload:r});function xa(r=an,e){switch(e.type){case"session/set-conversation-id":return{...r,conversationId:e.payload};case"session/set-cursor-id":return{...r,cursorId:e.payload};case"session/set-channel":return{...r,channel:e.payload};case"session/set-active":return{...r,isActive:e.payload};case"session/set-thinking":return{...r,isThinking:e.payload};case"session/set-busy":return{...r,isBusy:e.payload};default:return r}}const ln={feedbackFormOpen:!1,feedbackFormTarget:"assistant",error:null,errorStack:[]},Sa=r=>({type:"ui/open-feedback-form",payload:{target:r}}),xr=()=>({type:"ui/close-feedback-form"}),ye=r=>({type:"ui/set-error",payload:r}),Ea=r=>({type:"ui/push-error",payload:r});function Ta(r=ln,e){switch(e.type){case"ui/open-feedback-form":return{...r,feedbackFormOpen:!0,feedbackFormTarget:e.payload.target};case"ui/close-feedback-form":return{...r,feedbackFormOpen:!1};case"ui/set-error":return{...r,error:e.payload};case"ui/push-error":{const t=r.errorStack??[];return{...r,errorStack:[...t,e.payload],error:e.payload}}default:return r}}const Sr={config:nn,messages:on,session:an,ui:ln},cn="app/reset",Ca=()=>({type:cn});function Ia(r,e){if(e.type===cn)return{...Sr,config:r.config};const t=r??Sr;return{config:ba(t.config,e),messages:_a(t.messages,e),session:xa(t.session,e),ui:Ta(t.ui,e)}}class Aa{constructor(e=Ia,t=Sr){this.listeners=new Set,this.pending=!1,this.state=t,this.reducer=e}get snapshot(){return this.state}subscribe(e){return this.listeners.add(e),e(this.state),()=>this.listeners.delete(e)}dispatch(e){this.state=this.reducer(this.state,e),this.pending||(this.pending=!0,queueMicrotask(()=>{this.pending=!1;for(const t of this.listeners)t(this.state)}))}}const Ra=(()=>{let r=[],e={},t=[];return n=>(n.messages.ids===r&&n.messages.entities===e||(r=n.messages.ids,e=n.messages.entities,t=r.map(s=>e[s])),t)})();class $a{constructor(e,t){this.store=e,this.svc=t}async initialize(){try{const e=await this.svc.getBootstrapConfig();this.store.dispatch(ma(e))}catch(e){this.store.dispatch(ye(it(e))),console.error("Failed to load bootstrap configuration:",e)}finally{this.store.dispatch(fa())}}async clear(){this.svc.clearBootstrapConfig(),this.store.dispatch(wa())}}class Er{constructor(){this.key="gaia-chat:conversation-id"}load(){const e=localStorage.getItem(this.key);return e||null}save(e){localStorage.setItem(this.key,e)}clear(){localStorage.removeItem(this.key)}}class Pa{constructor(e,t){this.store=e,this.svc=t,this.storage=new Er}async getHistory(){const e=this.storage.load();if(e){this.store.dispatch($t(e));try{const t=await this.svc.getConversationHistory(e);this.store.dispatch(va(t.messages)),this.store.dispatch(kr(t.channel))}catch{this.store.dispatch($t(null)),this.storage.clear()}}}clear(){this.storage.clear(),this.store.dispatch(Ca())}}class Ma{constructor(e,t){this.store=e,this.svc=t}async submitFeedback(e,t,n){const s=this.store.snapshot.session.conversationId;if(s){this.store.dispatch($t(s));try{await this.svc.submitFeedback({conversationId:s,target:e,score:t,comment:n}),this.store.dispatch(xr())}catch(o){this.store.dispatch(ye(it(o)))}}}}const lt=()=>crypto.randomUUID(),Tr=()=>new Date().toISOString();function hn(r,e){const t=e?.now?.()??Tr();return{messageId:e?.idGen?.()??lt(),turnId:lt(),role:"user",status:e?.status??"completed",content:r,createdAt:t,updatedAt:t}}function Da(r){const e=Tr();return{messageId:lt(),turnId:lt(),role:"system",status:"completed",content:"",createdAt:e,updatedAt:e,isSupportCompletedMarker:!0,isSupportStartedMarker:!1,isVisuallyHidden:!1}}function pn(r,e,t){const n=t?.now?.()??Tr();return{messageId:t?.idGen?.()??lt(),role:"operator",status:t?.status??"pending",operator:r,content:e,createdAt:n,updatedAt:n,isTyping:t?.isTyping??!1}}const Oa=r=>({"conversation.start":e=>{r.dispatch($t(e.data))},"turn.start":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,e.data.message))},"assistant.start":e=>{r.dispatch(ve(e.data)),r.dispatch(at(e.data.messageId))},"assistant.delta":e=>{const t=r.snapshot.session.cursorId;t&&(r.dispatch(ka(t,e.data)),r.dispatch(_r(!1)))},"assistant.tool":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,e.data))},"assistant.complete":e=>{r.dispatch(ue(e.data.messageId,e.data))},"tool.start":e=>{r.dispatch(ve(e.data)),r.dispatch(at(e.data.messageId))},"tool.complete":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,{toolCallResult:e.data}))},"tool.failed":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,{toolCallResult:e.data}))},"turn.toolcalls.approved":e=>{r.dispatch(ue(e.data.messageId,{approvalStatus:"approved"}))},"turn.toolcalls.declined":e=>{r.dispatch(ue(e.data.messageId,{approvalStatus:"declined"}))},"support.handoff.start":e=>{r.dispatch(ve(e.data.message)),r.dispatch(at(e.data.message.messageId)),r.dispatch(kr("support"))},error:e=>{r.dispatch(ye(it(new yr(null,e.data.message??"Stream error",e.data.errorType))))}});class La{async run(e){return this.abort?.abort(),this.abort=new AbortController,e(this.abort.signal).finally(()=>{this.abort?.signal.aborted===!1&&(this.abort=void 0)})}cancel(){this.abort?.abort()}}class Na{constructor(e,t){this.store=e,this.svc=t,this.tasks=new La,this.storage=new Er,this.handlers=Oa(this.store),this.storage=new Er}async sendMessage(e,t,n){const s=crypto.randomUUID();this.store.dispatch(ve(hn(e,{idGen:()=>s}))),this.store.dispatch(at(s));const o=await this.tasks.run(async i=>this.consume(this.svc.sendMessage({message:e,profileId:t,conversationId:this.store.snapshot.session.conversationId,partnerId:n??null},i)));return this.store.snapshot.session.conversationId&&this.storage.save(this.store.snapshot.session.conversationId),o}async approveToolCall(e,t){const n=this.requireConversation();return this.tasks.run(async s=>this.consume(this.svc.approveToolCall({conversationId:n,turnId:e,messageId:t},s)))}async declineToolCall(e,t){const n=this.requireConversation();return this.tasks.run(async s=>this.consume(this.svc.declineToolCall({conversationId:n,turnId:e,messageId:t},s)))}abortCurrentTask(){this.tasks.cancel()}async consume(e){this.store.dispatch(Pt(!0)),this.store.dispatch(_r(!0));try{for await(const t of e)this.handlers[t.event]?.(t)}catch(t){console.error("[SSE] stream error",t),this.store.dispatch(Ea(it(t)))}finally{this.store.dispatch(_r(!1)),this.store.dispatch(Pt(!1))}}requireConversation(){const e=this.store.snapshot.session.conversationId;if(!e)throw new Error("No conversation id");return e}}class Ie extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Cr extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ne extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class za extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Fa extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class Ba extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class dn extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class Ua extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class un{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Mt{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}var h;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None"})(h||(h={}));class ct{constructor(){}log(e,t){}}ct.instance=new ct;const Ha="9.0.6";class O{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}}class R{static get isBrowser(){return!R.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!R.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!R.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function ht(r,e){let t="";return Ae(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${ja(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function ja(r){const e=new Uint8Array(r);let t="";return e.forEach(n=>{const s=n<16?"0":"";t+=`0x${s}${n.toString(16)} `}),t.substr(0,t.length-1)}function Ae(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}async function gn(r,e,t,n,s,o){const i={},[a,c]=Le();i[a]=c,r.log(h.Trace,`(${e} transport) sending data. ${ht(s,o.logMessageContent)}.`);const p=Ae(s)?"arraybuffer":"text",u=await t.post(n,{content:s,headers:{...i,...o.headers},responseType:p,timeout:o.timeout,withCredentials:o.withCredentials});r.log(h.Trace,`(${e} transport) request complete. Response status: ${u.statusCode}.`)}function qa(r){return r===void 0?new Dt(h.Information):r===null?ct.instance:r.log!==void 0?r:new Dt(r)}class Wa{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}}class Dt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${new Date().toISOString()}] ${h[e]}: ${t}`;switch(e){case h.Critical:case h.Error:this.out.error(n);break;case h.Warning:this.out.warn(n);break;case h.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function Le(){let r="X-SignalR-User-Agent";return R.isNode&&(r="User-Agent"),[r,Va(Ha,Ga(),Xa(),Ya())]}function Va(r,e,t,n){let s="Microsoft SignalR/";const o=r.split(".");return s+=`${o[0]}.${o[1]}`,s+=` (${r}; `,e&&e!==""?s+=`${e}; `:s+="Unknown OS; ",s+=`${t}`,n?s+=`; ${n}`:s+="; Unknown Runtime Version",s+=")",s}function Ga(){if(R.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Ya(){if(R.isNode)return process.versions.node}function Xa(){return R.isNode?"NodeJS":"Browser"}function Ir(r){return r.stack?r.stack:r.message?r.message:`${r}`}function Za(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Ka extends Mt{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||R.isNode){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Za());if(typeof AbortController>"u"){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new ne;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new ne});let s=null;if(e.timeout){const c=e.timeout;s=setTimeout(()=>{t.abort(),this._logger.log(h.Warning,"Timeout from HTTP request."),n=new Cr},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Ae(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(c){throw n||(this._logger.log(h.Warning,`Error from HTTP request. ${c}.`),c)}finally{s&&clearTimeout(s),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const c=await fn(o,"text");throw new Ie(c||o.statusText,o.status)}const a=await fn(o,e.responseType);return new un(o.status,o.statusText,a)}getCookieString(e){let t="";return R.isNode&&this._jar&&this._jar.getCookies(e,(n,s)=>t=s.join("; ")),t}}function fn(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}class Ja extends Mt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ne):e.method?e.url?new Promise((t,n)=>{const s=new XMLHttpRequest;s.open(e.method,e.url,!0),s.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,s.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(Ae(e.content)?s.setRequestHeader("Content-Type","application/octet-stream"):s.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach(i=>{s.setRequestHeader(i,o[i])}),e.responseType&&(s.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{s.abort(),n(new ne)}),e.timeout&&(s.timeout=e.timeout),s.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),s.status>=200&&s.status<300?t(new un(s.status,s.statusText,s.response||s.responseText)):n(new Ie(s.response||s.responseText||s.statusText,s.status))},s.onerror=()=>{this._logger.log(h.Warning,`Error from HTTP request. ${s.status}: ${s.statusText}.`),n(new Ie(s.statusText,s.status))},s.ontimeout=()=>{this._logger.log(h.Warning,"Timeout from HTTP request."),n(new Cr)},s.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Qa extends Mt{constructor(e){if(super(),typeof fetch<"u"||R.isNode)this._httpClient=new Ka(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new Ja(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ne):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class K{static write(e){return`${e}${K.RecordSeparator}`}static parse(e){if(e[e.length-1]!==K.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(K.RecordSeparator);return t.pop(),t}}K.RecordSeparatorCode=30,K.RecordSeparator=String.fromCharCode(K.RecordSeparatorCode);class el{writeHandshakeRequest(e){return K.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Ae(e)){const a=new Uint8Array(e),c=a.indexOf(K.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const p=c+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,p))),n=a.byteLength>p?a.slice(p).buffer:null}else{const a=e,c=a.indexOf(K.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const p=c+1;t=a.substring(0,p),n=a.length>p?a.substring(p):null}const s=K.parse(t),o=JSON.parse(s[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}}var b;(function(r){r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence"})(b||(b={}));class tl{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Wa(this,e)}}class rl{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let s=()=>{},o=()=>{};Ae(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{s=i,o=a})),this._messages.push(new sl(t,this._totalMessageCount,s,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){const s=this._messages[n];if(s._id<=e.sequenceId)t=n,Ae(s._message)?this._bufferedByteCount-=s._message.byteLength:this._bufferedByteCount-=s._message.length,s._resolver();else if(this._bufferedByteCount<this._bufferSize)s._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==b.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:b.Sequence,sequenceId:e}));const t=this._messages;for(const n of t)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case b.Invocation:case b.StreamItem:case b.Completion:case b.StreamInvocation:case b.CancelInvocation:return!0;case b.Close:case b.Sequence:case b.Ping:case b.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:b.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class sl{constructor(e,t,n,s){this._message=e,this._id=t,this._resolver=n,this._rejector=s}}const nl=30*1e3,ol=15*1e3,il=1e5;var I;(function(r){r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting"})(I||(I={}));class Ar{static create(e,t,n,s,o,i,a){return new Ar(e,t,n,s,o,i,a)}constructor(e,t,n,s,o,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(h.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},O.isRequired(e,"connection"),O.isRequired(t,"logger"),O.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=o??nl,this.keepAliveIntervalInMilliseconds=i??ol,this._statefulReconnectBufferSize=a??il,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=s,this._handshakeProtocol=new el,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=I.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:b.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==I.Disconnected&&this._connectionState!==I.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==I.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=I.Connecting,this._logger.log(h.Debug,"Starting HubConnection.");try{await this._startInternal(),R.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=I.Connected,this._connectionStarted=!0,this._logger.log(h.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=I.Disconnected,this._logger.log(h.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(h.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(h.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new rl(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(t){throw this._logger.log(h.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(t),t}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===I.Disconnected)return this._logger.log(h.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===I.Disconnecting)return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=I.Disconnecting,this._logger.log(h.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(h.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===I.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new ne("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,s);let i;const a=new tl;return a.cancelCallback=()=>{const c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,p)=>{if(p){a.error(p);return}else c&&(c.type===b.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(n,i),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,s));return this._launchStreams(n,o),o}invoke(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,s);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(u,v)=>{if(v){c(v);return}else u&&(u.type===b.Completion?u.error?c(new Error(u.error)):a(u.result):c(new Error(`Unexpected message type: ${u.type}`)))};const p=this._sendWithProtocol(o).catch(u=>{c(u),delete this._callbacks[o.invocationId]});this._launchStreams(n,p)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const s=n.indexOf(t);s!==-1&&(n.splice(s,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const t=this._protocol.parseMessages(e,this._logger);for(const n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case b.Invocation:this._invokeClientMethod(n).catch(s=>{this._logger.log(h.Error,`Invoke client method threw error: ${Ir(s)}`)});break;case b.StreamItem:case b.Completion:{const s=this._callbacks[n.invocationId];if(s){n.type===b.Completion&&delete this._callbacks[n.invocationId];try{s(n)}catch(o){this._logger.log(h.Error,`Stream callback threw error: ${Ir(o)}`)}}break}case b.Ping:break;case b.Close:{this._logger.log(h.Information,"Close message received from server.");const s=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(s):this._stopPromise=this._stopInternal(s);break}case b.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case b.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(h.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(s){const o="Error parsing handshake response: "+s;this._logger.log(h.Error,o);const i=new Error(o);throw this._handshakeRejecter(i),i}if(t.error){const s="Server returned handshake error: "+t.error;this._logger.log(h.Error,s);const o=new Error(s);throw this._handshakeRejecter(o),o}else this._logger.log(h.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===I.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(h.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(h.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const s=n.slice(),o=!!e.invocationId;let i,a,c;for(const p of s)try{const u=i;i=await p.apply(this,e.arguments),o&&i&&u&&(this._logger.log(h.Error,`Multiple results provided for '${t}'. Sending error to server.`),c=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(u){a=u,this._logger.log(h.Error,`A callback for the method '${t}' threw error '${u}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(e.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(h.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),c=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(h.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(h.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ne("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===I.Disconnecting?this._completeClose(e):this._connectionState===I.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===I.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=I.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),R.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(h.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,s=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n++,0,s);if(o===null){this._logger.log(h.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=I.Reconnecting,e?this._logger.log(h.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(h.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[e]))}catch(i){this._logger.log(h.Error,`An onreconnecting callback called with error '${e}' threw error '${i}'.`)}if(this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(h.Information,`Reconnect attempt number ${n} will start in ${o} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=I.Connected,this._logger.log(h.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(h.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(h.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===I.Disconnecting&&this._completeClose();return}s=i instanceof Error?i:new Error(i.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,s)}}this._logger.log(h.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(s){return this._logger.log(h.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${s}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{const s=t[n];try{s(null,e)}catch(o){this._logger.log(h.Error,`Stream 'error' callback called with '${e}' threw error: ${Ir(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,s){if(n)return s.length!==0?{target:e,arguments:t,streamIds:s,type:b.Invocation}:{target:e,arguments:t,type:b.Invocation};{const o=this._invocationId;return this._invocationId++,s.length!==0?{target:e,arguments:t,invocationId:o.toString(),streamIds:s,type:b.Invocation}:{target:e,arguments:t,invocationId:o.toString(),type:b.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:s=>{let o;s instanceof Error?o=s.message:s&&s.toString?o=s.toString():o="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,o)))},next:s=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,s)))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let s=0;s<e.length;s++){const o=e[s];if(this._isObservable(o)){const i=this._invocationId;this._invocationId++,t[i]=o,n.push(i.toString()),e.splice(s,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){const s=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:n,type:b.StreamInvocation}:{target:e,arguments:t,invocationId:s.toString(),type:b.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:b.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:b.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:b.Completion}:{invocationId:e,result:n,type:b.Completion}}_createCloseMessage(){return{type:b.Close}}}const al=[0,2e3,1e4,3e4,null];class mn{constructor(e){this._retryDelays=e!==void 0?[...e,null]:al}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Re{}Re.Authorization="Authorization",Re.Cookie="Cookie";class ll extends Mt{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[Re.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Re.Authorization]&&delete e.headers[Re.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var L;(function(r){r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling"})(L||(L={}));var H;(function(r){r[r.Text=1]="Text",r[r.Binary=2]="Binary"})(H||(H={}));let cl=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class wn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new cl,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._url=e,this._logger.log(h.Trace,"(LongPolling transport) Connecting."),t===H.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,s]=Le(),o={[n]:s,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===H.Binary&&(i.responseType="arraybuffer");const a=`${e}&_=${Date.now()}`;this._logger.log(h.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(h.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new Ie(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(h.Trace,`(LongPolling transport) polling: ${n}.`);const s=await this._httpClient.get(n,t);s.statusCode===204?(this._logger.log(h.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):s.statusCode!==200?(this._logger.log(h.Error,`(LongPolling transport) Unexpected response code: ${s.statusCode}.`),this._closeError=new Ie(s.statusText||"",s.statusCode),this._running=!1):s.content?(this._logger.log(h.Trace,`(LongPolling transport) data received. ${ht(s.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(s.content)):this._logger.log(h.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Cr?this._logger.log(h.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(h.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(h.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?gn(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(h.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(h.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Le();e[t]=n;const s={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,s)}catch(i){o=i}o?o instanceof Ie&&(o.statusCode===404?this._logger.log(h.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(h.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(h.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(h.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(h.Trace,e),this.onclose(this._closeError)}}}class hl{constructor(e,t,n,s){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=s,this.onreceive=null,this.onclose=null}async connect(e,t){return O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._logger.log(h.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,s)=>{let o=!1;if(t!==H.Text){s(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(R.isBrowser||R.isWebWorker)i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(e),c={};c.Cookie=a;const[p,u]=Le();c[p]=u,i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(h.Trace,`(SSE transport) data received. ${ht(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{o?this._close():s(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(h.Information,`SSE connected to ${this._url}`),this._eventSource=i,o=!0,n()}}catch(a){s(a);return}})}async send(e){return this._eventSource?gn(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class pl{constructor(e,t,n,s,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=s,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._logger.log(h.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((s,o)=>{e=e.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(e);let c=!1;if(R.isNode||R.isReactNative){const p={},[u,v]=Le();p[u]=v,n&&(p[Re.Authorization]=`Bearer ${n}`),a&&(p[Re.Cookie]=a),i=new this._webSocketConstructor(e,void 0,{headers:{...p,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===H.Binary&&(i.binaryType="arraybuffer"),i.onopen=p=>{this._logger.log(h.Information,`WebSocket connected to ${e}.`),this._webSocket=i,c=!0,s()},i.onerror=p=>{let u=null;typeof ErrorEvent<"u"&&p instanceof ErrorEvent?u=p.error:u="There was an error with the transport",this._logger.log(h.Information,`(WebSockets transport) ${u}.`)},i.onmessage=p=>{if(this._logger.log(h.Trace,`(WebSockets transport) data received. ${ht(p.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(p.data)}catch(u){this._close(u);return}},i.onclose=p=>{if(c)this._close(p);else{let u=null;typeof ErrorEvent<"u"&&p instanceof ErrorEvent?u=p.error:u="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(u))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(h.Trace,`(WebSockets transport) sending data. ${ht(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(h.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const bn=100;class dl{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,O.isRequired(e,"url"),this._logger=qa(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,s=null;if(R.isNode&&typeof require<"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=o("ws"),s=o("eventsource")}!R.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:R.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!R.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:R.isNode&&!t.EventSource&&typeof s<"u"&&(t.EventSource=s),this._httpClient=new ll(t.httpClient||new Qa(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||H.Binary,O.isIn(e,H,"transferFormat"),this._logger.log(h.Debug,`Starting connection with transfer format '${H[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(h.Error,t),await this._stopPromise,Promise.reject(new ne(t))}else if(this._connectionState!=="Connected"){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(h.Error,t),Promise.reject(new ne(t))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Rr(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(t){this._logger.log(h.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(h.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===L.WebSockets)this.transport=this._constructTransport(L.WebSockets),await this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,s=0;do{if(n=await this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new ne("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const o=n.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}s++}while(n.url&&s<bn);if(s===bn&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof wn&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(h.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(h.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(e){const t={},[n,s]=Le();t[n]=s;const o=this._resolveNegotiateUrl(e);this._logger.log(h.Debug,`Sending negotiation request: ${o}.`);try{const i=await this._httpClient.post(o,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new dn("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof Ie&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(h.Error,a),Promise.reject(new dn(a))}}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,s){let o=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(h.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,s),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const p of a){const u=this._resolveTransportOrError(p,t,s,c?.useStatefulReconnect===!0);if(u instanceof Error)i.push(`${p.transport} failed:`),i.push(u);else if(this._isITransport(u)){if(this.transport=u,!c){try{c=await this._getNegotiationResponse(e)}catch(v){return Promise.reject(v)}o=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(o,s),this.connectionId=c.connectionId;return}catch(v){if(this._logger.log(h.Error,`Failed to start the transport '${p.transport}': ${v}`),c=void 0,i.push(new Ba(`${p.transport} failed: ${v}`,L[p.transport])),this._connectionState!=="Connecting"){const _="Failed to select transport before stop() was called.";return this._logger.log(h.Debug,_),Promise.reject(new ne(_))}}}}return i.length>0?Promise.reject(new Ua(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case L.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new pl(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case L.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new hl(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case L.LongPolling:return new wn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let s=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{s=!0}else{this._stopConnection(n);return}s&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,s){const o=L[e.transport];if(o==null)return this._logger.log(h.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(ul(t,o))if(e.transferFormats.map(a=>H[a]).indexOf(n)>=0){if(o===L.WebSockets&&!this._options.WebSocket||o===L.ServerSentEvents&&!this._options.EventSource)return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it is not supported in your environment.'`),new za(`'${L[o]}' is not supported in your environment.`,o);this._logger.log(h.Debug,`Selecting transport '${L[o]}'.`);try{return this.features.reconnect=o===L.WebSockets?s:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it does not support the requested transfer format '${H[n]}'.`),new Error(`'${L[o]}' does not support ${H[n]}.`);else return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it was disabled by the client.`),new Fa(`'${L[o]}' is disabled by the client.`,o)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(h.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(h.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(h.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(h.Error,`Connection disconnected with error '${e}'.`):this._logger.log(h.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(h.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(h.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!R.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(h.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}function ul(r,e){return!r||(e&r)!==0}class Rr{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Ot,this._transportResult=new Ot,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Ot),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Ot;const e=this._transportResult;this._transportResult=void 0;const t=typeof this._buffer[0]=="string"?this._buffer.join(""):Rr._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}}static _concatBuffers(e){const t=e.map(o=>o.byteLength).reduce((o,i)=>o+i),n=new Uint8Array(t);let s=0;for(const o of e)n.set(new Uint8Array(o),s),s+=o.byteLength;return n.buffer}}class Ot{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const gl="json";class fl{constructor(){this.name=gl,this.version=2,this.transferFormat=H.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=ct.instance);const n=K.parse(e),s=[];for(const o of n){const i=JSON.parse(o);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case b.Invocation:this._isInvocationMessage(i);break;case b.StreamItem:this._isStreamItemMessage(i);break;case b.Completion:this._isCompletionMessage(i);break;case b.Ping:break;case b.Close:break;case b.Ack:this._isAckMessage(i);break;case b.Sequence:this._isSequenceMessage(i);break;default:t.log(h.Information,"Unknown message type '"+i.type+"' ignored.");continue}s.push(i)}return s}writeMessage(e){return K.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}}const ml={trace:h.Trace,debug:h.Debug,info:h.Information,information:h.Information,warn:h.Warning,warning:h.Warning,error:h.Error,critical:h.Critical,none:h.None};function wl(r){const e=ml[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}class bl{configureLogging(e){if(O.isRequired(e,"logging"),vl(e))this.logger=e;else if(typeof e=="string"){const t=wl(e);this.logger=new Dt(t)}else this.logger=new Dt(e);return this}withUrl(e,t){return O.isRequired(e,"url"),O.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...t}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return O.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new mn(e):this.reconnectPolicy=e:this.reconnectPolicy=new mn,this}withServerTimeout(e){return O.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return O.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new dl(this.url,e);return Ar.create(t,this.logger||ct.instance,this.protocol||new fl,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function vl(r){return r.log!==void 0}class yl{constructor(e,t){this.store=e,this.accessTokenProvider=t,this.typingTimeoutMs=1e4,this.operatorMsgIdByOp=new Map,this.typingTimeoutByOp=new Map}async start(e,t){this.connection&&await this.stop();const s=`${new URL(e).origin}/ws/support`;this.connection=new bl().withUrl(s,{accessTokenFactory:()=>this.accessTokenProvider.getAccessToken()}).withAutomaticReconnect().configureLogging(h.Information).build(),this.connection.on("Typing",o=>this.onTyping(o)),this.connection.on("Text",o=>this.onText(o)),this.connection.on("Close",o=>this.onClose(o)),this.connection.onclose(o=>{console.error("Support Hub connection closed.",o),o&&this.onError(o),this.onSupportEnded()});try{await this.connection.start(),await this.connection.invoke("JoinConversation",t)}catch(o){console.error("Failed to connect to support hub:",o),this.onError(o)}}async stop(){await this.connection?.stop(),this.connection=void 0;for(const e of this.typingTimeoutByOp.values())clearTimeout(e);this.typingTimeoutByOp.clear(),this.operatorMsgIdByOp.clear()}async sendMessage(e){if(this.connection){this.store.dispatch(ve(hn(e)));try{await this.connection.invoke("SendMessage",e)}catch(t){console.error("Failed to send message via SignalR:",t),this.onError(t)}}}async sendTyping(){if(this.connection)try{await this.connection.invoke("SendTyping")}catch(e){console.error("Failed to send typing message via SignalR:",e),this.onError(e)}}async sendSeenMessage(e,t){if(this.connection)try{await this.connection.invoke("SendSeen",e,t)}catch(n){console.error("Failed to send seen message via SignalR:",n),this.onError(n)}}async close(){if(this.connection)try{await this.connection.invoke("SendClose")}catch(e){console.error("Failed to close support connection via SignalR:",e),this.onError(e)}}onError(e){this.store.dispatch(ye(it(new sn("Support connection error",e))))}clearTyping(e){const t=this.typingTimeoutByOp.get(e);t&&clearTimeout(t),this.typingTimeoutByOp.delete(e)}scheduleTypingRemoval(e){this.clearTyping(e);const t=window.setTimeout(()=>{const n=this.operatorMsgIdByOp.get(e);n&&this.store.dispatch(ya(n)),this.operatorMsgIdByOp.delete(e),this.typingTimeoutByOp.delete(e)},this.typingTimeoutMs);this.typingTimeoutByOp.set(e,t)}async onTyping(e){const t=e.operator;if(t){if(this.operatorMsgIdByOp.has(t.id))this.store.dispatch(ue(this.operatorMsgIdByOp.get(t.id),{isTyping:!0}));else{const n=crypto.randomUUID();this.operatorMsgIdByOp.set(t.id,n),this.store.dispatch(ve(pn(t,"...",{idGen:()=>n,isTyping:!0})))}this.scheduleTypingRemoval(t.id)}}async onText(e){const t=e.operator;if(!t)return;this.clearTyping(t.id);const n=this.operatorMsgIdByOp.get(t.id);n?(this.store.dispatch(ue(n,{content:e.content,isTyping:!1,status:"completed"})),this.operatorMsgIdByOp.delete(t.id)):this.store.dispatch(ve(pn(t,e.content,{status:"completed"})))}async onClose(e){this.stop()}onSupportEnded(){const e=Da();this.store.dispatch(ve(e)),this.store.dispatch(at(e.messageId)),this.store.dispatch(kr("assistant"))}}class ge extends CustomEvent{constructor(e,t){super(e,{...t,bubbles:!0})}}class kl extends ge{constructor(){super("conversation-cleared")}}class vn extends ge{constructor(e,t){super("message-sent",{detail:{message:e,channel:t}})}}class _l extends ge{constructor(e,t){super("tool-call-approved",{detail:{turnId:e,messageId:t}})}}class xl extends ge{constructor(e,t){super("tool-call-declined",{detail:{turnId:e,messageId:t}})}}class Sl extends ge{constructor(e,t){super("feedback-submitted",{detail:{rating:e,comment:t}})}}class El extends ge{constructor(e,t){super("token-updated",{detail:{expiresAt:e,token:t}})}}class Tl extends ge{constructor(e,t){super("token-expiring",{detail:{expiresAt:e,remainingMs:t}})}}class Cl extends ge{constructor(e){super("token-expired",{detail:{expiredAt:e}})}}class Il extends ge{constructor(){super("close-requested")}}const Al={version:"2.1.0"};class Rl{constructor(e,t){this.authProvider=e,this.config=t,this.version=Al.version}async request(e,t={}){const n=async()=>{let o;try{o=await this.authProvider.getAccessToken()}catch(a){throw a instanceof qe?a:new xe("Network error",0,this.formatUrl(e),a)}const i=new Headers(t.headers||{});this.authProvider.strategyKind==="visitor"?i.set("VSN-Assistant-Visitor",o):i.set("Authorization",`Bearer ${o}`),i.set("App-Version",this.version),i.set("App-Origin",window.location.href||"");try{return await(this.config.fetchImpl??fetch)(this.formatUrl(e),{...t,headers:i})}catch(a){throw new xe("Network error",0,this.formatUrl(e),a)}};let s=await n();if(s.status===401&&(await this.authProvider.clear(),s=await n(),s.status===401))throw new xe("Unauthorized",s.status,s.url);return await ts(s),s}formatUrl(e){const t=String(e);return/^https?:\/\//i.test(t)?t:`${this.config.baseUrl}${t.startsWith("/")?"":"/"}${t}`}}class $l{constructor(){this.key="gaia-chat:bootstrap-config",this.ttlMs=3600*1e3}load(){const e=localStorage.getItem(this.key);if(!e)return null;try{const t=JSON.parse(e);return Date.now()-t.timestamp>this.ttlMs?(localStorage.removeItem(this.key),null):t.data}catch{return localStorage.removeItem(this.key),null}}save(e){const t={timestamp:Date.now(),data:e};localStorage.setItem(this.key,JSON.stringify(t))}clear(){localStorage.removeItem(this.key)}}class Pl{constructor(e){this.apiClient=e,this.storage=new $l}async getBootstrapConfig(){const e=this.storage.load();if(e)return e;const t=await this.apiClient.request("/api/v1/bootstrap",{method:"GET"}),n=await Wt(t);return this.storage.save(n),n}clearBootstrapConfig(){this.storage.clear()}}class yn extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function $r(r){}function Ml(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=$r,onError:t=$r,onRetry:n=$r,onComment:s}=r;let o="",i=!0,a,c="",p="";function u(x){const M=i?x.replace(/^\xEF\xBB\xBF/,""):x,[ee,ke]=Dl(`${o}${M}`);for(const oe of ee)v(oe);o=ke,i=!1}function v(x){if(x===""){$();return}if(x.startsWith(":")){s&&s(x.slice(x.startsWith(": ")?2:1));return}const M=x.indexOf(":");if(M!==-1){const ee=x.slice(0,M),ke=x[M+1]===" "?2:1,oe=x.slice(M+ke);_(ee,oe,x);return}_(x,"",x)}function _(x,M,ee){switch(x){case"event":p=M;break;case"data":c=`${c}${M}
|
|
548
|
-
`;break;case"id":a=M.includes("\0")?void 0:M;break;case"retry":/^\d+$/.test(M)?n(parseInt(M,10)):t(new yn(`Invalid \`retry\` value: "${M}"`,{type:"invalid-retry",value:M,line:ee}));break;default:t(new yn(`Unknown field "${x.length>20?`${x.slice(0,20)}…`:x}"`,{type:"unknown-field",field:x,value:M,line:ee}));break}}function
|
|
549
|
-
`)?c.slice(0,-1):c}),a=void 0,c="",
|
|
547
|
+
</div>`}};ae([w.query("#scroll-view")],se.prototype,"$scrollView",2),ae([w.property({attribute:!1})],se.prototype,"isInitialized",2),ae([w.property({attribute:!1})],se.prototype,"welcomeMessages",2),ae([w.property({attribute:!1})],se.prototype,"isThinking",2),ae([w.property({attribute:!1})],se.prototype,"feedbackFormOpen",2),ae([w.property({attribute:!1})],se.prototype,"feedbackFormTarget",2),ae([w.property({attribute:!1})],se.prototype,"error",2),ae([w.property({attribute:!1})],se.prototype,"isConnectedToSupport",2),ae([w.property({attribute:!1})],se.prototype,"messages",2),se=ae([w.customElement("gaia-chat-message-list")],se);class sn extends Error{constructor(e,t){super(e),this.innerError=t,this.name="SignalRError"}}class _r extends Error{constructor(e,t,n){super(t),this.innerError=e,this.errorType=n}}function it(r){if(r instanceof DOMException&&r.name==="AbortError")return{code:"CANCELED",message:y("Request canceled.",{id:"error-request-canceled"}),retryable:!1,source:"ui",cause:r};if(r instanceof qe){const e={code:"UNAUTHORIZED",retryable:!1,source:"auth",cause:r};return r instanceof ns?{...e,message:y("Your access token has expired.",{id:"error-token-expired"})}:r instanceof We?{...e,message:y("Your access token is invalid.",{id:"error-token-invalid"})}:r instanceof Ve?{...e,message:y("You need to provide an access token to continue.",{id:"error-token-required"})}:{...e,message:y("Authentication error. Please authenticate again.",{id:"error-auth-generic"})}}return r instanceof xe?r.isNetworkError?{code:"NETWORK",message:y("Network error. Check your connection.",{id:"error-network-error"}),retryable:!0,source:"http",http:{status:0,url:r.url},cause:r}:r.isUnauthorized?{code:"UNAUTHORIZED",message:y("Your session expired. Please sign in again.",{id:"error-session-expired"}),retryable:!1,source:"http",http:{status:401,url:r.url},cause:r}:r.isForbidden?{code:"FORBIDDEN",message:y("You don't have access to this action.",{id:"error-forbidden"}),retryable:!1,source:"http",http:{status:403,url:r.url},cause:r}:r.isNotFound?{code:"NOT_FOUND",message:y("Not found.",{id:"error-not-found"}),retryable:!1,source:"http",http:{status:404,url:r.url},cause:r}:r.status===429?{code:"RATE_LIMIT",message:y("Too many requests. Please slow down.",{id:"error-rate-limit"}),retryable:!0,source:"http",http:{status:429,url:r.url},cause:r}:r.isServerError?{code:"SERVER",message:y("The server had a problem. Please try again.",{id:"error-server-error"}),retryable:!0,source:"http",http:{status:r.status,url:r.url},cause:r}:{code:"UNKNOWN",message:y("Something went wrong.",{id:"error-something-went-wrong"}),retryable:!0,source:"http",http:{status:r.status,url:r.url},cause:r}:r instanceof _r?r.errorType&&r.errorType==="ProfileNotFoundException"?{code:"NOT_FOUND",message:y("Failed to load the current profile. Are you using the correct profile?",{id:"error-profile-not-found"}),retryable:!1}:{code:"SSE",message:y("Live response stream interrupted. Try again.",{id:"error-sse-error"}),retryable:!0,source:"sse",cause:r}:r instanceof sn?{code:"WS",message:y("Live chat connection error. Reconnecting might help.",{id:"error-ws-error"}),retryable:!0,source:"ws",cause:r}:{code:"UNKNOWN",message:y("Unexpected error. Please try again.",{id:"error-unexpected-error"}),retryable:!0,source:"unknown",cause:r}}const nn={initialized:!1,maxInputLength:2e3,welcomeMessages:{}},fa=()=>({type:"config/setInitialized"}),ma=r=>({type:"config/set",payload:r}),wa=()=>({type:"config/clear"});function ba(r=nn,e){switch(e.type){case"config/setInitialized":return{...r,initialized:!0};case"config/set":return{...r,...e.payload,initialized:!0};case"config/clear":return{...r,initialized:!1,welcomeMessages:{}};default:return r}}const on={entities:{},ids:[]},va=r=>({type:"messages/set",payload:r}),ve=r=>({type:"messages/add",payload:r}),ya=r=>({type:"messages/delete",payload:r}),ue=(r,e)=>({type:"messages/patch",payload:{id:r,patch:e}}),ka=(r,e)=>({type:"messages/add-delta",payload:{id:r,delta:e}});function _a(r=on,e){switch(e.type){case"messages/set":return{...r,ids:e.payload.map(t=>t.messageId),entities:e.payload.reduce((t,n)=>({...t,[n.messageId]:n}),{})};case"messages/add":{const t=e.payload;return{...r,ids:[...r.ids,t.messageId],entities:{...r.entities,[t.messageId]:t}}}case"messages/delete":{const t={...r.entities};return delete t[e.payload],{...r,ids:r.ids.filter(n=>n!==e.payload),entities:t}}case"messages/patch":{const{id:t,patch:n}=e.payload,s=r.entities[t];return s?{...r,entities:{...r.entities,[t]:{...s,...n}}}:r}case"messages/add-delta":{const{id:t,delta:n}=e.payload,s=r.entities[t];if(!s)return r;const o=("content"in s?s.content:"")+n;return{...r,entities:{...r.entities,[t]:{...s,content:o}}}}default:return r}}const an={conversationId:null,cursorId:null,channel:"assistant",isActive:!0,isThinking:!1,isBusy:!1},Pt=r=>({type:"session/set-conversation-id",payload:r}),at=r=>({type:"session/set-cursor-id",payload:r}),xr=r=>({type:"session/set-channel",payload:r}),Sr=r=>({type:"session/set-thinking",payload:r}),Mt=r=>({type:"session/set-busy",payload:r});function xa(r=an,e){switch(e.type){case"session/set-conversation-id":return{...r,conversationId:e.payload};case"session/set-cursor-id":return{...r,cursorId:e.payload};case"session/set-channel":return{...r,channel:e.payload};case"session/set-active":return{...r,isActive:e.payload};case"session/set-thinking":return{...r,isThinking:e.payload};case"session/set-busy":return{...r,isBusy:e.payload};default:return r}}const ln={feedbackFormOpen:!1,feedbackFormTarget:"assistant",error:null,errorStack:[]},Sa=r=>({type:"ui/open-feedback-form",payload:{target:r}}),Er=()=>({type:"ui/close-feedback-form"}),ye=r=>({type:"ui/set-error",payload:r}),Ea=r=>({type:"ui/push-error",payload:r});function Ta(r=ln,e){switch(e.type){case"ui/open-feedback-form":return{...r,feedbackFormOpen:!0,feedbackFormTarget:e.payload.target};case"ui/close-feedback-form":return{...r,feedbackFormOpen:!1};case"ui/set-error":return{...r,error:e.payload};case"ui/push-error":{const t=r.errorStack??[];return{...r,errorStack:[...t,e.payload],error:e.payload}}default:return r}}const Tr={config:nn,messages:on,session:an,ui:ln},cn="app/reset",Ca=()=>({type:cn});function Ia(r,e){if(e.type===cn)return{...Tr,config:r.config};const t=r??Tr;return{config:ba(t.config,e),messages:_a(t.messages,e),session:xa(t.session,e),ui:Ta(t.ui,e)}}class Aa{constructor(e=Ia,t=Tr){this.listeners=new Set,this.pending=!1,this.state=t,this.reducer=e}get snapshot(){return this.state}subscribe(e){return this.listeners.add(e),e(this.state),()=>this.listeners.delete(e)}dispatch(e){this.state=this.reducer(this.state,e),this.pending||(this.pending=!0,queueMicrotask(()=>{this.pending=!1;for(const t of this.listeners)t(this.state)}))}}const $a=(()=>{let r=[],e={},t=[];return n=>(n.messages.ids===r&&n.messages.entities===e||(r=n.messages.ids,e=n.messages.entities,t=r.map(s=>e[s])),t)})();class Ra{constructor(e,t){this.store=e,this.svc=t}async initialize(){try{const e=await this.svc.getBootstrapConfig();this.store.dispatch(ma(e))}catch(e){this.store.dispatch(ye(it(e))),console.error("Failed to load bootstrap configuration:",e)}finally{this.store.dispatch(fa())}}async clear(){this.svc.clearBootstrapConfig(),this.store.dispatch(wa())}}class Cr{constructor(){this.key="gaia-chat:conversation-id"}load(){const e=localStorage.getItem(this.key);return e||null}save(e){localStorage.setItem(this.key,e)}clear(){localStorage.removeItem(this.key)}}class Pa{constructor(e,t){this.store=e,this.svc=t,this.storage=new Cr}async getHistory(){const e=this.storage.load();if(e){this.store.dispatch(Pt(e));try{const t=await this.svc.getConversationHistory(e);this.store.dispatch(va(t.messages)),this.store.dispatch(xr(t.channel))}catch{this.store.dispatch(Pt(null)),this.storage.clear()}}}clear(){this.storage.clear(),this.store.dispatch(Ca())}}class Ma{constructor(e,t){this.store=e,this.svc=t}async submitFeedback(e,t,n){const s=this.store.snapshot.session.conversationId;if(s){this.store.dispatch(Pt(s));try{await this.svc.submitFeedback({conversationId:s,target:e,score:t,comment:n}),this.store.dispatch(Er())}catch(o){this.store.dispatch(ye(it(o)))}}}}const lt=()=>crypto.randomUUID(),Ir=()=>new Date().toISOString();function hn(r,e){const t=e?.now?.()??Ir();return{messageId:e?.idGen?.()??lt(),turnId:lt(),role:"user",status:e?.status??"completed",content:r,createdAt:t,updatedAt:t}}function Da(r){const e=Ir();return{messageId:lt(),turnId:lt(),role:"system",status:"completed",content:"",createdAt:e,updatedAt:e,isSupportCompletedMarker:!0,isSupportStartedMarker:!1,isVisuallyHidden:!1}}function dn(r,e,t){const n=t?.now?.()??Ir();return{messageId:t?.idGen?.()??lt(),role:"operator",status:t?.status??"pending",operator:r,content:e,createdAt:n,updatedAt:n,isTyping:t?.isTyping??!1}}const Oa=r=>({"conversation.start":e=>{r.dispatch(Pt(e.data))},"turn.start":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,e.data.message))},"assistant.start":e=>{r.dispatch(ve(e.data)),r.dispatch(at(e.data.messageId))},"assistant.delta":e=>{const t=r.snapshot.session.cursorId;t&&(r.dispatch(ka(t,e.data)),r.dispatch(Sr(!1)))},"assistant.tool":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,e.data))},"assistant.complete":e=>{r.dispatch(ue(e.data.messageId,e.data))},"tool.start":e=>{r.dispatch(ve(e.data)),r.dispatch(at(e.data.messageId))},"tool.complete":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,{toolCallResult:e.data}))},"tool.failed":e=>{const t=r.snapshot.session.cursorId;t&&r.dispatch(ue(t,{toolCallResult:e.data}))},"turn.toolcalls.approved":e=>{r.dispatch(ue(e.data.messageId,{approvalStatus:"approved"}))},"turn.toolcalls.declined":e=>{r.dispatch(ue(e.data.messageId,{approvalStatus:"declined"}))},"support.handoff.start":e=>{r.dispatch(ve(e.data.message)),r.dispatch(at(e.data.message.messageId)),r.dispatch(xr("support"))},error:e=>{r.dispatch(ye(it(new _r(null,e.data.message??"Stream error",e.data.errorType))))}});class La{async run(e){return this.abort?.abort(),this.abort=new AbortController,e(this.abort.signal).finally(()=>{this.abort?.signal.aborted===!1&&(this.abort=void 0)})}cancel(){this.abort?.abort()}}class Na{constructor(e,t){this.store=e,this.svc=t,this.tasks=new La,this.storage=new Cr,this.handlers=Oa(this.store),this.storage=new Cr}async sendMessage(e,t,n){const s=crypto.randomUUID();this.store.dispatch(ve(hn(e,{idGen:()=>s}))),this.store.dispatch(at(s));const o=await this.tasks.run(async i=>this.consume(this.svc.sendMessage({message:e,profileId:t,conversationId:this.store.snapshot.session.conversationId,partnerId:n??null},i)));return this.store.snapshot.session.conversationId&&this.storage.save(this.store.snapshot.session.conversationId),o}async approveToolCall(e,t){const n=this.requireConversation();return this.tasks.run(async s=>this.consume(this.svc.approveToolCall({conversationId:n,turnId:e,messageId:t},s)))}async declineToolCall(e,t){const n=this.requireConversation();return this.tasks.run(async s=>this.consume(this.svc.declineToolCall({conversationId:n,turnId:e,messageId:t},s)))}abortCurrentTask(){this.tasks.cancel()}async consume(e){this.store.dispatch(Mt(!0)),this.store.dispatch(Sr(!0));try{for await(const t of e)this.handlers[t.event]?.(t)}catch(t){console.error("[SSE] stream error",t),this.store.dispatch(Ea(it(t)))}finally{this.store.dispatch(Sr(!1)),this.store.dispatch(Mt(!1))}}requireConversation(){const e=this.store.snapshot.session.conversationId;if(!e)throw new Error("No conversation id");return e}}class Ie extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Ar extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ne extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class za extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Fa extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class Ua extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class pn extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class Ba extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class un{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Dt{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}var h;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None"})(h||(h={}));class ct{constructor(){}log(e,t){}}ct.instance=new ct;const Ha="9.0.6";class O{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}}class ${static get isBrowser(){return!$.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!$.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!$.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function ht(r,e){let t="";return Ae(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${ja(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function ja(r){const e=new Uint8Array(r);let t="";return e.forEach(n=>{const s=n<16?"0":"";t+=`0x${s}${n.toString(16)} `}),t.substr(0,t.length-1)}function Ae(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}async function gn(r,e,t,n,s,o){const i={},[a,c]=Le();i[a]=c,r.log(h.Trace,`(${e} transport) sending data. ${ht(s,o.logMessageContent)}.`);const d=Ae(s)?"arraybuffer":"text",u=await t.post(n,{content:s,headers:{...i,...o.headers},responseType:d,timeout:o.timeout,withCredentials:o.withCredentials});r.log(h.Trace,`(${e} transport) request complete. Response status: ${u.statusCode}.`)}function qa(r){return r===void 0?new Ot(h.Information):r===null?ct.instance:r.log!==void 0?r:new Ot(r)}class Wa{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}}class Ot{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${new Date().toISOString()}] ${h[e]}: ${t}`;switch(e){case h.Critical:case h.Error:this.out.error(n);break;case h.Warning:this.out.warn(n);break;case h.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function Le(){let r="X-SignalR-User-Agent";return $.isNode&&(r="User-Agent"),[r,Va(Ha,Ga(),Xa(),Ya())]}function Va(r,e,t,n){let s="Microsoft SignalR/";const o=r.split(".");return s+=`${o[0]}.${o[1]}`,s+=` (${r}; `,e&&e!==""?s+=`${e}; `:s+="Unknown OS; ",s+=`${t}`,n?s+=`; ${n}`:s+="; Unknown Runtime Version",s+=")",s}function Ga(){if($.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Ya(){if($.isNode)return process.versions.node}function Xa(){return $.isNode?"NodeJS":"Browser"}function $r(r){return r.stack?r.stack:r.message?r.message:`${r}`}function Za(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Ka extends Dt{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||$.isNode){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Za());if(typeof AbortController>"u"){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new ne;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new ne});let s=null;if(e.timeout){const c=e.timeout;s=setTimeout(()=>{t.abort(),this._logger.log(h.Warning,"Timeout from HTTP request."),n=new Ar},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Ae(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(c){throw n||(this._logger.log(h.Warning,`Error from HTTP request. ${c}.`),c)}finally{s&&clearTimeout(s),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const c=await fn(o,"text");throw new Ie(c||o.statusText,o.status)}const a=await fn(o,e.responseType);return new un(o.status,o.statusText,a)}getCookieString(e){let t="";return $.isNode&&this._jar&&this._jar.getCookies(e,(n,s)=>t=s.join("; ")),t}}function fn(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}class Ja extends Dt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ne):e.method?e.url?new Promise((t,n)=>{const s=new XMLHttpRequest;s.open(e.method,e.url,!0),s.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,s.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(Ae(e.content)?s.setRequestHeader("Content-Type","application/octet-stream"):s.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach(i=>{s.setRequestHeader(i,o[i])}),e.responseType&&(s.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{s.abort(),n(new ne)}),e.timeout&&(s.timeout=e.timeout),s.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),s.status>=200&&s.status<300?t(new un(s.status,s.statusText,s.response||s.responseText)):n(new Ie(s.response||s.responseText||s.statusText,s.status))},s.onerror=()=>{this._logger.log(h.Warning,`Error from HTTP request. ${s.status}: ${s.statusText}.`),n(new Ie(s.statusText,s.status))},s.ontimeout=()=>{this._logger.log(h.Warning,"Timeout from HTTP request."),n(new Ar)},s.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Qa extends Dt{constructor(e){if(super(),typeof fetch<"u"||$.isNode)this._httpClient=new Ka(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new Ja(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ne):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class K{static write(e){return`${e}${K.RecordSeparator}`}static parse(e){if(e[e.length-1]!==K.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(K.RecordSeparator);return t.pop(),t}}K.RecordSeparatorCode=30,K.RecordSeparator=String.fromCharCode(K.RecordSeparatorCode);class el{writeHandshakeRequest(e){return K.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Ae(e)){const a=new Uint8Array(e),c=a.indexOf(K.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const d=c+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,d))),n=a.byteLength>d?a.slice(d).buffer:null}else{const a=e,c=a.indexOf(K.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const d=c+1;t=a.substring(0,d),n=a.length>d?a.substring(d):null}const s=K.parse(t),o=JSON.parse(s[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}}var b;(function(r){r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence"})(b||(b={}));class tl{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Wa(this,e)}}class rl{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let s=()=>{},o=()=>{};Ae(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{s=i,o=a})),this._messages.push(new sl(t,this._totalMessageCount,s,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){const s=this._messages[n];if(s._id<=e.sequenceId)t=n,Ae(s._message)?this._bufferedByteCount-=s._message.byteLength:this._bufferedByteCount-=s._message.length,s._resolver();else if(this._bufferedByteCount<this._bufferSize)s._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==b.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:b.Sequence,sequenceId:e}));const t=this._messages;for(const n of t)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case b.Invocation:case b.StreamItem:case b.Completion:case b.StreamInvocation:case b.CancelInvocation:return!0;case b.Close:case b.Sequence:case b.Ping:case b.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:b.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class sl{constructor(e,t,n,s){this._message=e,this._id=t,this._resolver=n,this._rejector=s}}const nl=30*1e3,ol=15*1e3,il=1e5;var I;(function(r){r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting"})(I||(I={}));class Rr{static create(e,t,n,s,o,i,a){return new Rr(e,t,n,s,o,i,a)}constructor(e,t,n,s,o,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(h.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},O.isRequired(e,"connection"),O.isRequired(t,"logger"),O.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=o??nl,this.keepAliveIntervalInMilliseconds=i??ol,this._statefulReconnectBufferSize=a??il,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=s,this._handshakeProtocol=new el,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=I.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:b.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==I.Disconnected&&this._connectionState!==I.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==I.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=I.Connecting,this._logger.log(h.Debug,"Starting HubConnection.");try{await this._startInternal(),$.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=I.Connected,this._connectionStarted=!0,this._logger.log(h.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=I.Disconnected,this._logger.log(h.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(h.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(h.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new rl(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(t){throw this._logger.log(h.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(t),t}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===I.Disconnected)return this._logger.log(h.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===I.Disconnecting)return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=I.Disconnecting,this._logger.log(h.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(h.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===I.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new ne("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,s);let i;const a=new tl;return a.cancelCallback=()=>{const c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,d)=>{if(d){a.error(d);return}else c&&(c.type===b.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(n,i),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,s));return this._launchStreams(n,o),o}invoke(e,...t){const[n,s]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,s);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(u,v)=>{if(v){c(v);return}else u&&(u.type===b.Completion?u.error?c(new Error(u.error)):a(u.result):c(new Error(`Unexpected message type: ${u.type}`)))};const d=this._sendWithProtocol(o).catch(u=>{c(u),delete this._callbacks[o.invocationId]});this._launchStreams(n,d)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const s=n.indexOf(t);s!==-1&&(n.splice(s,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const t=this._protocol.parseMessages(e,this._logger);for(const n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case b.Invocation:this._invokeClientMethod(n).catch(s=>{this._logger.log(h.Error,`Invoke client method threw error: ${$r(s)}`)});break;case b.StreamItem:case b.Completion:{const s=this._callbacks[n.invocationId];if(s){n.type===b.Completion&&delete this._callbacks[n.invocationId];try{s(n)}catch(o){this._logger.log(h.Error,`Stream callback threw error: ${$r(o)}`)}}break}case b.Ping:break;case b.Close:{this._logger.log(h.Information,"Close message received from server.");const s=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(s):this._stopPromise=this._stopInternal(s);break}case b.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case b.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(h.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(s){const o="Error parsing handshake response: "+s;this._logger.log(h.Error,o);const i=new Error(o);throw this._handshakeRejecter(i),i}if(t.error){const s="Server returned handshake error: "+t.error;this._logger.log(h.Error,s);const o=new Error(s);throw this._handshakeRejecter(o),o}else this._logger.log(h.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===I.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(h.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(h.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const s=n.slice(),o=!!e.invocationId;let i,a,c;for(const d of s)try{const u=i;i=await d.apply(this,e.arguments),o&&i&&u&&(this._logger.log(h.Error,`Multiple results provided for '${t}'. Sending error to server.`),c=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(u){a=u,this._logger.log(h.Error,`A callback for the method '${t}' threw error '${u}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(e.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(h.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),c=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(h.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(h.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ne("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===I.Disconnecting?this._completeClose(e):this._connectionState===I.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===I.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=I.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),$.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(h.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,s=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n++,0,s);if(o===null){this._logger.log(h.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=I.Reconnecting,e?this._logger.log(h.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(h.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[e]))}catch(i){this._logger.log(h.Error,`An onreconnecting callback called with error '${e}' threw error '${i}'.`)}if(this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(h.Information,`Reconnect attempt number ${n} will start in ${o} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=I.Connected,this._logger.log(h.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(h.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(h.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==I.Reconnecting){this._logger.log(h.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===I.Disconnecting&&this._completeClose();return}s=i instanceof Error?i:new Error(i.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,s)}}this._logger.log(h.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(s){return this._logger.log(h.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${s}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{const s=t[n];try{s(null,e)}catch(o){this._logger.log(h.Error,`Stream 'error' callback called with '${e}' threw error: ${$r(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,s){if(n)return s.length!==0?{target:e,arguments:t,streamIds:s,type:b.Invocation}:{target:e,arguments:t,type:b.Invocation};{const o=this._invocationId;return this._invocationId++,s.length!==0?{target:e,arguments:t,invocationId:o.toString(),streamIds:s,type:b.Invocation}:{target:e,arguments:t,invocationId:o.toString(),type:b.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:s=>{let o;s instanceof Error?o=s.message:s&&s.toString?o=s.toString():o="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,o)))},next:s=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,s)))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let s=0;s<e.length;s++){const o=e[s];if(this._isObservable(o)){const i=this._invocationId;this._invocationId++,t[i]=o,n.push(i.toString()),e.splice(s,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){const s=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:n,type:b.StreamInvocation}:{target:e,arguments:t,invocationId:s.toString(),type:b.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:b.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:b.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:b.Completion}:{invocationId:e,result:n,type:b.Completion}}_createCloseMessage(){return{type:b.Close}}}const al=[0,2e3,1e4,3e4,null];class mn{constructor(e){this._retryDelays=e!==void 0?[...e,null]:al}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class $e{}$e.Authorization="Authorization",$e.Cookie="Cookie";class ll extends Dt{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[$e.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[$e.Authorization]&&delete e.headers[$e.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var L;(function(r){r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling"})(L||(L={}));var H;(function(r){r[r.Text=1]="Text",r[r.Binary=2]="Binary"})(H||(H={}));let cl=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class wn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new cl,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._url=e,this._logger.log(h.Trace,"(LongPolling transport) Connecting."),t===H.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,s]=Le(),o={[n]:s,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===H.Binary&&(i.responseType="arraybuffer");const a=`${e}&_=${Date.now()}`;this._logger.log(h.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(h.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new Ie(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(h.Trace,`(LongPolling transport) polling: ${n}.`);const s=await this._httpClient.get(n,t);s.statusCode===204?(this._logger.log(h.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):s.statusCode!==200?(this._logger.log(h.Error,`(LongPolling transport) Unexpected response code: ${s.statusCode}.`),this._closeError=new Ie(s.statusText||"",s.statusCode),this._running=!1):s.content?(this._logger.log(h.Trace,`(LongPolling transport) data received. ${ht(s.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(s.content)):this._logger.log(h.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Ar?this._logger.log(h.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(h.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(h.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?gn(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(h.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(h.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Le();e[t]=n;const s={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,s)}catch(i){o=i}o?o instanceof Ie&&(o.statusCode===404?this._logger.log(h.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(h.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(h.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(h.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(h.Trace,e),this.onclose(this._closeError)}}}class hl{constructor(e,t,n,s){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=s,this.onreceive=null,this.onclose=null}async connect(e,t){return O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._logger.log(h.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,s)=>{let o=!1;if(t!==H.Text){s(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if($.isBrowser||$.isWebWorker)i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(e),c={};c.Cookie=a;const[d,u]=Le();c[d]=u,i=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(h.Trace,`(SSE transport) data received. ${ht(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{o?this._close():s(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(h.Information,`SSE connected to ${this._url}`),this._eventSource=i,o=!0,n()}}catch(a){s(a);return}})}async send(e){return this._eventSource?gn(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class dl{constructor(e,t,n,s,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=s,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){O.isRequired(e,"url"),O.isRequired(t,"transferFormat"),O.isIn(t,H,"transferFormat"),this._logger.log(h.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((s,o)=>{e=e.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(e);let c=!1;if($.isNode||$.isReactNative){const d={},[u,v]=Le();d[u]=v,n&&(d[$e.Authorization]=`Bearer ${n}`),a&&(d[$e.Cookie]=a),i=new this._webSocketConstructor(e,void 0,{headers:{...d,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===H.Binary&&(i.binaryType="arraybuffer"),i.onopen=d=>{this._logger.log(h.Information,`WebSocket connected to ${e}.`),this._webSocket=i,c=!0,s()},i.onerror=d=>{let u=null;typeof ErrorEvent<"u"&&d instanceof ErrorEvent?u=d.error:u="There was an error with the transport",this._logger.log(h.Information,`(WebSockets transport) ${u}.`)},i.onmessage=d=>{if(this._logger.log(h.Trace,`(WebSockets transport) data received. ${ht(d.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(d.data)}catch(u){this._close(u);return}},i.onclose=d=>{if(c)this._close(d);else{let u=null;typeof ErrorEvent<"u"&&d instanceof ErrorEvent?u=d.error:u="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(u))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(h.Trace,`(WebSockets transport) sending data. ${ht(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(h.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const bn=100;class pl{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,O.isRequired(e,"url"),this._logger=qa(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,s=null;if($.isNode&&typeof require<"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=o("ws"),s=o("eventsource")}!$.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:$.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!$.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:$.isNode&&!t.EventSource&&typeof s<"u"&&(t.EventSource=s),this._httpClient=new ll(t.httpClient||new Qa(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||H.Binary,O.isIn(e,H,"transferFormat"),this._logger.log(h.Debug,`Starting connection with transfer format '${H[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(h.Error,t),await this._stopPromise,Promise.reject(new ne(t))}else if(this._connectionState!=="Connected"){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(h.Error,t),Promise.reject(new ne(t))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Pr(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(h.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(t){this._logger.log(h.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(h.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===L.WebSockets)this.transport=this._constructTransport(L.WebSockets),await this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,s=0;do{if(n=await this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new ne("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const o=n.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}s++}while(n.url&&s<bn);if(s===bn&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof wn&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(h.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(h.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(e){const t={},[n,s]=Le();t[n]=s;const o=this._resolveNegotiateUrl(e);this._logger.log(h.Debug,`Sending negotiation request: ${o}.`);try{const i=await this._httpClient.post(o,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new pn("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof Ie&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(h.Error,a),Promise.reject(new pn(a))}}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,s){let o=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(h.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,s),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const d of a){const u=this._resolveTransportOrError(d,t,s,c?.useStatefulReconnect===!0);if(u instanceof Error)i.push(`${d.transport} failed:`),i.push(u);else if(this._isITransport(u)){if(this.transport=u,!c){try{c=await this._getNegotiationResponse(e)}catch(v){return Promise.reject(v)}o=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(o,s),this.connectionId=c.connectionId;return}catch(v){if(this._logger.log(h.Error,`Failed to start the transport '${d.transport}': ${v}`),c=void 0,i.push(new Ua(`${d.transport} failed: ${v}`,L[d.transport])),this._connectionState!=="Connecting"){const _="Failed to select transport before stop() was called.";return this._logger.log(h.Debug,_),Promise.reject(new ne(_))}}}}return i.length>0?Promise.reject(new Ba(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case L.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new dl(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case L.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new hl(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case L.LongPolling:return new wn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let s=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{s=!0}else{this._stopConnection(n);return}s&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,s){const o=L[e.transport];if(o==null)return this._logger.log(h.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(ul(t,o))if(e.transferFormats.map(a=>H[a]).indexOf(n)>=0){if(o===L.WebSockets&&!this._options.WebSocket||o===L.ServerSentEvents&&!this._options.EventSource)return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it is not supported in your environment.'`),new za(`'${L[o]}' is not supported in your environment.`,o);this._logger.log(h.Debug,`Selecting transport '${L[o]}'.`);try{return this.features.reconnect=o===L.WebSockets?s:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it does not support the requested transfer format '${H[n]}'.`),new Error(`'${L[o]}' does not support ${H[n]}.`);else return this._logger.log(h.Debug,`Skipping transport '${L[o]}' because it was disabled by the client.`),new Fa(`'${L[o]}' is disabled by the client.`,o)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(h.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(h.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(h.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(h.Error,`Connection disconnected with error '${e}'.`):this._logger.log(h.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(h.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(h.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!$.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(h.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}function ul(r,e){return!r||(e&r)!==0}class Pr{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Lt,this._transportResult=new Lt,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Lt),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Lt;const e=this._transportResult;this._transportResult=void 0;const t=typeof this._buffer[0]=="string"?this._buffer.join(""):Pr._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}}static _concatBuffers(e){const t=e.map(o=>o.byteLength).reduce((o,i)=>o+i),n=new Uint8Array(t);let s=0;for(const o of e)n.set(new Uint8Array(o),s),s+=o.byteLength;return n.buffer}}class Lt{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const gl="json";class fl{constructor(){this.name=gl,this.version=2,this.transferFormat=H.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=ct.instance);const n=K.parse(e),s=[];for(const o of n){const i=JSON.parse(o);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case b.Invocation:this._isInvocationMessage(i);break;case b.StreamItem:this._isStreamItemMessage(i);break;case b.Completion:this._isCompletionMessage(i);break;case b.Ping:break;case b.Close:break;case b.Ack:this._isAckMessage(i);break;case b.Sequence:this._isSequenceMessage(i);break;default:t.log(h.Information,"Unknown message type '"+i.type+"' ignored.");continue}s.push(i)}return s}writeMessage(e){return K.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}}const ml={trace:h.Trace,debug:h.Debug,info:h.Information,information:h.Information,warn:h.Warning,warning:h.Warning,error:h.Error,critical:h.Critical,none:h.None};function wl(r){const e=ml[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}class bl{configureLogging(e){if(O.isRequired(e,"logging"),vl(e))this.logger=e;else if(typeof e=="string"){const t=wl(e);this.logger=new Ot(t)}else this.logger=new Ot(e);return this}withUrl(e,t){return O.isRequired(e,"url"),O.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...t}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return O.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new mn(e):this.reconnectPolicy=e:this.reconnectPolicy=new mn,this}withServerTimeout(e){return O.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return O.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new pl(this.url,e);return Rr.create(t,this.logger||ct.instance,this.protocol||new fl,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function vl(r){return r.log!==void 0}class yl{constructor(e,t){this.store=e,this.accessTokenProvider=t,this.typingTimeoutMs=1e4,this.operatorMsgIdByOp=new Map,this.typingTimeoutByOp=new Map}async start(e,t){this.connection&&await this.stop();const s=`${new URL(e).origin}/ws/support`;this.connection=new bl().withUrl(s,{accessTokenFactory:()=>this.accessTokenProvider.getAccessToken()}).withAutomaticReconnect().configureLogging(h.Information).build(),this.connection.on("Typing",o=>this.onTyping(o)),this.connection.on("Text",o=>this.onText(o)),this.connection.on("Close",o=>this.onClose(o)),this.connection.onclose(o=>{console.error("Support Hub connection closed.",o),o&&this.onError(o),this.onSupportEnded()});try{await this.connection.start(),await this.connection.invoke("JoinConversation",t)}catch(o){console.error("Failed to connect to support hub:",o),this.onError(o)}}async stop(){await this.connection?.stop(),this.connection=void 0;for(const e of this.typingTimeoutByOp.values())clearTimeout(e);this.typingTimeoutByOp.clear(),this.operatorMsgIdByOp.clear()}async sendMessage(e){if(this.connection){this.store.dispatch(ve(hn(e)));try{await this.connection.invoke("SendMessage",e)}catch(t){console.error("Failed to send message via SignalR:",t),this.onError(t)}}}async sendTyping(){if(this.connection)try{await this.connection.invoke("SendTyping")}catch(e){console.error("Failed to send typing message via SignalR:",e),this.onError(e)}}async sendSeenMessage(e,t){if(this.connection)try{await this.connection.invoke("SendSeen",e,t)}catch(n){console.error("Failed to send seen message via SignalR:",n),this.onError(n)}}async close(){if(this.connection)try{await this.connection.invoke("SendClose")}catch(e){console.error("Failed to close support connection via SignalR:",e),this.onError(e)}}onError(e){this.store.dispatch(ye(it(new sn("Support connection error",e))))}clearTyping(e){const t=this.typingTimeoutByOp.get(e);t&&clearTimeout(t),this.typingTimeoutByOp.delete(e)}scheduleTypingRemoval(e){this.clearTyping(e);const t=window.setTimeout(()=>{const n=this.operatorMsgIdByOp.get(e);n&&this.store.dispatch(ya(n)),this.operatorMsgIdByOp.delete(e),this.typingTimeoutByOp.delete(e)},this.typingTimeoutMs);this.typingTimeoutByOp.set(e,t)}async onTyping(e){const t=e.operator;if(t){if(this.operatorMsgIdByOp.has(t.id))this.store.dispatch(ue(this.operatorMsgIdByOp.get(t.id),{isTyping:!0}));else{const n=crypto.randomUUID();this.operatorMsgIdByOp.set(t.id,n),this.store.dispatch(ve(dn(t,"...",{idGen:()=>n,isTyping:!0})))}this.scheduleTypingRemoval(t.id)}}async onText(e){const t=e.operator;if(!t)return;this.clearTyping(t.id);const n=this.operatorMsgIdByOp.get(t.id);n?(this.store.dispatch(ue(n,{content:e.content,isTyping:!1,status:"completed"})),this.operatorMsgIdByOp.delete(t.id)):this.store.dispatch(ve(dn(t,e.content,{status:"completed"})))}async onClose(e){this.stop()}onSupportEnded(){const e=Da();this.store.dispatch(ve(e)),this.store.dispatch(at(e.messageId)),this.store.dispatch(xr("assistant"))}}class ge extends CustomEvent{constructor(e,t){super(e,{...t,bubbles:!0})}}class kl extends ge{constructor(){super("conversation-cleared")}}class vn extends ge{constructor(e,t){super("message-sent",{detail:{message:e,channel:t}})}}class _l extends ge{constructor(e,t){super("tool-call-approved",{detail:{turnId:e,messageId:t}})}}class xl extends ge{constructor(e,t){super("tool-call-declined",{detail:{turnId:e,messageId:t}})}}class Sl extends ge{constructor(e,t){super("feedback-submitted",{detail:{rating:e,comment:t}})}}class El extends ge{constructor(e,t){super("token-updated",{detail:{expiresAt:e,token:t}})}}class Tl extends ge{constructor(e,t){super("token-expiring",{detail:{expiresAt:e,remainingMs:t}})}}class Cl extends ge{constructor(e){super("token-expired",{detail:{expiredAt:e}})}}class Il extends ge{constructor(){super("close-requested")}}const Al={version:"2.1.2"};class $l{constructor(e,t){this.authProvider=e,this.config=t,this.version=Al.version}set baseUrl(e){this.config.baseUrl=e}async request(e,t={}){const n=async()=>{let o;try{o=await this.authProvider.getAccessToken()}catch(a){throw a instanceof qe?a:new xe("Network error",0,this.formatUrl(e),a)}const i=new Headers(t.headers||{});this.authProvider.strategyKind==="visitor"?i.set("VSN-Assistant-Visitor",o):i.set("Authorization",`Bearer ${o}`),i.set("App-Version",this.version),i.set("App-Origin",window.location.href||"");try{return await(this.config.fetchImpl??fetch)(this.formatUrl(e),{...t,headers:i})}catch(a){throw new xe("Network error",0,this.formatUrl(e),a)}};let s=await n();if(s.status===401&&(await this.authProvider.clear(),s=await n(),s.status===401))throw new xe("Unauthorized",s.status,s.url);return await ss(s),s}formatUrl(e){const t=String(e);return/^https?:\/\//i.test(t)?t:`${this.config.baseUrl}${t.startsWith("/")?"":"/"}${t}`}}class Rl{constructor(){this.key="gaia-chat:bootstrap-config",this.ttlMs=3600*1e3}load(){const e=localStorage.getItem(this.key);if(!e)return null;try{const t=JSON.parse(e);return Date.now()-t.timestamp>this.ttlMs?(localStorage.removeItem(this.key),null):t.data}catch{return localStorage.removeItem(this.key),null}}save(e){const t={timestamp:Date.now(),data:e};localStorage.setItem(this.key,JSON.stringify(t))}clear(){localStorage.removeItem(this.key)}}class Pl{constructor(e){this.apiClient=e,this.storage=new Rl}async getBootstrapConfig(){const e=this.storage.load();if(e)return e;const t=await this.apiClient.request("/api/v1/bootstrap",{method:"GET"}),n=await Vt(t);return this.storage.save(n),n}clearBootstrapConfig(){this.storage.clear()}}class yn extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function Mr(r){}function Ml(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Mr,onError:t=Mr,onRetry:n=Mr,onComment:s}=r;let o="",i=!0,a,c="",d="";function u(x){const M=i?x.replace(/^\xEF\xBB\xBF/,""):x,[ee,ke]=Dl(`${o}${M}`);for(const oe of ee)v(oe);o=ke,i=!1}function v(x){if(x===""){R();return}if(x.startsWith(":")){s&&s(x.slice(x.startsWith(": ")?2:1));return}const M=x.indexOf(":");if(M!==-1){const ee=x.slice(0,M),ke=x[M+1]===" "?2:1,oe=x.slice(M+ke);_(ee,oe,x);return}_(x,"",x)}function _(x,M,ee){switch(x){case"event":d=M;break;case"data":c=`${c}${M}
|
|
548
|
+
`;break;case"id":a=M.includes("\0")?void 0:M;break;case"retry":/^\d+$/.test(M)?n(parseInt(M,10)):t(new yn(`Invalid \`retry\` value: "${M}"`,{type:"invalid-retry",value:M,line:ee}));break;default:t(new yn(`Unknown field "${x.length>20?`${x.slice(0,20)}…`:x}"`,{type:"unknown-field",field:x,value:M,line:ee}));break}}function R(){c.length>0&&e({id:a,event:d||void 0,data:c.endsWith(`
|
|
549
|
+
`)?c.slice(0,-1):c}),a=void 0,c="",d=""}function T(x={}){o&&x.consume&&v(o),i=!0,a=void 0,c="",d="",o=""}return{feed:u,reset:T}}function Dl(r){const e=[];let t="",n=0;for(;n<r.length;){const s=r.indexOf("\r",n),o=r.indexOf(`
|
|
550
550
|
`,n);let i=-1;if(s!==-1&&o!==-1?i=Math.min(s,o):s!==-1?s===r.length-1?i=-1:i=s:o!==-1&&(i=o),i===-1){t=r.slice(n);break}else{const a=r.slice(n,i);e.push(a),n=i+1,r[n-1]==="\r"&&r[n]===`
|
|
551
|
-
`&&n++}}return[e,t]}class Ol extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let s;super({start(o){s=Ml({onEvent:i=>{o.enqueue(i)},onError(i){e==="terminate"?o.error(i):typeof e=="function"&&e(i)},onRetry:t,onComment:n})},transform(o){s.feed(o)}})}}async function*
|
|
551
|
+
`&&n++}}return[e,t]}class Ol extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let s;super({start(o){s=Ml({onEvent:i=>{o.enqueue(i)},onError(i){e==="terminate"?o.error(i):typeof e=="function"&&e(i)},onRetry:t,onComment:n})},transform(o){s.feed(o)}})}}async function*Dr(r,e){const t=Ll()?new TextDecoderStream:Nl(),n=r.pipeThrough(t).pipeThrough(new Ol),s=n.getReader();try{for(;!e?.aborted;){const{value:o,done:i}=await s.read();if(i)break;yield o}}catch(o){throw new _r(o)}finally{try{s.releaseLock()}catch{}try{await n.cancel()}catch{}}}function Ll(){return typeof TextDecoderStream<"u"}function Nl(){const r=new TextDecoder;return new TransformStream({transform(e,t){t.enqueue(r.decode(e,{stream:!0}))},flush(e){e.enqueue(r.decode())}})}class zl{constructor(e){this.apiClient=e}async*sendMessage(e,t){const n=await this.apiClient.request("/api/v1/conversations",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},signal:t}),s=Wt(n);for await(const o of Dr(s,t))yield this.parseSseEvent(o)}async*approveToolCall(e,t){const n=await this.apiClient.request(`/api/v1/conversations/${e.conversationId}/turns/${e.turnId}/tool-call:approve-pending`,{method:"POST"}),s=Wt(n);for await(const o of Dr(s,t))yield this.parseSseEvent(o)}async*declineToolCall(e,t){const n=await this.apiClient.request(`/api/v1/conversations/${e.conversationId}/turns/${e.turnId}/tool-call:decline-pending`,{method:"POST"}),s=Wt(n);for await(const o of Dr(s,t))yield this.parseSseEvent(o)}async getConversationHistory(e){const t=await this.apiClient.request(`/api/v1/conversations/${encodeURIComponent(e)}/history`,{method:"GET"});return Vt(t)}parseSseEvent(e){try{return{event:e.event,data:JSON.parse(e.data)}}catch{return{event:"error",data:{message:"Malformed server event"}}}}}class Fl{constructor(e){this.apiClient=e}async submitFeedback(e){await this.apiClient.request("/api/v1/feedback",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}}class Ul{constructor(e,t){this.onOffline=()=>{this.store.dispatch(ye({code:"NETWORK",message:y("You're offline. Check your connection.",{id:"error-offline"}),retryable:!1,source:"ui"}))},this.onOnline=()=>{this.store.snapshot.ui.error?.code==="NETWORK"&&this.store.dispatch(ye(null))},e.addController(this),this.store=t}hostConnected(){window.addEventListener("offline",this.onOffline),window.addEventListener("online",this.onOnline)}hostDisconnected(){window.removeEventListener("offline",this.onOffline),window.removeEventListener("online",this.onOnline)}}const Bl=(r,e,t)=>{const n=r[e];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((s,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})},kn="en",Hl=["da","nb","sv"],jl=["da","en","nb","sv"],{getLocale:ql,setLocale:Wl}=wo({sourceLocale:kn,targetLocales:Hl,loadLocale:r=>Bl(Object.assign({"../generated/locales/da.ts":()=>Promise.resolve().then(()=>Jl),"../generated/locales/nb.ts":()=>Promise.resolve().then(()=>ec),"../generated/locales/sv.ts":()=>Promise.resolve().then(()=>rc)}),`../generated/locales/${r}.ts`,4)});function Vl(r){const[e]=r.split("-"),t=e.toLowerCase();return Gl(t)}function Gl(r){switch(r){case"no":case"nn":return"nb";default:return Yl(r)?r:kn}}function Yl(r){return jl.includes(r)}var Xl=Object.defineProperty,Zl=Object.getOwnPropertyDescriptor,Q=(r,e,t,n)=>{for(var s=n>1?void 0:n?Zl(e,t):e,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Xl(e,t,s),s};C.ChatApp=class extends te{constructor(){super(...arguments),this.baseUrl="https://api.assistant.stag.vsn.dev",this.profileId="default",this.isVisitor=!1,this.tokenExpiringLeadSeconds=10,this.closeable=!0,this.state=null,this.messages=[],this.isConnectedToSupport=!1,this.store=new Aa}connectedCallback(){super.connectedCallback(),this.lang||(this.lang=this.ownerDocument.documentElement.lang),Wl(Vl(this.lang)),new Ul(this,this.store),this.checkPlatform(),this.accessTokenProvider=new Kn({onUpdated:(s,o)=>{this.dispatchEvent(new El(s,o))},onExpiring:(s,o)=>{this.dispatchEvent(new Tl(s,o))},onExpired:s=>{this.dispatchEvent(new Cl(s))}}),this.accessTokenProvider.setExpiringLeadMs(this.tokenExpiringLeadSeconds*1e3);const{kind:e,strategy:t}=Gt(this.baseUrl,this.vismaAccessToken);this.accessTokenProvider.setStrategy(e,t),this.apiClient=new $l(this.accessTokenProvider,{baseUrl:this.baseUrl,fetchImpl:fetch});const n=new zl(this.apiClient);this.bootstrapEffect=new Ra(this.store,new Pl(this.apiClient)),this.streamEffect=new Na(this.store,n),this.supportEffect=new yl(this.store,this.accessTokenProvider),this.conversationEffect=new Pa(this.store,n),this.feedbackEffect=new Ma(this.store,new Fl(this.apiClient)),this.unsubscribe=this.store.subscribe(s=>{const o=this.state;this.state=s,this.messages=$a(s),this.isConnectedToSupport=s.session.channel==="support",this.welcomeMessages=s.config.welcomeMessages[ql()],this.isConnectedToSupport&&o?.session.channel!=="support"&&this.supportEffect?.start(this.baseUrl,this.store.snapshot.session.conversationId)})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.(),this.supportEffect?.stop()}async onPrincipalChanged(e,t,n,s){if(!(e===t&&n===s)){this.store.dispatch(ye(null)),this.store.dispatch(Mt(!0));try{const o=await this.accessTokenProvider.getIdentifier(),{kind:i,strategy:a}=Gt(this.baseUrl,t);this.accessTokenProvider.setStrategy(i,a);const c=await this.accessTokenProvider.getIdentifier();(!e&&!!t||!n&&!!s||c!==o)&&(this.bootstrapEffect.clear(),this.streamEffect.abortCurrentTask?.(),this.supportEffect.close(),this.supportEffect.stop()),this.bootstrapEffect.initialize(),this.conversationEffect.getHistory()}finally{this.store.dispatch(Mt(!1))}}}updated(e){if(super.updated(e),e.has("vismaAccessToken")||e.has("isVisitor")){if(!this.vismaAccessToken&&!this.isVisitor)throw new Error("Visma token is required when not in visitor mode");if(this.vismaAccessToken&&this.isVisitor)throw new Error("Visma token is not allowed in visitor mode");requestAnimationFrame(()=>{this.onPrincipalChanged(e.get("vismaAccessToken"),this.vismaAccessToken,e.get("isVisitor"),this.isVisitor)})}if(e.has("tokenExpiringLeadSeconds")){const t=this.tokenExpiringLeadSeconds;this.accessTokenProvider?.setExpiringLeadMs(t*1e3)}if(e.has("baseUrl")){this.apiClient.baseUrl=this.baseUrl;const{kind:t,strategy:n}=Gt(this.baseUrl,this.vismaAccessToken);this.accessTokenProvider.setStrategy(t,n)}}checkPlatform(){const e=window.navigator.userAgent;let t="unknown";e.indexOf("Win")!==-1?t="windows":e.indexOf("Mac")!==-1?t="macos":t="unknown",this.setAttribute("data-platform",t)}async onSendMessage(e){e.stopPropagation();const t=e.detail.message;!t||!this.streamEffect||(this.closeFeedbackIfOpen(),this.isConnectedToSupport?(this.supportEffect.sendMessage(t),this.dispatchEvent(new vn(t,"support"))):(this.streamEffect?.sendMessage(t,this.profileId,this.supportPartnerId),this.dispatchEvent(new vn(t,"assistant"))))}onApproveToolCall(e){e.stopPropagation(),this.closeFeedbackIfOpen(),this.streamEffect?.approveToolCall(e.detail.turnId,e.detail.messageId),this.dispatchEvent(new _l(e.detail.turnId,e.detail.messageId))}onDeclineToolCall(e){e.stopPropagation(),this.closeFeedbackIfOpen(),this.streamEffect?.declineToolCall(e.detail.turnId,e.detail.messageId),this.dispatchEvent(new xl(e.detail.turnId,e.detail.messageId))}onSubmitFeedback(e){e.stopPropagation(),this.feedbackEffect?.submitFeedback(e.detail.target,e.detail.rating,e.detail.comment),this.dispatchEvent(new Sl(e.detail.rating,e.detail.comment))}onToggleFeedbackForm(e){e.stopPropagation(),e.detail.target?this.store.dispatch(Sa(e.detail.target)):this.store.dispatch(Er())}onClearConversation(e){e.stopPropagation(),this.conversationEffect?.clear(),this.supportEffect?.stop(),this.dispatchEvent(new kl)}onClearError(){this.store.dispatch(ye(null))}closeFeedbackIfOpen(){this.state?.ui.feedbackFormOpen&&this.store.dispatch(Er())}onSendTyping(e){e.stopPropagation(),this.isConnectedToSupport&&this.supportEffect?.sendTyping()}onMarkSeen(e){if(e.stopPropagation(),this.isConnectedToSupport){const{messageId:t,seenAt:n}=e.detail;this.supportEffect?.sendSeenMessage(t,n)}}onCloseChat(e){e.stopPropagation(),this.dispatchEvent(new Il)}render(){return g.html`
|
|
552
552
|
<div
|
|
553
553
|
class=${_e("@container/main grid h-full w-full [grid-template-rows:auto_1fr_auto] overflow-hidden [grid-template-areas:'header''content''footer']",{"border border-solid border-neutral-300 shadow-md":this.closeable})}
|
|
554
554
|
>
|
|
@@ -588,5 +588,5 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
|
|
|
588
588
|
@send-typing=${this.onSendTyping}
|
|
589
589
|
></gaia-chat-composer>
|
|
590
590
|
</div>
|
|
591
|
-
`}},Q([w.property({type:String,attribute:"base-url"})],C.ChatApp.prototype,"baseUrl",2),Q([w.property({type:String,attribute:"profile-id"})],C.ChatApp.prototype,"profileId",2),Q([w.property({type:String,attribute:"support-partner-id"})],C.ChatApp.prototype,"supportPartnerId",2),Q([w.property({type:String,attribute:"visma-token",reflect:!1})],C.ChatApp.prototype,"vismaAccessToken",2),Q([w.property({type:Boolean,attribute:"is-visitor"})],C.ChatApp.prototype,"isVisitor",2),Q([w.property({type:Number,attribute:"token-expiring-lead-seconds"})],C.ChatApp.prototype,"tokenExpiringLeadSeconds",2),Q([w.property({type:Boolean,attribute:"closeable",reflect:!0,converter:r=>r==="true"||r===""})],C.ChatApp.prototype,"closeable",2),Q([w.state()],C.ChatApp.prototype,"state",2),Q([w.state()],C.ChatApp.prototype,"messages",2),Q([w.state()],C.ChatApp.prototype,"isConnectedToSupport",2),Q([w.state()],C.ChatApp.prototype,"welcomeMessages",2),C.ChatApp=Q([w.customElement("gaia-chat")],C.ChatApp);const
|
|
591
|
+
`}},Q([w.property({type:String,attribute:"base-url"})],C.ChatApp.prototype,"baseUrl",2),Q([w.property({type:String,attribute:"profile-id"})],C.ChatApp.prototype,"profileId",2),Q([w.property({type:String,attribute:"support-partner-id"})],C.ChatApp.prototype,"supportPartnerId",2),Q([w.property({type:String,attribute:"visma-token",reflect:!1})],C.ChatApp.prototype,"vismaAccessToken",2),Q([w.property({type:Boolean,attribute:"is-visitor"})],C.ChatApp.prototype,"isVisitor",2),Q([w.property({type:Number,attribute:"token-expiring-lead-seconds"})],C.ChatApp.prototype,"tokenExpiringLeadSeconds",2),Q([w.property({type:Boolean,attribute:"closeable",reflect:!0,converter:r=>r==="true"||r===""})],C.ChatApp.prototype,"closeable",2),Q([w.state()],C.ChatApp.prototype,"state",2),Q([w.state()],C.ChatApp.prototype,"messages",2),Q([w.state()],C.ChatApp.prototype,"isConnectedToSupport",2),Q([w.state()],C.ChatApp.prototype,"welcomeMessages",2),C.ChatApp=Q([w.customElement("gaia-chat")],C.ChatApp);const Kl={"assistant-message-approve":"Ja","assistant-message-citations-length":ft`Brugte ${0} kilder`,"assistant-message-decline":"Nej","composer-error-character-limit":"Tegngrænsen er overskredet.","composer-placeholder":"Skriv dit spørgsmål her...","disclaimer-link":"her","disclaimer-text":"Svar genereres af AI og kan indeholde fejl, læs mere","error-auth-generic":"Autentificeringsfejl. Venligst autentificer igen.","error-forbidden":"Du har ikke adgang til denne handling.","error-network-error":"Netværksfejl. Tjek din forbindelse.","error-not-found":"Ikke fundet.","error-offline":"Du er offline. Tjek din forbindelse.","error-profile-not-found":"Kunne ikke indlæse den aktuelle profil. Bruger du den rigtige profil?","error-rate-limit":"For mange forespørgsler. Vær venlig at sænke farten.","error-request-canceled":"Forespørgsel annulleret.","error-server-error":"Serveren havde et problem. Prøv venligst igen.","error-session-expired":"Din session er udløbet. Log venligst ind igen.","error-something-went-wrong":"Der gik noget galt.","error-sse-error":"Live-svarstrømmen blev afbrudt. Prøv igen.","error-token-expired":"Din adgangstoken er udløbet.","error-token-invalid":"Din adgangstoken er ugyldig.","error-token-required":"Du skal angive en adgangstoken for at fortsætte.","error-unexpected-error":"Uventet fejl. Prøv venligst igen.","error-ws-error":"Fejl i livechatforbindelsen. At genoprette forbindelsen kan hjælpe.","feedback-form-cancel":"Annuller","feedback-form-comment-placeholder":"Skriv din kommentar her","feedback-form-comments-title":"Nogle yderligere kommentarer?","feedback-form-description":"Del venligst dine tanker og forslag for at hjælpe os med at blive bedre.","feedback-form-satisfaction-title--assistant":"Hvor tilfreds er du med assistenten?","feedback-form-satisfaction-title--support":"Hvor tilfreds er du med den hjælp, du fik?","feedback-form-submit":"Indsend feedback","feedback-form-title":"Feedback","system-message-provide-feedback":"Giv feedback","system-message-start-new-conversation":"Start ny samtale","system-message-support-completed":"Du er blevet afbrudt fra supportmedarbejderen.","system-message-support-feedback":"For at fortsætte, start venligst en ny samtale. Vi vil også gerne høre din feedback om vores supportoplevelse!","system-message-support-started":"Du er blevet forbundet med en menneskelig supportmedarbejder.","thinking-indicator-text":"Tænker..."},Jl=Object.freeze(Object.defineProperty({__proto__:null,templates:Kl},Symbol.toStringTag,{value:"Module"})),Ql={"assistant-message-approve":"Ja","assistant-message-citations-length":ft`Brukte ${0} kilder`,"assistant-message-decline":"Nei","composer-error-character-limit":"Karakterbegrensning overskredet.","composer-placeholder":"Skriv inn spørsmålet ditt her...","disclaimer-link":"her","disclaimer-text":"Svar er generert av AI og kan inneholde feil, les mer","error-auth-generic":"Autentiseringsfeil. Vennligst autentiser igjen.","error-forbidden":"Du har ikke tilgang til denne handlingen.","error-network-error":"Nettverksfeil. Sjekk tilkoblingen.","error-not-found":"Ikke funnet.","error-offline":"Du er frakoblet. Sjekk tilkoblingen din.","error-profile-not-found":"Kunne ikke laste inn nåværende profil. Bruker du riktig profil?","error-rate-limit":"For mange forespørsler. Vennligst sakt ned.","error-request-canceled":"Forespørsel avbrutt.","error-server-error":"Serverproblemer. Vennligst prøv igjen.","error-session-expired":"Din sesjon har utløpt. Vennligst logg inn igjen.","error-something-went-wrong":"Noe gikk galt.","error-sse-error":"Live responsestream avbrutt. Prøv igjen.","error-token-expired":"Din tilgangsnøkkel har utløpt.","error-token-invalid":"Din tilgangsnøkkel er ugyldig.","error-token-required":"Du må ha en tilgangsnøkkel for å fortsette.","error-unexpected-error":"Uventet feil. Vennligst prøv igjen.","error-ws-error":"Live chatsesjon feil. Det kan hjelpe å prøve igjen.","feedback-form-cancel":"Avbryt","feedback-form-comment-placeholder":"Skriv inn tilbakemeldingen her","feedback-form-comments-title":"Eventuelle tilbakemeldinger?","feedback-form-description":"Vennligst del dine tanker og forslag for å hjelpe oss å forbedre.","feedback-form-satisfaction-title--assistant":"Hvor fornøyd er du med assistenten?","feedback-form-satisfaction-title--support":"Hvor fornøyd er du med hjelpen du fikk?","feedback-form-submit":"Send tilbakemelding","feedback-form-title":"Feedback","system-message-provide-feedback":"Gi tilbakemelding","system-message-start-new-conversation":"Start ny samtale","system-message-support-completed":"Du har blitt frakoblet fra den menneskelige support agenten.","system-message-support-feedback":"For å fortsette, vennligst start en ny samtale. Vi vil også gjerne høre din tilbakemelding på vår supportopplevelse!","system-message-support-started":"Du har blitt koblet til en menneskelig support agent.","thinking-indicator-text":"Tenker..."},ec=Object.freeze(Object.defineProperty({__proto__:null,templates:Ql},Symbol.toStringTag,{value:"Module"})),tc={"assistant-message-approve":"Ja","assistant-message-citations-length":ft`Använde ${0} källor`,"assistant-message-decline":"Nej","composer-error-character-limit":"Teckenbegränsningen har överskridits.","composer-placeholder":"Skriv din fråga här...","disclaimer-link":"här","disclaimer-text":"Svar genereras av AI och kan innehålla fel, läs mer","error-auth-generic":"Autentiseringsfel. Vänligen autentisera igen.","error-forbidden":"Du har inte behörighet till denna åtgärd.","error-network-error":"Nätverksfel. Kontrollera din anslutning.","error-not-found":"Hittades inte.","error-offline":"Du är offline. Kontrollera din anslutning.","error-profile-not-found":"Kunde inte ladda den aktuella profilen. Använder du rätt profil?","error-rate-limit":"För många förfrågningar. Vänligen sakta ner.","error-request-canceled":"Förfrågan avbröts.","error-server-error":"Servern hade ett problem. Vänligen försök igen.","error-session-expired":"Din session har löpt ut. Vänligen logga in igen.","error-something-went-wrong":"Något gick fel.","error-sse-error":"Live-svarströmmen avbröts. Försök igen.","error-token-expired":"Din åtkomsttoken har löpt ut.","error-token-invalid":"Din åtkomsttoken är ogiltig.","error-token-required":"Du måste ange en åtkomsttoken för att fortsätta.","error-unexpected-error":"Oväntat fel. Vänligen försök igen.","error-ws-error":"Fel vid livechattanslutning. Att återansluta kan hjälpa.","feedback-form-cancel":"Avbryt","feedback-form-comment-placeholder":"Skriv din kommentar här","feedback-form-comments-title":"Några ytterligare kommentarer?","feedback-form-description":"Dela gärna dina tankar och förslag för att hjälpa oss att bli bättre.","feedback-form-satisfaction-title--assistant":"Hur nöjd är du med assistenten?","feedback-form-satisfaction-title--support":"Hur nöjd är du med hjälpen du fick?","feedback-form-submit":"Skicka feedback","feedback-form-title":"Feedback","system-message-provide-feedback":"Lämna feedback","system-message-start-new-conversation":"Starta ny konversation","system-message-support-completed":"Du har blivit frånkopplad från supportagenten.","system-message-support-feedback":"För att fortsätta, vänligen starta en ny konversation. Vi vill också gärna höra din feedback om vår supportupplevelse!","system-message-support-started":"Du har blivit ansluten till en mänsklig supportagent.","thinking-indicator-text":"Tänker..."},rc=Object.freeze(Object.defineProperty({__proto__:null,templates:tc},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
|
|
592
592
|
//# sourceMappingURL=index.umd.js.map
|