@kodaris/krubble-app-components 1.0.107 → 1.0.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,41 +1,41 @@
1
- import{KRContextMenu as e,KRDialog as t,KRFilePreview as i}from"@kodaris/krubble-components";import{KRHttp as s}from"@kodaris/krubble-http";
1
+ import{KRContextMenu as e,KRDialog as t,KRSnackbar as i,KRFilePreview as s}from"@kodaris/krubble-components";import{KRHttp as n}from"@kodaris/krubble-http";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
- */const n=globalThis,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),o=new WeakMap;let l=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(r&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=o.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&o.set(t,e))}return e}toString(){return this.cssText}};const h=(e,...t)=>{const i=1===e.length?e[0]:t.reduce(((t,i,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[s+1]),e[0]);return new l(i,e,a)},c=r?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new l("string"==typeof e?e:e+"",void 0,a))(t)})(e):e
6
+ */const r=globalThis,o=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;let h=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(o&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=l.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(t,e))}return e}toString(){return this.cssText}};const c=(e,...t)=>{const i=1===e.length?e[0]:t.reduce(((t,i,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[s+1]),e[0]);return new h(i,e,a)},d=o?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new h("string"==typeof e?e:e+"",void 0,a))(t)})(e):e
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */,{is:d,defineProperty:p,getOwnPropertyDescriptor:u,getOwnPropertyNames:g,getOwnPropertySymbols:m,getPrototypeOf:f}=Object,b=globalThis,v=b.trustedTypes,x=v?v.emptyScript:"",_=b.reactiveElementPolyfillSupport,k=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?x:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},w=(e,t)=>!d(e,t),$={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),b.litPropertyMetadata??=new WeakMap;let S=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=$){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&p(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:n}=u(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const r=s?.call(this);n?.call(this,t),this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){const e=this.properties,t=[...g(e),...m(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(c(e))}else void 0!==e&&t.push(c(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(r)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const i of t){const t=document.createElement("style"),s=n.litNonce;void 0!==s&&t.setAttribute("nonce",s),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:y).toAttribute(t,i.type);this._$Em=e,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:y;this._$Em=s;const r=n.fromAttribute(t,e.type);this[s]=r??this._$Ej?.get(s)??r,this._$Em=null}}requestUpdate(e,t,i,s=!1,n){if(void 0!==e){const r=this.constructor;if(!1===s&&(n=this[e]),i??=r.getPropertyOptions(e),!((i.hasChanged??w)(n,t)||i.useDefault&&i.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:n},r){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==n||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[k("elementProperties")]=new Map,S[k("finalized")]=new Map,_?.({ReactiveElement:S}),(b.reactiveElementVersions??=[]).push("2.1.2");
11
+ */,{is:p,defineProperty:u,getOwnPropertyDescriptor:g,getOwnPropertyNames:m,getOwnPropertySymbols:f,getPrototypeOf:b}=Object,v=globalThis,x=v.trustedTypes,_=x?x.emptyScript:"",k=v.reactiveElementPolyfillSupport,y=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?_:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},$=(e,t)=>!p(e,t),S={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:$};Symbol.metadata??=Symbol("metadata"),v.litPropertyMetadata??=new WeakMap;let I=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=S){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&u(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:n}=g(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const r=s?.call(this);n?.call(this,t),this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??S}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const e=b(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,t=[...m(e),...f(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(d(e))}else void 0!==e&&t.push(d(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(o)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const i of t){const t=document.createElement("style"),s=r.litNonce;void 0!==s&&t.setAttribute("nonce",s),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:w).toAttribute(t,i.type);this._$Em=e,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=s;const r=n.fromAttribute(t,e.type);this[s]=r??this._$Ej?.get(s)??r,this._$Em=null}}requestUpdate(e,t,i,s=!1,n){if(void 0!==e){const r=this.constructor;if(!1===s&&(n=this[e]),i??=r.getPropertyOptions(e),!((i.hasChanged??$)(n,t)||i.useDefault&&i.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:n},r){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==n||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};I.elementStyles=[],I.shadowRootOptions={mode:"open"},I[y("elementProperties")]=new Map,I[y("finalized")]=new Map,k?.({ReactiveElement:I}),(v.reactiveElementVersions??=[]).push("2.1.2");
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const I=globalThis,E=I.trustedTypes,z=E?E.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+A,T=`<${R}>`,D=document,M=()=>D.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,N=Array.isArray,O="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,F=/>/g,j=RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,B=/"/g,q=/^(?:script|style|textarea|title)$/i,W=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),X=Symbol.for("lit-noChange"),Q=Symbol.for("lit-nothing"),V=new WeakMap,Y=D.createTreeWalker(D,129);function Z(e,t){if(!N(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==z?z.createHTML(t):t}class K{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,r=0;const a=e.length-1,o=this.parts,[l,h]=((e,t)=>{const i=e.length-1,s=[];let n,r=2===t?"<svg>":3===t?"<math>":"",a=U;for(let t=0;t<i;t++){const i=e[t];let o,l,h=-1,c=0;for(;c<i.length&&(a.lastIndex=c,l=a.exec(i),null!==l);)c=a.lastIndex,a===U?"!--"===l[1]?a=L:void 0!==l[1]?a=F:void 0!==l[2]?(q.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=j):void 0!==l[3]&&(a=j):a===j?">"===l[0]?(a=n??U,h=-1):void 0===l[1]?h=-2:(h=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?j:'"'===l[3]?B:H):a===B||a===H?a=j:a===L||a===F?a=U:(a=j,n=void 0);const d=a===j&&e[t+1].startsWith("/>")?" ":"";r+=a===U?i+T:h>=0?(s.push(o),i.slice(0,h)+C+i.slice(h)+A+d):i+A+(-2===h?t:d)}return[Z(e,r+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]})(e,t);if(this.el=K.createElement(l,i),Y.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=Y.nextNode())&&o.length<a;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(C)){const t=h[r++],i=s.getAttribute(e).split(A),a=/([.?@])?(.*)/.exec(t);o.push({type:1,index:n,name:a[2],strings:i,ctor:"."===a[1]?ie:"?"===a[1]?se:"@"===a[1]?ne:te}),s.removeAttribute(e)}else e.startsWith(A)&&(o.push({type:6,index:n}),s.removeAttribute(e));if(q.test(s.tagName)){const e=s.textContent.split(A),t=e.length-1;if(t>0){s.textContent=E?E.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],M()),Y.nextNode(),o.push({type:2,index:++n});s.append(e[t],M())}}}else if(8===s.nodeType)if(s.data===R)o.push({type:2,index:n});else{let e=-1;for(;-1!==(e=s.data.indexOf(A,e+1));)o.push({type:7,index:n}),e+=A.length-1}n++}}static createElement(e,t){const i=D.createElement("template");return i.innerHTML=e,i}}function G(e,t,i=e,s){if(t===X)return t;let n=void 0!==s?i._$Co?.[s]:i._$Cl;const r=P(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),void 0===r?n=void 0:(n=new r(e),n._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=n:i._$Cl=n),void 0!==n&&(t=G(e,n._$AS(e,t.values),n,s)),t}class J{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??D).importNode(t,!0);Y.currentNode=s;let n=Y.nextNode(),r=0,a=0,o=i[0];for(;void 0!==o;){if(r===o.index){let t;2===o.type?t=new ee(n,n.nextSibling,this,e):1===o.type?t=new o.ctor(n,o.name,o.strings,this,e):6===o.type&&(t=new re(n,this,e)),this._$AV.push(t),o=i[++a]}r!==o?.index&&(n=Y.nextNode(),r++)}return Y.currentNode=D,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class ee{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=Q,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=G(this,e,t),P(e)?e===Q||null==e||""===e?(this._$AH!==Q&&this._$AR(),this._$AH=Q):e!==this._$AH&&e!==X&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>N(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Q&&P(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=K.createElement(Z(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new J(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=V.get(e.strings);return void 0===t&&V.set(e.strings,t=new K(e)),t}k(e){N(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const n of e)s===t.length?t.push(i=new ee(this.O(M()),this.O(M()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class te{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=Q,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Q}_$AI(e,t=this,i,s){const n=this.strings;let r=!1;if(void 0===n)e=G(this,e,t,0),r=!P(e)||e!==this._$AH&&e!==X,r&&(this._$AH=e);else{const s=e;let a,o;for(e=n[0],a=0;a<n.length-1;a++)o=G(this,s[i+a],t,a),o===X&&(o=this._$AH[a]),r||=!P(o)||o!==this._$AH[a],o===Q?e=Q:e!==Q&&(e+=(o??"")+n[a+1]),this._$AH[a]=o}r&&!s&&this.j(e)}j(e){e===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ie extends te{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q?void 0:e}}class se extends te{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q)}}class ne extends te{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=G(this,e,t,0)??Q)===X)return;const i=this._$AH,s=e===Q&&i!==Q||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Q&&(i===Q||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class re{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){G(this,e)}}const ae={I:ee},oe=I.litHtmlPolyfillSupport;oe?.(K,ee),(I.litHtmlVersions??=[]).push("3.3.2");const le=globalThis;
17
+ const E=globalThis,C=E.trustedTypes,z=C?C.createPolicy("lit-html",{createHTML:e=>e}):void 0,A="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+R,D=`<${T}>`,M=document,P=()=>M.createComment(""),N=e=>null===e||"object"!=typeof e&&"function"!=typeof e,O=Array.isArray,U="[ \t\n\f\r]",L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,j=/>/g,H=RegExp(`>|${U}(?:([^\\s"'>=/]+)(${U}*=${U}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),B=/'/g,q=/"/g,W=/^(?:script|style|textarea|title)$/i,X=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),Q=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),Y=new WeakMap,Z=M.createTreeWalker(M,129);function K(e,t){if(!O(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==z?z.createHTML(t):t}class G{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,r=0;const o=e.length-1,a=this.parts,[l,h]=((e,t)=>{const i=e.length-1,s=[];let n,r=2===t?"<svg>":3===t?"<math>":"",o=L;for(let t=0;t<i;t++){const i=e[t];let a,l,h=-1,c=0;for(;c<i.length&&(o.lastIndex=c,l=o.exec(i),null!==l);)c=o.lastIndex,o===L?"!--"===l[1]?o=F:void 0!==l[1]?o=j:void 0!==l[2]?(W.test(l[2])&&(n=RegExp("</"+l[2],"g")),o=H):void 0!==l[3]&&(o=H):o===H?">"===l[0]?(o=n??L,h=-1):void 0===l[1]?h=-2:(h=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?H:'"'===l[3]?q:B):o===q||o===B?o=H:o===F||o===j?o=L:(o=H,n=void 0);const d=o===H&&e[t+1].startsWith("/>")?" ":"";r+=o===L?i+D:h>=0?(s.push(a),i.slice(0,h)+A+i.slice(h)+R+d):i+R+(-2===h?t:d)}return[K(e,r+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]})(e,t);if(this.el=G.createElement(l,i),Z.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=Z.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(A)){const t=h[r++],i=s.getAttribute(e).split(R),o=/([.?@])?(.*)/.exec(t);a.push({type:1,index:n,name:o[2],strings:i,ctor:"."===o[1]?se:"?"===o[1]?ne:"@"===o[1]?re:ie}),s.removeAttribute(e)}else e.startsWith(R)&&(a.push({type:6,index:n}),s.removeAttribute(e));if(W.test(s.tagName)){const e=s.textContent.split(R),t=e.length-1;if(t>0){s.textContent=C?C.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],P()),Z.nextNode(),a.push({type:2,index:++n});s.append(e[t],P())}}}else if(8===s.nodeType)if(s.data===T)a.push({type:2,index:n});else{let e=-1;for(;-1!==(e=s.data.indexOf(R,e+1));)a.push({type:7,index:n}),e+=R.length-1}n++}}static createElement(e,t){const i=M.createElement("template");return i.innerHTML=e,i}}function J(e,t,i=e,s){if(t===Q)return t;let n=void 0!==s?i._$Co?.[s]:i._$Cl;const r=N(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),void 0===r?n=void 0:(n=new r(e),n._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=n:i._$Cl=n),void 0!==n&&(t=J(e,n._$AS(e,t.values),n,s)),t}class ee{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??M).importNode(t,!0);Z.currentNode=s;let n=Z.nextNode(),r=0,o=0,a=i[0];for(;void 0!==a;){if(r===a.index){let t;2===a.type?t=new te(n,n.nextSibling,this,e):1===a.type?t=new a.ctor(n,a.name,a.strings,this,e):6===a.type&&(t=new oe(n,this,e)),this._$AV.push(t),a=i[++o]}r!==a?.index&&(n=Z.nextNode(),r++)}return Z.currentNode=M,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class te{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=J(this,e,t),N(e)?e===V||null==e||""===e?(this._$AH!==V&&this._$AR(),this._$AH=V):e!==this._$AH&&e!==Q&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>O(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==V&&N(this._$AH)?this._$AA.nextSibling.data=e:this.T(M.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=G.createElement(K(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new ee(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=Y.get(e.strings);return void 0===t&&Y.set(e.strings,t=new G(e)),t}k(e){O(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const n of e)s===t.length?t.push(i=new te(this.O(P()),this.O(P()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class ie{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=V,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=V}_$AI(e,t=this,i,s){const n=this.strings;let r=!1;if(void 0===n)e=J(this,e,t,0),r=!N(e)||e!==this._$AH&&e!==Q,r&&(this._$AH=e);else{const s=e;let o,a;for(e=n[0],o=0;o<n.length-1;o++)a=J(this,s[i+o],t,o),a===Q&&(a=this._$AH[o]),r||=!N(a)||a!==this._$AH[o],a===V?e=V:e!==V&&(e+=(a??"")+n[o+1]),this._$AH[o]=a}r&&!s&&this.j(e)}j(e){e===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class se extends ie{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===V?void 0:e}}class ne extends ie{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==V)}}class re extends ie{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=J(this,e,t,0)??V)===Q)return;const i=this._$AH,s=e===V&&i!==V||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==V&&(i===V||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class oe{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){J(this,e)}}const ae={I:te},le=E.litHtmlPolyfillSupport;le?.(G,te),(E.litHtmlVersions??=[]).push("3.3.2");const he=globalThis;
18
18
  /**
19
19
  * @license
20
20
  * Copyright 2017 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */let he=class extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,i)=>{const s=i?.renderBefore??t;let n=s._$litPart$;if(void 0===n){const e=i?.renderBefore??null;s._$litPart$=n=new ee(t.insertBefore(M(),e),e,void 0,i??{})}return n._$AI(e),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}};he._$litElement$=!0,he.finalized=!0,le.litElementHydrateSupport?.({LitElement:he});const ce=le.litElementPolyfillSupport;ce?.({LitElement:he}),(le.litElementVersions??=[]).push("4.2.2");
22
+ */let ce=class extends I{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,i)=>{const s=i?.renderBefore??t;let n=s._$litPart$;if(void 0===n){const e=i?.renderBefore??null;s._$litPart$=n=new te(t.insertBefore(P(),e),e,void 0,i??{})}return n._$AI(e),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Q}};ce._$litElement$=!0,ce.finalized=!0,he.litElementHydrateSupport?.({LitElement:ce});const de=he.litElementPolyfillSupport;de?.({LitElement:ce}),(he.litElementVersions??=[]).push("4.2.2");
23
23
  /**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
27
  */
28
- const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)}
28
+ const pe=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)}
29
29
  /**
30
30
  * @license
31
31
  * Copyright 2017 Google LLC
32
32
  * SPDX-License-Identifier: BSD-3-Clause
33
- */,pe={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:w},ue=(e=pe,t,i)=>{const{kind:s,metadata:n}=i;let r=globalThis.litPropertyMetadata.get(n);if(void 0===r&&globalThis.litPropertyMetadata.set(n,r=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),r.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const n=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,n,e,!0,i)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const n=this[s];t.call(this,i),this.requestUpdate(s,n,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};function ge(e){return(t,i)=>"object"==typeof i?ue(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)
33
+ */,ue={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:$},ge=(e=ue,t,i)=>{const{kind:s,metadata:n}=i;let r=globalThis.litPropertyMetadata.get(n);if(void 0===r&&globalThis.litPropertyMetadata.set(n,r=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),r.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const n=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,n,e,!0,i)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const n=this[s];t.call(this,i),this.requestUpdate(s,n,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};function me(e){return(t,i)=>"object"==typeof i?ge(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)
34
34
  /**
35
35
  * @license
36
36
  * Copyright 2017 Google LLC
37
37
  * SPDX-License-Identifier: BSD-3-Clause
38
- */}function me(e){return ge({...e,state:!0,attribute:!1})}
38
+ */}function fe(e){return me({...e,state:!0,attribute:!1})}
39
39
  /**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
@@ -46,22 +46,22 @@ const de=e=>(t,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(e,t)
46
46
  * Copyright 2017 Google LLC
47
47
  * SPDX-License-Identifier: BSD-3-Clause
48
48
  */
49
- function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}
49
+ function be(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}
50
50
  /**
51
51
  * @license
52
52
  * Copyright 2017 Google LLC
53
53
  * SPDX-License-Identifier: BSD-3-Clause
54
- */const be=1,ve=2,xe=e=>(...t)=>({_$litDirective$:e,values:t});let _e=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},ke=class extends _e{constructor(e){if(super(e),this.it=Q,e.type!==ve)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Q||null==e)return this._t=void 0,this.it=e;if(e===X)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};
54
+ */const ve=1,xe=2,_e=e=>(...t)=>({_$litDirective$:e,values:t});let ke=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},ye=class extends ke{constructor(e){if(super(e),this.it=V,e.type!==xe)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===V||null==e)return this._t=void 0,this.it=e;if(e===Q)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};
55
55
  /**
56
56
  * @license
57
57
  * Copyright 2017 Google LLC
58
58
  * SPDX-License-Identifier: BSD-3-Clause
59
- */ke.directiveName="unsafeHTML",ke.resultType=1;const ye=xe(ke),we=xe(class extends _e{constructor(e){if(super(e),e.type!==be||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const i=e.element.classList;for(const e of this.st)e in t||(i.remove(e),this.st.delete(e));for(const e in t){const s=!!t[e];s===this.st.has(e)||this.nt?.has(e)||(s?(i.add(e),this.st.add(e)):(i.remove(e),this.st.delete(e)))}return X}});
59
+ */ye.directiveName="unsafeHTML",ye.resultType=1;const we=_e(ye),$e=_e(class extends ke{constructor(e){if(super(e),e.type!==ve||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const i=e.element.classList;for(const e of this.st)e in t||(i.remove(e),this.st.delete(e));for(const e in t){const s=!!t[e];s===this.st.has(e)||this.nt?.has(e)||(s?(i.add(e),this.st.add(e)):(i.remove(e),this.st.delete(e)))}return Q}});
60
60
  /**
61
61
  * @license
62
62
  * Copyright 2018 Google LLC
63
63
  * SPDX-License-Identifier: BSD-3-Clause
64
- */var $e=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Se=class extends he{constructor(){super(...arguments),this.label="",this.icon="",this.url="",this.active=!0}connectedCallback(){super.connectedCallback(),this.data&&(this.label=this.data.label||"",this.icon=this.data.icon||"",this.url=this.data.url||"",this.active=!1!==this.data.active)}handleLabelInput(e){const t=e.target;this.label=t.value}handleIconInput(e){const t=e.target;this.icon=t.value}handleUrlInput(e){const t=e.target;this.url=t.value}handleActiveChange(e){this.active=e.target.checked}handleCancel(){this.dialogRef.close(void 0)}handleSave(){this.dialogRef.close({label:this.label,icon:this.icon||void 0,url:this.url||void 0,active:this.active})}handleKeyDown(e){"Enter"===e.key&&this.handleSave()}render(){return W`
64
+ */var Se=function(e,t,i,s){var n,r=arguments.length,o=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let Ie=class extends ce{constructor(){super(...arguments),this.label="",this.icon="",this.url="",this.active=!0}connectedCallback(){super.connectedCallback(),this.data&&(this.label=this.data.label||"",this.icon=this.data.icon||"",this.url=this.data.url||"",this.active=!1!==this.data.active)}handleLabelInput(e){const t=e.target;this.label=t.value}handleIconInput(e){const t=e.target;this.icon=t.value}handleUrlInput(e){const t=e.target;this.url=t.value}handleActiveChange(e){this.active=e.target.checked}handleCancel(){this.dialogRef.close(void 0)}handleSave(){this.dialogRef.close({label:this.label,icon:this.icon||void 0,url:this.url||void 0,active:this.active})}handleKeyDown(e){"Enter"===e.key&&this.handleSave()}render(){return X`
65
65
  <h2>Edit Navigation Item</h2>
66
66
 
67
67
  <div class="form-group">
@@ -113,7 +113,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
113
113
  <button class="btn-cancel" @click=${this.handleCancel}>Cancel</button>
114
114
  <button class="btn-save" @click=${this.handleSave}>Save</button>
115
115
  </div>
116
- `}};Se.styles=h`
116
+ `}};Ie.styles=c`
117
117
  :host {
118
118
  display: block;
119
119
  width: 360px;
@@ -198,26 +198,26 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
198
198
  .btn-save:hover {
199
199
  background: #d4f472;
200
200
  }
201
- `,$e([me()],Se.prototype,"label",void 0),$e([me()],Se.prototype,"icon",void 0),$e([me()],Se.prototype,"url",void 0),$e([me()],Se.prototype,"active",void 0),Se=$e([de("kr-nav-item-edit")],Se);var Ie=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Ee=class extends he{constructor(){super(),this.defaultNavItemIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/></svg>',this.originalFetch=null,this.originalXhrOpen=null,this.navItemDragPreview=null,this.navItemDragStartY=0,this.isNavItemDragging=!1,this.navItemDragExpandTimeout=null,this.navInitialized=!1,this.logo="",this.label="",this.homeUrl="/",this.scheme="light",this.nav=[],this.navIconsDisplayed=!1,this.navExpanded=!1,this.user=null,this.subbar=!1,this.navEnabled=!0,this.userType="employee",this.breadcrumbs=[],this.navItemsExpanded=new Set,this.navQuery="",this.activeNavItemId=null,this.isNavScrolled=!1,this.isNavOpened="false"!==localStorage.getItem("kr-scaffold-nav-opened"),this.isEditing=!1,this.isUserMenuOpen=!1,this.pref={nav:{}},this.draggedNavItemId=null,this.navItemDropTargetId=null,this.navItemDropPosition="above",this.pendingRequests=0,this.boundHandleMouseMove=this.handleMouseMove.bind(this),this.boundHandleMouseUp=this.handleMouseUp.bind(this)}connectedCallback(){super.connectedCallback(),this.installFetchInterceptor()}firstUpdated(){this.loadPref()}updated(e){super.updated(e),e.has("nav")&&this.nav.length>0&&(this.updateActiveNavItem(),this.navExpanded&&!this.navInitialized&&(this.navInitialized=!0,this.getComputedNav().filter((e=>"group"===e.type)).forEach((e=>this.navItemsExpanded.add(e.id)))))}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const e=this;this.originalFetch=window.fetch.bind(window);const t=this.originalFetch;window.fetch=function(...i){return e.pendingRequests++,t(...i).finally((()=>{e.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const i=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(t,s,n=!0,r,a){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,s,n,r,a)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}resolveUrl(e){if(!e.url)return"#";if(e.external)return e.url;let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1));const i=document.querySelector("base")?.getAttribute("href")||"/";return i.endsWith("/")?i+t:i+"/"+t}getComputedNav(){const e=[];return this.nav.forEach(((t,i)=>{const s=this.pref.nav[t.id];e.push({...t,...s,order:s?.order??t.order??i,parentId:s?.parentId??null}),"group"===t.type&&t.children&&t.children.forEach(((i,s)=>{const n=this.pref.nav[i.id];let r=t.id;void 0!==n?.parentId&&(r=n.parentId),e.push({...i,...n,order:n?.order??i.order??s,parentId:r})}))})),Object.entries(this.pref.nav).forEach((([t,i])=>{t.startsWith("custom")&&i.type&&i.label&&e.push({id:t,type:i.type,label:i.label,icon:i.icon,url:i.url,active:i.active,order:i.order??e.length,parentId:i.parentId??null})})),e}getNavItemChildren(e){let t=this.getComputedNav().filter((t=>t.parentId===e)).sort(((e,t)=>e.order-t.order));if(this.isEditing||(t=t.filter((e=>!1!==e.active))),this.navQuery){const i=this.navQuery.toLowerCase(),s=this.getComputedNav();if(null!==e){const n=s.find((t=>t.id===e));if(n?.label.toLowerCase().includes(i))return t}t=t.filter((e=>"group"===e.type?e.label.toLowerCase().includes(i)||s.some((t=>t.parentId===e.id&&!1!==t.active&&t.label.toLowerCase().includes(i))):e.label.toLowerCase().includes(i)))}return t}handleNavQueryChange(e){this.navQuery=e.target.value,this.navQuery?this.getComputedNav().forEach((e=>{"group"===e.type&&this.navItemsExpanded.add(e.id)})):this.navItemsExpanded.clear()}handleNavQueryClear(){this.navQuery="",this.navItemsExpanded.clear()}handleMenuClick(){this.isNavOpened=!this.isNavOpened,localStorage.setItem("kr-scaffold-nav-opened",String(this.isNavOpened))}handleNavHeaderClick(){this.activeNavItemId=null;const e=new CustomEvent("nav-item-click",{detail:{item:{url:this.homeUrl}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(window.location.href=this.homeUrl)}handleNavScroll(e){this.isNavScrolled=e.target.scrollTop>0}expandNavGroup(e){this.navItemsExpanded.has(e)||(this.navItemsExpanded.add(e),this.requestUpdate())}handleNavItemClick(e,t){if("group"===t.type){const e=this.shadowRoot?.querySelector(`.nav-item[data-id="${t.id}"]`),i=e?.nextElementSibling;if(!i)return;this.navItemsExpanded.has(t.id)?(this.navItemsExpanded.delete(t.id),i.animate([{height:`${i.scrollHeight}px`},{height:"0px"}],{duration:300,easing:"ease-in-out"}).onfinish=()=>{i.classList.remove("nav-group--expanded")}):(this.navItemsExpanded.add(t.id),i.classList.add("nav-group--expanded"),i.animate([{height:"0px"},{height:`${i.scrollHeight}px`}],{duration:300,easing:"ease-in-out"})),this.requestUpdate()}else{if(e.ctrlKey||e.metaKey||1===e.button)return;this.activeNavItemId=t.id;const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault()}}updateActiveNavItem(){const e=window.location.pathname,t=this.getComputedNav().filter((e=>"item"===e.type&&e.url));let i=null,s=0;for(const n of t){const t=this.resolveUrl(n);e.startsWith(t)&&t.length>s&&(i=n,s=t.length)}i?(this.activeNavItemId=i.id,i.parentId&&this.navItemsExpanded.add(i.parentId)):this.activeNavItemId=null}handleEditCancel(){this.isEditing=!1,this.loadPref()}handlePrefReset(){this.pref.nav={}}handlePrefSave(){if("customer"===this.userType)return;let e="/api/system/preference/json/scaffold?global=true",t="POST";this.pref.uuid&&(e=`/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`,t="PUT"),s.fetch({url:e,method:t,body:JSON.stringify({nav:this.pref.nav})}).then((e=>e.json())).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){"customer"!==this.userType&&s.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>e.json())).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(t,i){this.isEditing&&(t.preventDefault(),e.open({x:t.clientX,y:t.clientY,items:[{id:"edit",label:"Edit Item"},{id:"divider-1",label:"",divider:!0},{id:"add-above",label:"Add Item Above"},{id:"add-below",label:"Add Item Below"}]}).then((e=>{if(e)switch(e.id){case"edit":this.openNavItemEdit(i);break;case"add-above":this.addNavItem(i,"above");break;case"add-below":this.addNavItem(i,"below")}})))}openNavItemEdit(e){t.open(Se,{data:e}).afterClosed().then((t=>{const i=t;i&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id]={...this.pref.nav[e.id],...i},this.requestUpdate())}))}addNavItem(e,t){const i=`custom-${Date.now()}`,s=this.getComputedNav().filter((t=>t.parentId===e.parentId)).sort(((e,t)=>e.order-t.order)),n=s.findIndex((t=>t.id===e.id));let r;r="above"===t?n:n+1,s.forEach(((e,t)=>{t>=r&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id].order=t+1)}));const a={id:i,type:"item",label:"New Item",order:r,parentId:e.parentId,active:!0};this.pref.nav[i]=a,this.requestUpdate(),this.openNavItemEdit(a)}handleNavItemMouseDown(e,t){this.isEditing&&(e.preventDefault(),this.draggedNavItemId=t.id,this.navItemDragStartY=e.clientY,this.isNavItemDragging=!1,document.addEventListener("mousemove",this.boundHandleMouseMove),document.addEventListener("mouseup",this.boundHandleMouseUp))}handleMouseMove(e){if(this.draggedNavItemId){if(!this.isNavItemDragging&&Math.abs(e.clientY-this.navItemDragStartY)>5){this.isNavItemDragging=!0,this.classList.add("kr-scaffold--dragging");const t=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));t&&(this.navItemDragPreview=document.createElement("div"),this.navItemDragPreview.className="nav-item-drag-preview",this.navItemDragPreview.textContent=t.label,this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px",this.shadowRoot?.appendChild(this.navItemDragPreview))}this.isNavItemDragging&&(this.navItemDragPreview&&(this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px"),this.updateNavItemDropTarget(e))}}handleMouseUp(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),this.isNavItemDragging&&this.navItemDropTargetId&&this.executeNavItemDrop(),this.draggedNavItemId=null,this.navItemDropTargetId=null,this.isNavItemDragging=!1,this.classList.remove("kr-scaffold--dragging"),this.navItemDragPreview&&(this.navItemDragPreview.remove(),this.navItemDragPreview=null),this.clearNavItemDragExpandTimeout(),this.requestUpdate()}updateNavItemDropTarget(e){const t=this.shadowRoot?.querySelectorAll(".nav-item[data-id]");if(!t)return;let i=!1;t.forEach((t=>{const s=t.getBoundingClientRect(),n=t.getAttribute("data-id");if(!n||n===this.draggedNavItemId)return;if(e.clientX<s.left||e.clientX>s.right||e.clientY<s.top||e.clientY>s.bottom)return;const r=this.getComputedNav().find((e=>e.id===n));if(!r)return;const a=e.clientY-s.top;let o,l;"group"===r.type?a<s.height/3?(o="above",this.clearNavItemDragExpandTimeout()):a>2*s.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(r.id)||this.navItemDragExpandTimeout||(this.navItemDragExpandTimeout=window.setTimeout((()=>{this.navItemDropTargetId===r.id&&"center"===this.navItemDropPosition&&(this.navItemsExpanded.add(r.id),this.requestUpdate()),this.navItemDragExpandTimeout=null}),500))):(o=a<s.height/2?"above":"below",this.clearNavItemDragExpandTimeout()),l="center"===o?r.id:r.parentId;const h=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));if(l===this.draggedNavItemId||"group"===h?.type&&null!==l)return this.navItemDropTargetId=null,void this.clearNavItemDragExpandTimeout();this.navItemDropTargetId=r.id,this.navItemDropPosition=o,i=!0})),i||(this.navItemDropTargetId=null,this.clearNavItemDragExpandTimeout()),this.requestUpdate()}clearNavItemDragExpandTimeout(){this.navItemDragExpandTimeout&&(clearTimeout(this.navItemDragExpandTimeout),this.navItemDragExpandTimeout=null)}executeNavItemDrop(){if(!this.draggedNavItemId||!this.navItemDropTargetId)return;const e=this.getComputedNav(),t=e.find((e=>e.id===this.draggedNavItemId)),i=e.find((e=>e.id===this.navItemDropTargetId));if(!t||!i)return;let s;if("center"===this.navItemDropPosition&&"group"===i.type){if(i.id===this.draggedNavItemId)return;s=i.id}else s=i.parentId;if(s===this.draggedNavItemId)return;const n=e.filter((e=>e.parentId===s&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),r=this.pref.nav;let a;if("center"===this.navItemDropPosition)a=n.length>0?Math.max(...n.map((e=>e.order)))+1:0;else{const e=n.findIndex((e=>e.id===i.id));a=-1===e?0:"above"===this.navItemDropPosition?e:e+1,n.forEach(((e,t)=>{r[e.id]||(r[e.id]={}),r[e.id].order=t>=a?t+1:t}))}r[this.draggedNavItemId]||(r[this.draggedNavItemId]={}),r[this.draggedNavItemId].order=a,r[this.draggedNavItemId].parentId=s,this.pref.nav=r,this.requestUpdate()}handleUserMenuToggle(){this.isUserMenuOpen=!this.isUserMenuOpen}handleCustomize(){this.isUserMenuOpen=!1,this.isEditing=!0}renderNormalFooter(){if(!this.user)return Q;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return W`
201
+ `,Se([fe()],Ie.prototype,"label",void 0),Se([fe()],Ie.prototype,"icon",void 0),Se([fe()],Ie.prototype,"url",void 0),Se([fe()],Ie.prototype,"active",void 0),Ie=Se([pe("kr-nav-item-edit")],Ie);var Ee=function(e,t,i,s){var n,r=arguments.length,o=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let Ce=class extends ce{constructor(){super(),this.defaultNavItemIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/></svg>',this.originalFetch=null,this.originalXhrOpen=null,this.navItemDragPreview=null,this.navItemDragStartY=0,this.isNavItemDragging=!1,this.navItemDragExpandTimeout=null,this.navInitialized=!1,this.logo="",this.label="",this.homeUrl="/",this.scheme="light",this.nav=[],this.navIconsDisplayed=!1,this.navExpanded=!1,this.user=null,this.subbar=!1,this.navEnabled=!0,this.userType="employee",this.breadcrumbs=[],this.navItemsExpanded=new Set,this.navQuery="",this.activeNavItemId=null,this.isNavScrolled=!1,this.isNavOpened="false"!==localStorage.getItem("kr-scaffold-nav-opened"),this.isEditing=!1,this.isUserMenuOpen=!1,this.pref={nav:{}},this.draggedNavItemId=null,this.navItemDropTargetId=null,this.navItemDropPosition="above",this.pendingRequests=0,this.boundHandleMouseMove=this.handleMouseMove.bind(this),this.boundHandleMouseUp=this.handleMouseUp.bind(this)}connectedCallback(){super.connectedCallback(),this.installFetchInterceptor()}firstUpdated(){this.loadPref()}updated(e){super.updated(e),e.has("nav")&&this.nav.length>0&&(this.updateActiveNavItem(),this.navExpanded&&!this.navInitialized&&(this.navInitialized=!0,this.getComputedNav().filter((e=>"group"===e.type)).forEach((e=>this.navItemsExpanded.add(e.id)))))}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const e=this;this.originalFetch=window.fetch.bind(window);const t=this.originalFetch;window.fetch=function(...i){return e.pendingRequests++,t(...i).finally((()=>{e.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const i=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(t,s,n=!0,r,o){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),i.call(this,t,s,n,r,o)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}resolveUrl(e){if(!e.url)return"#";if(e.external)return e.url;let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1));const i=document.querySelector("base")?.getAttribute("href")||"/";return i.endsWith("/")?i+t:i+"/"+t}getComputedNav(){const e=[];return this.nav.forEach(((t,i)=>{const s=this.pref.nav[t.id];e.push({...t,...s,order:s?.order??t.order??i,parentId:s?.parentId??null}),"group"===t.type&&t.children&&t.children.forEach(((i,s)=>{const n=this.pref.nav[i.id];let r=t.id;void 0!==n?.parentId&&(r=n.parentId),e.push({...i,...n,order:n?.order??i.order??s,parentId:r})}))})),Object.entries(this.pref.nav).forEach((([t,i])=>{t.startsWith("custom")&&i.type&&i.label&&e.push({id:t,type:i.type,label:i.label,icon:i.icon,url:i.url,active:i.active,order:i.order??e.length,parentId:i.parentId??null})})),e}getNavItemChildren(e){let t=this.getComputedNav().filter((t=>t.parentId===e)).sort(((e,t)=>e.order-t.order));if(this.isEditing||(t=t.filter((e=>!1!==e.active))),this.navQuery){const i=this.navQuery.toLowerCase(),s=this.getComputedNav();if(null!==e){const n=s.find((t=>t.id===e));if(n?.label.toLowerCase().includes(i))return t}t=t.filter((e=>"group"===e.type?e.label.toLowerCase().includes(i)||s.some((t=>t.parentId===e.id&&!1!==t.active&&t.label.toLowerCase().includes(i))):e.label.toLowerCase().includes(i)))}return t}handleNavQueryChange(e){this.navQuery=e.target.value,this.navQuery?this.getComputedNav().forEach((e=>{"group"===e.type&&this.navItemsExpanded.add(e.id)})):this.navItemsExpanded.clear()}handleNavQueryClear(){this.navQuery="",this.navItemsExpanded.clear()}handleMenuClick(){this.isNavOpened=!this.isNavOpened,localStorage.setItem("kr-scaffold-nav-opened",String(this.isNavOpened))}handleNavHeaderClick(){this.activeNavItemId=null;const e=new CustomEvent("nav-item-click",{detail:{item:{url:this.homeUrl}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(window.location.href=this.homeUrl)}handleNavScroll(e){this.isNavScrolled=e.target.scrollTop>0}expandNavGroup(e){this.navItemsExpanded.has(e)||(this.navItemsExpanded.add(e),this.requestUpdate())}handleNavItemClick(e,t){if("group"===t.type){const e=this.shadowRoot?.querySelector(`.nav-item[data-id="${t.id}"]`),i=e?.nextElementSibling;if(!i)return;this.navItemsExpanded.has(t.id)?(this.navItemsExpanded.delete(t.id),i.animate([{height:`${i.scrollHeight}px`},{height:"0px"}],{duration:300,easing:"ease-in-out"}).onfinish=()=>{i.classList.remove("nav-group--expanded")}):(this.navItemsExpanded.add(t.id),i.classList.add("nav-group--expanded"),i.animate([{height:"0px"},{height:`${i.scrollHeight}px`}],{duration:300,easing:"ease-in-out"})),this.requestUpdate()}else{if(e.ctrlKey||e.metaKey||1===e.button)return;this.activeNavItemId=t.id;const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault()}}updateActiveNavItem(){const e=window.location.pathname,t=this.getComputedNav().filter((e=>"item"===e.type&&e.url));let i=null,s=0;for(const n of t){const t=this.resolveUrl(n);e.startsWith(t)&&t.length>s&&(i=n,s=t.length)}i?(this.activeNavItemId=i.id,i.parentId&&this.navItemsExpanded.add(i.parentId)):this.activeNavItemId=null}handleEditCancel(){this.isEditing=!1,this.loadPref()}handlePrefReset(){this.pref.nav={}}handlePrefSave(){if("customer"===this.userType)return;let e="/api/system/preference/json/scaffold?global=true",t="POST";this.pref.uuid&&(e=`/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`,t="PUT"),n.fetch({url:e,method:t,body:JSON.stringify({nav:this.pref.nav})}).then((e=>e.json())).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){"customer"!==this.userType&&n.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>e.json())).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(t,i){this.isEditing&&(t.preventDefault(),e.open({x:t.clientX,y:t.clientY,items:[{id:"edit",label:"Edit Item"},{id:"divider-1",label:"",divider:!0},{id:"add-above",label:"Add Item Above"},{id:"add-below",label:"Add Item Below"}]}).then((e=>{if(e)switch(e.id){case"edit":this.openNavItemEdit(i);break;case"add-above":this.addNavItem(i,"above");break;case"add-below":this.addNavItem(i,"below")}})))}openNavItemEdit(e){t.open(Ie,{data:e}).afterClosed().then((t=>{const i=t;i&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id]={...this.pref.nav[e.id],...i},this.requestUpdate())}))}addNavItem(e,t){const i=`custom-${Date.now()}`,s=this.getComputedNav().filter((t=>t.parentId===e.parentId)).sort(((e,t)=>e.order-t.order)),n=s.findIndex((t=>t.id===e.id));let r;r="above"===t?n:n+1,s.forEach(((e,t)=>{t>=r&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id].order=t+1)}));const o={id:i,type:"item",label:"New Item",order:r,parentId:e.parentId,active:!0};this.pref.nav[i]=o,this.requestUpdate(),this.openNavItemEdit(o)}handleNavItemMouseDown(e,t){this.isEditing&&(e.preventDefault(),this.draggedNavItemId=t.id,this.navItemDragStartY=e.clientY,this.isNavItemDragging=!1,document.addEventListener("mousemove",this.boundHandleMouseMove),document.addEventListener("mouseup",this.boundHandleMouseUp))}handleMouseMove(e){if(this.draggedNavItemId){if(!this.isNavItemDragging&&Math.abs(e.clientY-this.navItemDragStartY)>5){this.isNavItemDragging=!0,this.classList.add("kr-scaffold--dragging");const t=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));t&&(this.navItemDragPreview=document.createElement("div"),this.navItemDragPreview.className="nav-item-drag-preview",this.navItemDragPreview.textContent=t.label,this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px",this.shadowRoot?.appendChild(this.navItemDragPreview))}this.isNavItemDragging&&(this.navItemDragPreview&&(this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px"),this.updateNavItemDropTarget(e))}}handleMouseUp(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),this.isNavItemDragging&&this.navItemDropTargetId&&this.executeNavItemDrop(),this.draggedNavItemId=null,this.navItemDropTargetId=null,this.isNavItemDragging=!1,this.classList.remove("kr-scaffold--dragging"),this.navItemDragPreview&&(this.navItemDragPreview.remove(),this.navItemDragPreview=null),this.clearNavItemDragExpandTimeout(),this.requestUpdate()}updateNavItemDropTarget(e){const t=this.shadowRoot?.querySelectorAll(".nav-item[data-id]");if(!t)return;let i=!1;t.forEach((t=>{const s=t.getBoundingClientRect(),n=t.getAttribute("data-id");if(!n||n===this.draggedNavItemId)return;if(e.clientX<s.left||e.clientX>s.right||e.clientY<s.top||e.clientY>s.bottom)return;const r=this.getComputedNav().find((e=>e.id===n));if(!r)return;const o=e.clientY-s.top;let a,l;"group"===r.type?o<s.height/3?(a="above",this.clearNavItemDragExpandTimeout()):o>2*s.height/3?(a="below",this.clearNavItemDragExpandTimeout()):(a="center",this.navItemsExpanded.has(r.id)||this.navItemDragExpandTimeout||(this.navItemDragExpandTimeout=window.setTimeout((()=>{this.navItemDropTargetId===r.id&&"center"===this.navItemDropPosition&&(this.navItemsExpanded.add(r.id),this.requestUpdate()),this.navItemDragExpandTimeout=null}),500))):(a=o<s.height/2?"above":"below",this.clearNavItemDragExpandTimeout()),l="center"===a?r.id:r.parentId;const h=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));if(l===this.draggedNavItemId||"group"===h?.type&&null!==l)return this.navItemDropTargetId=null,void this.clearNavItemDragExpandTimeout();this.navItemDropTargetId=r.id,this.navItemDropPosition=a,i=!0})),i||(this.navItemDropTargetId=null,this.clearNavItemDragExpandTimeout()),this.requestUpdate()}clearNavItemDragExpandTimeout(){this.navItemDragExpandTimeout&&(clearTimeout(this.navItemDragExpandTimeout),this.navItemDragExpandTimeout=null)}executeNavItemDrop(){if(!this.draggedNavItemId||!this.navItemDropTargetId)return;const e=this.getComputedNav(),t=e.find((e=>e.id===this.draggedNavItemId)),i=e.find((e=>e.id===this.navItemDropTargetId));if(!t||!i)return;let s;if("center"===this.navItemDropPosition&&"group"===i.type){if(i.id===this.draggedNavItemId)return;s=i.id}else s=i.parentId;if(s===this.draggedNavItemId)return;const n=e.filter((e=>e.parentId===s&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),r=this.pref.nav;let o;if("center"===this.navItemDropPosition)o=n.length>0?Math.max(...n.map((e=>e.order)))+1:0;else{const e=n.findIndex((e=>e.id===i.id));o=-1===e?0:"above"===this.navItemDropPosition?e:e+1,n.forEach(((e,t)=>{r[e.id]||(r[e.id]={}),r[e.id].order=t>=o?t+1:t}))}r[this.draggedNavItemId]||(r[this.draggedNavItemId]={}),r[this.draggedNavItemId].order=o,r[this.draggedNavItemId].parentId=s,this.pref.nav=r,this.requestUpdate()}handleUserMenuToggle(){this.isUserMenuOpen=!this.isUserMenuOpen}handleCustomize(){this.isUserMenuOpen=!1,this.isEditing=!0}renderNormalFooter(){if(!this.user)return V;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return X`
202
202
  <div class="user-menu-container">
203
- ${this.isUserMenuOpen?W`
203
+ ${this.isUserMenuOpen?X`
204
204
  <div class="user-menu">
205
205
  <button class="user-menu__item" @click=${this.handleCustomize}>
206
206
  Customize Navigation
207
207
  </button>
208
208
  </div>
209
- `:Q}
209
+ `:V}
210
210
  <div class="user" @click=${this.handleUserMenuToggle}>
211
211
  <div class="user__avatar">
212
- ${this.user.avatar?W`<img src=${this.user.avatar} alt=${this.user.name} />`:e}
212
+ ${this.user.avatar?X`<img src=${this.user.avatar} alt=${this.user.name} />`:e}
213
213
  </div>
214
214
  <div class="user__info">
215
215
  <div class="user__name">${this.user.name}</div>
216
- ${this.user.email?W`<div class="user__email">${this.user.email}</div>`:Q}
216
+ ${this.user.email?X`<div class="user__email">${this.user.email}</div>`:V}
217
217
  </div>
218
218
  </div>
219
219
  </div>
220
- `}renderEditFooter(){return W`
220
+ `}renderEditFooter(){return X`
221
221
  <div class="edit-actions">
222
222
  <button class="edit-actions__btn edit-actions__btn--primary" @click=${this.handlePrefSave}>
223
223
  Save
@@ -231,17 +231,17 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
231
231
  </button>
232
232
  </div>
233
233
  </div>
234
- `}renderNavItem(e,t=!1){if("section"===e.type)return W`
234
+ `}renderNavItem(e,t=!1){if("section"===e.type)return X`
235
235
  <div class="nav-section">${e.label}</div>
236
- `;if("group"===e.type){const t=this.getNavItemChildren(e.id);return W`
236
+ `;if("group"===e.type){const t=this.getNavItemChildren(e.id);return X`
237
237
  <button
238
- class=${we({"nav-item":!0,"nav-item--expanded":this.navItemsExpanded.has(e.id),"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition,"nav-item--drop-center":this.navItemDropTargetId===e.id&&"center"===this.navItemDropPosition})}
238
+ class=${$e({"nav-item":!0,"nav-item--expanded":this.navItemsExpanded.has(e.id),"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition,"nav-item--drop-center":this.navItemDropTargetId===e.id&&"center"===this.navItemDropPosition})}
239
239
  data-id="${e.id}"
240
240
  @mousedown=${t=>this.handleNavItemMouseDown(t,e)}
241
241
  @click=${t=>this.handleNavItemClick(t,e)}
242
242
  @contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
243
243
  >
244
- ${this.navIconsDisplayed?W`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:Q}
244
+ ${this.navIconsDisplayed?X`<span class="nav-item__icon">${we(e.icon||this.defaultNavItemIcon)}</span>`:V}
245
245
  <span class="nav-item__label">${e.label}</span>
246
246
  <svg
247
247
  class="nav-item__chevron"
@@ -257,24 +257,24 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
257
257
  />
258
258
  </svg>
259
259
  </button>
260
- <div class=${we({"nav-group":!0,"nav-group--expanded":this.navItemsExpanded.has(e.id)})}>
260
+ <div class=${$e({"nav-group":!0,"nav-group--expanded":this.navItemsExpanded.has(e.id)})}>
261
261
  ${t.map((e=>this.renderNavItem(e,!0)))}
262
262
  </div>
263
- `}return W`
263
+ `}return X`
264
264
  <a
265
- class=${we({"nav-item":!0,"nav-item--active":this.activeNavItemId===e.id,"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition})}
265
+ class=${$e({"nav-item":!0,"nav-item--active":this.activeNavItemId===e.id,"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition})}
266
266
  data-id="${e.id}"
267
267
  href=${this.resolveUrl(e)}
268
- target=${e.external?"_blank":Q}
268
+ target=${e.external?"_blank":V}
269
269
  @mousedown=${t=>this.handleNavItemMouseDown(t,e)}
270
270
  @click=${t=>this.handleNavItemClick(t,e)}
271
271
  @contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
272
272
  >
273
- ${this.navIconsDisplayed&&!t?W`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:Q}
273
+ ${this.navIconsDisplayed&&!t?X`<span class="nav-item__icon">${we(e.icon||this.defaultNavItemIcon)}</span>`:V}
274
274
  <span class="nav-item__label">${e.label}</span>
275
275
  </a>
276
- `}render(){const e=this.getNavItemChildren(null),t=this.getComputedNav().filter((e=>null===e.parentId)).length;return W`
277
- <div class=${we({progress:!0,"progress--loading":this.pendingRequests>0})}>
276
+ `}render(){const e=this.getNavItemChildren(null),t=this.getComputedNav().filter((e=>null===e.parentId)).length;return X`
277
+ <div class=${$e({progress:!0,"progress--loading":this.pendingRequests>0})}>
278
278
  <div class="progress__track"></div>
279
279
  <div class="progress__bar progress__bar--primary">
280
280
  <span class="progress__bar-inner"></span>
@@ -284,7 +284,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
284
284
  </div>
285
285
  </div>
286
286
 
287
- ${this.subbar?W`
287
+ ${this.subbar?X`
288
288
  <kr-subbar
289
289
  menu
290
290
  .breadcrumbs=${this.breadcrumbs}
@@ -292,20 +292,20 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
292
292
  >
293
293
  <slot name="subbar"></slot>
294
294
  </kr-subbar>
295
- `:Q}
295
+ `:V}
296
296
 
297
297
  <div class="wrapper">
298
- ${this.navEnabled?W`
299
- <nav class=${we({nav:!0,"nav--scrolled":this.isNavScrolled,"nav--opened":!this.subbar||this.isNavOpened})}>
298
+ ${this.navEnabled?X`
299
+ <nav class=${$e({nav:!0,"nav--scrolled":this.isNavScrolled,"nav--opened":!this.subbar||this.isNavOpened})}>
300
300
  <div class="nav-header" @click=${this.handleNavHeaderClick}>
301
- ${this.label?W`<span class="nav-title">${this.label}</span>`:this.logo?W`<img
301
+ ${this.label?X`<span class="nav-title">${this.label}</span>`:this.logo?X`<img
302
302
  class="nav-logo"
303
303
  src=${this.logo}
304
304
  alt="Logo"
305
- />`:Q}
305
+ />`:V}
306
306
  </div>
307
307
  <div class="nav-content" @scroll=${this.handleNavScroll}>
308
- ${t>20?W`
308
+ ${t>20?X`
309
309
  <div class="nav-search">
310
310
  <div class="nav-search__wrapper">
311
311
  <span class="nav-search__icon">
@@ -324,7 +324,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
324
324
  .value=${this.navQuery}
325
325
  @input=${this.handleNavQueryChange}
326
326
  />
327
- ${this.navQuery?W`
327
+ ${this.navQuery?X`
328
328
  <button class="nav-search__clear" @click=${this.handleNavQueryClear}>
329
329
  <svg
330
330
  xmlns="http://www.w3.org/2000/svg"
@@ -334,10 +334,10 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
334
334
  <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
335
335
  </svg>
336
336
  </button>
337
- `:Q}
337
+ `:V}
338
338
  </div>
339
339
  </div>
340
- `:Q}
340
+ `:V}
341
341
  <div class="nav-items">
342
342
  ${e.map((e=>this.renderNavItem(e)))}
343
343
  </div>
@@ -346,14 +346,14 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
346
346
  ${this.isEditing?this.renderEditFooter():this.renderNormalFooter()}
347
347
  </div> -->
348
348
  </nav>
349
- `:Q}
349
+ `:V}
350
350
 
351
351
  <main class="main">
352
352
  <slot></slot>
353
353
  </main>
354
354
  </div>
355
355
 
356
- `}};Ee.styles=h`
356
+ `}};Ce.styles=c`
357
357
  :host {
358
358
  display: flex;
359
359
  flex-direction: column;
@@ -1078,21 +1078,21 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1078
1078
  transform: scaleX(0.08);
1079
1079
  }
1080
1080
  }
1081
- `,Ie([ge({type:String})],Ee.prototype,"logo",void 0),Ie([ge({type:String})],Ee.prototype,"label",void 0),Ie([ge({type:String,attribute:"home-url"})],Ee.prototype,"homeUrl",void 0),Ie([ge({type:String,reflect:!0})],Ee.prototype,"scheme",void 0),Ie([ge({type:Array})],Ee.prototype,"nav",void 0),Ie([ge({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],Ee.prototype,"navIconsDisplayed",void 0),Ie([ge({type:Boolean,attribute:"nav-expanded"})],Ee.prototype,"navExpanded",void 0),Ie([ge({type:Object})],Ee.prototype,"user",void 0),Ie([ge({type:Boolean})],Ee.prototype,"subbar",void 0),Ie([ge({type:Boolean,attribute:"nav-enabled"})],Ee.prototype,"navEnabled",void 0),Ie([ge({type:String,attribute:"user-type"})],Ee.prototype,"userType",void 0),Ie([ge({type:Array})],Ee.prototype,"breadcrumbs",void 0),Ie([me()],Ee.prototype,"navItemsExpanded",void 0),Ie([me()],Ee.prototype,"navQuery",void 0),Ie([me()],Ee.prototype,"activeNavItemId",void 0),Ie([me()],Ee.prototype,"isNavScrolled",void 0),Ie([me()],Ee.prototype,"isNavOpened",void 0),Ie([me()],Ee.prototype,"isEditing",void 0),Ie([me()],Ee.prototype,"isUserMenuOpen",void 0),Ie([me()],Ee.prototype,"pref",void 0),Ie([me()],Ee.prototype,"draggedNavItemId",void 0),Ie([me()],Ee.prototype,"navItemDropTargetId",void 0),Ie([me()],Ee.prototype,"navItemDropPosition",void 0),Ie([me()],Ee.prototype,"pendingRequests",void 0),Ee=Ie([de("kr-scaffold")],Ee);var ze=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Ce=class extends he{constructor(){super(...arguments),this.label="",this.subLabel="",this.items=[],this.activeId="",this.handlePopstate=()=>{this.syncActiveFromUrl()}}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>this.syncActiveFromUrl())),window.addEventListener("popstate",this.handlePopstate)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopstate)}handleNavItemClick(e,t){const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault(),this.activeId=t.id}syncActiveFromUrl(){const e=window.location.pathname,t=this.items.find((t=>!!t.url&&(t.url.startsWith("/")?e===t.url:e.endsWith("/"+t.url))));t&&(this.activeId=t.id)}render(){return W`
1081
+ `,Ee([me({type:String})],Ce.prototype,"logo",void 0),Ee([me({type:String})],Ce.prototype,"label",void 0),Ee([me({type:String,attribute:"home-url"})],Ce.prototype,"homeUrl",void 0),Ee([me({type:String,reflect:!0})],Ce.prototype,"scheme",void 0),Ee([me({type:Array})],Ce.prototype,"nav",void 0),Ee([me({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],Ce.prototype,"navIconsDisplayed",void 0),Ee([me({type:Boolean,attribute:"nav-expanded"})],Ce.prototype,"navExpanded",void 0),Ee([me({type:Object})],Ce.prototype,"user",void 0),Ee([me({type:Boolean})],Ce.prototype,"subbar",void 0),Ee([me({type:Boolean,attribute:"nav-enabled"})],Ce.prototype,"navEnabled",void 0),Ee([me({type:String,attribute:"user-type"})],Ce.prototype,"userType",void 0),Ee([me({type:Array})],Ce.prototype,"breadcrumbs",void 0),Ee([fe()],Ce.prototype,"navItemsExpanded",void 0),Ee([fe()],Ce.prototype,"navQuery",void 0),Ee([fe()],Ce.prototype,"activeNavItemId",void 0),Ee([fe()],Ce.prototype,"isNavScrolled",void 0),Ee([fe()],Ce.prototype,"isNavOpened",void 0),Ee([fe()],Ce.prototype,"isEditing",void 0),Ee([fe()],Ce.prototype,"isUserMenuOpen",void 0),Ee([fe()],Ce.prototype,"pref",void 0),Ee([fe()],Ce.prototype,"draggedNavItemId",void 0),Ee([fe()],Ce.prototype,"navItemDropTargetId",void 0),Ee([fe()],Ce.prototype,"navItemDropPosition",void 0),Ee([fe()],Ce.prototype,"pendingRequests",void 0),Ce=Ee([pe("kr-scaffold")],Ce);var ze=function(e,t,i,s){var n,r=arguments.length,o=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let Ae=class extends ce{constructor(){super(...arguments),this.label="",this.subLabel="",this.items=[],this.activeId="",this.handlePopstate=()=>{this.syncActiveFromUrl()}}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>this.syncActiveFromUrl())),window.addEventListener("popstate",this.handlePopstate)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopstate)}handleNavItemClick(e,t){const i=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault(),this.activeId=t.id}syncActiveFromUrl(){const e=window.location.pathname,t=this.items.find((t=>!!t.url&&(t.url.startsWith("/")?e===t.url:e.endsWith("/"+t.url))));t&&(this.activeId=t.id)}render(){return X`
1082
1082
  <nav class="nav">
1083
- ${this.label?W`
1083
+ ${this.label?X`
1084
1084
  <div class="nav-header">
1085
1085
  <div class="nav-header__text">
1086
- ${this.subLabel?W`<div class="nav-header__subtitle">${this.subLabel}</div>`:Q}
1086
+ ${this.subLabel?X`<div class="nav-header__subtitle">${this.subLabel}</div>`:V}
1087
1087
  <div class="nav-header__title">${this.label}</div>
1088
1088
  </div>
1089
1089
  </div>
1090
- `:Q}
1090
+ `:V}
1091
1091
  <div class="nav-content">
1092
1092
  <div class="nav-items">
1093
- ${this.items.map((e=>W`
1093
+ ${this.items.map((e=>X`
1094
1094
  <a
1095
- class=${we({"nav-item":!0,"nav-item--active":e.id===this.activeId})}
1095
+ class=${$e({"nav-item":!0,"nav-item--active":e.id===this.activeId})}
1096
1096
  href=${e.url||"#"}
1097
1097
  @click=${t=>this.handleNavItemClick(t,e)}
1098
1098
  >
@@ -1107,7 +1107,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1107
1107
  <slot></slot>
1108
1108
  </div>
1109
1109
  </main>
1110
- `}};Ce.styles=h`
1110
+ `}};Ae.styles=c`
1111
1111
  :host {
1112
1112
  display: flex;
1113
1113
  height: 100%;
@@ -1198,7 +1198,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1198
1198
  flex: 1;
1199
1199
  overflow-y: auto;
1200
1200
  }
1201
- `,ze([ge({type:String})],Ce.prototype,"label",void 0),ze([ge({type:String})],Ce.prototype,"subLabel",void 0),ze([ge({type:Array})],Ce.prototype,"items",void 0),ze([ge({type:String})],Ce.prototype,"activeId",void 0),Ce=ze([de("kr-screen-nav")],Ce);var Ae=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Re=class extends he{constructor(){super(...arguments),this.title=""}render(){return W`
1201
+ `,ze([me({type:String})],Ae.prototype,"label",void 0),ze([me({type:String})],Ae.prototype,"subLabel",void 0),ze([me({type:Array})],Ae.prototype,"items",void 0),ze([me({type:String})],Ae.prototype,"activeId",void 0),Ae=ze([pe("kr-screen-nav")],Ae);var Re=function(e,t,i,s){var n,r=arguments.length,o=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let Te=class extends ce{constructor(){super(...arguments),this.title=""}render(){return X`
1202
1202
  <div class="header">
1203
1203
  <h2 class="header__title">${this.title}</h2>
1204
1204
  <div class="header__actions">
@@ -1210,7 +1210,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1210
1210
  <slot></slot>
1211
1211
  </div>
1212
1212
  </div>
1213
- `}};Re.styles=h`
1213
+ `}};Te.styles=c`
1214
1214
  :host {
1215
1215
  display: flex;
1216
1216
  flex-direction: column;
@@ -1254,8 +1254,8 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1254
1254
  width: 100%;
1255
1255
  max-width: 700px;
1256
1256
  }
1257
- `,Ae([ge({type:String})],Re.prototype,"title",void 0),Re=Ae([de("kr-screen-detail")],Re);var Te=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let De=class extends he{constructor(){super(...arguments),this.breadcrumbs=[],this.menu=!1}_handleMenuClick(){this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0}))}_handleBreadcrumbClick(e,t,i){if(i||!t.url)return void e.preventDefault();if(e.ctrlKey||e.metaKey||1===e.button)return;const s=new CustomEvent("breadcrumb-click",{detail:{breadcrumb:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented&&e.preventDefault()}render(){return W`
1258
- ${this.menu?W`
1257
+ `,Re([me({type:String})],Te.prototype,"title",void 0),Te=Re([pe("kr-screen-detail")],Te);var De=function(e,t,i,s){var n,r=arguments.length,o=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};let Me=class extends ce{constructor(){super(...arguments),this.breadcrumbs=[],this.menu=!1}_handleMenuClick(){this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0}))}_handleBreadcrumbClick(e,t,i){if(i||!t.url)return void e.preventDefault();if(e.ctrlKey||e.metaKey||1===e.button)return;const s=new CustomEvent("breadcrumb-click",{detail:{breadcrumb:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented&&e.preventDefault()}render(){return X`
1258
+ ${this.menu?X`
1259
1259
  <div class="menu" @click=${this._handleMenuClick}>
1260
1260
  <svg
1261
1261
  class="menu__icon"
@@ -1284,12 +1284,12 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1284
1284
  ></line>
1285
1285
  </svg>
1286
1286
  </div>
1287
- `:Q}
1287
+ `:V}
1288
1288
  <div class="breadcrumbs">
1289
- ${this.breadcrumbs.map(((e,t)=>{const i=t===this.breadcrumbs.length-1,s=document.querySelector("base")?.getAttribute("href")||"/";let n="#";if(e.url){let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1)),n=s+t,s.endsWith("/")||(n=s+"/"+t)}return W`
1290
- ${t>0?W`<span class="breadcrumb-separator">/</span>`:""}
1289
+ ${this.breadcrumbs.map(((e,t)=>{const i=t===this.breadcrumbs.length-1,s=document.querySelector("base")?.getAttribute("href")||"/";let n="#";if(e.url){let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1)),n=s+t,s.endsWith("/")||(n=s+"/"+t)}return X`
1290
+ ${t>0?X`<span class="breadcrumb-separator">/</span>`:""}
1291
1291
  <a
1292
- class=${we({breadcrumb:!0,"breadcrumb--current":i})}
1292
+ class=${$e({breadcrumb:!0,"breadcrumb--current":i})}
1293
1293
  href=${n}
1294
1294
  @click=${t=>this._handleBreadcrumbClick(t,e,i)}
1295
1295
  >${e.label}</a>
@@ -1299,7 +1299,7 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1299
1299
  <slot></slot>
1300
1300
  </div>
1301
1301
 
1302
- `}};De.styles=h`
1302
+ `}};Me.styles=c`
1303
1303
  :host {
1304
1304
  display: flex;
1305
1305
  flex-direction: row;
@@ -1365,79 +1365,79 @@ function fe(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1365
1365
  width: 18px;
1366
1366
  height: 18px;
1367
1367
  }
1368
- `,Te([ge({type:Array})],De.prototype,"breadcrumbs",void 0),Te([ge({type:Boolean})],De.prototype,"menu",void 0),De=Te([de("kr-subbar")],De);var Me=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Pe{static configure(e){Pe.base=e.base,Pe.routes=e.routes,window.addEventListener("click",(e=>{const t=e.composedPath().find((e=>e instanceof HTMLAnchorElement));t&&t.origin===window.location.origin&&t.pathname.startsWith(Pe.base)&&(e.preventDefault(),Pe.navigate(t.pathname))}))}static navigate(e){let t=e;e.startsWith("/")||(t=Pe.base+"/"+e),window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const e=Pe.matchAll(),t={};for(const i of e)for(const e in i.params)t[e]=decodeURIComponent(i.params[e]);return t}static outlet(e){const t=Pe.matchAll();if(e>=t.length)return null;const i=t[e].route.component,s=Pe.elementCache.get(e+":"+i);if(s)return s;for(const t of Pe.elementCache.keys())t.startsWith(e+":")&&Pe.elementCache.delete(t);const n=document.createElement(i);return Pe.elementCache.set(e+":"+i,n),n}static matchAll(){const e=window.location.pathname;let t=e;e.startsWith(Pe.base)&&(t=e.slice(Pe.base.length));const i=t.split("/").filter((e=>e));return Pe.matchRoutes(Pe.routes,i)}static matchRoutes(e,t){for(const i of e){const e=i.path.split("/").filter((e=>e));if(0===e.length&&0===t.length)return[{route:i,params:{}}];if(0===e.length)continue;if(t.length<e.length)continue;const s={};let n=!0;for(let i=0;i<e.length;i++)if(e[i].startsWith(":"))s[e[i].slice(1)]=t[i];else if(e[i]!==t[i]){n=!1;break}if(!n)continue;const r=t.slice(e.length);if(r.length>0&&!i.children)continue;const a=[{route:i,params:s}];if(i.children&&r.length>0){const e=Pe.matchRoutes(i.children,r);if(e.length>0)return a.push(...e),a}if(i.children&&0===r.length&&i.default){window.history.replaceState({},"",window.location.pathname+"/"+i.default);const e=Pe.matchRoutes(i.children,[i.default]);if(e.length>0)return a.push(...e),a}return a}return[]}}Pe.base="",Pe.routes=[],Pe.elementCache=new Map;let Ne=class extends he{constructor(){super(...arguments),this.level=-1,this.handlePopState=()=>{this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.level=this.detectLevel(),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopState)}detectLevel(){let e=0,t=this;for(;t;)t instanceof ShadowRoot?t=t.host:(t instanceof HTMLElement&&"KR-ROUTER-OUTLET"===t.tagName&&t!==this&&e++,t=t instanceof HTMLElement?t.parentNode:null);return e}render(){const e=Pe.outlet(this.level);return e?W`${e}`:W``}};Ne.styles=h`
1368
+ `,De([me({type:Array})],Me.prototype,"breadcrumbs",void 0),De([me({type:Boolean})],Me.prototype,"menu",void 0),Me=De([pe("kr-subbar")],Me);var Pe=function(e,t,i,s){var n,r=arguments.length,o=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};class Ne{static configure(e){Ne.base=e.base,Ne.routes=e.routes,window.addEventListener("click",(e=>{const t=e.composedPath().find((e=>e instanceof HTMLAnchorElement));t&&t.origin===window.location.origin&&t.pathname.startsWith(Ne.base)&&(e.preventDefault(),Ne.navigate(t.pathname))}))}static navigate(e){let t=e;e.startsWith("/")||(t=Ne.base+"/"+e),window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const e=Ne.matchAll(),t={};for(const i of e)for(const e in i.params)t[e]=decodeURIComponent(i.params[e]);return t}static outlet(e){const t=Ne.matchAll();if(e>=t.length)return null;const i=t[e].route.component,s=Ne.elementCache.get(e+":"+i);if(s)return s;for(const t of Ne.elementCache.keys())t.startsWith(e+":")&&Ne.elementCache.delete(t);const n=document.createElement(i);return Ne.elementCache.set(e+":"+i,n),n}static matchAll(){const e=window.location.pathname;let t=e;e.startsWith(Ne.base)&&(t=e.slice(Ne.base.length));const i=t.split("/").filter((e=>e));return Ne.matchRoutes(Ne.routes,i)}static matchRoutes(e,t){for(const i of e){const e=i.path.split("/").filter((e=>e));if(0===e.length&&0===t.length)return[{route:i,params:{}}];if(0===e.length)continue;if(t.length<e.length)continue;const s={};let n=!0;for(let i=0;i<e.length;i++)if(e[i].startsWith(":"))s[e[i].slice(1)]=t[i];else if(e[i]!==t[i]){n=!1;break}if(!n)continue;const r=t.slice(e.length);if(r.length>0&&!i.children)continue;const o=[{route:i,params:s}];if(i.children&&r.length>0){const e=Ne.matchRoutes(i.children,r);if(e.length>0)return o.push(...e),o}if(i.children&&0===r.length&&i.default){window.history.replaceState({},"",window.location.pathname+"/"+i.default);const e=Ne.matchRoutes(i.children,[i.default]);if(e.length>0)return o.push(...e),o}return o}return[]}}Ne.base="",Ne.routes=[],Ne.elementCache=new Map;let Oe=class extends ce{constructor(){super(...arguments),this.level=-1,this.handlePopState=()=>{this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.level=this.detectLevel(),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopState)}detectLevel(){let e=0,t=this;for(;t;)t instanceof ShadowRoot?t=t.host:(t instanceof HTMLElement&&"KR-ROUTER-OUTLET"===t.tagName&&t!==this&&e++,t=t instanceof HTMLElement?t.parentNode:null);return e}render(){const e=Ne.outlet(this.level);return e?X`${e}`:X``}};Oe.styles=c`
1369
1369
  :host {
1370
1370
  display: block;
1371
1371
  height: 100%;
1372
1372
  }
1373
- `,Ne=Me([de("kr-router-outlet")],Ne);
1373
+ `,Oe=Pe([pe("kr-router-outlet")],Oe);
1374
1374
  /**
1375
1375
  * @license
1376
1376
  * Copyright 2018 Google LLC
1377
1377
  * SPDX-License-Identifier: BSD-3-Clause
1378
1378
  */
1379
- const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e),e.type!==be||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const s=e[i];return null==s?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const s=t[e];if(null!=s){this.ft.add(e);const t="string"==typeof s&&s.endsWith(Ue);e.includes("-")||t?i.setProperty(e,t?s.slice(0,-11):s,t?Oe:""):i[e]=s}}return X}}),{I:Fe}=ae,je=()=>document.createComment(""),He=(e,t,i)=>{const s=e._$AA.parentNode,n=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=s.insertBefore(je(),n),r=s.insertBefore(je(),n);i=new Fe(t,r,e,e.options)}else{const t=i._$AB.nextSibling,r=i._$AM,a=r!==e;if(a){let t;i._$AQ?.(e),i._$AM=e,void 0!==i._$AP&&(t=e._$AU)!==r._$AU&&i._$AP(t)}if(t!==n||a){let e=i._$AA;for(;e!==t;){const t=e.nextSibling;s.insertBefore(e,n),e=t}}}return i},Be=(e,t,i=e)=>(e._$AI(t,i),e),qe={},We=(e,t=qe)=>e._$AH=t,Xe=e=>{e._$AR(),e._$AA.remove()},Qe=(e,t,i)=>{const s=new Map;for(let n=t;n<=i;n++)s.set(e[n],n);return s},Ve=xe(class extends _e{constructor(e){if(super(e),e.type!==ve)throw Error("repeat() can only be used in text expressions")}dt(e,t,i){let s;void 0===i?i=t:void 0!==t&&(s=t);const n=[],r=[];let a=0;for(const t of e)n[a]=s?s(t,a):a,r[a]=i(t,a),a++;return{values:r,keys:n}}render(e,t,i){return this.dt(e,t,i).values}update(e,[t,i,s]){const n=(e=>e._$AH)(e),{values:r,keys:a}=this.dt(t,i,s);if(!Array.isArray(n))return this.ut=a,r;const o=this.ut??=[],l=[];let h,c,d=0,p=n.length-1,u=0,g=r.length-1;for(;d<=p&&u<=g;)if(null===n[d])d++;else if(null===n[p])p--;else if(o[d]===a[u])l[u]=Be(n[d],r[u]),d++,u++;else if(o[p]===a[g])l[g]=Be(n[p],r[g]),p--,g--;else if(o[d]===a[g])l[g]=Be(n[d],r[g]),He(e,l[g+1],n[d]),d++,g--;else if(o[p]===a[u])l[u]=Be(n[p],r[u]),He(e,n[d],n[p]),p--,u++;else if(void 0===h&&(h=Qe(a,u,g),c=Qe(o,d,p)),h.has(o[d]))if(h.has(o[p])){const t=c.get(a[u]),i=void 0!==t?n[t]:null;if(null===i){const t=He(e,n[d]);Be(t,r[u]),l[u]=t}else l[u]=Be(i,r[u]),He(e,n[d],i),n[t]=null;u++}else Xe(n[p]),p--;else Xe(n[d]),d++;for(;u<=g;){const t=He(e,l[g+1]);Be(t,r[u]),l[u++]=t}for(;d<=p;){const e=n[d++];null!==e&&Xe(e)}return this.ut=a,We(e,l),X}});
1379
+ const Ue="important",Le=" !"+Ue,Fe=_e(class extends ke{constructor(e){if(super(e),e.type!==ve||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const s=e[i];return null==s?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const s=t[e];if(null!=s){this.ft.add(e);const t="string"==typeof s&&s.endsWith(Le);e.includes("-")||t?i.setProperty(e,t?s.slice(0,-11):s,t?Ue:""):i[e]=s}}return Q}}),{I:je}=ae,He=()=>document.createComment(""),Be=(e,t,i)=>{const s=e._$AA.parentNode,n=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=s.insertBefore(He(),n),r=s.insertBefore(He(),n);i=new je(t,r,e,e.options)}else{const t=i._$AB.nextSibling,r=i._$AM,o=r!==e;if(o){let t;i._$AQ?.(e),i._$AM=e,void 0!==i._$AP&&(t=e._$AU)!==r._$AU&&i._$AP(t)}if(t!==n||o){let e=i._$AA;for(;e!==t;){const t=e.nextSibling;s.insertBefore(e,n),e=t}}}return i},qe=(e,t,i=e)=>(e._$AI(t,i),e),We={},Xe=(e,t=We)=>e._$AH=t,Qe=e=>{e._$AR(),e._$AA.remove()},Ve=(e,t,i)=>{const s=new Map;for(let n=t;n<=i;n++)s.set(e[n],n);return s},Ye=_e(class extends ke{constructor(e){if(super(e),e.type!==xe)throw Error("repeat() can only be used in text expressions")}dt(e,t,i){let s;void 0===i?i=t:void 0!==t&&(s=t);const n=[],r=[];let o=0;for(const t of e)n[o]=s?s(t,o):o,r[o]=i(t,o),o++;return{values:r,keys:n}}render(e,t,i){return this.dt(e,t,i).values}update(e,[t,i,s]){const n=(e=>e._$AH)(e),{values:r,keys:o}=this.dt(t,i,s);if(!Array.isArray(n))return this.ut=o,r;const a=this.ut??=[],l=[];let h,c,d=0,p=n.length-1,u=0,g=r.length-1;for(;d<=p&&u<=g;)if(null===n[d])d++;else if(null===n[p])p--;else if(a[d]===o[u])l[u]=qe(n[d],r[u]),d++,u++;else if(a[p]===o[g])l[g]=qe(n[p],r[g]),p--,g--;else if(a[d]===o[g])l[g]=qe(n[d],r[g]),Be(e,l[g+1],n[d]),d++,g--;else if(a[p]===o[u])l[u]=qe(n[p],r[u]),Be(e,n[d],n[p]),p--,u++;else if(void 0===h&&(h=Ve(o,u,g),c=Ve(a,d,p)),h.has(a[d]))if(h.has(a[p])){const t=c.get(o[u]),i=void 0!==t?n[t]:null;if(null===i){const t=Be(e,n[d]);qe(t,r[u]),l[u]=t}else l[u]=qe(i,r[u]),Be(e,n[d],i),n[t]=null;u++}else Qe(n[p]),p--;else Qe(n[d]),d++;for(;u<=g;){const t=Be(e,l[g+1]);qe(t,r[u]),l[u++]=t}for(;d<=p;){const e=n[d++];null!==e&&Qe(e)}return this.ut=o,Xe(e,l),Q}});
1380
1380
  /**
1381
1381
  * @license
1382
1382
  * Copyright 2020 Google LLC
1383
1383
  * SPDX-License-Identifier: BSD-3-Clause
1384
- */function Ye(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Ze={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Ke(e){Ze=e}const Ge=/[&<>"']/,Je=new RegExp(Ge.source,"g"),et=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,tt=new RegExp(et.source,"g"),it={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},st=e=>it[e];function nt(e,t){if(t){if(Ge.test(e))return e.replace(Je,st)}else if(et.test(e))return e.replace(tt,st);return e}const rt=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function at(e){return e.replace(rt,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const ot=/(^|[^\[])\^/g;function lt(e,t){let i="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let n="string"==typeof t?t:t.source;return n=n.replace(ot,"$1"),i=i.replace(e,n),s},getRegex:()=>new RegExp(i,t)};return s}function ht(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const ct={exec:()=>null};function dt(e,t){const i=e.replace(/\|/g,((e,t,i)=>{let s=!1,n=t;for(;--n>=0&&"\\"===i[n];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(/\\\|/g,"|");return i}function pt(e,t,i){const s=e.length;if(0===s)return"";let n=0;for(;n<s;){if(e.charAt(s-n-1)!==t)break;n++}return e.slice(0,s-n)}function ut(e,t,i,s){const n=t.href,r=t.title?nt(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:i,href:n,title:r,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,e}return{type:"image",raw:i,href:n,title:r,text:nt(a)}}class gt{options;rules;lexer;constructor(e){this.options=e||Ze}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:pt(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],i=function(e,t){const i=e.match(/^(\s+)(?:```)/);if(null===i)return t;const s=i[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[i]=t;return i.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=pt(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=pt(e.replace(/^ *>[ \t]?/gm,""),"\n");const i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim();const s=i.length>1,n={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");const r=new RegExp(`^( {0,3}${i})((?:[\t ][^\\n]*)?(?:\\n|$))`);let a="",o="",l=!1;for(;e;){let i=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),h=e.split("\n",1)[0],c=0;this.options.pedantic?(c=2,o=s.trimStart()):(c=t[2].search(/[^ ]/),c=c>4?1:c,o=s.slice(c),c+=t[1].length);let d=!1;if(!s&&/^ *$/.test(h)&&(a+=h+"\n",e=e.substring(h.length+1),i=!0),!i){const t=new RegExp(`^ {0,${Math.min(3,c-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),i=new RegExp(`^ {0,${Math.min(3,c-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),n=new RegExp(`^ {0,${Math.min(3,c-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,c-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(h=l,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),n.test(h))break;if(r.test(h))break;if(t.test(h))break;if(i.test(e))break;if(h.search(/[^ ]/)>=c||!h.trim())o+="\n"+h.slice(c);else{if(d)break;if(s.search(/[^ ]/)>=4)break;if(n.test(s))break;if(r.test(s))break;if(i.test(s))break;o+="\n"+h}d||h.trim()||(d=!0),a+=l+"\n",e=e.substring(l.length+1),s=h.slice(c)}}n.loose||(l?n.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(o),u&&(p="[ ] "!==u[0],o=o.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:a,task:!!u,checked:p,loose:!1,text:o,tokens:[]}),n.raw+=a}n.items[n.items.length-1].raw=a.trimEnd(),n.items[n.items.length-1].text=o.trimEnd(),n.raw=n.raw.trimEnd();for(let e=0;e<n.items.length;e++)if(this.lexer.state.top=!1,n.items[e].tokens=this.lexer.blockTokens(n.items[e].text,[]),!n.loose){const t=n.items[e].tokens.filter((e=>"space"===e.type)),i=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));n.loose=i}if(n.loose)for(let e=0;e<n.items.length;e++)n.items[e].loose=!0;return n}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:i,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const i=dt(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),n=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===s.length){for(const e of s)/^ *-+: *$/.test(e)?r.align.push("right"):/^ *:-+: *$/.test(e)?r.align.push("center"):/^ *:-+ *$/.test(e)?r.align.push("left"):r.align.push(null);for(const e of i)r.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of n)r.rows.push(dt(e,r.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:nt(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=pt(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let i=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])i++;else if(e[s]===t[1]&&(i--,i<0))return s;return-1}(t[2],"()");if(e>-1){const i=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);e&&(i=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(i=this.options.pedantic&&!/>$/.test(e)?i.slice(1):i.slice(1,-1)),ut(t,{href:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){const e=t[(i[2]||i[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=i[0].charAt(0);return{type:"text",raw:e,text:e}}return ut(i,e,i[0],this.lexer)}}emStrong(e,t,i=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&i.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!i||this.rules.inline.punctuation.exec(i)){const i=[...s[0]].length-1;let n,r,a=i,o=0;const l="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+i);null!=(s=l.exec(t));){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(r=[...n].length,s[3]||s[4]){a+=r;continue}if((s[5]||s[6])&&i%3&&!((i+r)%3)){o+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+o);const t=[...s[0]][0].length,l=e.slice(0,i+s.index+t+r);if(Math.min(i,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const h=l.slice(2,-2);return{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const i=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return i&&s&&(e=e.substring(1,e.length-1)),e=nt(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,i;return"@"===t[2]?(e=nt(t[1]),i="mailto:"+e):(e=nt(t[1]),i=e),{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,i;if("@"===t[2])e=nt(t[0]),i="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=nt(t[0]),i="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:nt(t[0]),{type:"text",raw:t[0],text:e}}}}const mt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ft=/(?:[*+-]|\d{1,9}[.)])/,bt=lt(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ft).replace(/blockCode/g,/ {4}/).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/).getRegex(),vt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,xt=/(?!\s*\])(?:\\.|[^\[\]\\])+/,_t=lt(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",xt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kt=lt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ft).getRegex(),yt="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",wt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$t=lt("^ {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",wt).replace("tag",yt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),St=lt(vt).replace("hr",mt).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",yt).getRegex(),It={blockquote:lt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",St).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:_t,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:mt,html:$t,lheading:bt,list:kt,newline:/^(?: *(?:\n|$))+/,paragraph:St,table:ct,text:/^[^\n]+/},Et=lt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",yt).getRegex(),zt={...It,table:Et,paragraph:lt(vt).replace("hr",mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Et).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",yt).getRegex()},Ct={...It,html:lt("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",wt).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:ct,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:lt(vt).replace("hr",mt).replace("heading"," *#{1,6} *[^\n]").replace("lheading",bt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},At=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Rt=/^( {2,}|\\)\n(?!\s*$)/,Tt="\\p{P}\\p{S}",Dt=lt(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Tt).getRegex(),Mt=lt(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Tt).getRegex(),Pt=lt("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Tt).getRegex(),Nt=lt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Tt).getRegex(),Ot=lt(/\\([punct])/,"gu").replace(/punct/g,Tt).getRegex(),Ut=lt(/^<(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(),Lt=lt(wt).replace("(?:--\x3e|$)","--\x3e").getRegex(),Ft=lt("^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",Lt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ht=lt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",jt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Bt=lt(/^!?\[(label)\]\[(ref)\]/).replace("label",jt).replace("ref",xt).getRegex(),qt=lt(/^!?\[(ref)\](?:\[\])?/).replace("ref",xt).getRegex(),Wt={_backpedal:ct,anyPunctuation:Ot,autolink:Ut,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:Rt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:ct,emStrongLDelim:Mt,emStrongRDelimAst:Pt,emStrongRDelimUnd:Nt,escape:At,link:Ht,nolink:qt,punctuation:Dt,reflink:Bt,reflinkSearch:lt("reflink|nolink(?!\\()","g").replace("reflink",Bt).replace("nolink",qt).getRegex(),tag:Ft,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:ct},Xt={...Wt,link:lt(/^!?\[(label)\]\((.*?)\)/).replace("label",jt).getRegex(),reflink:lt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",jt).getRegex()},Qt={...Wt,escape:lt(At).replace("])","~|])").getRegex(),url:lt(/^((?: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\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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Vt={...Qt,br:lt(Rt).replace("{2,}","*").getRegex(),text:lt(Qt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Yt={normal:It,gfm:zt,pedantic:Ct},Zt={normal:Wt,gfm:Qt,breaks:Vt,pedantic:Xt};class Kt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ze,this.options.tokenizer=this.options.tokenizer||new gt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Yt.normal,inline:Zt.normal};this.options.pedantic?(t.block=Yt.pedantic,t.inline=Zt.pedantic):this.options.gfm&&(t.block=Yt.gfm,this.options.breaks?t.inline=Zt.breaks:t.inline=Zt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Yt,inline:Zt}}static lex(e,t){return new Kt(t).lex(e)}static lexInline(e,t){return new Kt(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let i,s,n,r;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,i)=>t+" ".repeat(i.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(i=s.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))))if(i=this.tokenizer.space(e))e=e.substring(i.raw.length),1===i.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(i);else if(i=this.tokenizer.code(e))e=e.substring(i.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(i):(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(i=this.tokenizer.fences(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.heading(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.hr(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.blockquote(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.list(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.html(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.def(e))e=e.substring(i.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}):(s.raw+="\n"+i.raw,s.text+="\n"+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(i=this.tokenizer.table(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.lheading(e))e=e.substring(i.raw.length),t.push(i);else{if(n=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const i=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},i),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(n=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(n)))s=t[t.length-1],r&&"paragraph"===s.type?(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i),r=n.length!==e.length,e=e.substring(i.raw.length);else if(i=this.tokenizer.text(e))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let i,s,n,r,a,o,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(i=s.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))))if(i=this.tokenizer.escape(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.tag(e))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===i.type&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(i=this.tokenizer.link(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===i.type&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(i=this.tokenizer.emStrong(e,l,o))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.codespan(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.br(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.del(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.autolink(e))e=e.substring(i.raw.length),t.push(i);else if(this.state.inLink||!(i=this.tokenizer.url(e))){if(n=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const i=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},i),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(n=e.substring(0,t+1))}if(i=this.tokenizer.inlineText(n))e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(o=i.raw.slice(-1)),a=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(i.raw.length),t.push(i);return t}}class Gt{options;constructor(e){this.options=e||Ze}code(e,t,i){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+nt(s)+'">'+(i?e:nt(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:nt(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,i){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,i){const s=t?"ol":"ul";return"<"+s+(t&&1!==i?' start="'+i+'"':"")+">\n"+e+"</"+s+">\n"}listitem(e,t,i){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+e+`</${i}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,i){const s=ht(e);if(null===s)return i;let n='<a href="'+(e=s)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+i+"</a>",n}image(e,t,i){const s=ht(e);if(null===s)return i;let n=`<img src="${e=s}" alt="${i}"`;return t&&(n+=` title="${t}"`),n+=">",n}text(e){return e}}class Jt{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,i){return""+i}image(e,t,i){return""+i}br(){return""}}class ei{options;renderer;textRenderer;constructor(e){this.options=e||Ze,this.options.renderer=this.options.renderer||new Gt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Jt}static parse(e,t){return new ei(t).parse(e)}static parseInline(e,t){return new ei(t).parseInline(e)}parse(e,t=!0){let i="";for(let s=0;s<e.length;s++){const n=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=n,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){i+=t||"";continue}}switch(n.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":{const e=n;i+=this.renderer.heading(this.parseInline(e.tokens),e.depth,at(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=n;i+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=n;let t="",s="";for(let t=0;t<e.header.length;t++)s+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(s);let r="";for(let t=0;t<e.rows.length;t++){const i=e.rows[t];s="";for(let t=0;t<i.length;t++)s+=this.renderer.tablecell(this.parseInline(i[t].tokens),{header:!1,align:e.align[t]});r+=this.renderer.tablerow(s)}i+=this.renderer.table(t,r);continue}case"blockquote":{const e=n,t=this.parse(e.tokens);i+=this.renderer.blockquote(t);continue}case"list":{const e=n,t=e.ordered,s=e.start,r=e.loose;let a="";for(let t=0;t<e.items.length;t++){const i=e.items[t],s=i.checked,n=i.task;let o="";if(i.task){const e=this.renderer.checkbox(!!s);r?i.tokens.length>0&&"paragraph"===i.tokens[0].type?(i.tokens[0].text=e+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&"text"===i.tokens[0].tokens[0].type&&(i.tokens[0].tokens[0].text=e+" "+i.tokens[0].tokens[0].text)):i.tokens.unshift({type:"text",text:e+" "}):o+=e+" "}o+=this.parse(i.tokens,r),a+=this.renderer.listitem(o,n,!!s)}i+=this.renderer.list(a,t,s);continue}case"html":{const e=n;i+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=n;i+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=n,a=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1<e.length&&"text"===e[s+1].type;)r=e[++s],a+="\n"+(r.tokens?this.parseInline(r.tokens):r.text);i+=t?this.renderer.paragraph(a):a;continue}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}parseInline(e,t){t=t||this.renderer;let i="";for(let s=0;s<e.length;s++){const n=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){i+=e||"";continue}}switch(n.type){case"escape":{const e=n;i+=t.text(e.text);break}case"html":{const e=n;i+=t.html(e.text);break}case"link":{const e=n;i+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=n;i+=t.image(e.href,e.title,e.text);break}case"strong":{const e=n;i+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=n;i+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=n;i+=t.codespan(e.text);break}case"br":i+=t.br();break;case"del":{const e=n;i+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=n;i+=t.text(e.text);break}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}}class ti{options;constructor(e){this.options=e||Ze}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const ii=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Kt.lex,ei.parse);parseInline=this.#e(Kt.lexInline,ei.parseInline);Parser=ei;Renderer=Gt;TextRenderer=Jt;Lexer=Kt;Tokenizer=gt;Hooks=ti;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(const s of e)switch(i=i.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)i=i.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;i=i.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{const n=e[s].flat(1/0);i=i.concat(this.walkTokens(n,t))})):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const i={...e};if(i.async=this.defaults.async||i.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const i=t.renderers[e.name];t.renderers[e.name]=i?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=i.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const i=t[e.level];i?i.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),i.extensions=t),e.renderer){const t=this.defaults.renderer||new Gt(this.defaults);for(const i in e.renderer){if(!(i in t))throw new Error(`renderer '${i}' does not exist`);if("options"===i)continue;const s=i,n=e.renderer[s],r=t[s];t[s]=(...e)=>{let i=n.apply(t,e);return!1===i&&(i=r.apply(t,e)),i||""}}i.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new gt(this.defaults);for(const i in e.tokenizer){if(!(i in t))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const s=i,n=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let i=n.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new ti;for(const i in e.hooks){if(!(i in t))throw new Error(`hook '${i}' does not exist`);if("options"===i)continue;const s=i,n=e.hooks[s],r=t[s];ti.passThroughHooks.has(i)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(n.call(t,e)).then((e=>r.call(t,e)));const i=n.call(t,e);return r.call(t,i)}:t[s]=(...e)=>{let i=n.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;i.walkTokens=function(e){let i=[];return i.push(s.call(this,e)),t&&(i=i.concat(t.call(this,e))),i}}this.defaults={...this.defaults,...i}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Kt.lex(e,t??this.defaults)}parser(e,t){return ei.parse(e,t??this.defaults)}#e(e,t){return(i,s)=>{const n={...s},r={...this.defaults,...n};!0===this.defaults.async&&!1===n.async&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const a=this.#t(!!r.silent,!!r.async);if(null==i)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof i)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(i):i).then((t=>e(t,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>t(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(a);try{r.hooks&&(i=r.hooks.preprocess(i));let s=e(i,r);r.hooks&&(s=r.hooks.processAllTokens(s)),r.walkTokens&&this.walkTokens(s,r.walkTokens);let n=t(s,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(e){return a(e)}}}#t(e,t){return i=>{if(i.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+nt(i.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(i);throw i}}};function si(e,t){return ii.parse(e,t)}si.options=si.setOptions=function(e){return ii.setOptions(e),si.defaults=ii.defaults,Ke(si.defaults),si},si.getDefaults=Ye,si.defaults=Ze,si.use=function(...e){return ii.use(...e),si.defaults=ii.defaults,Ke(si.defaults),si},si.walkTokens=function(e,t){return ii.walkTokens(e,t)},si.parseInline=ii.parseInline,si.Parser=ei,si.parser=ei.parse,si.Renderer=Gt,si.TextRenderer=Jt,si.Lexer=Kt,si.lexer=Kt.lex,si.Tokenizer=gt,si.Hooks=ti,si.parse=si,si.options,si.setOptions,si.use,si.walkTokens,si.parseInline,ei.parse,Kt.lex;var ni=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};const ri=["jpg","jpeg","png","gif","webp"],ai=["pdf","doc","docx","xls","xlsx","csv","html","md","txt","json","xml",...ri,"mp4","webm","ogg","mov"];let oi=class extends he{constructor(){super(...arguments),this._reader=null,this._decoder=new TextDecoder,this._buffer="",this._userHasScrolledUp=!1,this._isDragging=!1,this._isResizing=!1,this._overlay=null,this._resizeDir="",this._dragStartX=0,this._dragStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._resizeStartW=0,this._resizeStartH=0,this._debugResizeStartX=0,this._debugResizeStartW=0,this._dragDepth=0,this._pendingSeq=0,this._pendingAttachAnalyze=!0,this._orgSkillRequestId=0,this._globalSkillRequestId=0,this._invocableSkillRequestId=0,this._globalSkillPending=new Set,this._speechRecognition=null,this._speechBaseValue="",this._speechFinalTranscript="",this.send=null,this.load=null,this.messages=[],this.label="Kat",this.placeholder="Type a message...",this.opened=!1,this.hideToggle=!1,this.variant="floating",this.conversationId=null,this._inputValue="",this._isStreaming=!1,this._error="",this._contextWarning="",this._contextLimitReached=!1,this._contextLimitMessage="",this._telemetry=null,this._iterationLog=[],this._cacheCheckpoints={},this._debugPanelOpen=!1,this._debugDrawerWidth=430,this._isDebugResizing=!1,this._pendingConversationFiles=[],this._isDraggingFile=!1,this._skillMenuOpened=!1,this._skillQuery="",this._orgSkills=[],this._globalSkills=[],this._invocableSkills=[],this._aiFrameworkConfig={},this._skillHighlighted=0,this._copiedIndex=-1,this._skillBrowseOpened=!1,this._skillBrowseSource="org",this._skillBrowseQuery="",this._isDictating=!1,this._handleDocumentClick=e=>{if(!this._skillMenuOpened)return;e.composedPath().some((e=>e instanceof HTMLElement&&(e.classList.contains("skill-menu")||e.classList.contains("input")||e.classList.contains("input-plus"))))||(this._skillMenuOpened=!1)},this._handleMouseMove=e=>{if(this._isDragging){let t=this._dragStartLeft+(e.clientX-this._dragStartX),i=this._dragStartTop+(e.clientY-this._dragStartY);const s=this._panelEl.offsetWidth;t=Math.max(48-s,Math.min(t,window.innerWidth-48)),i=Math.max(0,Math.min(i,window.innerHeight-48)),this._panelEl.style.left=t+"px",this._panelEl.style.top=i+"px"}else if(this._isResizing){const t=e.clientX-this._dragStartX,i=e.clientY-this._dragStartY,s=340,n=380,r=.9*window.innerWidth,a=window.innerHeight-72;let o=this._resizeStartW,l=this._resizeStartH,h=this._dragStartLeft,c=this._dragStartTop;this._resizeDir.includes("e")&&(o=Math.max(s,Math.min(this._resizeStartW+t,r))),this._resizeDir.includes("w")&&(o=Math.max(s,Math.min(this._resizeStartW-t,r)),h=this._dragStartLeft+(this._resizeStartW-o)),this._resizeDir.includes("s")&&(l=Math.max(n,Math.min(this._resizeStartH+i,a))),this._resizeDir.includes("n")&&(l=Math.max(n,Math.min(this._resizeStartH-i,a)),c=this._dragStartTop+(this._resizeStartH-l)),h=Math.max(0,h),c=Math.max(0,c),this._panelEl.style.width=o+"px",this._panelEl.style.height=l+"px",this._panelEl.style.left=h+"px",this._panelEl.style.top=c+"px"}},this._handleMouseUp=()=>{this._isDragging&&(this._isDragging=!1,this._panelEl.classList.remove("panel--dragging")),this._isResizing&&(this._isResizing=!1,this._panelEl.classList.remove("panel--resizing")),this._overlay&&(this._overlay.style.display="none"),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._saveState()},this._handleDebugResizeMouseMove=e=>{if(!this._isDebugResizing)return;const t=e.clientX-this._debugResizeStartX,i=Math.max(300,this.offsetWidth-300);this._debugDrawerWidth=Math.max(300,Math.min(this._debugResizeStartW-t,i))},this._handleDebugResizeMouseUp=()=>{this._isDebugResizing=!1,document.removeEventListener("mousemove",this._handleDebugResizeMouseMove),document.removeEventListener("mouseup",this._handleDebugResizeMouseUp),this._saveState()}}connectedCallback(){super.connectedCallback(),this.load||(this.load=()=>null==this.conversationId?Promise.resolve([]):s.fetch({url:`/api/system/conversation/${this.conversationId}/messages`}).then((e=>e.json())).then((e=>Promise.all((e?.data||[]).map((e=>{let t=[];try{t=JSON.parse(e.conversationFileIDs||"[]")}catch{}return t.length?Promise.all(t.map((e=>s.fetch({url:`/api/system/conversationFile/${e}`}).then((e=>e.json())).then((e=>e?.data)).catch((()=>null))))).then((t=>(e.conversationFiles=t.filter((e=>null!=e)),e))):Promise.resolve(e)})))))),this.load().then((e=>{e&&e.length&&(this.messages=e)})).catch((()=>{})),s.fetch({url:"/api/system/integration/aws/bedrock/aiFrameworkConfig"}).then((e=>e.json())).then((e=>{this._aiFrameworkConfig=e?.data||{}})).catch((()=>{})),"inline"===this.variant&&(this.opened=!0),this._restoreState(),document.addEventListener("click",this._handleDocumentClick)}disconnectedCallback(){super.disconnectedCallback(),this._reader&&(this._reader.cancel(),this._reader=null),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),document.removeEventListener("click",this._handleDocumentClick),this._speechRecognition&&(this._speechRecognition.abort(),this._speechRecognition=null,this._isDictating=!1),this._pendingConversationFiles.forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}))}updated(e){e.has("messages")&&(this._userHasScrolledUp||this._isStreaming||!this._messagesEl||requestAnimationFrame((()=>{this._messagesEl&&(this._messagesEl.scrollTop=this._messagesEl.scrollHeight)}))),e.has("opened")&&this.opened&&this._inputEl&&setTimeout((()=>{this._inputEl&&this._inputEl.focus()}),200),this._skillMenuOpened&&this._positionSkillMenu(),e.has("_skillHighlighted")&&this._skillMenuOpened&&this._skillMenuEl?.querySelector(".skill-menu__item--highlighted")?.scrollIntoView({block:"nearest"})}_positionSkillMenu(){requestAnimationFrame((()=>{if(!this._skillMenuEl||!this._inputWrapperEl)return;const e=this._inputWrapperEl.getBoundingClientRect();this._skillMenuEl.style.left=e.left+"px",this._skillMenuEl.style.width=e.width+"px";const t=this._panelEl.getBoundingClientRect().top+8,i=e.top-8-t;this._skillMenuEl.style.maxHeight=i+"px";const s=this._skillMenuEl.getBoundingClientRect(),n=Math.max(t,e.top-s.height-8);this._skillMenuEl.style.top=n+"px"}))}stop(){this._handleStop()}isStreaming(){return this._isStreaming}open(){this.opened||this._handleToggle()}close(){this.opened&&this._handleToggle()}toggle(){this._handleToggle()}_showOverlay(){this._overlay||(this._overlay=document.createElement("div"),this._overlay.style.cssText="position:fixed; inset:0; z-index:9999; display:none;",document.body.appendChild(this._overlay)),this._overlay.style.display="block"}_handleHeaderMouseDown(e){if("inline"===this.variant)return;if(e.target.closest("button"))return;if(!this._panelEl)return;this._isDragging=!0,this._panelEl.classList.add("panel--dragging"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,e.preventDefault(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleResizeMouseDown(e){if("inline"===this.variant)return;if(!this._panelEl)return;this._isResizing=!0,this._resizeDir=e.currentTarget.dataset.dir||"",this._panelEl.classList.add("panel--resizing"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,this._resizeStartW=t.width,this._resizeStartH=t.height,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleToggle(){this.opened=!this.opened,this.opened&&this._panelEl&&this._applyStoredLayout(),this._saveState()}_saveState(){try{const e={opened:String(this.opened),message:this._inputValue,debugPanelOpen:String(this._debugPanelOpen),debugDrawerWidth:String(this._debugDrawerWidth)};if(this._panelEl){const t=this._panelEl.style;t.left&&(e.left=t.left),t.top&&(e.top=t.top),t.width&&(e.width=t.width),t.height&&(e.height=t.height),t.position&&(e.position=t.position)}localStorage.setItem("kr-chatbot-state",JSON.stringify(e))}catch{}}_restoreState(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e)return;const t=JSON.parse(e);"string"==typeof t.message&&"/"!==t.message.trim()&&(this._inputValue=t.message),this._debugPanelOpen="true"===t.debugPanelOpen;const i=Number(t.debugDrawerWidth);i>=300&&(this._debugDrawerWidth=i),"inline"!==this.variant&&"true"===t.opened&&(this.opened=!0,this.updateComplete.then((()=>this._applyStoredLayout())))}catch{}}_applyStoredLayout(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e||!this._panelEl)return;const t=JSON.parse(e);t.position&&(this._panelEl.style.position=t.position),t.left&&(this._panelEl.style.left=t.left),t.top&&(this._panelEl.style.top=t.top),t.width&&(this._panelEl.style.width=t.width),t.height&&(this._panelEl.style.height=t.height)}catch{}}_handleInputChange(e){this._inputValue=e.target.value,this._saveState();const t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px";const i=this._inputValue.match(/^\/(\S*)$/);i?(this._skillMenuOpened=!0,this._skillQuery=i[1],this._skillHighlighted=0,this._searchInvocableSkills(this._skillQuery)):this._skillMenuOpened=!1}_handleKeyDown(e){if(this._skillMenuOpened){let t=3;"inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled&&(t=5);const i=t+this._invocableSkills.length;if("ArrowDown"===e.key)return e.preventDefault(),void(this._skillHighlighted=(this._skillHighlighted+1)%i);if("ArrowUp"===e.key)return e.preventDefault(),void(this._skillHighlighted=(this._skillHighlighted-1+i)%i);if("Enter"===e.key&&!e.shiftKey)return e.preventDefault(),void this._activateSkillMenuItem(this._skillHighlighted);if("Escape"===e.key)return e.preventDefault(),void(this._skillMenuOpened=!1)}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this._handleSubmit())}_activateSkillMenuItem(e){const t="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;let i=3;if(t&&(i=5),0===e)return void this._openFilePicker(!0);if(1===e)return void this._openFilePicker(!1);if(2===e)return void this._handleSkillBrowseOpen();if(t&&3===e)return this._skillMenuOpened=!1,void this._send({message:"/test-context-warning",conversationFiles:[]});if(t&&4===e)return this._skillMenuOpened=!1,void this._send({message:"/test-context-limit",conversationFiles:[]});const s=this._invocableSkills[e-i];s&&this._handleSkillSelect(s)}_searchOrgSkills(e){this._orgSkillRequestId++;const t=this._orgSkillRequestId,i=e.trim();let n={match_all:{}};i&&(n={bool:{should:[{wildcard:{"name.raw":{value:`*${i.replace(/([*?\\])/g,"\\$1")}*`,case_insensitive:!0}}},{wildcard:{"code.raw":{value:`*${i.replace(/([*?\\])/g,"\\$1")}*`,case_insensitive:!0}}},{wildcard:{"description.raw":{value:`*${i.replace(/([*?\\])/g,"\\$1")}*`,case_insensitive:!0}}}],minimum_should_match:1}}),s.fetch({url:"/api/system/opensearch/aiskills/search",method:"POST",body:{size:100,query:{bool:{must:[n],filter:[{term:{active:!0}}],must_not:[{term:{globalPublished:!0}}]}}}}).then((e=>e.json())).then((e=>{t===this._orgSkillRequestId&&(this._orgSkills=(e?.data?.hits?.hits||[]).map((e=>e._source)))})).catch((e=>{console.error("kr-chatbot: skill search failed",e)}))}_searchInvocableSkills(e){this._invocableSkillRequestId++;const t=this._invocableSkillRequestId;s.fetch({url:"/api/system/conversation/availableSkills",method:"POST",body:{query:e.trim()}}).then((e=>e.json())).then((e=>{t===this._invocableSkillRequestId&&(this._invocableSkills=e?.data||[])})).catch((e=>{console.error("kr-chatbot: invocable skill search failed",e)}))}_searchGlobalSkills(e){this._globalSkillRequestId++;const t=this._globalSkillRequestId;s.fetch({url:"/api/system/conversation/globalSkillCatalog",method:"POST",body:{query:e.trim()}}).then((e=>e.json())).then((e=>{t===this._globalSkillRequestId&&(this._globalSkills=e?.data||[])})).catch((e=>{console.error("kr-chatbot: global skill search failed",e)}))}_handleGlobalSkillEnable(e,t){if(t.stopPropagation(),this._globalSkillPending.has(e.code))return;const i=t.currentTarget;this._globalSkillPending.add(e.code),i?.showLoading(),s.fetch({url:`/api/system/opensearch/aiskills/global/${encodeURIComponent(e.code)}/enabled`,method:"POST",body:{enabled:!e.enabled}}).then((e=>e.json())).then((t=>{e.enabled=t?.data?.enabled,i?.reset(),this.requestUpdate()})).catch((e=>{console.error("kr-chatbot: global skill enable failed",e),i?.showError("Error")})).finally((()=>{this._globalSkillPending.delete(e.code)}))}_handlePlusClick(){this._skillMenuOpened?this._skillMenuOpened=!1:(this._skillQuery="",this._skillHighlighted=0,this._skillMenuOpened=!0,this._searchInvocableSkills(""))}_handleMicClick(){if(this._speechRecognition)return void this._speechRecognition.stop();const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e)return;const t=new e;t.continuous=!0,t.interimResults=!0,this._speechBaseValue=this._inputValue,this._speechBaseValue&&!this._speechBaseValue.endsWith(" ")&&(this._speechBaseValue+=" "),this._speechFinalTranscript="",t.onresult=e=>{let t="";for(let i=e.resultIndex;i<e.results.length;i++)e.results[i].isFinal?this._speechFinalTranscript+=e.results[i][0].transcript:t+=e.results[i][0].transcript;this._inputValue=this._speechBaseValue+this._speechFinalTranscript+t,this._saveState(),this._inputEl&&(this._inputEl.style.height="auto",this._inputEl.style.height=Math.min(this._inputEl.scrollHeight,120)+"px")},t.onerror=e=>{"not-allowed"!==e.error&&"service-not-allowed"!==e.error||(this._error="Microphone access is blocked. Allow it in your browser settings to use voice input.")},t.onend=()=>{this._speechRecognition=null,this._isDictating=!1},this._speechRecognition=t,this._isDictating=!0,this._error="",t.start(),this._inputEl?.focus()}_handleSkillSelect(e){!1!==e.enabled&&(this._inputValue=`/${e.code} `,this._saveState(),this._skillMenuOpened=!1,this._skillBrowseOpened=!1,this._inputEl?.focus())}_handleSkillCardKeydown(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._handleSkillSelect(t))}_handleCopyMessage(e,t){navigator.clipboard.writeText(e).then((()=>{this._copiedIndex=t,setTimeout((()=>{this._copiedIndex===t&&(this._copiedIndex=-1)}),2e3)})).catch((()=>{}))}_handleSkillBrowseOpen(){this._skillMenuOpened=!1,this._skillBrowseQuery="",this._skillBrowseOpened=!0,this._searchOrgSkills(""),this._searchGlobalSkills("")}_handleSkillBrowseClose(){this._skillBrowseOpened=!1}_handleSkillBrowseSearch(e){this._skillBrowseQuery=e.target.value,this._searchOrgSkills(this._skillBrowseQuery),this._searchGlobalSkills(this._skillBrowseQuery)}_handleSkillBrowseTabChange(e){this._skillBrowseSource=e.detail.activeTabId}_openFilePicker(e=!0){this._skillMenuOpened=!1,"/"===this._inputValue.trim()&&(this._inputValue="",this._saveState()),this._pendingAttachAnalyze=e,this._fileInputEl?.click()}_handleFileInputChange(e){const t=e.target;t.files&&this._addFiles(t.files,this._pendingAttachAnalyze),t.value=""}_handlePaste(e){const t=e.clipboardData?.items;if(!t)return;const i=[];for(let e=0;e<t.length;e++)if("file"===t[e].kind){const s=t[e].getAsFile();s&&i.push(s)}i.length&&(e.preventDefault(),this._addFiles(i))}_handleDragEnter(e){this._hasFiles(e)&&(e.preventDefault(),this._dragDepth++,this._isDraggingFile=!0)}_handleDragOver(e){this._hasFiles(e)&&e.preventDefault()}_handleDragLeave(e){this._hasFiles(e)&&(this._dragDepth--,this._dragDepth<=0&&(this._dragDepth=0,this._isDraggingFile=!1))}_handleDrop(e){this._hasFiles(e)&&(e.preventDefault(),this._dragDepth=0,this._isDraggingFile=!1,e.dataTransfer?.files&&this._addFiles(e.dataTransfer.files))}_hasFiles(e){return Array.from(e.dataTransfer?.types||[]).includes("Files")}_getFileExtension(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t+1).toLowerCase()}_addFiles(e,t=!0){const i=Array.from(e).filter((e=>ai.includes(this._getFileExtension(e.name))));i.length&&i.forEach((e=>{let i;(e.type.startsWith("image/")||ri.includes(this._getFileExtension(e.name)))&&(i=URL.createObjectURL(e));const s={localId:"att-"+this._pendingSeq++,file:e,name:e.name,mimeType:e.type,previewUrl:i,aiAnalyze:t};this._pendingConversationFiles=[...this._pendingConversationFiles,s]}))}_handlePendingRemove(e){const t=this._pendingConversationFiles.find((t=>t.localId===e));t?.previewUrl&&URL.revokeObjectURL(t.previewUrl),this._pendingConversationFiles=this._pendingConversationFiles.filter((t=>t.localId!==e))}_clearPending(){this._pendingConversationFiles.forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),this._pendingConversationFiles=[]}_handleFileOpen(e){const t=e.previewUrl||`${s.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view`;i.open({src:t,name:e.niceName||"file"}).addEventListener("download",(()=>{window.open(`${s.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view?download=true`,"_blank")}))}_handleSubmit(){if(this._isStreaming)return;const e=this._inputValue.trim(),t=this._pendingConversationFiles;if(!e&&!t.length)return;const i=t.map((e=>({file:e.file,aiAnalyze:e.aiAnalyze}))),s=new CustomEvent("message-submit",{detail:{message:e,conversationFiles:i},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented||this._send({message:e,conversationFiles:i})}_send(e){const t={type:"user",content:e.message};this._pendingConversationFiles.length&&(t.conversationFiles=this._pendingConversationFiles.map((e=>({conversationFileID:-1,niceName:e.name,mimeType:e.mimeType,aiAnalyze:e.aiAnalyze,previewUrl:e.previewUrl})))),this._speechRecognition&&this._speechRecognition.abort(),this.messages=[...this.messages,t],this._inputValue="",this._saveState(),this._error="",this._userHasScrolledUp=!1,this._pendingConversationFiles=[],this._inputEl&&(this._inputEl.style.height="auto"),this.messages=[...this.messages,{type:"assistant",content:""}],this._isStreaming=!0,this.updateComplete.then((()=>{if(!this._messagesEl)return;this._messagesEl.querySelectorAll(".message--assistant").forEach((e=>{e.style.minHeight=""}));const e=this._messagesEl.querySelectorAll(".message"),t=e[this.messages.length-2],i=e[this.messages.length-1];i&&(i.style.minHeight=this._messagesEl.clientHeight+"px"),t&&(this._messagesEl.scrollTop=t.offsetTop-this._messagesEl.offsetTop-24)})),this.send||(this.send=e=>{let t=Promise.resolve([]);return e.conversationFiles.length&&(t=Promise.all(e.conversationFiles.map((({file:e,aiAnalyze:t})=>{const i=new FormData;return i.append("file",e),i.append("type","LIBRARY"),i.append("niceName",e.name),t||i.append("aiAnalyze","false"),s.fetch({url:"/api/system/conversationFile/upload",method:"POST",body:i}).then((e=>e.json())).then((e=>e.data))})))),t.then((t=>{if(t.length)for(let e=this.messages.length-1;e>=0;e--)if("user"===this.messages[e].type){(this.messages[e].conversationFiles||[]).forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),this.messages[e].conversationFiles=t,this.requestUpdate();break}const i={userText:e.message,fileIds:t.map((e=>e.conversationFileID))};return null!=this.conversationId?i.conversationID=this.conversationId:i.createNew=!0,s.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState",method:"POST",headers:{Accept:"text/event-stream"},body:i}).then((e=>(null==this.conversationId&&s.fetch({url:"/api/system/conversation/last"}).then((e=>e.json())).then((e=>{const t=e?.data,i=t?.conversationID;"number"==typeof i&&(this.conversationId=i,this.dispatchEvent(new CustomEvent("conversation-created",{detail:{conversation:t},bubbles:!0,composed:!0})))})).catch((()=>{})),e)))}))}),this.send({message:e.message,messages:this.messages.slice(0,-1),conversationFiles:e.conversationFiles}).then((e=>{e.ok?e.body?(this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",this._readStreamChunk()):this._handleStreamError("No response body"):this._handleStreamError("Request failed: "+e.status)})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_handleStop(){this._reader&&(this._reader.cancel(),this._reader=null),this._isStreaming=!1}_handleMessagesScroll(e){const t=e.target,i=t.scrollHeight-t.scrollTop-t.clientHeight;this._userHasScrolledUp=i>50}_handleErrorDismiss(){this._error=""}_handleContextWarningDismiss(){this._contextWarning=""}_handleToggleDebugPanel(){this._debugPanelOpen=!this._debugPanelOpen,this._saveState()}_handleDebugResizeMouseDown(e){this._isDebugResizing=!0,this._debugResizeStartX=e.clientX,this._debugResizeStartW=this._debugDrawerWidth,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleDebugResizeMouseMove),document.addEventListener("mouseup",this._handleDebugResizeMouseUp)}_readStreamChunk(){this._reader&&this._reader.read().then((e=>{if(e.done)return this._isStreaming=!1,void(this._reader=null);this._buffer=this._buffer+this._decoder.decode(e.value,{stream:!0});const t=this._buffer.split("\n\n");this._buffer=t.pop()||"";for(let e=0;e<t.length;e++){if(!t[e].trim())continue;const i=t[e].split("\n");for(let e=0;e<i.length;e++){if(!i[e].startsWith("data:"))continue;const t=i[e].slice(5).trim();if(!t)continue;let s;try{s=JSON.parse(t)}catch{continue}if(this.dispatchEvent(new CustomEvent("stream-event",{detail:s,bubbles:!0,composed:!0})),"REASONING_PART"===s.type){if(s.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&(this.messages[e].reasoning||(this.messages[e].reasoning=""),this.messages[e].reasoning+=String(s.message),this.requestUpdate())}}else if("RESPONSE_PART"===s.type){if(s.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&(this.messages[e].content+=String(s.message),this.requestUpdate())}}else if("ERROR"===s.type)this._handleStreamError(String(s.message||"Unknown error"));else if("CONVERSATION_TOKEN_WARNING"===s.type)this._contextWarning=String(s.message||"");else if("CONVERSATION_TITLE"===s.type){if(s.data){const e=String(s.data.title||"");e&&(this.label=e,this.dispatchEvent(new CustomEvent("conversation-title",{detail:{title:e},bubbles:!0,composed:!0})))}}else if("CONVERSATION_LIMIT_REACHED"===s.type)this._contextLimitReached=!0,this._contextLimitMessage=String(s.message||""),this._contextWarning="";else if("TOKEN_USAGE"===s.type){if(s.data){const e=s.data;this._telemetry=e,1===e.iteration?(this._iterationLog=[e],this._cacheCheckpoints={}):this._iterationLog=[...this._iterationLog,e]}}else if("CACHE_CHECKPOINT"===s.type&&s.data){const e=s.data;this._cacheCheckpoints={...this._cacheCheckpoints,[e.iteration]:e}}s.finished&&(this._isStreaming=!1,this._reader=null)}}this._readStreamChunk()})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_handleStreamError(e){if(this._isStreaming=!1,this._error=e,this._reader&&(this._reader.cancel(),this._reader=null),this.messages.length>0){const e=this.messages[this.messages.length-1];"assistant"!==e.type||e.content||(this.messages=this.messages.slice(0,-1))}}_renderSkillMenu(){const e=this._invocableSkills,t="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;let i=3;return t&&(i=5),W`
1384
+ */function Ze(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Ke={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Ge(e){Ke=e}const Je=/[&<>"']/,et=new RegExp(Je.source,"g"),tt=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,it=new RegExp(tt.source,"g"),st={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nt=e=>st[e];function rt(e,t){if(t){if(Je.test(e))return e.replace(et,nt)}else if(tt.test(e))return e.replace(it,nt);return e}const ot=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function at(e){return e.replace(ot,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const lt=/(^|[^\[])\^/g;function ht(e,t){let i="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let n="string"==typeof t?t:t.source;return n=n.replace(lt,"$1"),i=i.replace(e,n),s},getRegex:()=>new RegExp(i,t)};return s}function ct(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const dt={exec:()=>null};function pt(e,t){const i=e.replace(/\|/g,((e,t,i)=>{let s=!1,n=t;for(;--n>=0&&"\\"===i[n];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(/\\\|/g,"|");return i}function ut(e,t,i){const s=e.length;if(0===s)return"";let n=0;for(;n<s;){if(e.charAt(s-n-1)!==t)break;n++}return e.slice(0,s-n)}function gt(e,t,i,s){const n=t.href,r=t.title?rt(t.title):null,o=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:i,href:n,title:r,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,e}return{type:"image",raw:i,href:n,title:r,text:rt(o)}}class mt{options;rules;lexer;constructor(e){this.options=e||Ke}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:ut(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],i=function(e,t){const i=e.match(/^(\s+)(?:```)/);if(null===i)return t;const s=i[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[i]=t;return i.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=ut(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=ut(e.replace(/^ *>[ \t]?/gm,""),"\n");const i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim();const s=i.length>1,n={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");const r=new RegExp(`^( {0,3}${i})((?:[\t ][^\\n]*)?(?:\\n|$))`);let o="",a="",l=!1;for(;e;){let i=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),h=e.split("\n",1)[0],c=0;this.options.pedantic?(c=2,a=s.trimStart()):(c=t[2].search(/[^ ]/),c=c>4?1:c,a=s.slice(c),c+=t[1].length);let d=!1;if(!s&&/^ *$/.test(h)&&(o+=h+"\n",e=e.substring(h.length+1),i=!0),!i){const t=new RegExp(`^ {0,${Math.min(3,c-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),i=new RegExp(`^ {0,${Math.min(3,c-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),n=new RegExp(`^ {0,${Math.min(3,c-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,c-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(h=l,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),n.test(h))break;if(r.test(h))break;if(t.test(h))break;if(i.test(e))break;if(h.search(/[^ ]/)>=c||!h.trim())a+="\n"+h.slice(c);else{if(d)break;if(s.search(/[^ ]/)>=4)break;if(n.test(s))break;if(r.test(s))break;if(i.test(s))break;a+="\n"+h}d||h.trim()||(d=!0),o+=l+"\n",e=e.substring(l.length+1),s=h.slice(c)}}n.loose||(l?n.loose=!0:/\n *\n *$/.test(o)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(a),u&&(p="[ ] "!==u[0],a=a.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:o,task:!!u,checked:p,loose:!1,text:a,tokens:[]}),n.raw+=o}n.items[n.items.length-1].raw=o.trimEnd(),n.items[n.items.length-1].text=a.trimEnd(),n.raw=n.raw.trimEnd();for(let e=0;e<n.items.length;e++)if(this.lexer.state.top=!1,n.items[e].tokens=this.lexer.blockTokens(n.items[e].text,[]),!n.loose){const t=n.items[e].tokens.filter((e=>"space"===e.type)),i=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));n.loose=i}if(n.loose)for(let e=0;e<n.items.length;e++)n.items[e].loose=!0;return n}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:i,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const i=pt(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),n=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===s.length){for(const e of s)/^ *-+: *$/.test(e)?r.align.push("right"):/^ *:-+: *$/.test(e)?r.align.push("center"):/^ *:-+ *$/.test(e)?r.align.push("left"):r.align.push(null);for(const e of i)r.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of n)r.rows.push(pt(e,r.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:rt(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=ut(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let i=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])i++;else if(e[s]===t[1]&&(i--,i<0))return s;return-1}(t[2],"()");if(e>-1){const i=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);e&&(i=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(i=this.options.pedantic&&!/>$/.test(e)?i.slice(1):i.slice(1,-1)),gt(t,{href:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){const e=t[(i[2]||i[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=i[0].charAt(0);return{type:"text",raw:e,text:e}}return gt(i,e,i[0],this.lexer)}}emStrong(e,t,i=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&i.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!i||this.rules.inline.punctuation.exec(i)){const i=[...s[0]].length-1;let n,r,o=i,a=0;const l="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+i);null!=(s=l.exec(t));){if(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!n)continue;if(r=[...n].length,s[3]||s[4]){o+=r;continue}if((s[5]||s[6])&&i%3&&!((i+r)%3)){a+=r;continue}if(o-=r,o>0)continue;r=Math.min(r,r+o+a);const t=[...s[0]][0].length,l=e.slice(0,i+s.index+t+r);if(Math.min(i,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const h=l.slice(2,-2);return{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const i=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return i&&s&&(e=e.substring(1,e.length-1)),e=rt(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,i;return"@"===t[2]?(e=rt(t[1]),i="mailto:"+e):(e=rt(t[1]),i=e),{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,i;if("@"===t[2])e=rt(t[0]),i="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=rt(t[0]),i="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:rt(t[0]),{type:"text",raw:t[0],text:e}}}}const ft=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,bt=/(?:[*+-]|\d{1,9}[.)])/,vt=ht(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,bt).replace(/blockCode/g,/ {4}/).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/).getRegex(),xt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,_t=/(?!\s*\])(?:\\.|[^\[\]\\])+/,kt=ht(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",_t).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yt=ht(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bt).getRegex(),wt="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",$t=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,St=ht("^ {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",$t).replace("tag",wt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),It=ht(xt).replace("hr",ft).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",wt).getRegex(),Et={blockquote:ht(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",It).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:kt,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:ft,html:St,lheading:vt,list:yt,newline:/^(?: *(?:\n|$))+/,paragraph:It,table:dt,text:/^[^\n]+/},Ct=ht("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",wt).getRegex(),zt={...Et,table:Ct,paragraph:ht(xt).replace("hr",ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ct).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",wt).getRegex()},At={...Et,html:ht("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",$t).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:dt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ht(xt).replace("hr",ft).replace("heading"," *#{1,6} *[^\n]").replace("lheading",vt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Rt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Tt=/^( {2,}|\\)\n(?!\s*$)/,Dt="\\p{P}\\p{S}",Mt=ht(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Dt).getRegex(),Pt=ht(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Dt).getRegex(),Nt=ht("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Dt).getRegex(),Ot=ht("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Dt).getRegex(),Ut=ht(/\\([punct])/,"gu").replace(/punct/g,Dt).getRegex(),Lt=ht(/^<(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(),Ft=ht($t).replace("(?:--\x3e|$)","--\x3e").getRegex(),jt=ht("^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",Ft).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ht=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Bt=ht(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ht).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qt=ht(/^!?\[(label)\]\[(ref)\]/).replace("label",Ht).replace("ref",_t).getRegex(),Wt=ht(/^!?\[(ref)\](?:\[\])?/).replace("ref",_t).getRegex(),Xt={_backpedal:dt,anyPunctuation:Ut,autolink:Lt,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:Tt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:dt,emStrongLDelim:Pt,emStrongRDelimAst:Nt,emStrongRDelimUnd:Ot,escape:Rt,link:Bt,nolink:Wt,punctuation:Mt,reflink:qt,reflinkSearch:ht("reflink|nolink(?!\\()","g").replace("reflink",qt).replace("nolink",Wt).getRegex(),tag:jt,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:dt},Qt={...Xt,link:ht(/^!?\[(label)\]\((.*?)\)/).replace("label",Ht).getRegex(),reflink:ht(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ht).getRegex()},Vt={...Xt,escape:ht(Rt).replace("])","~|])").getRegex(),url:ht(/^((?: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\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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Yt={...Vt,br:ht(Tt).replace("{2,}","*").getRegex(),text:ht(Vt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Zt={normal:Et,gfm:zt,pedantic:At},Kt={normal:Xt,gfm:Vt,breaks:Yt,pedantic:Qt};class Gt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ke,this.options.tokenizer=this.options.tokenizer||new mt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Zt.normal,inline:Kt.normal};this.options.pedantic?(t.block=Zt.pedantic,t.inline=Kt.pedantic):this.options.gfm&&(t.block=Zt.gfm,this.options.breaks?t.inline=Kt.breaks:t.inline=Kt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Zt,inline:Kt}}static lex(e,t){return new Gt(t).lex(e)}static lexInline(e,t){return new Gt(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let i,s,n,r;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,i)=>t+" ".repeat(i.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(i=s.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))))if(i=this.tokenizer.space(e))e=e.substring(i.raw.length),1===i.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(i);else if(i=this.tokenizer.code(e))e=e.substring(i.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(i):(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(i=this.tokenizer.fences(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.heading(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.hr(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.blockquote(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.list(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.html(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.def(e))e=e.substring(i.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}):(s.raw+="\n"+i.raw,s.text+="\n"+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(i=this.tokenizer.table(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.lheading(e))e=e.substring(i.raw.length),t.push(i);else{if(n=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const i=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},i),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(n=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(n)))s=t[t.length-1],r&&"paragraph"===s.type?(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i),r=n.length!==e.length,e=e.substring(i.raw.length);else if(i=this.tokenizer.text(e))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+i.raw,s.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(i);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let i,s,n,r,o,a,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(a=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(i=s.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))))if(i=this.tokenizer.escape(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.tag(e))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===i.type&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(i=this.tokenizer.link(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(i.raw.length),s=t[t.length-1],s&&"text"===i.type&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(i=this.tokenizer.emStrong(e,l,a))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.codespan(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.br(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.del(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.autolink(e))e=e.substring(i.raw.length),t.push(i);else if(this.state.inLink||!(i=this.tokenizer.url(e))){if(n=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const i=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},i),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(n=e.substring(0,t+1))}if(i=this.tokenizer.inlineText(n))e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(a=i.raw.slice(-1)),o=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=i.raw,s.text+=i.text):t.push(i);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(i.raw.length),t.push(i);return t}}class Jt{options;constructor(e){this.options=e||Ke}code(e,t,i){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+rt(s)+'">'+(i?e:rt(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:rt(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,i){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,i){const s=t?"ol":"ul";return"<"+s+(t&&1!==i?' start="'+i+'"':"")+">\n"+e+"</"+s+">\n"}listitem(e,t,i){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+e+`</${i}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,i){const s=ct(e);if(null===s)return i;let n='<a href="'+(e=s)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+i+"</a>",n}image(e,t,i){const s=ct(e);if(null===s)return i;let n=`<img src="${e=s}" alt="${i}"`;return t&&(n+=` title="${t}"`),n+=">",n}text(e){return e}}class ei{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,i){return""+i}image(e,t,i){return""+i}br(){return""}}class ti{options;renderer;textRenderer;constructor(e){this.options=e||Ke,this.options.renderer=this.options.renderer||new Jt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ei}static parse(e,t){return new ti(t).parse(e)}static parseInline(e,t){return new ti(t).parseInline(e)}parse(e,t=!0){let i="";for(let s=0;s<e.length;s++){const n=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=n,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){i+=t||"";continue}}switch(n.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":{const e=n;i+=this.renderer.heading(this.parseInline(e.tokens),e.depth,at(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=n;i+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=n;let t="",s="";for(let t=0;t<e.header.length;t++)s+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(s);let r="";for(let t=0;t<e.rows.length;t++){const i=e.rows[t];s="";for(let t=0;t<i.length;t++)s+=this.renderer.tablecell(this.parseInline(i[t].tokens),{header:!1,align:e.align[t]});r+=this.renderer.tablerow(s)}i+=this.renderer.table(t,r);continue}case"blockquote":{const e=n,t=this.parse(e.tokens);i+=this.renderer.blockquote(t);continue}case"list":{const e=n,t=e.ordered,s=e.start,r=e.loose;let o="";for(let t=0;t<e.items.length;t++){const i=e.items[t],s=i.checked,n=i.task;let a="";if(i.task){const e=this.renderer.checkbox(!!s);r?i.tokens.length>0&&"paragraph"===i.tokens[0].type?(i.tokens[0].text=e+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&"text"===i.tokens[0].tokens[0].type&&(i.tokens[0].tokens[0].text=e+" "+i.tokens[0].tokens[0].text)):i.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(i.tokens,r),o+=this.renderer.listitem(a,n,!!s)}i+=this.renderer.list(o,t,s);continue}case"html":{const e=n;i+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=n;i+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=n,o=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1<e.length&&"text"===e[s+1].type;)r=e[++s],o+="\n"+(r.tokens?this.parseInline(r.tokens):r.text);i+=t?this.renderer.paragraph(o):o;continue}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}parseInline(e,t){t=t||this.renderer;let i="";for(let s=0;s<e.length;s++){const n=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){i+=e||"";continue}}switch(n.type){case"escape":{const e=n;i+=t.text(e.text);break}case"html":{const e=n;i+=t.html(e.text);break}case"link":{const e=n;i+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=n;i+=t.image(e.href,e.title,e.text);break}case"strong":{const e=n;i+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=n;i+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=n;i+=t.codespan(e.text);break}case"br":i+=t.br();break;case"del":{const e=n;i+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=n;i+=t.text(e.text);break}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}}class ii{options;constructor(e){this.options=e||Ke}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const si=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Gt.lex,ti.parse);parseInline=this.#e(Gt.lexInline,ti.parseInline);Parser=ti;Renderer=Jt;TextRenderer=ei;Lexer=Gt;Tokenizer=mt;Hooks=ii;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(const s of e)switch(i=i.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)i=i.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;i=i.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{const n=e[s].flat(1/0);i=i.concat(this.walkTokens(n,t))})):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const i={...e};if(i.async=this.defaults.async||i.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const i=t.renderers[e.name];t.renderers[e.name]=i?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=i.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const i=t[e.level];i?i.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),i.extensions=t),e.renderer){const t=this.defaults.renderer||new Jt(this.defaults);for(const i in e.renderer){if(!(i in t))throw new Error(`renderer '${i}' does not exist`);if("options"===i)continue;const s=i,n=e.renderer[s],r=t[s];t[s]=(...e)=>{let i=n.apply(t,e);return!1===i&&(i=r.apply(t,e)),i||""}}i.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new mt(this.defaults);for(const i in e.tokenizer){if(!(i in t))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const s=i,n=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let i=n.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new ii;for(const i in e.hooks){if(!(i in t))throw new Error(`hook '${i}' does not exist`);if("options"===i)continue;const s=i,n=e.hooks[s],r=t[s];ii.passThroughHooks.has(i)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(n.call(t,e)).then((e=>r.call(t,e)));const i=n.call(t,e);return r.call(t,i)}:t[s]=(...e)=>{let i=n.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;i.walkTokens=function(e){let i=[];return i.push(s.call(this,e)),t&&(i=i.concat(t.call(this,e))),i}}this.defaults={...this.defaults,...i}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Gt.lex(e,t??this.defaults)}parser(e,t){return ti.parse(e,t??this.defaults)}#e(e,t){return(i,s)=>{const n={...s},r={...this.defaults,...n};!0===this.defaults.async&&!1===n.async&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const o=this.#t(!!r.silent,!!r.async);if(null==i)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof i)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(i):i).then((t=>e(t,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>t(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(o);try{r.hooks&&(i=r.hooks.preprocess(i));let s=e(i,r);r.hooks&&(s=r.hooks.processAllTokens(s)),r.walkTokens&&this.walkTokens(s,r.walkTokens);let n=t(s,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(e){return o(e)}}}#t(e,t){return i=>{if(i.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+rt(i.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(i);throw i}}};function ni(e,t){return si.parse(e,t)}ni.options=ni.setOptions=function(e){return si.setOptions(e),ni.defaults=si.defaults,Ge(ni.defaults),ni},ni.getDefaults=Ze,ni.defaults=Ke,ni.use=function(...e){return si.use(...e),ni.defaults=si.defaults,Ge(ni.defaults),ni},ni.walkTokens=function(e,t){return si.walkTokens(e,t)},ni.parseInline=si.parseInline,ni.Parser=ti,ni.parser=ti.parse,ni.Renderer=Jt,ni.TextRenderer=ei,ni.Lexer=Gt,ni.lexer=Gt.lex,ni.Tokenizer=mt,ni.Hooks=ii,ni.parse=ni,ni.options,ni.setOptions,ni.use,ni.walkTokens,ni.parseInline,ti.parse,Gt.lex;var ri=function(e,t,i,s){var n,r=arguments.length,o=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};const oi=["jpg","jpeg","png","gif","webp"],ai=["pdf","doc","docx","xls","xlsx","csv","html","md","txt","json","xml",...oi,"mp4","webm","ogg","mov"];let li=class extends ce{constructor(){super(...arguments),this._reader=null,this._decoder=new TextDecoder,this._buffer="",this._userHasScrolledUp=!1,this._isDragging=!1,this._isResizing=!1,this._overlay=null,this._resizeDir="",this._dragStartX=0,this._dragStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._resizeStartW=0,this._resizeStartH=0,this._debugResizeStartX=0,this._debugResizeStartW=0,this._dragDepth=0,this._pendingSeq=0,this._pendingAttachAnalyze=!0,this._orgSkillRequestId=0,this._globalSkillRequestId=0,this._invocableSkillRequestId=0,this._globalSkillPending=new Set,this._speechRecognition=null,this._speechBaseValue="",this._speechFinalTranscript="",this.send=null,this.load=null,this.messages=[],this.label="Kat",this.placeholder="Type a message...",this.opened=!1,this.hideToggle=!1,this.variant="floating",this.conversationId=null,this._inputValue="",this._isStreaming=!1,this._error="",this._contextWarning="",this._contextLimitReached=!1,this._contextLimitMessage="",this._telemetry=null,this._iterationLog=[],this._cacheCheckpoints={},this._debugPanelOpen=!1,this._debugDrawerWidth=430,this._isDebugResizing=!1,this._pendingConversationFiles=[],this._isDraggingFile=!1,this._skillMenuOpened=!1,this._skillQuery="",this._orgSkills=[],this._globalSkills=[],this._invocableSkills=[],this._aiFrameworkConfig={},this._skillHighlighted=0,this._copiedIndex=-1,this._skillBrowseOpened=!1,this._skillBrowseSource="org",this._skillBrowseQuery="",this._isDictating=!1,this._handleDocumentClick=e=>{if(!this._skillMenuOpened)return;e.composedPath().some((e=>e instanceof HTMLElement&&(e.classList.contains("skill-menu")||e.classList.contains("input")||e.classList.contains("input-plus"))))||(this._skillMenuOpened=!1)},this._handleMouseMove=e=>{if(this._isDragging){let t=this._dragStartLeft+(e.clientX-this._dragStartX),i=this._dragStartTop+(e.clientY-this._dragStartY);const s=this._panelEl.offsetWidth;t=Math.max(48-s,Math.min(t,window.innerWidth-48)),i=Math.max(0,Math.min(i,window.innerHeight-48)),this._panelEl.style.left=t+"px",this._panelEl.style.top=i+"px"}else if(this._isResizing){const t=e.clientX-this._dragStartX,i=e.clientY-this._dragStartY,s=340,n=380,r=.9*window.innerWidth,o=window.innerHeight-72;let a=this._resizeStartW,l=this._resizeStartH,h=this._dragStartLeft,c=this._dragStartTop;this._resizeDir.includes("e")&&(a=Math.max(s,Math.min(this._resizeStartW+t,r))),this._resizeDir.includes("w")&&(a=Math.max(s,Math.min(this._resizeStartW-t,r)),h=this._dragStartLeft+(this._resizeStartW-a)),this._resizeDir.includes("s")&&(l=Math.max(n,Math.min(this._resizeStartH+i,o))),this._resizeDir.includes("n")&&(l=Math.max(n,Math.min(this._resizeStartH-i,o)),c=this._dragStartTop+(this._resizeStartH-l)),h=Math.max(0,h),c=Math.max(0,c),this._panelEl.style.width=a+"px",this._panelEl.style.height=l+"px",this._panelEl.style.left=h+"px",this._panelEl.style.top=c+"px"}},this._handleMouseUp=()=>{this._isDragging&&(this._isDragging=!1,this._panelEl.classList.remove("panel--dragging")),this._isResizing&&(this._isResizing=!1,this._panelEl.classList.remove("panel--resizing")),this._overlay&&(this._overlay.style.display="none"),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._saveState()},this._handleDebugResizeMouseMove=e=>{if(!this._isDebugResizing)return;const t=e.clientX-this._debugResizeStartX,i=Math.max(300,this.offsetWidth-300);this._debugDrawerWidth=Math.max(300,Math.min(this._debugResizeStartW-t,i))},this._handleDebugResizeMouseUp=()=>{this._isDebugResizing=!1,document.removeEventListener("mousemove",this._handleDebugResizeMouseMove),document.removeEventListener("mouseup",this._handleDebugResizeMouseUp),this._saveState()}}connectedCallback(){super.connectedCallback(),this.load||(this.load=()=>null==this.conversationId?Promise.resolve([]):n.fetch({url:`/api/system/conversation/${this.conversationId}/messages`}).then((e=>e.json())).then((e=>Promise.all((e?.data||[]).map((e=>{let t=[];try{t=JSON.parse(e.conversationFileIDs||"[]")}catch{}return t.length?Promise.all(t.map((e=>n.fetch({url:`/api/system/conversationFile/${e}`}).then((e=>e.json())).then((e=>e?.data)).catch((()=>null))))).then((t=>(e.conversationFiles=t.filter((e=>null!=e)),e))):Promise.resolve(e)})))))),this.load().then((e=>{e&&e.length&&(this.messages=e)})).catch((()=>{})),n.fetch({url:"/api/system/integration/aws/bedrock/aiFrameworkConfig"}).then((e=>e.json())).then((e=>{this._aiFrameworkConfig=e?.data||{}})).catch((()=>{})),"inline"===this.variant&&(this.opened=!0),this._restoreState(),document.addEventListener("click",this._handleDocumentClick)}disconnectedCallback(){super.disconnectedCallback(),this._reader&&(this._reader.cancel(),this._reader=null),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),document.removeEventListener("click",this._handleDocumentClick),this._speechRecognition&&(this._speechRecognition.abort(),this._speechRecognition=null,this._isDictating=!1),this._pendingConversationFiles.forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}))}updated(e){e.has("messages")&&(this._userHasScrolledUp||this._isStreaming||!this._messagesEl||requestAnimationFrame((()=>{this._messagesEl&&(this._messagesEl.scrollTop=this._messagesEl.scrollHeight)}))),e.has("opened")&&this.opened&&this._inputEl&&setTimeout((()=>{this._inputEl&&this._inputEl.focus()}),200),this._skillMenuOpened&&this._positionSkillMenu(),e.has("_skillHighlighted")&&this._skillMenuOpened&&this._skillMenuEl?.querySelector(".skill-menu__item--highlighted")?.scrollIntoView({block:"nearest"})}_positionSkillMenu(){requestAnimationFrame((()=>{if(!this._skillMenuEl||!this._inputWrapperEl)return;const e=this._inputWrapperEl.getBoundingClientRect();this._skillMenuEl.style.left=e.left+"px",this._skillMenuEl.style.width=e.width+"px";const t=this._panelEl.getBoundingClientRect().top+8,i=e.top-8-t;this._skillMenuEl.style.maxHeight=i+"px";const s=this._skillMenuEl.getBoundingClientRect(),n=Math.max(t,e.top-s.height-8);this._skillMenuEl.style.top=n+"px"}))}stop(){this._handleStop()}isStreaming(){return this._isStreaming}open(){this.opened||this._handleToggle()}close(){this.opened&&this._handleToggle()}toggle(){this._handleToggle()}_showOverlay(){this._overlay||(this._overlay=document.createElement("div"),this._overlay.style.cssText="position:fixed; inset:0; z-index:9999; display:none;",document.body.appendChild(this._overlay)),this._overlay.style.display="block"}_handleHeaderMouseDown(e){if("inline"===this.variant)return;if(e.target.closest("button"))return;if(!this._panelEl)return;this._isDragging=!0,this._panelEl.classList.add("panel--dragging"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,e.preventDefault(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleResizeMouseDown(e){if("inline"===this.variant)return;if(!this._panelEl)return;this._isResizing=!0,this._resizeDir=e.currentTarget.dataset.dir||"",this._panelEl.classList.add("panel--resizing"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,this._resizeStartW=t.width,this._resizeStartH=t.height,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleToggle(){this.opened=!this.opened,this.opened&&this._panelEl&&this._applyStoredLayout(),this._saveState()}_saveState(){try{const e={opened:String(this.opened),message:this._inputValue,debugPanelOpen:String(this._debugPanelOpen),debugDrawerWidth:String(this._debugDrawerWidth)};if(this._panelEl){const t=this._panelEl.style;t.left&&(e.left=t.left),t.top&&(e.top=t.top),t.width&&(e.width=t.width),t.height&&(e.height=t.height),t.position&&(e.position=t.position)}localStorage.setItem("kr-chatbot-state",JSON.stringify(e))}catch{}}_restoreState(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e)return;const t=JSON.parse(e);"string"==typeof t.message&&"/"!==t.message.trim()&&(this._inputValue=t.message),this._debugPanelOpen="true"===t.debugPanelOpen;const i=Number(t.debugDrawerWidth);i>=300&&(this._debugDrawerWidth=i),"inline"!==this.variant&&"true"===t.opened&&(this.opened=!0,this.updateComplete.then((()=>this._applyStoredLayout())))}catch{}}_applyStoredLayout(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e||!this._panelEl)return;const t=JSON.parse(e);t.position&&(this._panelEl.style.position=t.position),t.left&&(this._panelEl.style.left=t.left),t.top&&(this._panelEl.style.top=t.top),t.width&&(this._panelEl.style.width=t.width),t.height&&(this._panelEl.style.height=t.height)}catch{}}_handleInputChange(e){this._inputValue=e.target.value,this._saveState();const t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px";const i=this._inputValue.match(/^\/(\S*)$/);i?(this._skillMenuOpened=!0,this._skillQuery=i[1],this._skillHighlighted=0,this._searchInvocableSkills(this._skillQuery)):this._skillMenuOpened=!1}_handleKeyDown(e){if(this._skillMenuOpened){let t=3;"inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled&&(t=5);const i=t+this._invocableSkills.length;if("ArrowDown"===e.key)return e.preventDefault(),void(this._skillHighlighted=(this._skillHighlighted+1)%i);if("ArrowUp"===e.key)return e.preventDefault(),void(this._skillHighlighted=(this._skillHighlighted-1+i)%i);if("Enter"===e.key&&!e.shiftKey)return e.preventDefault(),void this._activateSkillMenuItem(this._skillHighlighted);if("Escape"===e.key)return e.preventDefault(),void(this._skillMenuOpened=!1)}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this._handleSubmit())}_activateSkillMenuItem(e){const t="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;let i=3;if(t&&(i=5),0===e)return void this._openFilePicker(!0);if(1===e)return void this._openFilePicker(!1);if(2===e)return void this._handleSkillBrowseOpen();if(t&&3===e)return this._skillMenuOpened=!1,void this._send({message:"/test-context-warning",conversationFiles:[]});if(t&&4===e)return this._skillMenuOpened=!1,void this._send({message:"/test-context-limit",conversationFiles:[]});const s=this._invocableSkills[e-i];s&&this._handleSkillSelect(s)}_searchOrgSkills(e){this._orgSkillRequestId++;const t=this._orgSkillRequestId;n.fetch({url:"/api/system/conversation/localSkillList",method:"POST",body:{query:e.trim()}}).then((e=>e.json())).then((e=>{t===this._orgSkillRequestId&&(this._orgSkills=e?.data||[])})).catch((e=>{console.error("kr-chatbot: skill search failed",e)}))}_searchInvocableSkills(e){this._invocableSkillRequestId++;const t=this._invocableSkillRequestId;n.fetch({url:"/api/system/conversation/availableSkills",method:"POST",body:{query:e.trim()}}).then((e=>e.json())).then((e=>{t===this._invocableSkillRequestId&&(this._invocableSkills=e?.data||[])})).catch((e=>{console.error("kr-chatbot: invocable skill search failed",e)}))}_searchGlobalSkills(e){this._globalSkillRequestId++;const t=this._globalSkillRequestId;n.fetch({url:"/api/system/conversation/globalSkillList",method:"POST",body:{query:e.trim()}}).then((e=>e.json())).then((e=>{t===this._globalSkillRequestId&&(this._globalSkills=e?.data||[])})).catch((e=>{console.error("kr-chatbot: global skill search failed",e)}))}_handleGlobalSkillEnable(e,t){if(t.stopPropagation(),!e.canEnable)return void i.show({title:"Permission Required",message:"You do not have permission to install skills. Please contact your site administrator.",type:"error"});if(this._globalSkillPending.has(e.code))return;const s=t.currentTarget;this._globalSkillPending.add(e.code),s?.showLoading(),n.fetch({url:`/api/system/opensearch/aiskills/global/${encodeURIComponent(e.code)}/enabled`,method:"POST",body:{enabled:!e.enabled}}).then((e=>e.json())).then((t=>{e.enabled=t?.data?.enabled,s?.reset(),this.requestUpdate()})).catch((e=>{console.error("kr-chatbot: global skill enable failed",e),s?.showError("Error")})).finally((()=>{this._globalSkillPending.delete(e.code)}))}_handlePlusClick(){this._skillMenuOpened?this._skillMenuOpened=!1:(this._skillQuery="",this._skillHighlighted=0,this._skillMenuOpened=!0,this._searchInvocableSkills(""))}_handleMicClick(){if(this._speechRecognition)return void this._speechRecognition.stop();const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e)return;const t=new e;t.continuous=!0,t.interimResults=!0,this._speechBaseValue=this._inputValue,this._speechBaseValue&&!this._speechBaseValue.endsWith(" ")&&(this._speechBaseValue+=" "),this._speechFinalTranscript="",t.onresult=e=>{let t="";for(let i=e.resultIndex;i<e.results.length;i++)e.results[i].isFinal?this._speechFinalTranscript+=e.results[i][0].transcript:t+=e.results[i][0].transcript;this._inputValue=this._speechBaseValue+this._speechFinalTranscript+t,this._saveState(),this._inputEl&&(this._inputEl.style.height="auto",this._inputEl.style.height=Math.min(this._inputEl.scrollHeight,120)+"px")},t.onerror=e=>{"not-allowed"!==e.error&&"service-not-allowed"!==e.error||(this._error="Microphone access is blocked. Allow it in your browser settings to use voice input.")},t.onend=()=>{this._speechRecognition=null,this._isDictating=!1},this._speechRecognition=t,this._isDictating=!0,this._error="",t.start(),this._inputEl?.focus()}_handleSkillSelect(e){if(!1===e.canRun){let t=`You do not have access to "${e.name}". Ask your site administrator to grant it.`;return e.allowedRoles?.length&&(t=`"${e.name}" requires the ${e.allowedRoles.join(" or ")} role. Ask your site administrator to grant it.`),void i.show({title:"Access Required",message:t,type:"error"})}!e.global||e.enabled?(this._inputValue=`/${e.code} `,this._saveState(),this._skillMenuOpened=!1,this._skillBrowseOpened=!1,this._inputEl?.focus()):i.show({title:"Not Installed",message:`"${e.name}" has to be installed on this site before you can use it — use the Install button on the card.`,type:"info"})}_handleSkillCardKeydown(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._handleSkillSelect(t))}_handleCopyMessage(e,t){navigator.clipboard.writeText(e).then((()=>{this._copiedIndex=t,setTimeout((()=>{this._copiedIndex===t&&(this._copiedIndex=-1)}),2e3)})).catch((()=>{}))}_handleSkillBrowseOpen(){this._skillMenuOpened=!1,this._skillBrowseQuery="",this._skillBrowseOpened=!0,this._searchOrgSkills(""),!0!==this._aiFrameworkConfig.registryServer&&this._searchGlobalSkills("")}_handleSkillBrowseClose(){this._skillBrowseOpened=!1}_handleSkillBrowseSearch(e){this._skillBrowseQuery=e.target.value,this._searchOrgSkills(this._skillBrowseQuery),!0!==this._aiFrameworkConfig.registryServer&&this._searchGlobalSkills(this._skillBrowseQuery)}_handleSkillBrowseTabChange(e){this._skillBrowseSource=e.detail.activeTabId}_openFilePicker(e=!0){this._skillMenuOpened=!1,"/"===this._inputValue.trim()&&(this._inputValue="",this._saveState()),this._pendingAttachAnalyze=e,this._fileInputEl?.click()}_handleFileInputChange(e){const t=e.target;t.files&&this._addFiles(t.files,this._pendingAttachAnalyze),t.value=""}_handlePaste(e){const t=e.clipboardData?.items;if(!t)return;const i=[];for(let e=0;e<t.length;e++)if("file"===t[e].kind){const s=t[e].getAsFile();s&&i.push(s)}i.length&&(e.preventDefault(),this._addFiles(i))}_handleDragEnter(e){this._hasFiles(e)&&(e.preventDefault(),this._dragDepth++,this._isDraggingFile=!0)}_handleDragOver(e){this._hasFiles(e)&&e.preventDefault()}_handleDragLeave(e){this._hasFiles(e)&&(this._dragDepth--,this._dragDepth<=0&&(this._dragDepth=0,this._isDraggingFile=!1))}_handleDrop(e){this._hasFiles(e)&&(e.preventDefault(),this._dragDepth=0,this._isDraggingFile=!1,e.dataTransfer?.files&&this._addFiles(e.dataTransfer.files))}_hasFiles(e){return Array.from(e.dataTransfer?.types||[]).includes("Files")}_getFileExtension(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t+1).toLowerCase()}_addFiles(e,t=!0){const i=Array.from(e).filter((e=>ai.includes(this._getFileExtension(e.name))));i.length&&i.forEach((e=>{let i;(e.type.startsWith("image/")||oi.includes(this._getFileExtension(e.name)))&&(i=URL.createObjectURL(e));const s={localId:"att-"+this._pendingSeq++,file:e,name:e.name,mimeType:e.type,previewUrl:i,aiAnalyze:t};this._pendingConversationFiles=[...this._pendingConversationFiles,s]}))}_handlePendingRemove(e){const t=this._pendingConversationFiles.find((t=>t.localId===e));t?.previewUrl&&URL.revokeObjectURL(t.previewUrl),this._pendingConversationFiles=this._pendingConversationFiles.filter((t=>t.localId!==e))}_clearPending(){this._pendingConversationFiles.forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),this._pendingConversationFiles=[]}_handleFileOpen(e){const t=e.previewUrl||`${n.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view`;s.open({src:t,name:e.niceName||"file"}).addEventListener("download",(()=>{window.open(`${n.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view?download=true`,"_blank")}))}_handleSubmit(){if(this._isStreaming)return;const e=this._inputValue.trim(),t=this._pendingConversationFiles;if(!e&&!t.length)return;const i=t.map((e=>({file:e.file,aiAnalyze:e.aiAnalyze}))),s=new CustomEvent("message-submit",{detail:{message:e,conversationFiles:i},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented||this._send({message:e,conversationFiles:i})}_send(e){const t={type:"user",content:e.message};this._pendingConversationFiles.length&&(t.conversationFiles=this._pendingConversationFiles.map((e=>({conversationFileID:-1,niceName:e.name,mimeType:e.mimeType,aiAnalyze:e.aiAnalyze,previewUrl:e.previewUrl})))),this._speechRecognition&&this._speechRecognition.abort(),this.messages=[...this.messages,t],this._inputValue="",this._saveState(),this._error="",this._userHasScrolledUp=!1,this._pendingConversationFiles=[],this._inputEl&&(this._inputEl.style.height="auto"),this.messages=[...this.messages,{type:"assistant",content:""}],this._isStreaming=!0,this.updateComplete.then((()=>{if(!this._messagesEl)return;this._messagesEl.querySelectorAll(".message--assistant").forEach((e=>{e.style.minHeight=""}));const e=this._messagesEl.querySelectorAll(".message"),t=e[this.messages.length-2],i=e[this.messages.length-1];i&&(i.style.minHeight=this._messagesEl.clientHeight+"px"),t&&(this._messagesEl.scrollTop=t.offsetTop-this._messagesEl.offsetTop-24)})),this.send||(this.send=e=>{let t=Promise.resolve([]);return e.conversationFiles.length&&(t=Promise.all(e.conversationFiles.map((({file:e,aiAnalyze:t})=>{const i=new FormData;return i.append("file",e),i.append("type","LIBRARY"),i.append("niceName",e.name),t||i.append("aiAnalyze","false"),n.fetch({url:"/api/system/conversationFile/upload",method:"POST",body:i}).then((e=>e.json())).then((e=>e.data))})))),t.then((t=>{if(t.length)for(let e=this.messages.length-1;e>=0;e--)if("user"===this.messages[e].type){(this.messages[e].conversationFiles||[]).forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),this.messages[e].conversationFiles=t,this.requestUpdate();break}const i={userText:e.message,fileIds:t.map((e=>e.conversationFileID))};return e.pageContext&&(i.pageContext=e.pageContext),e.selectionContext&&(i.selectionContext=e.selectionContext),null!=this.conversationId?i.conversationID=this.conversationId:i.createNew=!0,n.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState",method:"POST",headers:{Accept:"text/event-stream"},body:i}).then((e=>(null==this.conversationId&&n.fetch({url:"/api/system/conversation/last"}).then((e=>e.json())).then((e=>{const t=e?.data,i=t?.conversationID;"number"==typeof i&&(this.conversationId=i,this.dispatchEvent(new CustomEvent("conversation-created",{detail:{conversation:t},bubbles:!0,composed:!0})))})).catch((()=>{})),e)))}))});const i=this._captureContext();this.send({message:e.message,messages:this.messages.slice(0,-1),conversationFiles:e.conversationFiles,pageContext:i.pageContext,selectionContext:i.selectionContext}).then((e=>{e.ok?e.body?(this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",this._readStreamChunk()):this._handleStreamError("No response body"):this._handleStreamError("Request failed: "+e.status)})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_captureContext(){let e="";try{const t={url:window.location.href,title:document.title},i=document.getElementById("kodaris-page");if(i&&i.textContent)try{t.page=JSON.parse(i.textContent)}catch{}e=JSON.stringify(t)}catch{}let t="";try{const e=window.getSelection();e&&(t=e.toString().trim())}catch{}return{pageContext:e,selectionContext:t}}_handleStop(){this._reader&&(this._reader.cancel(),this._reader=null),this._isStreaming=!1}_handleMessagesScroll(e){const t=e.target,i=t.scrollHeight-t.scrollTop-t.clientHeight;this._userHasScrolledUp=i>50}_handleErrorDismiss(){this._error=""}_handleContextWarningDismiss(){this._contextWarning=""}_handleToggleDebugPanel(){this._debugPanelOpen=!this._debugPanelOpen,this._saveState()}_handleDebugResizeMouseDown(e){this._isDebugResizing=!0,this._debugResizeStartX=e.clientX,this._debugResizeStartW=this._debugDrawerWidth,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleDebugResizeMouseMove),document.addEventListener("mouseup",this._handleDebugResizeMouseUp)}_readStreamChunk(){this._reader&&this._reader.read().then((e=>{if(e.done)return this._isStreaming=!1,void(this._reader=null);this._buffer=this._buffer+this._decoder.decode(e.value,{stream:!0});const t=this._buffer.split("\n\n");this._buffer=t.pop()||"";for(let e=0;e<t.length;e++){if(!t[e].trim())continue;const i=t[e].split("\n");for(let e=0;e<i.length;e++){if(!i[e].startsWith("data:"))continue;const t=i[e].slice(5).trim();if(!t)continue;let s;try{s=JSON.parse(t)}catch{continue}if(this.dispatchEvent(new CustomEvent("stream-event",{detail:s,bubbles:!0,composed:!0})),"REASONING_PART"===s.type){if(s.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&(this.messages[e].reasoning||(this.messages[e].reasoning=""),this.messages[e].reasoning+=String(s.message),this.requestUpdate())}}else if("RESPONSE_PART"===s.type){if(s.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&(this.messages[e].content+=String(s.message),this.requestUpdate())}}else if("ERROR"===s.type)this._handleStreamError(String(s.message||"Unknown error"));else if("CONVERSATION_TOKEN_WARNING"===s.type)this._contextWarning=String(s.message||"");else if("CONVERSATION_TITLE"===s.type){if(s.data){const e=String(s.data.title||"");e&&(this.label=e,this.dispatchEvent(new CustomEvent("conversation-title",{detail:{title:e},bubbles:!0,composed:!0})))}}else if("CONVERSATION_LIMIT_REACHED"===s.type)this._contextLimitReached=!0,this._contextLimitMessage=String(s.message||""),this._contextWarning="";else if("TOKEN_USAGE"===s.type){if(s.data){const e=s.data;this._telemetry=e,1===e.iteration?(this._iterationLog=[e],this._cacheCheckpoints={}):this._iterationLog=[...this._iterationLog,e]}}else if("CACHE_CHECKPOINT"===s.type&&s.data){const e=s.data;this._cacheCheckpoints={...this._cacheCheckpoints,[e.iteration]:e}}s.finished&&(this._isStreaming=!1,this._reader=null)}}this._readStreamChunk()})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_handleStreamError(e){if(this._isStreaming=!1,this._error=e,this._reader&&(this._reader.cancel(),this._reader=null),this.messages.length>0){const e=this.messages[this.messages.length-1];"assistant"!==e.type||e.content||(this.messages=this.messages.slice(0,-1))}}_renderSkillMenu(){const e=this._invocableSkills,t="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;let i=3;return t&&(i=5),X`
1385
1385
  <div class="skill-menu">
1386
1386
  <div class="skill-menu__actions">
1387
1387
  <button
1388
- class=${we({"skill-menu__action":!0,"skill-menu__item--highlighted":0===this._skillHighlighted})}
1388
+ class=${$e({"skill-menu__action":!0,"skill-menu__item--highlighted":0===this._skillHighlighted})}
1389
1389
  @click=${()=>this._openFilePicker(!0)}
1390
1390
  >
1391
1391
  <span class="skill-menu__name">Attach Files</span>
1392
1392
  <span class="skill-menu__desc">The AI reads these files</span>
1393
1393
  </button>
1394
1394
  <button
1395
- class=${we({"skill-menu__action":!0,"skill-menu__item--highlighted":1===this._skillHighlighted})}
1395
+ class=${$e({"skill-menu__action":!0,"skill-menu__item--highlighted":1===this._skillHighlighted})}
1396
1396
  @click=${()=>this._openFilePicker(!1)}
1397
1397
  >
1398
1398
  <span class="skill-menu__name">Attach Files for Reference</span>
1399
1399
  <span class="skill-menu__desc">Attached for a tool — not read by the AI</span>
1400
1400
  </button>
1401
1401
  <button
1402
- class=${we({"skill-menu__action":!0,"skill-menu__item--highlighted":2===this._skillHighlighted})}
1402
+ class=${$e({"skill-menu__action":!0,"skill-menu__item--highlighted":2===this._skillHighlighted})}
1403
1403
  @click=${this._handleSkillBrowseOpen}
1404
1404
  >
1405
1405
  Browse All Skills
1406
1406
  </button>
1407
- ${t?W`
1407
+ ${t?X`
1408
1408
  <button
1409
- class=${we({"skill-menu__action":!0,"skill-menu__item--highlighted":3===this._skillHighlighted})}
1409
+ class=${$e({"skill-menu__action":!0,"skill-menu__item--highlighted":3===this._skillHighlighted})}
1410
1410
  @click=${()=>this._activateSkillMenuItem(3)}
1411
1411
  >
1412
1412
  Test Context Warning
1413
1413
  </button>
1414
1414
  <button
1415
- class=${we({"skill-menu__action":!0,"skill-menu__item--highlighted":4===this._skillHighlighted})}
1415
+ class=${$e({"skill-menu__action":!0,"skill-menu__item--highlighted":4===this._skillHighlighted})}
1416
1416
  @click=${()=>this._activateSkillMenuItem(4)}
1417
1417
  >
1418
1418
  Test Context Limit
1419
1419
  </button>
1420
- `:Q}
1420
+ `:V}
1421
1421
  </div>
1422
- ${e.length?W`
1422
+ ${e.length?X`
1423
1423
  <ul class="skill-menu__list">
1424
- ${e.map(((e,t)=>W`
1424
+ ${e.map(((e,t)=>X`
1425
1425
  <li>
1426
1426
  <button
1427
- class=${we({"skill-menu__item":!0,"skill-menu__item--highlighted":t+i===this._skillHighlighted})}
1427
+ class=${$e({"skill-menu__item":!0,"skill-menu__item--highlighted":t+i===this._skillHighlighted})}
1428
1428
  @click=${()=>this._handleSkillSelect(e)}
1429
1429
  >
1430
1430
  <span class="skill-menu__name">${e.name}</span>
1431
- ${e.description?W`
1431
+ ${e.description?X`
1432
1432
  <span class="skill-menu__desc">${e.description}</span>
1433
- `:Q}
1433
+ `:V}
1434
1434
  </button>
1435
1435
  </li>
1436
1436
  `))}
1437
1437
  </ul>
1438
- `:Q}
1438
+ `:V}
1439
1439
  </div>
1440
- `}_renderSkillBrowse(){return W`
1440
+ `}_renderSkillBrowse(){return X`
1441
1441
  <kr-dialog
1442
1442
  opened
1443
1443
  label="Browse Skills"
@@ -1457,27 +1457,32 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1457
1457
  <kr-tab id="org" label="Your Org">
1458
1458
  ${this._renderSkillGrid()}
1459
1459
  </kr-tab>
1460
- <kr-tab id="kodaris" label="Kodaris">
1461
- ${this._renderSkillGrid(!0)}
1462
- </kr-tab>
1460
+ ${!0===this._aiFrameworkConfig.registryServer?V:X`
1461
+ <kr-tab id="kodaris" label="Kodaris">
1462
+ ${this._renderSkillGrid(!0)}
1463
+ </kr-tab>
1464
+ `}
1463
1465
  </kr-tab-group>
1464
1466
  </div>
1465
1467
  </kr-dialog>
1466
- `}_renderSkillGrid(e=!1){let t=this._orgSkills;return e&&(t=this._globalSkills),t.length?W`
1468
+ `}_renderSkillGrid(e=!1){let t=this._orgSkills;return e&&(t=this._globalSkills),t.length?X`
1467
1469
  <div class="skill-browse__grid">
1468
- ${t.map((t=>W`
1470
+ ${t.map((t=>X`
1469
1471
  <div
1470
- class="skill-card"
1472
+ class=${$e({"skill-card":!0,"skill-card--unavailable":!1===t.canRun||!!t.global&&!t.enabled})}
1471
1473
  role="button"
1472
1474
  tabindex="0"
1473
1475
  @click=${()=>this._handleSkillSelect(t)}
1474
1476
  @keydown=${e=>this._handleSkillCardKeydown(e,t)}
1475
1477
  >
1476
1478
  <span class="skill-card__name">${t.name}</span>
1477
- ${t.description?W`
1479
+ ${t.description?X`
1478
1480
  <span class="skill-card__desc">${t.description}</span>
1479
- `:Q}
1480
- ${e?W`
1481
+ `:V}
1482
+ ${!e&&t.global?X`
1483
+ <span class="skill-card__badge">Global</span>
1484
+ `:V}
1485
+ ${e?X`
1481
1486
  <div class="skill-card__footer">
1482
1487
  <span class="skill-card__price">Free</span>
1483
1488
  <kr-button
@@ -1488,14 +1493,14 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1488
1493
  @click=${e=>this._handleGlobalSkillEnable(t,e)}
1489
1494
  >${t.enabled?"Uninstall":"Install"}</kr-button>
1490
1495
  </div>
1491
- `:Q}
1496
+ `:V}
1492
1497
  </div>
1493
1498
  `))}
1494
1499
  </div>
1495
- `:Q}_renderUserContent(e){const t=e.match(/^\/(\S+)(\s[\s\S]*)?$/);return t?W`<span class="message-skill">/${t[1]}</span>${t[2]||""}`:e}_fmtTokens(e){return null==e||isNaN(e)?"—":e.toLocaleString("en-US")}_fmtCost(e){return null==e||isNaN(e)?"—":"~$"+e.toFixed(4)}_renderDebugPanel(){return W`
1500
+ `:V}_renderUserContent(e){const t=e.match(/^\/(\S+)(\s[\s\S]*)?$/);return t?X`<span class="message-skill">/${t[1]}</span>${t[2]||""}`:e}_fmtTokens(e){return null==e||isNaN(e)?"—":e.toLocaleString("en-US")}_fmtCost(e){return null==e||isNaN(e)?"—":"~$"+e.toFixed(4)}_renderDebugPanel(){return X`
1496
1501
  <div
1497
- class=${we({"debug-drawer":!0,"debug-drawer--open":this._debugPanelOpen,"debug-drawer--resizing":this._isDebugResizing})}
1498
- style=${Le({width:`${this._debugDrawerWidth}px`})}
1502
+ class=${$e({"debug-drawer":!0,"debug-drawer--open":this._debugPanelOpen,"debug-drawer--resizing":this._isDebugResizing})}
1503
+ style=${Fe({width:`${this._debugDrawerWidth}px`})}
1499
1504
  >
1500
1505
  <div
1501
1506
  class="debug-drawer__resize"
@@ -1525,14 +1530,14 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1525
1530
  </button>
1526
1531
  </div>
1527
1532
  <div class="debug-drawer__body">
1528
- ${this._telemetry?W`
1533
+ ${this._telemetry?X`
1529
1534
  <div class="debug-section">
1530
1535
  <div class="debug-section__label">Context</div>
1531
1536
  <div class="debug-gauge">
1532
1537
  <div class="debug-gauge__bar">
1533
1538
  <div
1534
1539
  class="debug-gauge__fill"
1535
- style=${Le({width:`${Math.min(100,Math.max(0,this._telemetry.contextUsedPercent||0))}%`})}
1540
+ style=${Fe({width:`${Math.min(100,Math.max(0,this._telemetry.contextUsedPercent||0))}%`})}
1536
1541
  ></div>
1537
1542
  </div>
1538
1543
  <span class="debug-gauge__text">
@@ -1573,11 +1578,11 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1573
1578
  <span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.conversationCostUsd)}</span>
1574
1579
  </div>
1575
1580
  </div>
1576
- `:W`
1581
+ `:X`
1577
1582
  <div class="debug-empty">No telemetry yet — send a message to populate.</div>
1578
1583
  `}
1579
1584
 
1580
- ${this._iterationLog.length?W`
1585
+ ${this._iterationLog.length?X`
1581
1586
  <div class="debug-section">
1582
1587
  <div class="debug-section__label">Iterations (this turn)</div>
1583
1588
  <div class="debug-iterations-scroll">
@@ -1595,7 +1600,7 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1595
1600
  </tr>
1596
1601
  </thead>
1597
1602
  <tbody>
1598
- ${this._iterationLog.map((e=>{const t=this._cacheCheckpoints[e.iteration];return W`
1603
+ ${this._iterationLog.map((e=>{const t=this._cacheCheckpoints[e.iteration];return X`
1599
1604
  <tr>
1600
1605
  <td>${e.iteration}</td>
1601
1606
  <td>${this._fmtTokens(e.iterationInput)}</td>
@@ -1611,13 +1616,13 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1611
1616
  </table>
1612
1617
  </div>
1613
1618
  </div>
1614
- `:Q}
1619
+ `:V}
1615
1620
  </div>
1616
1621
  </div>
1617
- `}render(){const e="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;return W`
1618
- ${this.hideToggle||"inline"===this.variant?Q:W`
1622
+ `}render(){const e="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;return X`
1623
+ ${this.hideToggle||"inline"===this.variant?V:X`
1619
1624
  <button
1620
- class=${we({toggle:!0,"toggle--hidden":this.opened})}
1625
+ class=${$e({toggle:!0,"toggle--hidden":this.opened})}
1621
1626
  @click=${this._handleToggle}
1622
1627
  title="Open chat"
1623
1628
  >
@@ -1636,14 +1641,14 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1636
1641
  `}
1637
1642
 
1638
1643
  <div
1639
- class=${we({panel:!0,"panel--opened":this.opened,"panel--resizing-debug":this._isDebugResizing})}
1640
- style=${Le(e&&this._debugPanelOpen?{paddingRight:`${this._debugDrawerWidth}px`}:{})}
1644
+ class=${$e({panel:!0,"panel--opened":this.opened,"panel--resizing-debug":this._isDebugResizing})}
1645
+ style=${Fe(e&&this._debugPanelOpen?{paddingRight:`${this._debugDrawerWidth}px`}:{})}
1641
1646
  @dragenter=${this._handleDragEnter}
1642
1647
  @dragover=${this._handleDragOver}
1643
1648
  @dragleave=${this._handleDragLeave}
1644
1649
  @drop=${this._handleDrop}
1645
1650
  >
1646
- ${this._isDraggingFile?W`
1651
+ ${this._isDraggingFile?X`
1647
1652
  <div class="drop-overlay">
1648
1653
  <svg
1649
1654
  xmlns="http://www.w3.org/2000/svg"
@@ -1660,8 +1665,8 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1660
1665
  </svg>
1661
1666
  <span>Drop images to attach</span>
1662
1667
  </div>
1663
- `:Q}
1664
- ${"inline"===this.variant?Q:W`
1668
+ `:V}
1669
+ ${"inline"===this.variant?V:X`
1665
1670
  <div
1666
1671
  class="resize resize--n"
1667
1672
  data-dir="n"
@@ -1710,9 +1715,9 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1710
1715
  </div>
1711
1716
  </div>
1712
1717
  <div class="header-actions">
1713
- ${e?W`
1718
+ ${e?X`
1714
1719
  <button
1715
- class=${we({"header-action":!0,"header-action--active":this._debugPanelOpen})}
1720
+ class=${$e({"header-action":!0,"header-action--active":this._debugPanelOpen})}
1716
1721
  @click=${this._handleToggleDebugPanel}
1717
1722
  title="Debug telemetry"
1718
1723
  >
@@ -1731,8 +1736,8 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1731
1736
  />
1732
1737
  </svg>
1733
1738
  </button>
1734
- `:Q}
1735
- ${"inline"===this.variant?Q:W`
1739
+ `:V}
1740
+ ${"inline"===this.variant?V:X`
1736
1741
  <button
1737
1742
  class="header-action"
1738
1743
  @click=${this._handleToggle}
@@ -1759,22 +1764,22 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1759
1764
 
1760
1765
  <div class="messages" @scroll=${this._handleMessagesScroll}>
1761
1766
  <div class="messages-inner">
1762
- ${0===this.messages.length?W`
1767
+ ${0===this.messages.length?X`
1763
1768
  <div class="empty">
1764
1769
  <span class="empty-text">What can I help you with?</span>
1765
1770
  </div>
1766
- `:Q}
1767
- ${this.messages.map(((e,t)=>W`
1768
- <div class=${we({message:!0,"message--user":"user"===e.type,"message--assistant":"assistant"===e.type})}>
1769
- ${e.reasoning?W`
1771
+ `:V}
1772
+ ${this.messages.map(((e,t)=>X`
1773
+ <div class=${$e({message:!0,"message--user":"user"===e.type,"message--assistant":"assistant"===e.type})}>
1774
+ ${e.reasoning?X`
1770
1775
  <details class="reasoning">
1771
1776
  <summary>Thinking</summary>
1772
1777
  <div class="reasoning-content">${e.reasoning}</div>
1773
1778
  </details>
1774
- `:Q}
1775
- ${e.conversationFiles&&e.conversationFiles.length?W`
1779
+ `:V}
1780
+ ${e.conversationFiles&&e.conversationFiles.length?X`
1776
1781
  <div class="attachments">
1777
- ${e.conversationFiles.map((e=>{const t=e.niceName||e.name||"File";let i=ri.includes(this._getFileExtension(t));return e.mimeType&&(i=e.mimeType.startsWith("image/")),i?W`
1782
+ ${e.conversationFiles.map((e=>{const t=e.niceName||e.name||"File";let i=oi.includes(this._getFileExtension(t));return e.mimeType&&(i=e.mimeType.startsWith("image/")),i?X`
1778
1783
  <button
1779
1784
  class="attachment"
1780
1785
  type="button"
@@ -1782,11 +1787,11 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1782
1787
  @click=${()=>this._handleFileOpen(e)}
1783
1788
  >
1784
1789
  <img
1785
- src=${e.previewUrl||`${s.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view`}
1790
+ src=${e.previewUrl||`${n.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view`}
1786
1791
  alt=${e.niceName||""}
1787
1792
  />
1788
1793
  </button>
1789
- `:W`
1794
+ `:X`
1790
1795
  <button
1791
1796
  class="attachment attachment--doc attachment--openable"
1792
1797
  type="button"
@@ -1798,26 +1803,26 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1798
1803
  </button>
1799
1804
  `}))}
1800
1805
  </div>
1801
- `:Q}
1802
- ${e.content?W`
1806
+ `:V}
1807
+ ${e.content?X`
1803
1808
  <div class="message-content">
1804
- ${"user"===e.type?this._renderUserContent(e.content):ye(si.parse(e.content,{breaks:!0}))}
1809
+ ${"user"===e.type?this._renderUserContent(e.content):we(ni.parse(e.content,{breaks:!0}))}
1805
1810
  </div>
1806
- `:Q}
1807
- ${"assistant"===e.type&&this._isStreaming&&e===this.messages[this.messages.length-1]?W`
1811
+ `:V}
1812
+ ${"assistant"===e.type&&this._isStreaming&&e===this.messages[this.messages.length-1]?X`
1808
1813
  <div class="typing">
1809
1814
  <span></span>
1810
1815
  <span></span>
1811
1816
  <span></span>
1812
1817
  </div>
1813
- `:Q}
1814
- ${e.content?W`
1818
+ `:V}
1819
+ ${e.content?X`
1815
1820
  <button
1816
1821
  class="message-copy"
1817
1822
  title=${this._copiedIndex===t?"Copied":"Copy"}
1818
1823
  @click=${()=>this._handleCopyMessage(e.content,t)}
1819
1824
  >
1820
- ${this._copiedIndex===t?W`
1825
+ ${this._copiedIndex===t?X`
1821
1826
  <svg
1822
1827
  viewBox="0 0 24 24"
1823
1828
  fill="none"
@@ -1828,7 +1833,7 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1828
1833
  >
1829
1834
  <path d="M20 6 9 17l-5-5" />
1830
1835
  </svg>
1831
- `:W`
1836
+ `:X`
1832
1837
  <svg
1833
1838
  viewBox="0 0 24 24"
1834
1839
  fill="none"
@@ -1848,13 +1853,13 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1848
1853
  </svg>
1849
1854
  `}
1850
1855
  </button>
1851
- `:Q}
1856
+ `:V}
1852
1857
  </div>
1853
1858
  `))}
1854
1859
  </div>
1855
1860
  </div>
1856
1861
 
1857
- ${this._error?W`
1862
+ ${this._error?X`
1858
1863
  <div class="error">
1859
1864
  <span>${this._error}</span>
1860
1865
  <button class="error-dismiss" @click=${this._handleErrorDismiss}>
@@ -1874,11 +1879,11 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1874
1879
  </svg>
1875
1880
  </button>
1876
1881
  </div>
1877
- `:this._contextLimitReached?W`
1882
+ `:this._contextLimitReached?X`
1878
1883
  <div class="context-limit" role="alert">
1879
1884
  ${this._contextLimitMessage||"This conversation has reached its limit. Please start a new one to continue."}
1880
1885
  </div>
1881
- `:this._contextWarning?W`
1886
+ `:this._contextWarning?X`
1882
1887
  <div class="context-warning" role="status">
1883
1888
  <span>${this._contextWarning}</span>
1884
1889
  <button
@@ -1902,20 +1907,20 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1902
1907
  </svg>
1903
1908
  </button>
1904
1909
  </div>
1905
- `:Q}
1910
+ `:V}
1906
1911
 
1907
1912
  <div class="footer">
1908
- ${this._pendingConversationFiles.length?W`
1913
+ ${this._pendingConversationFiles.length?X`
1909
1914
  <div class="composer-attachments">
1910
- ${Ve(this._pendingConversationFiles,(e=>e.localId),(e=>W`
1915
+ ${Ye(this._pendingConversationFiles,(e=>e.localId),(e=>X`
1911
1916
  <div
1912
- class=${we({chip:!0,"chip--doc":!e.previewUrl})}
1917
+ class=${$e({chip:!0,"chip--doc":!e.previewUrl})}
1913
1918
  title=${e.name}
1914
1919
  >
1915
1920
  <div
1916
- class=${we({"chip-body":!0,"chip-body--image":Boolean(e.previewUrl)})}
1921
+ class=${$e({"chip-body":!0,"chip-body--image":Boolean(e.previewUrl)})}
1917
1922
  >
1918
- ${e.previewUrl?W`<img src=${e.previewUrl} alt=${e.name} />`:W`
1923
+ ${e.previewUrl?X`<img src=${e.previewUrl} alt=${e.name} />`:X`
1919
1924
  <span class="chip-type">${this._getFileExtension(e.name)||"File"}</span>
1920
1925
  <span class="chip-name">${e.name}</span>
1921
1926
  `}
@@ -1942,7 +1947,7 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1942
1947
  </div>
1943
1948
  `))}
1944
1949
  </div>
1945
- `:Q}
1950
+ `:V}
1946
1951
  <input
1947
1952
  class="file-input"
1948
1953
  type="file"
@@ -1951,7 +1956,7 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1951
1956
  hidden
1952
1957
  @change=${this._handleFileInputChange}
1953
1958
  />
1954
- ${this._skillMenuOpened?this._renderSkillMenu():Q}
1959
+ ${this._skillMenuOpened?this._renderSkillMenu():V}
1955
1960
  <div class="input-wrapper">
1956
1961
  <button
1957
1962
  class="input-plus"
@@ -1966,8 +1971,8 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1966
1971
  @keydown=${this._handleKeyDown}
1967
1972
  @paste=${this._handlePaste}
1968
1973
  ></textarea>
1969
- ${window.SpeechRecognition||window.webkitSpeechRecognition?W`
1970
- ${this._isDictating?W`
1974
+ ${window.SpeechRecognition||window.webkitSpeechRecognition?X`
1975
+ ${this._isDictating?X`
1971
1976
  <button
1972
1977
  class="mic-stop"
1973
1978
  title="Stop dictation"
@@ -1990,7 +1995,7 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
1990
1995
  />
1991
1996
  </svg>
1992
1997
  </button>
1993
- `:W`
1998
+ `:X`
1994
1999
  <button
1995
2000
  class="mic"
1996
2001
  title="Dictate a message"
@@ -2014,8 +2019,8 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
2014
2019
  </svg>
2015
2020
  </button>
2016
2021
  `}
2017
- `:Q}
2018
- ${this._isStreaming?W`
2022
+ `:V}
2023
+ ${this._isStreaming?X`
2019
2024
  <button
2020
2025
  class="stop"
2021
2026
  @click=${this._handleStop}
@@ -2036,9 +2041,9 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
2036
2041
  />
2037
2042
  </svg>
2038
2043
  </button>
2039
- `:W`
2044
+ `:X`
2040
2045
  <button
2041
- class=${we({send:!0,"send--disabled":!this._inputValue.trim()&&!this._pendingConversationFiles.length})}
2046
+ class=${$e({send:!0,"send--disabled":!this._inputValue.trim()&&!this._pendingConversationFiles.length})}
2042
2047
  @click=${this._handleSubmit}
2043
2048
  title="Send message"
2044
2049
  >
@@ -2058,10 +2063,10 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
2058
2063
  `}
2059
2064
  </div>
2060
2065
  </div>
2061
- ${this._skillBrowseOpened?this._renderSkillBrowse():Q}
2062
- ${e?this._renderDebugPanel():Q}
2066
+ ${this._skillBrowseOpened?this._renderSkillBrowse():V}
2067
+ ${e?this._renderDebugPanel():V}
2063
2068
  </div>
2064
- `}};oi.styles=h`
2069
+ `}};li.styles=c`
2065
2070
  *,
2066
2071
  *::before,
2067
2072
  *::after {
@@ -3250,6 +3255,30 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
3250
3255
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
3251
3256
  }
3252
3257
 
3258
+ /* A Kodaris-tab card the user can't invoke — not in their roles, or not installed
3259
+ here yet. Clicking it does nothing, so it drops the pointer cursor and the hover
3260
+ highlight. The Install button inside keeps its own pointer cursor. */
3261
+ .skill-card--unavailable {
3262
+ cursor: default;
3263
+ }
3264
+
3265
+ .skill-card--unavailable:hover {
3266
+ border-color: #e5e7eb;
3267
+ box-shadow: none;
3268
+ }
3269
+
3270
+ /* Marks a globally-published skill listed on the Your Org tab — only happens on
3271
+ kodaris.com, which has no Kodaris tab for its own published skills. */
3272
+ .skill-card__badge {
3273
+ align-self: flex-start;
3274
+ padding: 2px 8px;
3275
+ border-radius: 10px;
3276
+ background: #f3f4f6;
3277
+ font-size: 11px;
3278
+ font-weight: 600;
3279
+ color: #000000;
3280
+ }
3281
+
3253
3282
  /* Footer row on global skill cards: install button on the left, price on the
3254
3283
  right. margin-top:auto pins it to the bottom so cards in a row align their
3255
3284
  footers regardless of description length. Negative horizontal margins
@@ -3438,5 +3467,5 @@ const Oe="important",Ue=" !"+Oe,Le=xe(class extends _e{constructor(e){if(super(e
3438
3467
  height: 32px;
3439
3468
  }
3440
3469
 
3441
- `,ni([ge({attribute:!1})],oi.prototype,"send",void 0),ni([ge({attribute:!1})],oi.prototype,"load",void 0),ni([ge({attribute:!1})],oi.prototype,"messages",void 0),ni([ge({type:String})],oi.prototype,"label",void 0),ni([ge({type:String})],oi.prototype,"placeholder",void 0),ni([ge({type:Boolean,reflect:!0})],oi.prototype,"opened",void 0),ni([ge({type:Boolean,attribute:"hide-toggle",reflect:!0})],oi.prototype,"hideToggle",void 0),ni([ge({type:String,reflect:!0})],oi.prototype,"variant",void 0),ni([ge({type:Number,attribute:"conversation-id",reflect:!0})],oi.prototype,"conversationId",void 0),ni([me()],oi.prototype,"_inputValue",void 0),ni([me()],oi.prototype,"_isStreaming",void 0),ni([me()],oi.prototype,"_error",void 0),ni([me()],oi.prototype,"_contextWarning",void 0),ni([me()],oi.prototype,"_contextLimitReached",void 0),ni([me()],oi.prototype,"_contextLimitMessage",void 0),ni([me()],oi.prototype,"_telemetry",void 0),ni([me()],oi.prototype,"_iterationLog",void 0),ni([me()],oi.prototype,"_cacheCheckpoints",void 0),ni([me()],oi.prototype,"_debugPanelOpen",void 0),ni([me()],oi.prototype,"_debugDrawerWidth",void 0),ni([me()],oi.prototype,"_isDebugResizing",void 0),ni([me()],oi.prototype,"_pendingConversationFiles",void 0),ni([me()],oi.prototype,"_isDraggingFile",void 0),ni([me()],oi.prototype,"_skillMenuOpened",void 0),ni([me()],oi.prototype,"_skillQuery",void 0),ni([me()],oi.prototype,"_orgSkills",void 0),ni([me()],oi.prototype,"_globalSkills",void 0),ni([me()],oi.prototype,"_invocableSkills",void 0),ni([me()],oi.prototype,"_aiFrameworkConfig",void 0),ni([me()],oi.prototype,"_skillHighlighted",void 0),ni([me()],oi.prototype,"_copiedIndex",void 0),ni([me()],oi.prototype,"_skillBrowseOpened",void 0),ni([me()],oi.prototype,"_skillBrowseSource",void 0),ni([me()],oi.prototype,"_skillBrowseQuery",void 0),ni([me()],oi.prototype,"_isDictating",void 0),ni([fe(".panel")],oi.prototype,"_panelEl",void 0),ni([fe(".messages")],oi.prototype,"_messagesEl",void 0),ni([fe(".input")],oi.prototype,"_inputEl",void 0),ni([fe(".file-input")],oi.prototype,"_fileInputEl",void 0),ni([fe(".input-wrapper")],oi.prototype,"_inputWrapperEl",void 0),ni([fe(".skill-menu")],oi.prototype,"_skillMenuEl",void 0),oi=ni([de("kr-chatbot")],oi);export{oi as KRChatbot,Pe as KRRouter,Ne as KRRouterOutlet,Ee as KRScaffold,Re as KRScreenDetail,Ce as KRScreenNav,De as KRSubbar};
3470
+ `,ri([me({attribute:!1})],li.prototype,"send",void 0),ri([me({attribute:!1})],li.prototype,"load",void 0),ri([me({attribute:!1})],li.prototype,"messages",void 0),ri([me({type:String})],li.prototype,"label",void 0),ri([me({type:String})],li.prototype,"placeholder",void 0),ri([me({type:Boolean,reflect:!0})],li.prototype,"opened",void 0),ri([me({type:Boolean,attribute:"hide-toggle",reflect:!0})],li.prototype,"hideToggle",void 0),ri([me({type:String,reflect:!0})],li.prototype,"variant",void 0),ri([me({type:Number,attribute:"conversation-id",reflect:!0})],li.prototype,"conversationId",void 0),ri([fe()],li.prototype,"_inputValue",void 0),ri([fe()],li.prototype,"_isStreaming",void 0),ri([fe()],li.prototype,"_error",void 0),ri([fe()],li.prototype,"_contextWarning",void 0),ri([fe()],li.prototype,"_contextLimitReached",void 0),ri([fe()],li.prototype,"_contextLimitMessage",void 0),ri([fe()],li.prototype,"_telemetry",void 0),ri([fe()],li.prototype,"_iterationLog",void 0),ri([fe()],li.prototype,"_cacheCheckpoints",void 0),ri([fe()],li.prototype,"_debugPanelOpen",void 0),ri([fe()],li.prototype,"_debugDrawerWidth",void 0),ri([fe()],li.prototype,"_isDebugResizing",void 0),ri([fe()],li.prototype,"_pendingConversationFiles",void 0),ri([fe()],li.prototype,"_isDraggingFile",void 0),ri([fe()],li.prototype,"_skillMenuOpened",void 0),ri([fe()],li.prototype,"_skillQuery",void 0),ri([fe()],li.prototype,"_orgSkills",void 0),ri([fe()],li.prototype,"_globalSkills",void 0),ri([fe()],li.prototype,"_invocableSkills",void 0),ri([fe()],li.prototype,"_aiFrameworkConfig",void 0),ri([fe()],li.prototype,"_skillHighlighted",void 0),ri([fe()],li.prototype,"_copiedIndex",void 0),ri([fe()],li.prototype,"_skillBrowseOpened",void 0),ri([fe()],li.prototype,"_skillBrowseSource",void 0),ri([fe()],li.prototype,"_skillBrowseQuery",void 0),ri([fe()],li.prototype,"_isDictating",void 0),ri([be(".panel")],li.prototype,"_panelEl",void 0),ri([be(".messages")],li.prototype,"_messagesEl",void 0),ri([be(".input")],li.prototype,"_inputEl",void 0),ri([be(".file-input")],li.prototype,"_fileInputEl",void 0),ri([be(".input-wrapper")],li.prototype,"_inputWrapperEl",void 0),ri([be(".skill-menu")],li.prototype,"_skillMenuEl",void 0),li=ri([pe("kr-chatbot")],li);export{li as KRChatbot,Ne as KRRouter,Oe as KRRouterOutlet,Ce as KRScaffold,Te as KRScreenDetail,Ae as KRScreenNav,Me as KRSubbar};
3442
3471
  //# sourceMappingURL=krubble-app.bundled.min.js.map