@kodaris/krubble-app-components 1.0.174 → 1.0.175
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.
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/,{is:l,defineProperty:d,getOwnPropertyDescriptor:h,getOwnPropertyNames:c,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,g=globalThis,f=g.trustedTypes,m=f?f.emptyScript:"",
|
|
11
|
+
*/,{is:l,defineProperty:d,getOwnPropertyDescriptor:h,getOwnPropertyNames:c,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,g=globalThis,f=g.trustedTypes,m=f?f.emptyScript:"",v=g.reactiveElementPolyfillSupport,b=(e,t)=>e,_={toAttribute(e,t){switch(t){case Boolean:e=e?m: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}},y=(e,t)=>!l(e,t),k={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let x=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=k){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&&d(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:o}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const r=s?.call(this);o?.call(this,t),this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??k}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=u(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...c(e),...p(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(n(e))}else void 0!==e&&t.push(n(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,s)=>{if(i)e.adoptedStyleSheets=s.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const i of s){const s=document.createElement("style"),o=t.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=i.cssText,e.appendChild(s)}})(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 o=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(t,i.type);this._$Em=e,null==o?this.removeAttribute(s):this.setAttribute(s,o),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),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:_;this._$Em=s;const r=o.fromAttribute(t,e.type);this[s]=r??this._$Ej?.get(s)??r,this._$Em=null}}requestUpdate(e,t,i,s=!1,o){if(void 0!==e){const r=this.constructor;if(!1===s&&(o=this[e]),i??=r.getPropertyOptions(e),!((i.hasChanged??y)(o,t)||i.useDefault&&i.reflect&&o===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:o},r){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==o||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){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[b("elementProperties")]=new Map,x[b("finalized")]=new Map,v?.({ReactiveElement:x}),(g.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 w=globalThis,$=w.trustedTypes,S=$?$.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,z="?"+E,D=`<${z}>`,T=document,O=()=>T.createComment(""),A=e=>null===e||"object"!=typeof e&&"function"!=typeof e,
|
|
17
|
+
const w=globalThis,$=w.trustedTypes,S=$?$.createPolicy("lit-html",{createHTML:e=>e}):void 0,C="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,z="?"+E,D=`<${z}>`,T=document,O=()=>T.createComment(""),A=e=>null===e||"object"!=typeof e&&"function"!=typeof e,M=Array.isArray,I="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,L=/>/g,q=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,B=/"/g,F=/^(?:script|style|textarea|title)$/i,N=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),j=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),H=new WeakMap,W=T.createTreeWalker(T,129);function Y(e,t){if(!M(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(t):t}class K{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,r=0;const a=e.length-1,n=this.parts,[l,d]=((e,t)=>{const i=e.length-1,s=[];let o,r=2===t?"<svg>":3===t?"<math>":"",a=R;for(let t=0;t<i;t++){const i=e[t];let n,l,d=-1,h=0;for(;h<i.length&&(a.lastIndex=h,l=a.exec(i),null!==l);)h=a.lastIndex,a===R?"!--"===l[1]?a=P:void 0!==l[1]?a=L:void 0!==l[2]?(F.test(l[2])&&(o=RegExp("</"+l[2],"g")),a=q):void 0!==l[3]&&(a=q):a===q?">"===l[0]?(a=o??R,d=-1):void 0===l[1]?d=-2:(d=a.lastIndex-l[2].length,n=l[1],a=void 0===l[3]?q:'"'===l[3]?B:V):a===B||a===V?a=q:a===P||a===L?a=R:(a=q,o=void 0);const c=a===q&&e[t+1].startsWith("/>")?" ":"";r+=a===R?i+D:d>=0?(s.push(n),i.slice(0,d)+C+i.slice(d)+E+c):i+E+(-2===d?t:c)}return[Y(e,r+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]})(e,t);if(this.el=K.createElement(l,i),W.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=W.nextNode())&&n.length<a;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(C)){const t=d[r++],i=s.getAttribute(e).split(E),a=/([.?@])?(.*)/.exec(t);n.push({type:1,index:o,name:a[2],strings:i,ctor:"."===a[1]?G:"?"===a[1]?ee:"@"===a[1]?te:Q}),s.removeAttribute(e)}else e.startsWith(E)&&(n.push({type:6,index:o}),s.removeAttribute(e));if(F.test(s.tagName)){const e=s.textContent.split(E),t=e.length-1;if(t>0){s.textContent=$?$.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],O()),W.nextNode(),n.push({type:2,index:++o});s.append(e[t],O())}}}else if(8===s.nodeType)if(s.data===z)n.push({type:2,index:o});else{let e=-1;for(;-1!==(e=s.data.indexOf(E,e+1));)n.push({type:7,index:o}),e+=E.length-1}o++}}static createElement(e,t){const i=T.createElement("template");return i.innerHTML=e,i}}function X(e,t,i=e,s){if(t===j)return t;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const r=A(t)?void 0:t._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(e),o._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(t=X(e,o._$AS(e,t.values),o,s)),t}class Z{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??T).importNode(t,!0);W.currentNode=s;let o=W.nextNode(),r=0,a=0,n=i[0];for(;void 0!==n;){if(r===n.index){let t;2===n.type?t=new J(o,o.nextSibling,this,e):1===n.type?t=new n.ctor(o,n.name,n.strings,this,e):6===n.type&&(t=new ie(o,this,e)),this._$AV.push(t),n=i[++a]}r!==n?.index&&(o=W.nextNode(),r++)}return W.currentNode=T,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 J{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=U,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=X(this,e,t),A(e)?e===U||null==e||""===e?(this._$AH!==U&&this._$AR(),this._$AH=U):e!==this._$AH&&e!==j&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>M(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!==U&&A(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.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(Y(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new Z(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=H.get(e.strings);return void 0===t&&H.set(e.strings,t=new K(e)),t}k(e){M(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const o of e)s===t.length?t.push(i=new J(this.O(O()),this.O(O()),this,this.options)):i=t[s],i._$AI(o),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 Q{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,o){this.type=1,this._$AH=U,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=U}_$AI(e,t=this,i,s){const o=this.strings;let r=!1;if(void 0===o)e=X(this,e,t,0),r=!A(e)||e!==this._$AH&&e!==j,r&&(this._$AH=e);else{const s=e;let a,n;for(e=o[0],a=0;a<o.length-1;a++)n=X(this,s[i+a],t,a),n===j&&(n=this._$AH[a]),r||=!A(n)||n!==this._$AH[a],n===U?e=U:e!==U&&(e+=(n??"")+o[a+1]),this._$AH[a]=n}r&&!s&&this.j(e)}j(e){e===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class G extends Q{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===U?void 0:e}}class ee extends Q{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==U)}}class te extends Q{constructor(e,t,i,s,o){super(e,t,i,s,o),this.type=5}_$AI(e,t=this){if((e=X(this,e,t,0)??U)===j)return;const i=this._$AH,s=e===U&&i!==U||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==U&&(i===U||s);s&&this.element.removeEventListener(this.name,this,i),o&&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 ie{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){X(this,e)}}const se={I:J},oe=w.litHtmlPolyfillSupport;oe?.(K,J),(w.litHtmlVersions??=[]).push("3.3.2");const re=(e,t,i)=>{const s=i?.renderBefore??t;let o=s._$litPart$;if(void 0===o){const e=i?.renderBefore??null;s._$litPart$=o=new J(t.insertBefore(O(),e),e,void 0,i??{})}return o._$AI(e),o
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/},ae=globalThis;let ne=class extends x{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=re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return
|
|
22
|
+
*/},ae=globalThis;let ne=class extends x{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=re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return j}};ne._$litElement$=!0,ne.finalized=!0,ae.litElementHydrateSupport?.({LitElement:ne});const le=ae.litElementPolyfillSupport;le?.({LitElement:ne}),(ae.litElementVersions??=[]).push("4.2.2");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
@@ -46,12 +46,12 @@ function ue(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
46
46
|
* @license
|
|
47
47
|
* Copyright 2017 Google LLC
|
|
48
48
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
|
-
*/const ge=1,fe=2,me=3,
|
|
49
|
+
*/const ge=1,fe=2,me=3,ve=4,be=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)}};
|
|
50
50
|
/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2018 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const ye=
|
|
54
|
+
*/const ye=be(class extends _e{constructor(e){if(super(e),e.type!==ge||"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 j}}),ke="important",xe=" !"+ke,we=be(class extends _e{constructor(e){if(super(e),e.type!==ge||"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(xe);e.includes("-")||t?i.setProperty(e,t?s.slice(0,-11):s,t?ke:""):i[e]=s}}return j}});
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2018 Google LLC
|
|
@@ -62,12 +62,12 @@ function ue(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
62
62
|
* Copyright 2017 Google LLC
|
|
63
63
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
64
|
*/
|
|
65
|
-
class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===U||null==e)return this._t=void 0,this.it=e;if(e===
|
|
65
|
+
class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===U||null==e)return this._t=void 0,this.it=e;if(e===j)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:[]}}}$e.directiveName="unsafeHTML",$e.resultType=1;const Se=be($e),{I:Ce}=se,Ee=()=>document.createComment(""),ze=(e,t,i)=>{const s=e._$AA.parentNode,o=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=s.insertBefore(Ee(),o),r=s.insertBefore(Ee(),o);i=new Ce(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!==o||a){let e=i._$AA;for(;e!==t;){const t=e.nextSibling;s.insertBefore(e,o),e=t}}}return i},De=(e,t,i=e)=>(e._$AI(t,i),e),Te={},Oe=(e,t=Te)=>e._$AH=t,Ae=e=>{e._$AR(),e._$AA.remove()},Me=(e,t,i)=>{const s=new Map;for(let o=t;o<=i;o++)s.set(e[o],o);return s},Ie=be(class extends _e{constructor(e){if(super(e),e.type!==fe)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 o=[],r=[];let a=0;for(const t of e)o[a]=s?s(t,a):a,r[a]=i(t,a),a++;return{values:r,keys:o}}render(e,t,i){return this.dt(e,t,i).values}update(e,[t,i,s]){const o=(e=>e._$AH)(e),{values:r,keys:a}=this.dt(t,i,s);if(!Array.isArray(o))return this.ut=a,r;const n=this.ut??=[],l=[];let d,h,c=0,p=o.length-1,u=0,g=r.length-1;for(;c<=p&&u<=g;)if(null===o[c])c++;else if(null===o[p])p--;else if(n[c]===a[u])l[u]=De(o[c],r[u]),c++,u++;else if(n[p]===a[g])l[g]=De(o[p],r[g]),p--,g--;else if(n[c]===a[g])l[g]=De(o[c],r[g]),ze(e,l[g+1],o[c]),c++,g--;else if(n[p]===a[u])l[u]=De(o[p],r[u]),ze(e,o[c],o[p]),p--,u++;else if(void 0===d&&(d=Me(a,u,g),h=Me(n,c,p)),d.has(n[c]))if(d.has(n[p])){const t=h.get(a[u]),i=void 0!==t?o[t]:null;if(null===i){const t=ze(e,o[c]);De(t,r[u]),l[u]=t}else l[u]=De(i,r[u]),ze(e,o[c],i),o[t]=null;u++}else Ae(o[p]),p--;else Ae(o[c]),c++;for(;u<=g;){const t=ze(e,l[g+1]);De(t,r[u]),l[u++]=t}for(;c<=p;){const e=o[c++];null!==e&&Ae(e)}return this.ut=a,Oe(e,l),j}});
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
68
68
|
* Copyright 2020 Google LLC
|
|
69
69
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
70
|
-
*/function Re(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Pe={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Le(e){Pe=e}const qe=/[&<>"']/,Ve=new RegExp(qe.source,"g"),Fe=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Be=new RegExp(Fe.source,"g"),je={"&":"&","<":"<",">":">",'"':""","'":"'"},Ne=e=>je[e];function Ue(e,t){if(t){if(qe.test(e))return e.replace(Ve,Ne)}else if(Fe.test(e))return e.replace(Be,Ne);return e}const He=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function We(e){return e.replace(He,((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 Ye=/(^|[^\[])\^/g;function Ke(e,t){let i="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let o="string"==typeof t?t:t.source;return o=o.replace(Ye,"$1"),i=i.replace(e,o),s},getRegex:()=>new RegExp(i,t)};return s}function Xe(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const Ze={exec:()=>null};function Qe(e,t){const i=e.replace(/\|/g,((e,t,i)=>{let s=!1,o=t;for(;--o>=0&&"\\"===i[o];)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 Je(e,t,i){const s=e.length;if(0===s)return"";let o=0;for(;o<s;){if(e.charAt(s-o-1)!==t)break;o++}return e.slice(0,s-o)}function Ge(e,t,i,s){const o=t.href,r=t.title?Ue(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:o,title:r,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,e}return{type:"image",raw:i,href:o,title:r,text:Ue(a)}}class et{options;rules;lexer;constructor(e){this.options=e||Pe}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:Je(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=Je(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=Je(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,o={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="",n="",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))),d=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,n=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,n=s.slice(h),h+=t[1].length);let c=!1;if(!s&&/^ *$/.test(d)&&(a+=d+"\n",e=e.substring(d.length+1),i=!0),!i){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),o=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(d=l,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),o.test(d))break;if(r.test(d))break;if(t.test(d))break;if(i.test(e))break;if(d.search(/[^ ]/)>=h||!d.trim())n+="\n"+d.slice(h);else{if(c)break;if(s.search(/[^ ]/)>=4)break;if(o.test(s))break;if(r.test(s))break;if(i.test(s))break;n+="\n"+d}c||d.trim()||(c=!0),a+=l+"\n",e=e.substring(l.length+1),s=d.slice(h)}}o.loose||(l?o.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(n),u&&(p="[ ] "!==u[0],n=n.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:a,task:!!u,checked:p,loose:!1,text:n,tokens:[]}),o.raw+=a}o.items[o.items.length-1].raw=a.trimEnd(),o.items[o.items.length-1].text=n.trimEnd(),o.raw=o.raw.trimEnd();for(let e=0;e<o.items.length;e++)if(this.lexer.state.top=!1,o.items[e].tokens=this.lexer.blockTokens(o.items[e].text,[]),!o.loose){const t=o.items[e].tokens.filter((e=>"space"===e.type)),i=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));o.loose=i}if(o.loose)for(let e=0;e<o.items.length;e++)o.items[e].loose=!0;return o}}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=Qe(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),o=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 o)r.rows.push(Qe(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:Ue(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=Je(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)),Ge(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 Ge(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 o,r,a=i,n=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(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){a+=r;continue}if((s[5]||s[6])&&i%3&&!((i+r)%3)){n+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+n);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 d=l.slice(2,-2);return{type:"strong",raw:l,text:d,tokens:this.lexer.inlineTokens(d)}}}}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=Ue(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=Ue(t[1]),i="mailto:"+e):(e=Ue(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=Ue(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=Ue(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]:Ue(t[0]),{type:"text",raw:t[0],text:e}}}}const tt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,it=/(?:[*+-]|\d{1,9}[.)])/,st=Ke(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,it).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(),ot=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rt=/(?!\s*\])(?:\\.|[^\[\]\\])+/,at=Ke(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",rt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nt=Ke(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,it).getRegex(),lt="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",dt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ht=Ke("^ {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",dt).replace("tag",lt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=Ke(ot).replace("hr",tt).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",lt).getRegex(),pt={blockquote:Ke(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:at,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:tt,html:ht,lheading:st,list:nt,newline:/^(?: *(?:\n|$))+/,paragraph:ct,table:Ze,text:/^[^\n]+/},ut=Ke("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tt).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",lt).getRegex(),gt={...pt,table:ut,paragraph:Ke(ot).replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ut).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",lt).getRegex()},ft={...pt,html:Ke("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",dt).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:Ze,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ke(ot).replace("hr",tt).replace("heading"," *#{1,6} *[^\n]").replace("lheading",st).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},mt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,bt=/^( {2,}|\\)\n(?!\s*$)/,vt="\\p{P}\\p{S}",_t=Ke(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,vt).getRegex(),yt=Ke(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,vt).getRegex(),kt=Ke("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,vt).getRegex(),xt=Ke("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,vt).getRegex(),wt=Ke(/\\([punct])/,"gu").replace(/punct/g,vt).getRegex(),$t=Ke(/^<(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(),St=Ke(dt).replace("(?:--\x3e|$)","--\x3e").getRegex(),Ct=Ke("^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",St).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Et=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zt=Ke(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Et).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Dt=Ke(/^!?\[(label)\]\[(ref)\]/).replace("label",Et).replace("ref",rt).getRegex(),Tt=Ke(/^!?\[(ref)\](?:\[\])?/).replace("ref",rt).getRegex(),Ot={_backpedal:Ze,anyPunctuation:wt,autolink:$t,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:bt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Ze,emStrongLDelim:yt,emStrongRDelimAst:kt,emStrongRDelimUnd:xt,escape:mt,link:zt,nolink:Tt,punctuation:_t,reflink:Dt,reflinkSearch:Ke("reflink|nolink(?!\\()","g").replace("reflink",Dt).replace("nolink",Tt).getRegex(),tag:Ct,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Ze},At={...Ot,link:Ke(/^!?\[(label)\]\((.*?)\)/).replace("label",Et).getRegex(),reflink:Ke(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Et).getRegex()},It={...Ot,escape:Ke(mt).replace("])","~|])").getRegex(),url:Ke(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Mt={...It,br:Ke(bt).replace("{2,}","*").getRegex(),text:Ke(It.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Rt={normal:pt,gfm:gt,pedantic:ft},Pt={normal:Ot,gfm:It,breaks:Mt,pedantic:At};class Lt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Pe,this.options.tokenizer=this.options.tokenizer||new et,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:Rt.normal,inline:Pt.normal};this.options.pedantic?(t.block=Rt.pedantic,t.inline=Pt.pedantic):this.options.gfm&&(t.block=Rt.gfm,this.options.breaks?t.inline=Pt.breaks:t.inline=Pt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Rt,inline:Pt}}static lex(e,t){return new Lt(t).lex(e)}static lexInline(e,t){return new Lt(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,o,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(o=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&&(o=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o)))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=o.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,o,r,a,n,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||(n=""),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,n))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(o=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&&(o=e.substring(0,t+1))}if(i=this.tokenizer.inlineText(o))e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(n=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 qt{options;constructor(e){this.options=e||Pe}code(e,t,i){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+Ue(s)+'">'+(i?e:Ue(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:Ue(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=Xe(e);if(null===s)return i;let o='<a href="'+(e=s)+'"';return t&&(o+=' title="'+t+'"'),o+=">"+i+"</a>",o}image(e,t,i){const s=Xe(e);if(null===s)return i;let o=`<img src="${e=s}" alt="${i}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class Vt{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 Ft{options;renderer;textRenderer;constructor(e){this.options=e||Pe,this.options.renderer=this.options.renderer||new qt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Vt}static parse(e,t){return new Ft(t).parse(e)}static parseInline(e,t){return new Ft(t).parseInline(e)}parse(e,t=!0){let i="";for(let s=0;s<e.length;s++){const o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const e=o,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(o.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":{const e=o;i+=this.renderer.heading(this.parseInline(e.tokens),e.depth,We(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=o;i+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=o;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=o,t=this.parse(e.tokens);i+=this.renderer.blockquote(t);continue}case"list":{const e=o,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,o=i.task;let n="";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+" "}):n+=e+" "}n+=this.parse(i.tokens,r),a+=this.renderer.listitem(n,o,!!s)}i+=this.renderer.list(a,t,s);continue}case"html":{const e=o;i+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=o;i+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=o,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 "'+o.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 o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=e||"";continue}}switch(o.type){case"escape":{const e=o;i+=t.text(e.text);break}case"html":{const e=o;i+=t.html(e.text);break}case"link":{const e=o;i+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=o;i+=t.image(e.href,e.title,e.text);break}case"strong":{const e=o;i+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=o;i+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=o;i+=t.codespan(e.text);break}case"br":i+=t.br();break;case"del":{const e=o;i+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=o;i+=t.text(e.text);break}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}}class Bt{options;constructor(e){this.options=e||Pe}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const jt=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(Lt.lex,Ft.parse);parseInline=this.#e(Lt.lexInline,Ft.parseInline);Parser=Ft;Renderer=qt;TextRenderer=Vt;Lexer=Lt;Tokenizer=et;Hooks=Bt;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 o=e[s].flat(1/0);i=i.concat(this.walkTokens(o,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 qt(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,o=e.renderer[s],r=t[s];t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i||""}}i.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new et(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,o=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Bt;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,o=e.hooks[s],r=t[s];Bt.passThroughHooks.has(i)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(o.call(t,e)).then((e=>r.call(t,e)));const i=o.call(t,e);return r.call(t,i)}:t[s]=(...e)=>{let i=o.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 Lt.lex(e,t??this.defaults)}parser(e,t){return Ft.parse(e,t??this.defaults)}#e(e,t){return(i,s)=>{const o={...s},r={...this.defaults,...o};!0===this.defaults.async&&!1===o.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 o=t(s,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}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>"+Ue(i.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(i);throw i}}};function Nt(e,t){return jt.parse(e,t)}Nt.options=Nt.setOptions=function(e){return jt.setOptions(e),Nt.defaults=jt.defaults,Le(Nt.defaults),Nt},Nt.getDefaults=Re,Nt.defaults=Pe,Nt.use=function(...e){return jt.use(...e),Nt.defaults=jt.defaults,Le(Nt.defaults),Nt},Nt.walkTokens=function(e,t){return jt.walkTokens(e,t)},Nt.parseInline=jt.parseInline,Nt.Parser=Ft,Nt.parser=Ft.parse,Nt.Renderer=qt,Nt.TextRenderer=Vt,Nt.Lexer=Lt,Nt.lexer=Lt.lex,Nt.Tokenizer=et,Nt.Hooks=Bt,Nt.parse=Nt,Nt.options,Nt.setOptions,Nt.use,Nt.walkTokens,Nt.parseInline,Ft.parse,Lt.lex;const Ut=a`
|
|
70
|
+
*/function Re(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Pe={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Le(e){Pe=e}const qe=/[&<>"']/,Ve=new RegExp(qe.source,"g"),Be=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Fe=new RegExp(Be.source,"g"),Ne={"&":"&","<":"<",">":">",'"':""","'":"'"},je=e=>Ne[e];function Ue(e,t){if(t){if(qe.test(e))return e.replace(Ve,je)}else if(Be.test(e))return e.replace(Fe,je);return e}const He=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function We(e){return e.replace(He,((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 Ye=/(^|[^\[])\^/g;function Ke(e,t){let i="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let o="string"==typeof t?t:t.source;return o=o.replace(Ye,"$1"),i=i.replace(e,o),s},getRegex:()=>new RegExp(i,t)};return s}function Xe(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const Ze={exec:()=>null};function Je(e,t){const i=e.replace(/\|/g,((e,t,i)=>{let s=!1,o=t;for(;--o>=0&&"\\"===i[o];)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 Qe(e,t,i){const s=e.length;if(0===s)return"";let o=0;for(;o<s;){if(e.charAt(s-o-1)!==t)break;o++}return e.slice(0,s-o)}function Ge(e,t,i,s){const o=t.href,r=t.title?Ue(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:o,title:r,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,e}return{type:"image",raw:i,href:o,title:r,text:Ue(a)}}class et{options;rules;lexer;constructor(e){this.options=e||Pe}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:Qe(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=Qe(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=Qe(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,o={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="",n="",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))),d=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,n=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,n=s.slice(h),h+=t[1].length);let c=!1;if(!s&&/^ *$/.test(d)&&(a+=d+"\n",e=e.substring(d.length+1),i=!0),!i){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),o=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(d=l,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),o.test(d))break;if(r.test(d))break;if(t.test(d))break;if(i.test(e))break;if(d.search(/[^ ]/)>=h||!d.trim())n+="\n"+d.slice(h);else{if(c)break;if(s.search(/[^ ]/)>=4)break;if(o.test(s))break;if(r.test(s))break;if(i.test(s))break;n+="\n"+d}c||d.trim()||(c=!0),a+=l+"\n",e=e.substring(l.length+1),s=d.slice(h)}}o.loose||(l?o.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(n),u&&(p="[ ] "!==u[0],n=n.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:a,task:!!u,checked:p,loose:!1,text:n,tokens:[]}),o.raw+=a}o.items[o.items.length-1].raw=a.trimEnd(),o.items[o.items.length-1].text=n.trimEnd(),o.raw=o.raw.trimEnd();for(let e=0;e<o.items.length;e++)if(this.lexer.state.top=!1,o.items[e].tokens=this.lexer.blockTokens(o.items[e].text,[]),!o.loose){const t=o.items[e].tokens.filter((e=>"space"===e.type)),i=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));o.loose=i}if(o.loose)for(let e=0;e<o.items.length;e++)o.items[e].loose=!0;return o}}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=Je(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),o=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 o)r.rows.push(Je(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:Ue(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=Qe(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)),Ge(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 Ge(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 o,r,a=i,n=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(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(r=[...o].length,s[3]||s[4]){a+=r;continue}if((s[5]||s[6])&&i%3&&!((i+r)%3)){n+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+n);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 d=l.slice(2,-2);return{type:"strong",raw:l,text:d,tokens:this.lexer.inlineTokens(d)}}}}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=Ue(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=Ue(t[1]),i="mailto:"+e):(e=Ue(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=Ue(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=Ue(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]:Ue(t[0]),{type:"text",raw:t[0],text:e}}}}const tt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,it=/(?:[*+-]|\d{1,9}[.)])/,st=Ke(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,it).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(),ot=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rt=/(?!\s*\])(?:\\.|[^\[\]\\])+/,at=Ke(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",rt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nt=Ke(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,it).getRegex(),lt="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",dt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ht=Ke("^ {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",dt).replace("tag",lt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=Ke(ot).replace("hr",tt).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",lt).getRegex(),pt={blockquote:Ke(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:at,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:tt,html:ht,lheading:st,list:nt,newline:/^(?: *(?:\n|$))+/,paragraph:ct,table:Ze,text:/^[^\n]+/},ut=Ke("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tt).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",lt).getRegex(),gt={...pt,table:ut,paragraph:Ke(ot).replace("hr",tt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ut).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",lt).getRegex()},ft={...pt,html:Ke("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",dt).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:Ze,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ke(ot).replace("hr",tt).replace("heading"," *#{1,6} *[^\n]").replace("lheading",st).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},mt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vt=/^( {2,}|\\)\n(?!\s*$)/,bt="\\p{P}\\p{S}",_t=Ke(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,bt).getRegex(),yt=Ke(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,bt).getRegex(),kt=Ke("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,bt).getRegex(),xt=Ke("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,bt).getRegex(),wt=Ke(/\\([punct])/,"gu").replace(/punct/g,bt).getRegex(),$t=Ke(/^<(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(),St=Ke(dt).replace("(?:--\x3e|$)","--\x3e").getRegex(),Ct=Ke("^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",St).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Et=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zt=Ke(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Et).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Dt=Ke(/^!?\[(label)\]\[(ref)\]/).replace("label",Et).replace("ref",rt).getRegex(),Tt=Ke(/^!?\[(ref)\](?:\[\])?/).replace("ref",rt).getRegex(),Ot={_backpedal:Ze,anyPunctuation:wt,autolink:$t,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:vt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Ze,emStrongLDelim:yt,emStrongRDelimAst:kt,emStrongRDelimUnd:xt,escape:mt,link:zt,nolink:Tt,punctuation:_t,reflink:Dt,reflinkSearch:Ke("reflink|nolink(?!\\()","g").replace("reflink",Dt).replace("nolink",Tt).getRegex(),tag:Ct,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Ze},At={...Ot,link:Ke(/^!?\[(label)\]\((.*?)\)/).replace("label",Et).getRegex(),reflink:Ke(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Et).getRegex()},Mt={...Ot,escape:Ke(mt).replace("])","~|])").getRegex(),url:Ke(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},It={...Mt,br:Ke(vt).replace("{2,}","*").getRegex(),text:Ke(Mt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Rt={normal:pt,gfm:gt,pedantic:ft},Pt={normal:Ot,gfm:Mt,breaks:It,pedantic:At};class Lt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Pe,this.options.tokenizer=this.options.tokenizer||new et,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:Rt.normal,inline:Pt.normal};this.options.pedantic?(t.block=Rt.pedantic,t.inline=Pt.pedantic):this.options.gfm&&(t.block=Rt.gfm,this.options.breaks?t.inline=Pt.breaks:t.inline=Pt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Rt,inline:Pt}}static lex(e,t){return new Lt(t).lex(e)}static lexInline(e,t){return new Lt(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,o,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(o=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&&(o=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o)))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=o.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,o,r,a,n,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||(n=""),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,n))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(o=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&&(o=e.substring(0,t+1))}if(i=this.tokenizer.inlineText(o))e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(n=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 qt{options;constructor(e){this.options=e||Pe}code(e,t,i){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+Ue(s)+'">'+(i?e:Ue(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:Ue(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=Xe(e);if(null===s)return i;let o='<a href="'+(e=s)+'"';return t&&(o+=' title="'+t+'"'),o+=">"+i+"</a>",o}image(e,t,i){const s=Xe(e);if(null===s)return i;let o=`<img src="${e=s}" alt="${i}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class Vt{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 Bt{options;renderer;textRenderer;constructor(e){this.options=e||Pe,this.options.renderer=this.options.renderer||new qt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Vt}static parse(e,t){return new Bt(t).parse(e)}static parseInline(e,t){return new Bt(t).parseInline(e)}parse(e,t=!0){let i="";for(let s=0;s<e.length;s++){const o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const e=o,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(o.type){case"space":continue;case"hr":i+=this.renderer.hr();continue;case"heading":{const e=o;i+=this.renderer.heading(this.parseInline(e.tokens),e.depth,We(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=o;i+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=o;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=o,t=this.parse(e.tokens);i+=this.renderer.blockquote(t);continue}case"list":{const e=o,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,o=i.task;let n="";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+" "}):n+=e+" "}n+=this.parse(i.tokens,r),a+=this.renderer.listitem(n,o,!!s)}i+=this.renderer.list(a,t,s);continue}case"html":{const e=o;i+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=o;i+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=o,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 "'+o.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 o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=e||"";continue}}switch(o.type){case"escape":{const e=o;i+=t.text(e.text);break}case"html":{const e=o;i+=t.html(e.text);break}case"link":{const e=o;i+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=o;i+=t.image(e.href,e.title,e.text);break}case"strong":{const e=o;i+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=o;i+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=o;i+=t.codespan(e.text);break}case"br":i+=t.br();break;case"del":{const e=o;i+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=o;i+=t.text(e.text);break}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return i}}class Ft{options;constructor(e){this.options=e||Pe}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Nt=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(Lt.lex,Bt.parse);parseInline=this.#e(Lt.lexInline,Bt.parseInline);Parser=Bt;Renderer=qt;TextRenderer=Vt;Lexer=Lt;Tokenizer=et;Hooks=Ft;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 o=e[s].flat(1/0);i=i.concat(this.walkTokens(o,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 qt(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,o=e.renderer[s],r=t[s];t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i||""}}i.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new et(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,o=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let i=o.apply(t,e);return!1===i&&(i=r.apply(t,e)),i}}i.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Ft;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,o=e.hooks[s],r=t[s];Ft.passThroughHooks.has(i)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(o.call(t,e)).then((e=>r.call(t,e)));const i=o.call(t,e);return r.call(t,i)}:t[s]=(...e)=>{let i=o.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 Lt.lex(e,t??this.defaults)}parser(e,t){return Bt.parse(e,t??this.defaults)}#e(e,t){return(i,s)=>{const o={...s},r={...this.defaults,...o};!0===this.defaults.async&&!1===o.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 o=t(s,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}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>"+Ue(i.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(i);throw i}}};function jt(e,t){return Nt.parse(e,t)}jt.options=jt.setOptions=function(e){return Nt.setOptions(e),jt.defaults=Nt.defaults,Le(jt.defaults),jt},jt.getDefaults=Re,jt.defaults=Pe,jt.use=function(...e){return Nt.use(...e),jt.defaults=Nt.defaults,Le(jt.defaults),jt},jt.walkTokens=function(e,t){return Nt.walkTokens(e,t)},jt.parseInline=Nt.parseInline,jt.Parser=Bt,jt.parser=Bt.parse,jt.Renderer=qt,jt.TextRenderer=Vt,jt.Lexer=Lt,jt.lexer=Lt.lex,jt.Tokenizer=et,jt.Hooks=Ft,jt.parse=jt,jt.options,jt.setOptions,jt.use,jt.walkTokens,jt.parseInline,Bt.parse,Lt.lex;const Ut=a`
|
|
71
71
|
:host,
|
|
72
72
|
*,
|
|
73
73
|
*::before,
|
|
@@ -94,7 +94,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
94
94
|
/* Borders */
|
|
95
95
|
--kr-border: #e5e7eb;
|
|
96
96
|
}
|
|
97
|
-
`;var Ht=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Wt extends ne{constructor(){super(...arguments),this.header="",this.expanded=!1}handleHeaderClick(){this.expanded=!this.expanded}render(){return
|
|
97
|
+
`;var Ht=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Wt extends ne{constructor(){super(...arguments),this.header="",this.expanded=!1}handleHeaderClick(){this.expanded=!this.expanded}render(){return N`
|
|
98
98
|
<div class="header" @click=${this.handleHeaderClick}>
|
|
99
99
|
<span class="header__title">${this.header}</span>
|
|
100
100
|
<svg
|
|
@@ -168,7 +168,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
168
168
|
.content__body {
|
|
169
169
|
padding: 16px 16px 8px 16px;
|
|
170
170
|
}
|
|
171
|
-
`,Ht([ce({type:String})],Wt.prototype,"header",void 0),Ht([ce({type:Boolean,reflect:!0})],Wt.prototype,"expanded",void 0),customElements.get("krs-accordion")||customElements.define("krs-accordion",Wt);var Yt=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Kt extends ne{constructor(){super(...arguments),this.type="info",this.label="",this.title="",this.dismissible=!1,this.visible=!0}_handleDismiss(){this.visible=!1,this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))}render(){const e={info:
|
|
171
|
+
`,Ht([ce({type:String})],Wt.prototype,"header",void 0),Ht([ce({type:Boolean,reflect:!0})],Wt.prototype,"expanded",void 0),customElements.get("krs-accordion")||customElements.define("krs-accordion",Wt);var Yt=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Kt extends ne{constructor(){super(...arguments),this.type="info",this.label="",this.title="",this.dismissible=!1,this.visible=!0}_handleDismiss(){this.visible=!1,this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))}render(){const e={info:N`
|
|
172
172
|
<svg
|
|
173
173
|
class="icon"
|
|
174
174
|
viewBox="0 0 20 20"
|
|
@@ -180,7 +180,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
180
180
|
clip-rule="evenodd"
|
|
181
181
|
/>
|
|
182
182
|
</svg>
|
|
183
|
-
`,success:
|
|
183
|
+
`,success:N`
|
|
184
184
|
<svg
|
|
185
185
|
class="icon"
|
|
186
186
|
viewBox="0 0 20 20"
|
|
@@ -192,7 +192,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
192
192
|
clip-rule="evenodd"
|
|
193
193
|
/>
|
|
194
194
|
</svg>
|
|
195
|
-
`,warning:
|
|
195
|
+
`,warning:N`
|
|
196
196
|
<svg
|
|
197
197
|
class="icon"
|
|
198
198
|
viewBox="0 0 20 20"
|
|
@@ -204,7 +204,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
204
204
|
clip-rule="evenodd"
|
|
205
205
|
/>
|
|
206
206
|
</svg>
|
|
207
|
-
`,error:
|
|
207
|
+
`,error:N`
|
|
208
208
|
<svg
|
|
209
209
|
class="icon"
|
|
210
210
|
viewBox="0 0 20 20"
|
|
@@ -216,19 +216,19 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
216
216
|
clip-rule="evenodd"
|
|
217
217
|
/>
|
|
218
218
|
</svg>
|
|
219
|
-
`};return
|
|
219
|
+
`};return N`
|
|
220
220
|
<div
|
|
221
221
|
class=${ye({alert:!0,["alert--"+this.type]:!0,"alert--has-header":!(!this.label&&!this.title),"alert--hidden":!this.visible})}
|
|
222
222
|
role="alert"
|
|
223
223
|
>
|
|
224
224
|
${e[this.type]}
|
|
225
225
|
<div class="content">
|
|
226
|
-
${this.label||this.title?
|
|
226
|
+
${this.label||this.title?N`<h4 class="header">${this.label||this.title}</h4>`:U}
|
|
227
227
|
<div class="message">
|
|
228
228
|
<slot></slot>
|
|
229
229
|
</div>
|
|
230
230
|
</div>
|
|
231
|
-
${this.dismissible?
|
|
231
|
+
${this.dismissible?N`
|
|
232
232
|
<button
|
|
233
233
|
class="dismiss"
|
|
234
234
|
type="button"
|
|
@@ -366,26 +366,26 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
366
366
|
outline: 2px solid #3b82f6;
|
|
367
367
|
outline-offset: 2px;
|
|
368
368
|
}
|
|
369
|
-
`,Yt([ce({type:String})],Kt.prototype,"type",void 0),Yt([ce({type:String})],Kt.prototype,"label",void 0),Yt([ce({type:String})],Kt.prototype,"title",void 0),Yt([ce({type:Boolean})],Kt.prototype,"dismissible",void 0),Yt([ce({type:Boolean})],Kt.prototype,"visible",void 0),customElements.get("krs-alert")||customElements.define("krs-alert",Kt);var Xt=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Zt extends ne{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this.iconPosition="left",this.split=!1,this._state="idle",this._stateText="",this._dropdownOpened=!1,this._handleHostClick=e=>{this.split&&this.options.length||this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{if("Escape"===e.key&&this._dropdownOpened)this._dropdownOpened=!1;else{if("Enter"===e.key||" "===e.key){if(e.preventDefault(),this.split&&this.options.length)return void this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}));this.options.length?this._toggleDropdown():this.click()}this.split&&this.options.length&&"ArrowDown"===e.key&&(e.preventDefault(),this._dropdownOpened||this._toggleDropdown())}},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.href?this.setAttribute("role","link"):this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._handleKeydown),this.addEventListener("click",this._handleHostClick),document.addEventListener("click",this._handleClickOutside)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown),this.removeEventListener("click",this._handleHostClick),document.removeEventListener("click",this._handleClickOutside)}updated(e){this.classList.toggle("kr-button--loading","loading"===this._state),this.classList.toggle("kr-button--success","success"===this._state),this.classList.toggle("kr-button--error","error"===this._state),this.classList.toggle("kr-button--flat","flat"===this.variant),this.classList.toggle("kr-button--outline","outline"===this.variant),this.classList.toggle("kr-button--primary","primary"===this.color),this.classList.toggle("kr-button--secondary","secondary"===this.color),this.classList.toggle("kr-button--danger","danger"===this.color),this.classList.toggle("kr-button--small","small"===this.size),this.classList.toggle("kr-button--large","large"===this.size),this.classList.toggle("kr-button--split",this.split&&!!this.options.length)}_handleSplitPrimaryClick(e){e.stopPropagation(),this._dropdownOpened&&(this._dropdownOpened=!1),this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}))}_handleSplitTriggerClick(e){e.stopPropagation(),this._toggleDropdown()}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=this.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.bottom="",e.style.left=t.left+"px",e.style.right="",e.style.minWidth=t.width+"px",e.style.transformOrigin="top left",e.style.maxHeight="",e.style.overflowY="";const i=e.getBoundingClientRect();i.height>window.innerHeight-t.bottom-8&&t.top>window.innerHeight-t.bottom?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.transformOrigin="bottom left",e.classList.add("dropdown--above"),i.height>t.top-8&&(e.style.maxHeight=t.top-8+"px",e.style.overflowY="auto")):(e.classList.remove("dropdown--above"),i.height>window.innerHeight-t.bottom-8&&(e.style.maxHeight=window.innerHeight-t.bottom-8+"px",e.style.overflowY="auto")),i.right>window.innerWidth&&(e.style.left="",e.style.right=window.innerWidth-t.right+"px",i.bottom>window.innerHeight?e.style.transformOrigin="bottom right":e.style.transformOrigin="top right")}}))}_handleOptionClick(e,t){t.stopPropagation(),this._dropdownOpened=!1,this.dispatchEvent(new CustomEvent("option-select",{detail:{id:e.id,label:e.label},bubbles:!0,composed:!0}))}showLoading(){this._clearStateTimeout(),this._state="loading",this._stateText=""}showSuccess(e="Success",t=Zt.STATE_DURATION){this._clearStateTimeout(),this._state="success",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}showError(e="Error",t=Zt.STATE_DURATION){this._clearStateTimeout(),this._state="error",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}isLoading(){return"loading"===this._state}reset(){this._clearStateTimeout(),this._state="idle",this._stateText=""}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}_renderDropdownItem(e){return e.href?
|
|
369
|
+
`,Yt([ce({type:String})],Kt.prototype,"type",void 0),Yt([ce({type:String})],Kt.prototype,"label",void 0),Yt([ce({type:String})],Kt.prototype,"title",void 0),Yt([ce({type:Boolean})],Kt.prototype,"dismissible",void 0),Yt([ce({type:Boolean})],Kt.prototype,"visible",void 0),customElements.get("krs-alert")||customElements.define("krs-alert",Kt);var Xt=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Zt extends ne{constructor(){super(...arguments),this.variant="flat",this.color="primary",this.size="medium",this.disabled=!1,this.options=[],this.iconPosition="left",this.split=!1,this._state="idle",this._stateText="",this._dropdownOpened=!1,this._handleHostClick=e=>{this.split&&this.options.length||this.options.length&&(e.stopPropagation(),this._toggleDropdown())},this._handleKeydown=e=>{if("Escape"===e.key&&this._dropdownOpened)this._dropdownOpened=!1;else{if("Enter"===e.key||" "===e.key){if(e.preventDefault(),this.split&&this.options.length)return void this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}));this.options.length?this._toggleDropdown():this.click()}this.split&&this.options.length&&"ArrowDown"===e.key&&(e.preventDefault(),this._dropdownOpened||this._toggleDropdown())}},this._handleClickOutside=e=>{this._dropdownOpened&&!this.contains(e.target)&&(this._dropdownOpened=!1)}}connectedCallback(){super.connectedCallback(),this.href?this.setAttribute("role","link"):this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._handleKeydown),this.addEventListener("click",this._handleHostClick),document.addEventListener("click",this._handleClickOutside)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown),this.removeEventListener("click",this._handleHostClick),document.removeEventListener("click",this._handleClickOutside)}updated(e){this.classList.toggle("kr-button--loading","loading"===this._state),this.classList.toggle("kr-button--success","success"===this._state),this.classList.toggle("kr-button--error","error"===this._state),this.classList.toggle("kr-button--flat","flat"===this.variant),this.classList.toggle("kr-button--outline","outline"===this.variant),this.classList.toggle("kr-button--primary","primary"===this.color),this.classList.toggle("kr-button--secondary","secondary"===this.color),this.classList.toggle("kr-button--danger","danger"===this.color),this.classList.toggle("kr-button--small","small"===this.size),this.classList.toggle("kr-button--large","large"===this.size),this.classList.toggle("kr-button--split",this.split&&!!this.options.length)}_handleSplitPrimaryClick(e){e.stopPropagation(),this._dropdownOpened&&(this._dropdownOpened=!1),this.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0}))}_handleSplitTriggerClick(e){e.stopPropagation(),this._toggleDropdown()}_toggleDropdown(){this._dropdownOpened=!this._dropdownOpened,this._dropdownOpened&&requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(e){const t=this.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.bottom="",e.style.left=t.left+"px",e.style.right="",e.style.minWidth=t.width+"px",e.style.transformOrigin="top left",e.style.maxHeight="",e.style.overflowY="";const i=e.getBoundingClientRect();i.height>window.innerHeight-t.bottom-8&&t.top>window.innerHeight-t.bottom?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.transformOrigin="bottom left",e.classList.add("dropdown--above"),i.height>t.top-8&&(e.style.maxHeight=t.top-8+"px",e.style.overflowY="auto")):(e.classList.remove("dropdown--above"),i.height>window.innerHeight-t.bottom-8&&(e.style.maxHeight=window.innerHeight-t.bottom-8+"px",e.style.overflowY="auto")),i.right>window.innerWidth&&(e.style.left="",e.style.right=window.innerWidth-t.right+"px",i.bottom>window.innerHeight?e.style.transformOrigin="bottom right":e.style.transformOrigin="top right")}}))}_handleOptionClick(e,t){t.stopPropagation(),this._dropdownOpened=!1,this.dispatchEvent(new CustomEvent("option-select",{detail:{id:e.id,label:e.label},bubbles:!0,composed:!0}))}showLoading(){this._clearStateTimeout(),this._state="loading",this._stateText=""}showSuccess(e="Success",t=Zt.STATE_DURATION){this._clearStateTimeout(),this._state="success",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}showError(e="Error",t=Zt.STATE_DURATION){this._clearStateTimeout(),this._state="error",this._stateText=e,t>0&&(this._stateTimeout=window.setTimeout((()=>this.reset()),t))}isLoading(){return"loading"===this._state}reset(){this._clearStateTimeout(),this._state="idle",this._stateText=""}_clearStateTimeout(){this._stateTimeout&&(clearTimeout(this._stateTimeout),this._stateTimeout=void 0)}_renderDropdownItem(e){return e.href?N`
|
|
370
370
|
<a
|
|
371
371
|
class="dropdown-item"
|
|
372
372
|
href=${e.href}
|
|
373
373
|
target=${e.hrefTarget||U}
|
|
374
374
|
@click=${this._handleOptionLinkClick}
|
|
375
375
|
>${e.label}</a>
|
|
376
|
-
`:
|
|
376
|
+
`:N`
|
|
377
377
|
<button
|
|
378
378
|
class="dropdown-item"
|
|
379
379
|
@click=${t=>this._handleOptionClick(e,t)}
|
|
380
380
|
>${e.label}</button>
|
|
381
|
-
`}_handleOptionLinkClick(){this._dropdownOpened=!1}render(){if(this.split&&this.options.length)return
|
|
381
|
+
`}_handleOptionLinkClick(){this._dropdownOpened=!1}render(){if(this.split&&this.options.length)return N`
|
|
382
382
|
<div class="split-primary" @click=${this._handleSplitPrimaryClick}>
|
|
383
383
|
<span class="content">
|
|
384
384
|
<slot name="icon"></slot>
|
|
385
385
|
<slot></slot>
|
|
386
386
|
</span>
|
|
387
|
-
${"idle"!==this._state?
|
|
388
|
-
${"loading"===this._state?
|
|
387
|
+
${"idle"!==this._state?N`<span class="state-overlay">
|
|
388
|
+
${"loading"===this._state?N`<span class="spinner"></span>`:this._stateText}
|
|
389
389
|
</span>`:U}
|
|
390
390
|
</div>
|
|
391
391
|
<div class="split-divider"></div>
|
|
@@ -404,12 +404,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
404
404
|
<div class=${ye({dropdown:!0,"dropdown--opened":this._dropdownOpened})}>
|
|
405
405
|
${this.options.map((e=>this._renderDropdownItem(e)))}
|
|
406
406
|
</div>
|
|
407
|
-
`;const e=
|
|
407
|
+
`;const e=N`
|
|
408
408
|
<span class="content">
|
|
409
409
|
<slot name="icon"></slot>
|
|
410
410
|
<slot></slot>
|
|
411
411
|
</span>
|
|
412
|
-
${this.options.length?
|
|
412
|
+
${this.options.length?N`
|
|
413
413
|
<svg
|
|
414
414
|
class="caret"
|
|
415
415
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -421,17 +421,17 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
421
421
|
<path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/>
|
|
422
422
|
</svg>
|
|
423
423
|
`:U}
|
|
424
|
-
${"idle"!==this._state?
|
|
424
|
+
${"idle"!==this._state?N`
|
|
425
425
|
<span class="state-overlay">
|
|
426
|
-
${"loading"===this._state?
|
|
426
|
+
${"loading"===this._state?N`<span class="spinner"></span>`:this._stateText}
|
|
427
427
|
</span>
|
|
428
428
|
`:U}
|
|
429
|
-
${this.options.length?
|
|
429
|
+
${this.options.length?N`
|
|
430
430
|
<div class=${ye({dropdown:!0,"dropdown--opened":this._dropdownOpened})}>
|
|
431
431
|
${this.options.map((e=>this._renderDropdownItem(e)))}
|
|
432
432
|
</div>
|
|
433
433
|
`:U}
|
|
434
|
-
`;return this.href?
|
|
434
|
+
`;return this.href?N`
|
|
435
435
|
<a
|
|
436
436
|
class="link"
|
|
437
437
|
href=${this.href}
|
|
@@ -860,7 +860,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
860
860
|
pointer-events: none;
|
|
861
861
|
opacity: 0.6;
|
|
862
862
|
}
|
|
863
|
-
`,Zt.STATE_DURATION=2e3,Xt([ce({type:String,reflect:!0})],Zt.prototype,"variant",void 0),Xt([ce({type:String,reflect:!0})],Zt.prototype,"color",void 0),Xt([ce({type:String,reflect:!0})],Zt.prototype,"size",void 0),Xt([ce({type:Boolean,reflect:!0})],Zt.prototype,"disabled",void 0),Xt([ce({type:String})],Zt.prototype,"href",void 0),Xt([ce({type:String})],Zt.prototype,"target",void 0),Xt([ce({type:Array})],Zt.prototype,"options",void 0),Xt([ce({type:String,reflect:!0,attribute:"icon-position"})],Zt.prototype,"iconPosition",void 0),Xt([ce({type:Boolean,reflect:!0})],Zt.prototype,"split",void 0),Xt([pe()],Zt.prototype,"_state",void 0),Xt([pe()],Zt.prototype,"_stateText",void 0),Xt([pe()],Zt.prototype,"_dropdownOpened",void 0),customElements.get("krs-button")||customElements.define("krs-button",Zt);var
|
|
863
|
+
`,Zt.STATE_DURATION=2e3,Xt([ce({type:String,reflect:!0})],Zt.prototype,"variant",void 0),Xt([ce({type:String,reflect:!0})],Zt.prototype,"color",void 0),Xt([ce({type:String,reflect:!0})],Zt.prototype,"size",void 0),Xt([ce({type:Boolean,reflect:!0})],Zt.prototype,"disabled",void 0),Xt([ce({type:String})],Zt.prototype,"href",void 0),Xt([ce({type:String})],Zt.prototype,"target",void 0),Xt([ce({type:Array})],Zt.prototype,"options",void 0),Xt([ce({type:String,reflect:!0,attribute:"icon-position"})],Zt.prototype,"iconPosition",void 0),Xt([ce({type:Boolean,reflect:!0})],Zt.prototype,"split",void 0),Xt([pe()],Zt.prototype,"_state",void 0),Xt([pe()],Zt.prototype,"_stateText",void 0),Xt([pe()],Zt.prototype,"_dropdownOpened",void 0),customElements.get("krs-button")||customElements.define("krs-button",Zt);var Jt=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Qt extends ne{constructor(){super(...arguments),this.language="html",this.code="",this.activeTab="preview",this.copied=!1,this.highlightedCode=""}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>{this.code||(this.code=this.innerHTML.trim().replace(/=""(?=[\s>])/g,"")),this.querySelectorAll("script").forEach((e=>{const t=document.createElement("script");t.textContent=e.textContent,e.replaceWith(t)})),this.code&&window.hljs&&window.hljs.getLanguage(this.language)?this.highlightedCode=window.hljs.highlight(this.code,{language:this.language}).value:this.highlightedCode=this.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}))}activateTab(e){this.activeTab=e}handleCopyClick(){this.code&&navigator.clipboard.writeText(this.code).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}render(){return N`
|
|
864
864
|
<div class="tabs">
|
|
865
865
|
<button
|
|
866
866
|
class=${ye({tab:!0,"tab--active":"preview"===this.activeTab})}
|
|
@@ -879,7 +879,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
879
879
|
@click=${this.handleCopyClick}
|
|
880
880
|
title=${this.copied?"Copied!":"Copy code"}
|
|
881
881
|
>
|
|
882
|
-
${this.copied?
|
|
882
|
+
${this.copied?N`
|
|
883
883
|
<svg
|
|
884
884
|
width="18"
|
|
885
885
|
height="18"
|
|
@@ -892,7 +892,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
892
892
|
>
|
|
893
893
|
<polyline points="20 6 9 17 4 12"></polyline>
|
|
894
894
|
</svg>
|
|
895
|
-
`:
|
|
895
|
+
`:N`
|
|
896
896
|
<svg
|
|
897
897
|
width="18"
|
|
898
898
|
height="18"
|
|
@@ -925,7 +925,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
925
925
|
<pre class="code"><code>${Se(this.highlightedCode)}</code></pre>
|
|
926
926
|
</div>
|
|
927
927
|
|
|
928
|
-
`}}
|
|
928
|
+
`}}Qt.styles=[Ut,a`
|
|
929
929
|
:host {
|
|
930
930
|
display: block;
|
|
931
931
|
border: 1px solid #d5dbdb;
|
|
@@ -1047,15 +1047,15 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1047
1047
|
.hljs-attribute { color: #005cc5; }
|
|
1048
1048
|
.hljs-property { color: #005cc5; }
|
|
1049
1049
|
|
|
1050
|
-
`],
|
|
1050
|
+
`],Jt([ce({type:String})],Qt.prototype,"language",void 0),Jt([pe()],Qt.prototype,"code",void 0),Jt([pe()],Qt.prototype,"activeTab",void 0),Jt([pe()],Qt.prototype,"copied",void 0),Jt([pe()],Qt.prototype,"highlightedCode",void 0),customElements.get("krs-code-demo")||customElements.define("krs-code-demo",Qt);var Gt=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ei extends ne{constructor(){super(...arguments),this.resolvePromise=null,this.boundHandleOutsideClick=this.handleOutsideClick.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this),this.items=[]}static open(e){const t=document.querySelector("krs-context-menu");t&&t.remove();const i=document.createElement("krs-context-menu");return document.body.appendChild(i),i.show(e)}show(e){return this.items=e.items,this.style.left=`${e.x}px`,this.style.top=`${e.y}px`,this.updateComplete.then((()=>{const t=this.getBoundingClientRect();return t.right>window.innerWidth&&(this.style.left=e.x-t.width+"px"),t.bottom>window.innerHeight&&(this.style.top=e.y-t.height+"px"),requestAnimationFrame((()=>{document.addEventListener("click",this.boundHandleOutsideClick),document.addEventListener("contextmenu",this.boundHandleOutsideClick),document.addEventListener("keydown",this.boundHandleKeyDown)})),new Promise((e=>{this.resolvePromise=e}))}))}handleOutsideClick(e){this.contains(e.target)||this.close(null)}handleKeyDown(e){"Escape"===e.key&&this.close(null)}handleItemClick(e){e.disabled||e.divider||this.close(e)}close(e){document.removeEventListener("click",this.boundHandleOutsideClick),document.removeEventListener("contextmenu",this.boundHandleOutsideClick),document.removeEventListener("keydown",this.boundHandleKeyDown),this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=null),this.remove()}render(){return N`
|
|
1051
1051
|
<div class="menu">
|
|
1052
|
-
${this.items.map((e=>e.divider?
|
|
1052
|
+
${this.items.map((e=>e.divider?N`<div class="menu__divider"></div>`:N`
|
|
1053
1053
|
<button
|
|
1054
1054
|
class="menu__item"
|
|
1055
1055
|
?disabled=${e.disabled}
|
|
1056
1056
|
@click=${()=>this.handleItemClick(e)}
|
|
1057
1057
|
>
|
|
1058
|
-
${e.icon?
|
|
1058
|
+
${e.icon?N`<span class="menu__item-icon">${e.icon}</span>`:null}
|
|
1059
1059
|
${e.label}
|
|
1060
1060
|
</button>
|
|
1061
1061
|
`))}
|
|
@@ -1115,7 +1115,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1115
1115
|
background: rgba(255, 255, 255, 0.1);
|
|
1116
1116
|
margin: 4px 0;
|
|
1117
1117
|
}
|
|
1118
|
-
`,Gt([pe()],ei.prototype,"items",void 0),customElements.get("krs-context-menu")||customElements.define("krs-context-menu",ei);var ti=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ii extends ne{render(){return
|
|
1118
|
+
`,Gt([pe()],ei.prototype,"items",void 0),customElements.get("krs-context-menu")||customElements.define("krs-context-menu",ei);var ti=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ii extends ne{render(){return N`<slot></slot>`}}ii.styles=a`
|
|
1119
1119
|
:host {
|
|
1120
1120
|
display: flex;
|
|
1121
1121
|
padding: 0 24px;
|
|
@@ -1130,14 +1130,14 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1130
1130
|
font-size: 18px;
|
|
1131
1131
|
font-weight: 600;
|
|
1132
1132
|
}
|
|
1133
|
-
`;class si extends ne{render(){return
|
|
1133
|
+
`;class si extends ne{render(){return N`<slot></slot>`}}si.styles=a`
|
|
1134
1134
|
:host {
|
|
1135
1135
|
display: block;
|
|
1136
1136
|
padding: 24px;
|
|
1137
1137
|
overflow: auto;
|
|
1138
1138
|
flex: 1 1 auto;
|
|
1139
1139
|
}
|
|
1140
|
-
`;class oi extends ne{render(){return
|
|
1140
|
+
`;class oi extends ne{render(){return N`<slot></slot>`}}oi.styles=a`
|
|
1141
1141
|
:host {
|
|
1142
1142
|
display: flex;
|
|
1143
1143
|
padding: 0 24px;
|
|
@@ -1148,10 +1148,10 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1148
1148
|
gap: 12px;
|
|
1149
1149
|
justify-content: flex-end;
|
|
1150
1150
|
}
|
|
1151
|
-
`;class ri{constructor(){this._resolvePromise=null,this._dialogElement=null,this._promise=new Promise((e=>{this._resolvePromise=e}))}setDialogElement(e){this._dialogElement=e}close(e){this._resolvePromise&&(this._resolvePromise(e),this._resolvePromise=null),this._dialogElement?.remove()}afterClosed(){return this._promise}}class ai extends ne{constructor(){super(...arguments),this._dialogRef=null,this.opened=!1,this.label="",this.width="560px",this._contentElement=null,this._handleDocumentKeyDown=e=>{"Escape"===e.key&&this.close()}}static open(e,t){document.querySelectorAll("krs-dialog").forEach((e=>{e._dialogRef&&e.remove()}));const i=new ri,s=document.createElement("krs-dialog");i.setDialogElement(s),s._dialogRef=i;const o=new e;return o.dialogRef=i,t?.data&&(o.data=t.data),t?.label&&(s.label=t.label),t?.width&&(s.width=t.width),s._contentElement=o,s.opened=!0,document.body.appendChild(s),i}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleDocumentKeyDown)}updated(e){super.updated(e),e.has("opened")&&(this.opened?document.addEventListener("keydown",this._handleDocumentKeyDown):document.removeEventListener("keydown",this._handleDocumentKeyDown))}open(){this.opened=!0}close(){this._dialogRef?this._dialogRef.close(void 0):(this.opened=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return
|
|
1151
|
+
`;class ri{constructor(){this._resolvePromise=null,this._dialogElement=null,this._promise=new Promise((e=>{this._resolvePromise=e}))}setDialogElement(e){this._dialogElement=e}close(e){this._resolvePromise&&(this._resolvePromise(e),this._resolvePromise=null),this._dialogElement?.remove()}afterClosed(){return this._promise}}class ai extends ne{constructor(){super(...arguments),this._dialogRef=null,this.opened=!1,this.label="",this.width="560px",this._contentElement=null,this._handleDocumentKeyDown=e=>{"Escape"===e.key&&this.close()}}static open(e,t){document.querySelectorAll("krs-dialog").forEach((e=>{e._dialogRef&&e.remove()}));const i=new ri,s=document.createElement("krs-dialog");i.setDialogElement(s),s._dialogRef=i;const o=new e;return o.dialogRef=i,t?.data&&(o.data=t.data),t?.label&&(s.label=t.label),t?.width&&(s.width=t.width),s._contentElement=o,s.opened=!0,document.body.appendChild(s),i}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleDocumentKeyDown)}updated(e){super.updated(e),e.has("opened")&&(this.opened?document.addEventListener("keydown",this._handleDocumentKeyDown):document.removeEventListener("keydown",this._handleDocumentKeyDown))}open(){this.opened=!0}close(){this._dialogRef?this._dialogRef.close(void 0):(this.opened=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return N`
|
|
1152
1152
|
<div class="backdrop" @click=${this._handleBackdropClick}></div>
|
|
1153
1153
|
<div class="dialog" style=${we({width:this.width})}>
|
|
1154
|
-
${this.label?
|
|
1154
|
+
${this.label?N`
|
|
1155
1155
|
<div class="dialog__header">
|
|
1156
1156
|
<div class="dialog__header-label">${this.label}</div>
|
|
1157
1157
|
<button
|
|
@@ -1172,7 +1172,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1172
1172
|
</button>
|
|
1173
1173
|
</div>
|
|
1174
1174
|
`:""}
|
|
1175
|
-
<div class="dialog__body">${this._contentElement?this._contentElement:
|
|
1175
|
+
<div class="dialog__body">${this._contentElement?this._contentElement:N`<slot></slot>`}</div>
|
|
1176
1176
|
</div>
|
|
1177
1177
|
`}}ai.styles=a`
|
|
1178
1178
|
:host {
|
|
@@ -1269,9 +1269,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1269
1269
|
display: flex;
|
|
1270
1270
|
flex-direction: column;
|
|
1271
1271
|
}
|
|
1272
|
-
`,ti([ce({type:Boolean,reflect:!0})],ai.prototype,"opened",void 0),ti([ce({type:String})],ai.prototype,"label",void 0),ti([ce({type:String})],ai.prototype,"width",void 0),ti([pe()],ai.prototype,"_contentElement",void 0),customElements.get("krs-dialog-header")||customElements.define("krs-dialog-header",ii),customElements.get("krs-dialog-content")||customElements.define("krs-dialog-content",si),customElements.get("krs-dialog-footer")||customElements.define("krs-dialog-footer",oi),customElements.get("krs-dialog")||customElements.define("krs-dialog",ai);var ni=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class li extends ne{static fromJSON(e){const t=new li;return void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.relativeOptions&&(t.relativeOptions=e.relativeOptions),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.startDate&&(t.startDate=e.startDate),void 0!==e.endDate&&(t.endDate=e.endDate),void 0!==e.mode&&(t.mode=e.mode),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this.name="",this.dirty=!1,this.saving=!1,this.relativeOptions=[{key:"last-5-minutes",amount:5,unit:"minute",type:"relative"},{key:"last-30-minutes",amount:30,unit:"minute",type:"relative"},{key:"last-1-hour",amount:1,unit:"hour",type:"relative"},{key:"last-6-hours",amount:6,unit:"hour",type:"relative"},{key:"last-1-day",amount:1,unit:"day",type:"relative"},{key:"last-7-days",amount:7,unit:"day",type:"relative"},{key:"last-30-days",amount:30,unit:"day",type:"relative"}],this.disabled=!1,this.invalid=!1,this.placeholder="Select a date range",this.startDate="",this.endDate="",this._isOpen=!1,this._activeTab="relative",this._tempStartDate="",this._tempEndDate="",this._handleClickOutside=e=>{e.composedPath().includes(this)||(this._isOpen=!1)},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),document.addEventListener("click",this._handleClickOutside),this.startDate&&(this._tempStartDate=this.startDate),this.endDate&&(this._tempEndDate=this.endDate),"relative"===this.mode?this._activeTab="relative":"absolute"===this.mode&&(this._activeTab="absolute")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleClickOutside)}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}formResetCallback(){this.value=void 0,this.startDate="",this.endDate="",this._tempStartDate="",this._tempEndDate="",this.dirty=!1,this.saving=!1,this._internals.setFormValue(null)}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}_updateFormValue(){if(!this.value||!this.name)return void this._internals.setFormValue(null);const e=new FormData;e.append(`${this.name}.type`,this.value.type),"absolute"===this.value.type?(e.append(`${this.name}.startDate`,this.value.startDate||""),e.append(`${this.name}.endDate`,this.value.endDate||"")):(e.append(`${this.name}.amount`,String(this.value.amount??"")),e.append(`${this.name}.unit`,this.value.unit||"")),this._internals.setFormValue(e)}_handleTriggerClick(){this.disabled||(this._isOpen=!this._isOpen)}_handleTabClick(e){this._activeTab=e}_handleRelativeSelect(e){this.value={type:"relative",amount:e.amount,unit:e.unit},this.dirty=!0,this._dirtyValue=this.value,this._updateFormValue(),this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_handleApplyAbsolute(){this._tempStartDate&&this._tempEndDate&&(this._tempStartDate>=this._tempEndDate||(this.value={type:"absolute",startDate:this._tempStartDate,endDate:this._tempEndDate},this.startDate=this._tempStartDate,this.endDate=this._tempEndDate,this.dirty=!0,this._dirtyValue=this.value,this._updateFormValue(),this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))))}_handleCancel(){this._isOpen=!1,this._tempStartDate=this.startDate,this._tempEndDate=this.endDate}_formatRelativeOption(e){if(e.label)return e.label;if(0===e.amount)return"day"===e.unit?"Today":`This ${e.unit}`;const t={};return 1===e.amount?(t.second="second",t.minute="minute",t.hour="hour",t.day="day",t.week="week",t.month="month",t.year="year"):(t.second="seconds",t.minute="minutes",t.hour="hours",t.day="days",t.week="weeks",t.month="months",t.year="years"),`Last ${e.amount} ${t[e.unit]}`}_renderTriggerText(){let e="";return this.value&&("relative"===this.value.type&&void 0!==this.value.amount&&this.value.unit&&(e=this._formatRelativeOption({key:"",amount:this.value.amount,unit:this.value.unit,type:"relative"})),"absolute"===this.value.type&&this.value.startDate&&this.value.endDate&&(e=`${this.value.startDate} - ${this.value.endDate}`)),e?
|
|
1272
|
+
`,ti([ce({type:Boolean,reflect:!0})],ai.prototype,"opened",void 0),ti([ce({type:String})],ai.prototype,"label",void 0),ti([ce({type:String})],ai.prototype,"width",void 0),ti([pe()],ai.prototype,"_contentElement",void 0),customElements.get("krs-dialog-header")||customElements.define("krs-dialog-header",ii),customElements.get("krs-dialog-content")||customElements.define("krs-dialog-content",si),customElements.get("krs-dialog-footer")||customElements.define("krs-dialog-footer",oi),customElements.get("krs-dialog")||customElements.define("krs-dialog",ai);var ni=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class li extends ne{static fromJSON(e){const t=new li;return void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.relativeOptions&&(t.relativeOptions=e.relativeOptions),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.startDate&&(t.startDate=e.startDate),void 0!==e.endDate&&(t.endDate=e.endDate),void 0!==e.mode&&(t.mode=e.mode),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this.name="",this.dirty=!1,this.saving=!1,this.relativeOptions=[{key:"last-5-minutes",amount:5,unit:"minute",type:"relative"},{key:"last-30-minutes",amount:30,unit:"minute",type:"relative"},{key:"last-1-hour",amount:1,unit:"hour",type:"relative"},{key:"last-6-hours",amount:6,unit:"hour",type:"relative"},{key:"last-1-day",amount:1,unit:"day",type:"relative"},{key:"last-7-days",amount:7,unit:"day",type:"relative"},{key:"last-30-days",amount:30,unit:"day",type:"relative"}],this.disabled=!1,this.invalid=!1,this.placeholder="Select a date range",this.startDate="",this.endDate="",this._isOpen=!1,this._activeTab="relative",this._tempStartDate="",this._tempEndDate="",this._handleClickOutside=e=>{e.composedPath().includes(this)||(this._isOpen=!1)},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),document.addEventListener("click",this._handleClickOutside),this.startDate&&(this._tempStartDate=this.startDate),this.endDate&&(this._tempEndDate=this.endDate),"relative"===this.mode?this._activeTab="relative":"absolute"===this.mode&&(this._activeTab="absolute")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleClickOutside)}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}formResetCallback(){this.value=void 0,this.startDate="",this.endDate="",this._tempStartDate="",this._tempEndDate="",this.dirty=!1,this.saving=!1,this._internals.setFormValue(null)}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}_updateFormValue(){if(!this.value||!this.name)return void this._internals.setFormValue(null);const e=new FormData;e.append(`${this.name}.type`,this.value.type),"absolute"===this.value.type?(e.append(`${this.name}.startDate`,this.value.startDate||""),e.append(`${this.name}.endDate`,this.value.endDate||"")):(e.append(`${this.name}.amount`,String(this.value.amount??"")),e.append(`${this.name}.unit`,this.value.unit||"")),this._internals.setFormValue(e)}_handleTriggerClick(){this.disabled||(this._isOpen=!this._isOpen)}_handleTabClick(e){this._activeTab=e}_handleRelativeSelect(e){this.value={type:"relative",amount:e.amount,unit:e.unit},this.dirty=!0,this._dirtyValue=this.value,this._updateFormValue(),this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}_handleApplyAbsolute(){this._tempStartDate&&this._tempEndDate&&(this._tempStartDate>=this._tempEndDate||(this.value={type:"absolute",startDate:this._tempStartDate,endDate:this._tempEndDate},this.startDate=this._tempStartDate,this.endDate=this._tempEndDate,this.dirty=!0,this._dirtyValue=this.value,this._updateFormValue(),this._isOpen=!1,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))))}_handleCancel(){this._isOpen=!1,this._tempStartDate=this.startDate,this._tempEndDate=this.endDate}_formatRelativeOption(e){if(e.label)return e.label;if(0===e.amount)return"day"===e.unit?"Today":`This ${e.unit}`;const t={};return 1===e.amount?(t.second="second",t.minute="minute",t.hour="hour",t.day="day",t.week="week",t.month="month",t.year="year"):(t.second="seconds",t.minute="minutes",t.hour="hours",t.day="days",t.week="weeks",t.month="months",t.year="years"),`Last ${e.amount} ${t[e.unit]}`}_renderTriggerText(){let e="";return this.value&&("relative"===this.value.type&&void 0!==this.value.amount&&this.value.unit&&(e=this._formatRelativeOption({key:"",amount:this.value.amount,unit:this.value.unit,type:"relative"})),"absolute"===this.value.type&&this.value.startDate&&this.value.endDate&&(e=`${this.value.startDate} - ${this.value.endDate}`)),e?N`${e}`:N`<span class="trigger-placeholder">${this.placeholder}</span>`}_renderContent(){return"relative"===this.mode?this._renderRelativeContent():"absolute"===this.mode?this._renderAbsoluteContent():"relative"===this._activeTab?this._renderRelativeContent():this._renderAbsoluteContent()}_renderRelativeContent(){return N`
|
|
1273
1273
|
<div class="relative-options">
|
|
1274
|
-
${this.relativeOptions.map((e=>
|
|
1274
|
+
${this.relativeOptions.map((e=>N`
|
|
1275
1275
|
<button
|
|
1276
1276
|
class=${ye({"relative-option":!0,"relative-option--selected":"relative"===this.value?.type&&this.value?.amount===e.amount&&this.value?.unit===e.unit})}
|
|
1277
1277
|
type="button"
|
|
@@ -1281,7 +1281,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1281
1281
|
</button>
|
|
1282
1282
|
`))}
|
|
1283
1283
|
</div>
|
|
1284
|
-
`}_renderAbsoluteContent(){return
|
|
1284
|
+
`}_renderAbsoluteContent(){return N`
|
|
1285
1285
|
<div class="absolute">
|
|
1286
1286
|
<div class="date-row">
|
|
1287
1287
|
<span class="date-label">Start</span>
|
|
@@ -1302,7 +1302,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1302
1302
|
/>
|
|
1303
1303
|
</div>
|
|
1304
1304
|
</div>
|
|
1305
|
-
`}_renderFooter(){return"absolute"===this.mode?
|
|
1305
|
+
`}_renderFooter(){return"absolute"===this.mode?N`
|
|
1306
1306
|
<div class="footer">
|
|
1307
1307
|
<krs-button
|
|
1308
1308
|
variant="outline"
|
|
@@ -1320,7 +1320,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1320
1320
|
Apply
|
|
1321
1321
|
</krs-button>
|
|
1322
1322
|
</div>
|
|
1323
|
-
`:"relative"===this.mode?U:"absolute"===this._activeTab?
|
|
1323
|
+
`:"relative"===this.mode?U:"absolute"===this._activeTab?N`
|
|
1324
1324
|
<div class="footer">
|
|
1325
1325
|
<krs-button
|
|
1326
1326
|
variant="outline"
|
|
@@ -1338,7 +1338,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1338
1338
|
Apply
|
|
1339
1339
|
</krs-button>
|
|
1340
1340
|
</div>
|
|
1341
|
-
`:U}_handleStartDateChange(e){this._tempStartDate=e.target.value}_handleEndDateChange(e){this._tempEndDate=e.target.value}render(){return
|
|
1341
|
+
`:U}_handleStartDateChange(e){this._tempStartDate=e.target.value}_handleEndDateChange(e){this._tempEndDate=e.target.value}render(){return N`
|
|
1342
1342
|
<button
|
|
1343
1343
|
part="trigger"
|
|
1344
1344
|
class=${ye({trigger:!0,"trigger--invalid":this.invalid})}
|
|
@@ -1378,7 +1378,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1378
1378
|
</button>
|
|
1379
1379
|
|
|
1380
1380
|
<div part="dropdown" class=${ye({dropdown:!0,"dropdown--open":this._isOpen})}>
|
|
1381
|
-
${this.mode?U:
|
|
1381
|
+
${this.mode?U:N`
|
|
1382
1382
|
<div class="tabs">
|
|
1383
1383
|
<button
|
|
1384
1384
|
class=${ye({tab:!0,"tab--active":"relative"===this._activeTab})}
|
|
@@ -1582,7 +1582,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1582
1582
|
padding: 0.75rem 1rem;
|
|
1583
1583
|
border-top: 1px solid #e5e7eb;
|
|
1584
1584
|
}
|
|
1585
|
-
`,li.formAssociated=!0,ni([ce({type:String})],li.prototype,"name",void 0),ni([ce({type:Boolean,reflect:!0})],li.prototype,"dirty",void 0),ni([ce({attribute:"save-mode"})],li.prototype,"saveMode",void 0),ni([ce({type:Boolean,reflect:!0})],li.prototype,"saving",void 0),ni([ce({type:Object})],li.prototype,"value",void 0),ni([ce({type:Array})],li.prototype,"relativeOptions",void 0),ni([ce({type:Boolean})],li.prototype,"disabled",void 0),ni([ce({type:Boolean})],li.prototype,"invalid",void 0),ni([ce({type:String})],li.prototype,"placeholder",void 0),ni([ce({type:String})],li.prototype,"startDate",void 0),ni([ce({type:String})],li.prototype,"endDate",void 0),ni([ce({type:String})],li.prototype,"mode",void 0),ni([pe()],li.prototype,"_isOpen",void 0),ni([pe()],li.prototype,"_activeTab",void 0),ni([pe()],li.prototype,"_tempStartDate",void 0),ni([pe()],li.prototype,"_tempEndDate",void 0),customElements.get("krs-date-range-picker")||customElements.define("krs-date-range-picker",li);var di=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class hi extends ne{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3,this.action=null}static show(e){for(const e of this.activeSnackbars)e.dismiss();const t=document.createElement("krs-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",e.action&&(t.action=e.action),void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),hi.activeSnackbars.push(this),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=hi.activeSnackbars.indexOf(this);e>-1&&hi.activeSnackbars.splice(e,1),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",(()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()}),{once:!0})}render(){const e={info:
|
|
1585
|
+
`,li.formAssociated=!0,ni([ce({type:String})],li.prototype,"name",void 0),ni([ce({type:Boolean,reflect:!0})],li.prototype,"dirty",void 0),ni([ce({attribute:"save-mode"})],li.prototype,"saveMode",void 0),ni([ce({type:Boolean,reflect:!0})],li.prototype,"saving",void 0),ni([ce({type:Object})],li.prototype,"value",void 0),ni([ce({type:Array})],li.prototype,"relativeOptions",void 0),ni([ce({type:Boolean})],li.prototype,"disabled",void 0),ni([ce({type:Boolean})],li.prototype,"invalid",void 0),ni([ce({type:String})],li.prototype,"placeholder",void 0),ni([ce({type:String})],li.prototype,"startDate",void 0),ni([ce({type:String})],li.prototype,"endDate",void 0),ni([ce({type:String})],li.prototype,"mode",void 0),ni([pe()],li.prototype,"_isOpen",void 0),ni([pe()],li.prototype,"_activeTab",void 0),ni([pe()],li.prototype,"_tempStartDate",void 0),ni([pe()],li.prototype,"_tempEndDate",void 0),customElements.get("krs-date-range-picker")||customElements.define("krs-date-range-picker",li);var di=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class hi extends ne{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3,this.action=null}static show(e){for(const e of this.activeSnackbars)e.dismiss();const t=document.createElement("krs-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",e.action&&(t.action=e.action),void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),hi.activeSnackbars.push(this),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=hi.activeSnackbars.indexOf(this);e>-1&&hi.activeSnackbars.splice(e,1),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",(()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()}),{once:!0})}render(){const e={info:N`
|
|
1586
1586
|
<svg
|
|
1587
1587
|
class="icon"
|
|
1588
1588
|
viewBox="0 0 20 20"
|
|
@@ -1594,7 +1594,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1594
1594
|
clip-rule="evenodd"
|
|
1595
1595
|
/>
|
|
1596
1596
|
</svg>
|
|
1597
|
-
`,success:
|
|
1597
|
+
`,success:N`
|
|
1598
1598
|
<svg
|
|
1599
1599
|
class="icon"
|
|
1600
1600
|
viewBox="0 0 20 20"
|
|
@@ -1606,7 +1606,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1606
1606
|
clip-rule="evenodd"
|
|
1607
1607
|
/>
|
|
1608
1608
|
</svg>
|
|
1609
|
-
`,warning:
|
|
1609
|
+
`,warning:N`
|
|
1610
1610
|
<svg
|
|
1611
1611
|
class="icon"
|
|
1612
1612
|
viewBox="0 0 20 20"
|
|
@@ -1618,7 +1618,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1618
1618
|
clip-rule="evenodd"
|
|
1619
1619
|
/>
|
|
1620
1620
|
</svg>
|
|
1621
|
-
`,error:
|
|
1621
|
+
`,error:N`
|
|
1622
1622
|
<svg
|
|
1623
1623
|
class="icon"
|
|
1624
1624
|
viewBox="0 0 20 20"
|
|
@@ -1630,12 +1630,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1630
1630
|
clip-rule="evenodd"
|
|
1631
1631
|
/>
|
|
1632
1632
|
</svg>
|
|
1633
|
-
`};return
|
|
1633
|
+
`};return N`
|
|
1634
1634
|
${e[this.type]}
|
|
1635
1635
|
<div class="content">
|
|
1636
|
-
${this.title?
|
|
1636
|
+
${this.title?N`<div class="title">${this.title}</div>`:""}
|
|
1637
1637
|
<div class="message">${this.message}</div>
|
|
1638
|
-
${this.action?
|
|
1638
|
+
${this.action?N`<a
|
|
1639
1639
|
class="action"
|
|
1640
1640
|
href=${this.action.href}
|
|
1641
1641
|
@click=${this.dismiss}
|
|
@@ -1833,13 +1833,13 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1833
1833
|
outline: 2px solid #3b82f6;
|
|
1834
1834
|
outline-offset: 2px;
|
|
1835
1835
|
}
|
|
1836
|
-
`,hi.activeSnackbars=[],di([ce({type:String})],hi.prototype,"type",void 0),di([ce({type:String})],hi.prototype,"title",void 0),di([ce({type:String})],hi.prototype,"message",void 0),di([ce({type:Number})],hi.prototype,"duration",void 0),di([ce({attribute:!1})],hi.prototype,"action",void 0),customElements.get("krs-snackbar")||customElements.define("krs-snackbar",hi);var ci=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class pi extends ne{constructor(){super(...arguments),this.justified=!1,this.size="medium"}updated(e){e.has("activeTabId")&&this._updateActiveTab()}firstUpdated(){this._updateActiveTab()}_getTabs(){return Array.from(this.querySelectorAll("krs-tab"))}_updateActiveTab(){const e=this._getTabs();0!==e.length&&(this.activeTabId||(this.activeTabId=e[0]?.id),e.forEach((e=>{e.active=e.id===this.activeTabId})),this.requestUpdate())}_handleTabClick(e){e.disabled||(this.activeTabId=e.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:e.id},bubbles:!0,composed:!0})))}_handleTabDismiss(e,t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("tab-dismiss",{detail:{tabId:e.id},bubbles:!0,composed:!0}))}_handleKeyDown(e){const t=this._getTabs().filter((e=>!e.disabled)),i=t.findIndex((e=>e.id===this.activeTabId));let s=-1;switch(e.key){case"ArrowLeft":s=i>0?i-1:t.length-1;break;case"ArrowRight":s=i<t.length-1?i+1:0;break;case"Home":s=0;break;case"End":s=t.length-1}if(s>=0){e.preventDefault();const i=t[s];this.activeTabId=i.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:i.id},bubbles:!0,composed:!0}));const o=this.shadowRoot?.querySelectorAll(".label"),r=Array.from(o||[]).find((e=>e.getAttribute("data-tab-id")===i.id));r?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return U;const i=t.cloneNode(!0);return i.removeAttribute("slot"),
|
|
1836
|
+
`,hi.activeSnackbars=[],di([ce({type:String})],hi.prototype,"type",void 0),di([ce({type:String})],hi.prototype,"title",void 0),di([ce({type:String})],hi.prototype,"message",void 0),di([ce({type:Number})],hi.prototype,"duration",void 0),di([ce({attribute:!1})],hi.prototype,"action",void 0),customElements.get("krs-snackbar")||customElements.define("krs-snackbar",hi);var ci=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class pi extends ne{constructor(){super(...arguments),this.justified=!1,this.size="medium"}updated(e){e.has("activeTabId")&&this._updateActiveTab()}firstUpdated(){this._updateActiveTab()}_getTabs(){return Array.from(this.querySelectorAll("krs-tab"))}_updateActiveTab(){const e=this._getTabs();0!==e.length&&(this.activeTabId||(this.activeTabId=e[0]?.id),e.forEach((e=>{e.active=e.id===this.activeTabId})),this.requestUpdate())}_handleTabClick(e){e.disabled||(this.activeTabId=e.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:e.id},bubbles:!0,composed:!0})))}_handleTabDismiss(e,t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("tab-dismiss",{detail:{tabId:e.id},bubbles:!0,composed:!0}))}_handleKeyDown(e){const t=this._getTabs().filter((e=>!e.disabled)),i=t.findIndex((e=>e.id===this.activeTabId));let s=-1;switch(e.key){case"ArrowLeft":s=i>0?i-1:t.length-1;break;case"ArrowRight":s=i<t.length-1?i+1:0;break;case"Home":s=0;break;case"End":s=t.length-1}if(s>=0){e.preventDefault();const i=t[s];this.activeTabId=i.id,this.dispatchEvent(new CustomEvent("tab-change",{detail:{activeTabId:i.id},bubbles:!0,composed:!0}));const o=this.shadowRoot?.querySelectorAll(".label"),r=Array.from(o||[]).find((e=>e.getAttribute("data-tab-id")===i.id));r?.focus()}}_renderTabIcon(e){const t=e.getIconElement();if(!t)return U;const i=t.cloneNode(!0);return i.removeAttribute("slot"),N`<span class="label-icon">${i}</span>`}render(){return N`
|
|
1837
1837
|
<div
|
|
1838
1838
|
class="header"
|
|
1839
1839
|
role="tablist"
|
|
1840
1840
|
@keydown=${this._handleKeyDown}
|
|
1841
1841
|
>
|
|
1842
|
-
${this._getTabs().map((e=>
|
|
1842
|
+
${this._getTabs().map((e=>N`
|
|
1843
1843
|
<button
|
|
1844
1844
|
class=${ye({label:!0,"label--active":e.id===this.activeTabId,"label--justified":this.justified})}
|
|
1845
1845
|
role="tab"
|
|
@@ -1852,8 +1852,8 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
1852
1852
|
>
|
|
1853
1853
|
${this._renderTabIcon(e)}
|
|
1854
1854
|
<span>${e.label}</span>
|
|
1855
|
-
${e.badge?
|
|
1856
|
-
${e.dismissible?
|
|
1855
|
+
${e.badge?N`<span class="label-badge" style=${we({backgroundColor:e.badgeBackground,color:e.badgeColor})}>${e.badge}</span>`:U}
|
|
1856
|
+
${e.dismissible?N`
|
|
1857
1857
|
<button
|
|
1858
1858
|
class="label-dismiss"
|
|
1859
1859
|
type="button"
|
|
@@ -2017,7 +2017,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2017
2017
|
::slotted(krs-tab[active]) {
|
|
2018
2018
|
display: block;
|
|
2019
2019
|
}
|
|
2020
|
-
`],ci([ce({type:String,attribute:"active-tab-id"})],pi.prototype,"activeTabId",void 0),ci([ce({type:Boolean})],pi.prototype,"justified",void 0),ci([ce({type:String,reflect:!0})],pi.prototype,"size",void 0),customElements.get("krs-tab-group")||customElements.define("krs-tab-group",pi);var ui=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class gi extends ne{constructor(){super(...arguments),this.id="",this.label="",this.badge="",this.badgeBackground="",this.badgeColor="",this.disabled=!1,this.dismissible=!1,this.active=!1}updated(){const e=this.closest("krs-tab-group");e&&e.requestUpdate()}getIconElement(){return this.querySelector('[slot="icon"]')}render(){return
|
|
2020
|
+
`],ci([ce({type:String,attribute:"active-tab-id"})],pi.prototype,"activeTabId",void 0),ci([ce({type:Boolean})],pi.prototype,"justified",void 0),ci([ce({type:String,reflect:!0})],pi.prototype,"size",void 0),customElements.get("krs-tab-group")||customElements.define("krs-tab-group",pi);var ui=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class gi extends ne{constructor(){super(...arguments),this.id="",this.label="",this.badge="",this.badgeBackground="",this.badgeColor="",this.disabled=!1,this.dismissible=!1,this.active=!1}updated(){const e=this.closest("krs-tab-group");e&&e.requestUpdate()}getIconElement(){return this.querySelector('[slot="icon"]')}render(){return N`<slot></slot>`}}gi.styles=[Ut,a`
|
|
2021
2021
|
:host {
|
|
2022
2022
|
display: none;
|
|
2023
2023
|
}
|
|
@@ -2027,16 +2027,16 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2027
2027
|
width: 100%;
|
|
2028
2028
|
height: 100%;
|
|
2029
2029
|
}
|
|
2030
|
-
`],ui([ce({type:String,reflect:!0})],gi.prototype,"id",void 0),ui([ce({type:String})],gi.prototype,"label",void 0),ui([ce({type:String})],gi.prototype,"badge",void 0),ui([ce({type:String,attribute:"badge-background"})],gi.prototype,"badgeBackground",void 0),ui([ce({type:String,attribute:"badge-color"})],gi.prototype,"badgeColor",void 0),ui([ce({type:Boolean})],gi.prototype,"disabled",void 0),ui([ce({type:Boolean})],gi.prototype,"dismissible",void 0),ui([ce({type:Boolean,reflect:!0})],gi.prototype,"active",void 0),customElements.get("krs-tab")||customElements.define("krs-tab",gi);var fi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class mi extends ne{constructor(){super(...arguments),this.value="",this.disabled=!1}get label(){return this.textContent?.trim()||""}render(){return
|
|
2030
|
+
`],ui([ce({type:String,reflect:!0})],gi.prototype,"id",void 0),ui([ce({type:String})],gi.prototype,"label",void 0),ui([ce({type:String})],gi.prototype,"badge",void 0),ui([ce({type:String,attribute:"badge-background"})],gi.prototype,"badgeBackground",void 0),ui([ce({type:String,attribute:"badge-color"})],gi.prototype,"badgeColor",void 0),ui([ce({type:Boolean})],gi.prototype,"disabled",void 0),ui([ce({type:Boolean})],gi.prototype,"dismissible",void 0),ui([ce({type:Boolean,reflect:!0})],gi.prototype,"active",void 0),customElements.get("krs-tab")||customElements.define("krs-tab",gi);var fi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class mi extends ne{constructor(){super(...arguments),this.value="",this.disabled=!1}get label(){return this.textContent?.trim()||""}render(){return N`<slot></slot>`}}mi.styles=a`
|
|
2031
2031
|
:host {
|
|
2032
2032
|
display: none;
|
|
2033
2033
|
}
|
|
2034
|
-
`,fi([ce({type:String})],mi.prototype,"value",void 0),fi([ce({type:Boolean})],mi.prototype,"disabled",void 0),customElements.get("krs-select-option")||customElements.define("krs-select-option",mi);var
|
|
2034
|
+
`,fi([ce({type:String})],mi.prototype,"value",void 0),fi([ce({type:Boolean})],mi.prototype,"disabled",void 0),customElements.get("krs-select-option")||customElements.define("krs-select-option",mi);var vi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class bi extends ne{static fromJSON(e){const t=new bi;if(void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.required&&(t.required=e.required),void 0!==e.readonly&&(t.readonly=e.readonly),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.saveMode&&(t.saveMode=e.saveMode),Array.isArray(e.options))for(const i of e.options){const e=new mi;"string"==typeof i?(e.value=i,e.textContent=i):(e.value=i.value,e.textContent=i.value,void 0!==i.label&&(e.textContent=i.label),void 0!==i.disabled&&(e.disabled=i.disabled)),t.appendChild(e)}return t}constructor(){super(),this._dirtyValue="",this.label="",this.name="",this.value="",this.placeholder="Select an option",this.disabled=!1,this.required=!1,this.readonly=!1,this.hint="",this.dirty=!1,this.saving=!1,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._handleOutsideClick=e=>{e.composedPath().includes(this)||this._close()},this._handleKeyDown=e=>{if(!this._isOpen)return;const t=Array.from(this.querySelectorAll("krs-select-option"));switch(e.key){case"Escape":this._close(),this._triggerElement?.focus();break;case"ArrowDown":if(e.preventDefault(),t.some((e=>!e.disabled))){let e=this._highlightedIndex+1;for(;e<t.length&&t[e]?.disabled;)e++;e<t.length&&(this._highlightedIndex=e)}break;case"ArrowUp":e.preventDefault();{let e=this._highlightedIndex-1;for(;e>=0&&t[e]?.disabled;)e--;e>=0&&(this._highlightedIndex=e)}break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this._highlightedIndex<t.length&&this._selectOption(t[this._highlightedIndex])}},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),document.addEventListener("click",this._handleOutsideClick),document.addEventListener("keydown",this._handleKeyDown),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),document.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this.dirty=!1,this.saving=!1,this._internals.setFormValue(""),this._internals.setValidity({})}formStateRestoreCallback(e){this.value=e}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}_handleTriggerClick(){if(!this.disabled&&!this.readonly)if(this._isOpen)this._close();else{this._isOpen=!0;const e=Array.from(this.querySelectorAll("krs-select-option"));this._highlightedIndex=e.findIndex((e=>e.value===this.value)),requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".select-dropdown");if(e){const t=this._triggerElement.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8;e.style.top=t.bottom+4+"px",e.style.left=t.left+"px",e.style.minWidth=t.width+"px",e.style.maxHeight=i+"px"}}))}}_close(){this._isOpen=!1,this._highlightedIndex=-1}_selectOption(e){e.disabled||(this.value=e.value,this.dirty=!0,this._dirtyValue=this.value,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._close(),this._triggerElement?.focus())}_handleBlur(){this._touched=!0,this._updateValidity()}_handleOptionMouseEnter(e){this._highlightedIndex=e}_handleSlotChange(){this.requestUpdate()}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}render(){const e=Array.from(this.querySelectorAll("krs-select-option")),t=e.find((e=>e.value===this.value))?.label;return N`
|
|
2035
2035
|
<div class="wrapper">
|
|
2036
|
-
${this.label?
|
|
2036
|
+
${this.label?N`
|
|
2037
2037
|
<label>
|
|
2038
2038
|
${this.label}
|
|
2039
|
-
${this.required?
|
|
2039
|
+
${this.required?N`<span class="required" aria-hidden="true">*</span>`:""}
|
|
2040
2040
|
</label>
|
|
2041
2041
|
`:U}
|
|
2042
2042
|
<div class="select-wrapper">
|
|
@@ -2063,7 +2063,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2063
2063
|
|
|
2064
2064
|
<div class=${ye({"select-dropdown":!0,hidden:!this._isOpen})} role="listbox">
|
|
2065
2065
|
<div class="select-options">
|
|
2066
|
-
${0===e.length?
|
|
2066
|
+
${0===e.length?N`<div class="select-empty">No options available</div>`:e.map(((e,t)=>{const i=e.value===this.value;return N`
|
|
2067
2067
|
<div
|
|
2068
2068
|
class=${ye({"select-option":!0,"select-option--selected":i,"select-option--disabled":e.disabled,"select-option--highlighted":t===this._highlightedIndex})}
|
|
2069
2069
|
role="option"
|
|
@@ -2077,12 +2077,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2077
2077
|
</div>
|
|
2078
2078
|
</div>
|
|
2079
2079
|
</div>
|
|
2080
|
-
${this._touched&&this.required&&!this.value?
|
|
2080
|
+
${this._touched&&this.required&&!this.value?N`<div class="validation-message">Please select an option</div>`:this.hint?N`<div class="hint">${this.hint}</div>`:""}
|
|
2081
2081
|
</div>
|
|
2082
2082
|
<div class="options-slot">
|
|
2083
2083
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
2084
2084
|
</div>
|
|
2085
|
-
`}}
|
|
2085
|
+
`}}bi.styles=[Ut,a`
|
|
2086
2086
|
:host {
|
|
2087
2087
|
display: block;
|
|
2088
2088
|
font-family: inherit;
|
|
@@ -2258,7 +2258,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2258
2258
|
.options-slot {
|
|
2259
2259
|
display: none;
|
|
2260
2260
|
}
|
|
2261
|
-
`],vi.formAssociated=!0,bi([ce({type:String})],vi.prototype,"label",void 0),bi([ce({type:String})],vi.prototype,"name",void 0),bi([ce({type:String})],vi.prototype,"value",void 0),bi([ce({type:String})],vi.prototype,"placeholder",void 0),bi([ce({type:Boolean})],vi.prototype,"disabled",void 0),bi([ce({type:Boolean})],vi.prototype,"required",void 0),bi([ce({type:Boolean})],vi.prototype,"readonly",void 0),bi([ce({type:String})],vi.prototype,"hint",void 0),bi([ce({type:Boolean,reflect:!0})],vi.prototype,"dirty",void 0),bi([ce({attribute:"save-mode"})],vi.prototype,"saveMode",void 0),bi([ce({type:Boolean,reflect:!0})],vi.prototype,"saving",void 0),bi([pe()],vi.prototype,"_isOpen",void 0),bi([pe()],vi.prototype,"_highlightedIndex",void 0),bi([pe()],vi.prototype,"_touched",void 0),bi([ue(".select-trigger")],vi.prototype,"_triggerElement",void 0),customElements.get("krs-select-field")||customElements.define("krs-select-field",vi);const _i={equals:{key:"equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Equals"},n_equals:{key:"n_equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Doesn't equal"},contains:{key:"contains",type:"comparison",dataTypes:["string"],label:"Contains"},n_contains:{key:"n_contains",type:"comparison",dataTypes:["string"],label:"Doesn't contain"},starts_with:{key:"starts_with",type:"comparison",dataTypes:["string"],label:"Starts with"},ends_with:{key:"ends_with",type:"comparison",dataTypes:["string"],label:"Ends with"},less_than:{key:"less_than",type:"comparison",dataTypes:["number","date"],label:"Less than"},less_than_equal:{key:"less_than_equal",type:"comparison",dataTypes:["number","date"],label:"Less than or equal"},greater_than:{key:"greater_than",type:"comparison",dataTypes:["number","date"],label:"Greater than"},greater_than_equal:{key:"greater_than_equal",type:"comparison",dataTypes:["number","date"],label:"Greater than or equal"},between:{key:"between",type:"range",dataTypes:["number","date"],label:"Between"},in:{key:"in",type:"list",dataTypes:["string","number"],label:"In"},n_in:{key:"n_in",type:"list",dataTypes:["string","number","date","boolean"],label:"Not In"},empty:{key:"empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Empty"},n_empty:{key:"n_empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Not empty"}};function yi(e){const t=[];for(const i of Object.values(_i))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const ki=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],xi=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function wi(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(ki.forEach(((t,i)=>{var s;e=e.replace(new RegExp(`${s=t,"string"!=typeof s?s:s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),xi[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function $i(e,t=!1){const i=new Date(e);return i.setMinutes(i.getMinutes()-i.getTimezoneOffset()),t&&(i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59),i.setUTCMilliseconds(999)),i.toISOString().replace(/:/g,"\\:")}function Si(e,t){let i,s,o,r;if(e&&"start"in e&&"end"in e)i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1];else{if(!(e instanceof Date))return"[* TO *]";i=new Date(e),s=new Date(e),o=t[0],r=t[0]}return"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0)):"day"===o?i.setUTCHours(0,0,0,0):"time"===o&&i.setUTCSeconds(0,0),"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999)):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999)):"day"===r?s.setUTCHours(23,59,59,999):"time"===r&&s.setUTCSeconds(59,999),`[${i.toISOString().replace(/:/g,"\\:")} TO ${s.toISOString().replace(/:/g,"\\:")}]`}function Ci(e,t){let i,s,o,r,a,n;return e&&"start"in e&&"end"in e?(i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1]):(i=new Date(e),s=new Date(e),o=t[0],r=t[0]),"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),a=i):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),a=i):"day"===o?(i.setUTCHours(0,0,0,0),a=i):"time"===o?(i.setUTCSeconds(0,0),a=i):a=i,"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999),n=s):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999),n=s):"day"===r?(s.setUTCHours(23,59,59,999),n=s):"time"===r?(s.setUTCSeconds(59,999),n=s):n=s,[a.toISOString().replace(/\..+/,"").replace("T"," "),n.toISOString().replace(/\..+/,"").replace("T"," ")]}function Ei(e){return e=e.trim(),/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/.test(e)||/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(e)?"day":/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)||/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)?"time":/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/.test(e)?"day":/^(\d{2})$/.test(e)||/^(\d{4})$/.test(e)?"year":/^([A-Za-z]+)\s+(\d{4})$/.test(e)?"month":null}class zi{constructor(){this.field="",this.operator="equals",this.value=null,this.kql="",this.text="",this.type="",this.specificity=[]}setKql(e){if(this.kql=e.trim(),this.text="",this.specificity=[],this.value=null,this.kql)if(e.startsWith("="))this.operator="equals",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("~")&&"string"===this.type)this.operator="contains",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("!~")&&"string"===this.type)this.operator="n_contains",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.endsWith("*")&&"string"===this.type)this.operator="starts_with",this.text=e.substring(0,e.length-1),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("*")&&"string"===this.type)this.operator="ends_with",this.text=e.substring(1),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if("EMPTY"===e)this.operator="empty",this.value=null,this.specificity=[];else if("NOT EMPTY"===e)this.operator="n_empty",this.value=null,this.specificity=[];else if(e.startsWith("<="))this.operator="less_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith(">="))this.operator="greater_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("[")&&e.endsWith("]")&&e.indexOf(" TO ")>-1){this.operator="between";const t=e.indexOf(" TO "),i=e.substring(1,t).trim(),s=e.substring(t+4,e.length-1).trim();this.text=`${i} - ${s}`,this.value={start:this._parse(i),end:this._parse(s)},this.specificity=[Ei(i),Ei(s)]}else e.startsWith("!(")&&e.endsWith(")")?(this.operator="n_in",this.text=e.substring(2,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Ei(this.text)]):e.startsWith("(")&&e.endsWith(")")?(this.operator="in",this.text=e.substring(1,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Ei(this.text)]):"date"===this.type||"boolean"===this.type||"number"===this.type?(this.operator="equals",this.text=this.kql,this.value=this._parse(this.text),this.specificity=[Ei(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[Ei(this.text)]);else"string"===this.type?this.operator="contains":this.operator="equals"}setOperator(e){"empty"===this.operator||"n_empty"===this.operator||"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this.operator=e,"empty"===this.operator?(this.value="EMPTY",this.text="EMPTY"):"n_empty"===this.operator?(this.value="NOT EMPTY",this.text="NOT EMPTY"):"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this._buildKql()}setValue(e,t){this.value=e,t?this.specificity=[t]:e instanceof Date?this.specificity=["time"]:this.specificity=[],this._buildText(),this._buildKql()}setStart(e,t){void 0===this.value?.start&&(this.value={start:null,end:null}),this.value.start=e,t?this.specificity[0]=t:e instanceof Date&&(this.specificity[0]="time"),this._buildText(),this._buildKql()}setEnd(e,t){void 0===this.value?.end&&(this.value={start:null,end:null}),this.value.end=e,t?this.specificity[1]=t:e instanceof Date&&(this.specificity[1]="time"),this._buildText(),this._buildKql()}clear(){"string"===this.type?this.operator="contains":this.operator="equals",this.value=null,this.kql="",this.text="",this.specificity=[]}isEmpty(){return"empty"===this.operator||"n_empty"===this.operator?!this.text:"between"===this.operator?!this.value?.start&&!this.value?.end:"in"===this.operator||"n_in"===this.operator?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("in"!==this.operator&&"n_in"!==this.operator||!Array.isArray(this.value))&&("boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1)),this.value.indexOf(e)>=0)}toggle(e){"in"!==this.operator&&"n_in"!==this.operator&&this.setOperator("in"),"boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1));const t=this.value.indexOf(e);t>=0?this.value.splice(t,1):this.value.push(e),this._buildText(),this._buildKql()}isValid(){return!this.kql||!!this.field&&(!!this.operator&&("empty"===this.operator||("n_empty"===this.operator||("in"===this.operator||"n_in"===this.operator?Array.isArray(this.value)&&this.value.length>0:"date"===this.type?"between"===this.operator?this.value?.start instanceof Date&&this.value?.end instanceof Date&&!isNaN(this.value.start.getTime())&&!isNaN(this.value.end.getTime()):this.value instanceof Date&&!isNaN(this.value.getTime()):"number"===this.type?"between"===this.operator?"number"==typeof this.value?.start&&"number"==typeof this.value?.end:"number"==typeof this.value:"boolean"===this.type?"boolean"==typeof this.value:"string"==typeof this.value&&!!this.value.trim().length))))}toSolrData(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null};switch(e.name=this.field,this.operator){case"equals":this.value instanceof Date?(e.operation="EXPRESSION",e.value=Si(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":this.value instanceof Date?(e.operation="EXPRESSION",e.not=!0,e.value=Si(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${wi(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${wi(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${wi(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${wi(this.value,!1)}`;break;case"empty":e.operation="EXPRESSION",e.not=!0,e.value="[* TO *]";break;case"n_empty":e.operation="EXPRESSION",e.value="[* TO *]";break;case"less_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${$i(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${wi(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${$i(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${wi(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${$i(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${wi(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${$i(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${wi(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=Si(this.value,this.specificity)):(e.operation="EXPRESSION",e.value=`[${this.value.start} TO ${this.value.end}]`);break;case"in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.value=`(${this.value.map((e=>wi(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=wi(this.value,!0));break;case"n_in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.not=!0,e.value=`(${this.value.map((e=>wi(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.not=!0,e.value=wi(this.value,!0));break;default:e.operation="EXPRESSION",e.value=wi(this.value,!0)}return e}toDbParams(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null,values:null};switch(e.name=this.field,this.operator){case"equals":"date"===this.type?(e.operation="BETWEEN",e.values=Ci(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":"date"===this.type?(e.operation="BETWEEN",e.not=!0,e.values=Ci(this.value,this.specificity)):(e.operation="IS",e.value=this.value,e.not=!0);break;case"contains":e.operation="CONTAINS",e.value=this.value;break;case"n_contains":e.operation="CONTAINS",e.value=this.value,e.not=!0;break;case"starts_with":e.operation="STARTS_WITH",e.value=this.value;break;case"ends_with":e.operation="ENDS_WITH",e.value=this.value;break;case"empty":e.operation="IS_BLANK";break;case"n_empty":e.operation="IS_NOT_BLANK";break;case"less_than":e.operation="LESS_THAN",e.value=this.value;break;case"less_than_equal":e.operation="LESS_THAN_EQUAL",e.value=this.value;break;case"greater_than":e.operation="GREATER_THAN",e.value=this.value;break;case"greater_than_equal":e.operation="GREATER_THAN_EQUAL",e.value=this.value;break;case"between":e.operation="BETWEEN","date"===this.type?e.values=Ci(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",e.values=this.value??[];break;case"n_in":e.operation="IN",e.not=!0,e.values=this.value??[];break;default:throw Error(`${this.operator} operator not supported by db params.`)}return e}toOpensearchData(){switch(this.operator){case"equals":return{term:{[this.field]:this.value}};case"n_equals":return{bool:{must_not:[{term:{[this.field]:this.value}}]}};case"contains":return{wildcard:{[this.field]:{value:`*${this.value}*`,case_insensitive:!0}}};case"n_contains":return{bool:{must_not:[{wildcard:{[this.field]:{value:`*${this.value}*`,case_insensitive:!0}}}]}};case"starts_with":return{wildcard:{[this.field]:{value:`${this.value}*`,case_insensitive:!0}}};case"ends_with":return{wildcard:{[this.field]:{value:`*${this.value}`,case_insensitive:!0}}};case"empty":return{bool:{must_not:[{exists:{field:this.field}}]}};case"n_empty":return{exists:{field:this.field}};case"less_than":return{range:{[this.field]:{lt:this.value}}};case"less_than_equal":return{range:{[this.field]:{lte:this.value}}};case"greater_than":return{range:{[this.field]:{gt:this.value}}};case"greater_than_equal":return{range:{[this.field]:{gte:this.value}}};case"between":return{range:{[this.field]:{gte:this.value?.start,lte:this.value?.end}}};case"in":return{terms:{[this.field]:this.value??[]}};case"n_in":return{bool:{must_not:[{terms:{[this.field]:this.value??[]}}]}};default:throw Error(`${this.operator} operator not supported by opensearch data.`)}}_buildText(){this.isEmpty()?this.text="":"between"===this.operator?this.text=`${this._format(this.value?.start)} - ${this._format(this.value?.end)}`:"in"===this.operator||"n_in"===this.operator?this.text=this.value.map((e=>this._format(e))).join(","):this.text=this._format(this.value)}_format(e){if(e instanceof Date&&!isNaN(e.getTime())){return`${String(e.getUTCMonth()+1).padStart(2,"0")}/${String(e.getUTCDate()).padStart(2,"0")}/${e.getUTCFullYear()}`}return"boolean"==typeof e?e?"Yes":"No":String(e??"")}_parse(e){if(null==e||""===e)return null;if(this.type)switch(this.type){case"boolean":{const t=e.toString().toLowerCase();return!0===e||!1!==e&&("yes"===t||"no"!==t&&("1"===t||"0"!==t&&null))}case"date":return this._parseDate(e);case"number":{const t=Number(e.toString().replace(/[$,]+/g,""));return isNaN(t)?null:t}default:return e.toString()}return e}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){let e=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==e&&(e+=12),"AM"===i[6].toUpperCase()&&12===e&&(e=0)),new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]),e,parseInt(i[5])))}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){const e=t[i[1].toLowerCase()];if(void 0!==e){let t=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==t&&(t+=12),"AM"===i[6].toUpperCase()&&12===t&&(t=0)),new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2]),t,parseInt(i[5])))}}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2])))}if(i=e.match(/^(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[1]),0,1));if(i=e.match(/^(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[1]),0,1));if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[2]),e,1))}return null}_buildKql(){if(this.isEmpty())this.kql="";else switch(this.operator){case"equals":this.kql=`= ${this.text}`;break;case"n_equals":this.kql=`!= ${this.text}`;break;case"contains":this.kql=`~ ${this.text}`;break;case"n_contains":this.kql=`!~ ${this.text}`;break;case"starts_with":this.kql=`${this.text}*`;break;case"ends_with":this.kql=`*${this.text}`;break;case"empty":this.kql="EMPTY";break;case"n_empty":this.kql="NOT EMPTY";break;case"less_than":this.kql=`< ${this.text}`;break;case"less_than_equal":this.kql=`<= ${this.text}`;break;case"greater_than":this.kql=`> ${this.text}`;break;case"greater_than_equal":this.kql=`>= ${this.text}`;break;case"between":this.kql=`[${this._format(this.value?.start??"")} TO ${this._format(this.value?.end??"")}]`;break;case"in":this.kql=`(${this.value.map((e=>this._format(e))).join(",")})`;break;case"n_in":this.kql=`!(${this.value.map((e=>this._format(e))).join(",")})`;break;default:throw Error(`Unknown operator ${this.operator}`)}}}var Di=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Ti{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}class Oi extends ne{constructor(){super(...arguments),this._scrollStyle="edge",this._filterPanelPos={top:0,left:0},this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._measuredColumnIds=new Set,this._model=new Ti,this.def={columns:[]},this.variant="default",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._sorts=[],this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this._measuredColumnIds.delete(t.id),this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition(),this._unlockColumnWidths()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._measuredColumnIds.clear(),this._model=new Ti,this._buckets=new Map,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable||e.options?.length)&&(t.filter=new zi,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):!e.facetable&&!e.options?.length||e.filterable?"string"===t.filter.type&&(t.filter.operator="contains"):(t.filter.operator="in",t.filter.value=[])),e.options?.length&&this._buckets.set(e.id,e.options.map((e=>({val:e})))),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._measuredColumnIds.add(t[i].id))}))}_unlockColumnWidths(){0!==this._measuredColumnIds.size&&(this.getDisplayedColumns().forEach((e=>{this._measuredColumnIds.has(e.id)&&(e.width=void 0)})),this._measuredColumnIds.clear(),this.requestUpdate())}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:re(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:wi(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error";let t="Failed to load data";e instanceof Error&&(t=e.message),hi.show({message:t,type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_handleColumnPickerClick(){this._columnPickerOpen=!this._columnPickerOpen}_handleColumnToggle(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault(),this.getDisplayedColumns().forEach((e=>{if(e.width||"actions"===e.type)return;const t=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${e.id}"]`);t?.offsetWidth&&(e.width=`${t.offsetWidth}px`)}));const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return U;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
2261
|
+
`],bi.formAssociated=!0,vi([ce({type:String})],bi.prototype,"label",void 0),vi([ce({type:String})],bi.prototype,"name",void 0),vi([ce({type:String})],bi.prototype,"value",void 0),vi([ce({type:String})],bi.prototype,"placeholder",void 0),vi([ce({type:Boolean})],bi.prototype,"disabled",void 0),vi([ce({type:Boolean})],bi.prototype,"required",void 0),vi([ce({type:Boolean})],bi.prototype,"readonly",void 0),vi([ce({type:String})],bi.prototype,"hint",void 0),vi([ce({type:Boolean,reflect:!0})],bi.prototype,"dirty",void 0),vi([ce({attribute:"save-mode"})],bi.prototype,"saveMode",void 0),vi([ce({type:Boolean,reflect:!0})],bi.prototype,"saving",void 0),vi([pe()],bi.prototype,"_isOpen",void 0),vi([pe()],bi.prototype,"_highlightedIndex",void 0),vi([pe()],bi.prototype,"_touched",void 0),vi([ue(".select-trigger")],bi.prototype,"_triggerElement",void 0),customElements.get("krs-select-field")||customElements.define("krs-select-field",bi);const _i={equals:{key:"equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Equals"},n_equals:{key:"n_equals",type:"comparison",dataTypes:["string","number","date","boolean"],label:"Doesn't equal"},contains:{key:"contains",type:"comparison",dataTypes:["string"],label:"Contains"},n_contains:{key:"n_contains",type:"comparison",dataTypes:["string"],label:"Doesn't contain"},starts_with:{key:"starts_with",type:"comparison",dataTypes:["string"],label:"Starts with"},ends_with:{key:"ends_with",type:"comparison",dataTypes:["string"],label:"Ends with"},less_than:{key:"less_than",type:"comparison",dataTypes:["number","date"],label:"Less than"},less_than_equal:{key:"less_than_equal",type:"comparison",dataTypes:["number","date"],label:"Less than or equal"},greater_than:{key:"greater_than",type:"comparison",dataTypes:["number","date"],label:"Greater than"},greater_than_equal:{key:"greater_than_equal",type:"comparison",dataTypes:["number","date"],label:"Greater than or equal"},between:{key:"between",type:"range",dataTypes:["number","date"],label:"Between"},in:{key:"in",type:"list",dataTypes:["string","number"],label:"In"},n_in:{key:"n_in",type:"list",dataTypes:["string","number","date","boolean"],label:"Not In"},empty:{key:"empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Empty"},n_empty:{key:"n_empty",type:"nil",dataTypes:["string","number","date","boolean"],label:"Not empty"}};function yi(e){const t=[];for(const i of Object.values(_i))i.dataTypes.includes(e)&&t.push({key:i.key,label:i.label});return t}const ki=['"',"+","-","&&","||","!","(",")","{","}","[","]","^","~","*","?",":"],xi=['\\"',"\\+","\\-","\\&\\&","\\|\\|","\\!","\\(","\\)","\\{","\\}","\\[","\\]","\\^","\\~","\\*","\\?","\\:"];function wi(e,t=!0){return!0===e||!1===e?e.toString():null===e?"(*:* NOT *)":"number"==typeof e?e.toString():"string"==typeof e?(ki.forEach(((t,i)=>{var s;e=e.replace(new RegExp(`${s=t,"string"!=typeof s?s:s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}`,"g"),xi[i])})),t?`"${e}"`:e.replace(/ /g,"\\ ")):e}function $i(e,t=!1){const i=new Date(e);return i.setMinutes(i.getMinutes()-i.getTimezoneOffset()),t&&(i.setUTCHours(23),i.setUTCMinutes(59),i.setUTCSeconds(59),i.setUTCMilliseconds(999)),i.toISOString().replace(/:/g,"\\:")}function Si(e,t){let i,s,o,r;if(e&&"start"in e&&"end"in e)i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1];else{if(!(e instanceof Date))return"[* TO *]";i=new Date(e),s=new Date(e),o=t[0],r=t[0]}return"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0)):"day"===o?i.setUTCHours(0,0,0,0):"time"===o&&i.setUTCSeconds(0,0),"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999)):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999)):"day"===r?s.setUTCHours(23,59,59,999):"time"===r&&s.setUTCSeconds(59,999),`[${i.toISOString().replace(/:/g,"\\:")} TO ${s.toISOString().replace(/:/g,"\\:")}]`}function Ci(e,t){let i,s,o,r,a,n;return e&&"start"in e&&"end"in e?(i=new Date(e.start),s=new Date(e.end),o=t[0],r=t[1]):(i=new Date(e),s=new Date(e),o=t[0],r=t[0]),"year"===o?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),a=i):"month"===o?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),a=i):"day"===o?(i.setUTCHours(0,0,0,0),a=i):"time"===o?(i.setUTCSeconds(0,0),a=i):a=i,"year"===r?(s.setUTCMonth(11,31),s.setUTCHours(23,59,59,999),n=s):"month"===r?(s.setUTCMonth(s.getUTCMonth()+1),s.setUTCDate(0),s.setUTCHours(23,59,59,999),n=s):"day"===r?(s.setUTCHours(23,59,59,999),n=s):"time"===r?(s.setUTCSeconds(59,999),n=s):n=s,[a.toISOString().replace(/\..+/,"").replace("T"," "),n.toISOString().replace(/\..+/,"").replace("T"," ")]}function Ei(e){return e=e.trim(),/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/.test(e)||/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(e)?"day":/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)||/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i.test(e)?"time":/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/.test(e)?"day":/^(\d{2})$/.test(e)||/^(\d{4})$/.test(e)?"year":/^([A-Za-z]+)\s+(\d{4})$/.test(e)?"month":null}class zi{constructor(){this.field="",this.operator="equals",this.value=null,this.kql="",this.text="",this.type="",this.specificity=[]}setKql(e){if(this.kql=e.trim(),this.text="",this.specificity=[],this.value=null,this.kql)if(e.startsWith("="))this.operator="equals",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("!="))this.operator="n_equals",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("~")&&"string"===this.type)this.operator="contains",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("!~")&&"string"===this.type)this.operator="n_contains",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.endsWith("*")&&"string"===this.type)this.operator="starts_with",this.text=e.substring(0,e.length-1),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("*")&&"string"===this.type)this.operator="ends_with",this.text=e.substring(1),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if("EMPTY"===e)this.operator="empty",this.value=null,this.specificity=[];else if("NOT EMPTY"===e)this.operator="n_empty",this.value=null,this.specificity=[];else if(e.startsWith("<="))this.operator="less_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("<"))this.operator="less_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith(">="))this.operator="greater_than_equal",this.text=e.substring(2).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith(">"))this.operator="greater_than",this.text=e.substring(1).trim(),this.value=this._parse(this.text),this.specificity=[Ei(this.text)];else if(e.startsWith("[")&&e.endsWith("]")&&e.indexOf(" TO ")>-1){this.operator="between";const t=e.indexOf(" TO "),i=e.substring(1,t).trim(),s=e.substring(t+4,e.length-1).trim();this.text=`${i} - ${s}`,this.value={start:this._parse(i),end:this._parse(s)},this.specificity=[Ei(i),Ei(s)]}else e.startsWith("!(")&&e.endsWith(")")?(this.operator="n_in",this.text=e.substring(2,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Ei(this.text)]):e.startsWith("(")&&e.endsWith(")")?(this.operator="in",this.text=e.substring(1,e.length-1).trim(),this.value=this.text.split(",").map((e=>e.trim())).map((e=>this._parse(e))),this.specificity=[Ei(this.text)]):"date"===this.type||"boolean"===this.type||"number"===this.type?(this.operator="equals",this.text=this.kql,this.value=this._parse(this.text),this.specificity=[Ei(this.text)]):(this.operator="contains",this.text=e,this.value=this._parse(this.text),this.specificity=[Ei(this.text)]);else"string"===this.type?this.operator="contains":this.operator="equals"}setOperator(e){"empty"===this.operator||"n_empty"===this.operator||"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this.operator=e,"empty"===this.operator?(this.value="EMPTY",this.text="EMPTY"):"n_empty"===this.operator?(this.value="NOT EMPTY",this.text="NOT EMPTY"):"between"===this.operator?(this.value=null,this.text=""):"in"!==this.operator&&"n_in"!==this.operator||(this.value=[],this.text=""),this._buildKql()}setValue(e,t){this.value=e,t?this.specificity=[t]:e instanceof Date?this.specificity=["time"]:this.specificity=[],this._buildText(),this._buildKql()}setStart(e,t){void 0===this.value?.start&&(this.value={start:null,end:null}),this.value.start=e,t?this.specificity[0]=t:e instanceof Date&&(this.specificity[0]="time"),this._buildText(),this._buildKql()}setEnd(e,t){void 0===this.value?.end&&(this.value={start:null,end:null}),this.value.end=e,t?this.specificity[1]=t:e instanceof Date&&(this.specificity[1]="time"),this._buildText(),this._buildKql()}clear(){"string"===this.type?this.operator="contains":this.operator="equals",this.value=null,this.kql="",this.text="",this.specificity=[]}isEmpty(){return"empty"===this.operator||"n_empty"===this.operator?!this.text:"between"===this.operator?!this.value?.start&&!this.value?.end:"in"===this.operator||"n_in"===this.operator?!this.value?.length:void 0===this.value||null===this.value||""===this.value}has(e){return!("in"!==this.operator&&"n_in"!==this.operator||!Array.isArray(this.value))&&("boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1)),this.value.indexOf(e)>=0)}toggle(e){"in"!==this.operator&&"n_in"!==this.operator&&this.setOperator("in"),"boolean"===this.type&&"string"==typeof e&&("true"===e?e=!0:"false"===e&&(e=!1));const t=this.value.indexOf(e);t>=0?this.value.splice(t,1):this.value.push(e),this._buildText(),this._buildKql()}isValid(){return!this.kql||!!this.field&&(!!this.operator&&("empty"===this.operator||("n_empty"===this.operator||("in"===this.operator||"n_in"===this.operator?Array.isArray(this.value)&&this.value.length>0:"date"===this.type?"between"===this.operator?this.value?.start instanceof Date&&this.value?.end instanceof Date&&!isNaN(this.value.start.getTime())&&!isNaN(this.value.end.getTime()):this.value instanceof Date&&!isNaN(this.value.getTime()):"number"===this.type?"between"===this.operator?"number"==typeof this.value?.start&&"number"==typeof this.value?.end:"number"==typeof this.value:"boolean"===this.type?"boolean"==typeof this.value:"string"==typeof this.value&&!!this.value.trim().length))))}toSolrData(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null};switch(e.name=this.field,this.operator){case"equals":this.value instanceof Date?(e.operation="EXPRESSION",e.value=Si(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":this.value instanceof Date?(e.operation="EXPRESSION",e.not=!0,e.value=Si(this.value,this.specificity)):(e.operation="IS",e.not=!0,e.value=this.value);break;case"contains":e.operation="EXPRESSION",e.value=`*${wi(this.value,!1)}*`;break;case"n_contains":e.operation="EXPRESSION",e.not=!0,e.value=`*${wi(this.value,!1)}*`;break;case"starts_with":e.operation="EXPRESSION",e.value=`${wi(this.value,!1)}*`;break;case"ends_with":e.operation="EXPRESSION",e.value=`*${wi(this.value,!1)}`;break;case"empty":e.operation="EXPRESSION",e.not=!0,e.value="[* TO *]";break;case"n_empty":e.operation="EXPRESSION",e.value="[* TO *]";break;case"less_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${$i(this.value)}}`):(e.operation="EXPRESSION",e.value=`[* TO ${wi(this.value,!0)}}`);break;case"less_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[* TO ${$i(this.value,!0)}]`):(e.operation="EXPRESSION",e.value=`[* TO ${wi(this.value,!0)}]`);break;case"greater_than":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`{${$i(this.value,!0)} TO *]`):(e.operation="EXPRESSION",e.value=`{${wi(this.value,!0)} TO *]`);break;case"greater_than_equal":this.value instanceof Date?(e.operation="EXPRESSION",e.value=`[${$i(this.value)} TO *]`):(e.operation="EXPRESSION",e.value=`[${wi(this.value,!0)} TO *]`);break;case"between":this.value?.start instanceof Date&&this.value?.end instanceof Date?(e.operation="EXPRESSION",e.value=Si(this.value,this.specificity)):(e.operation="EXPRESSION",e.value=`[${this.value.start} TO ${this.value.end}]`);break;case"in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.value=`(${this.value.map((e=>wi(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.value=wi(this.value,!0));break;case"n_in":Array.isArray(this.value)&&this.value.length>0?(e.operation="EXPRESSION",e.not=!0,e.value=`(${this.value.map((e=>wi(e,!0))).join(" OR ")})`):(e.operation="EXPRESSION",e.not=!0,e.value=wi(this.value,!0));break;default:e.operation="EXPRESSION",e.value=wi(this.value,!0)}return e}toDbParams(){const e={boost:null,fuzzy:null,not:!1,name:null,operation:null,tagged:!1,value:null,values:null};switch(e.name=this.field,this.operator){case"equals":"date"===this.type?(e.operation="BETWEEN",e.values=Ci(this.value,this.specificity)):(e.operation="IS",e.value=this.value);break;case"n_equals":"date"===this.type?(e.operation="BETWEEN",e.not=!0,e.values=Ci(this.value,this.specificity)):(e.operation="IS",e.value=this.value,e.not=!0);break;case"contains":e.operation="CONTAINS",e.value=this.value;break;case"n_contains":e.operation="CONTAINS",e.value=this.value,e.not=!0;break;case"starts_with":e.operation="STARTS_WITH",e.value=this.value;break;case"ends_with":e.operation="ENDS_WITH",e.value=this.value;break;case"empty":e.operation="IS_BLANK";break;case"n_empty":e.operation="IS_NOT_BLANK";break;case"less_than":e.operation="LESS_THAN",e.value=this.value;break;case"less_than_equal":e.operation="LESS_THAN_EQUAL",e.value=this.value;break;case"greater_than":e.operation="GREATER_THAN",e.value=this.value;break;case"greater_than_equal":e.operation="GREATER_THAN_EQUAL",e.value=this.value;break;case"between":e.operation="BETWEEN","date"===this.type?e.values=Ci(this.value,this.specificity):e.values=[this.value.start,this.value.end];break;case"in":e.operation="IN",e.values=this.value??[];break;case"n_in":e.operation="IN",e.not=!0,e.values=this.value??[];break;default:throw Error(`${this.operator} operator not supported by db params.`)}return e}toOpensearchData(){switch(this.operator){case"equals":return{term:{[this.field]:this.value}};case"n_equals":return{bool:{must_not:[{term:{[this.field]:this.value}}]}};case"contains":return{wildcard:{[this.field]:{value:`*${this.value}*`,case_insensitive:!0}}};case"n_contains":return{bool:{must_not:[{wildcard:{[this.field]:{value:`*${this.value}*`,case_insensitive:!0}}}]}};case"starts_with":return{wildcard:{[this.field]:{value:`${this.value}*`,case_insensitive:!0}}};case"ends_with":return{wildcard:{[this.field]:{value:`*${this.value}`,case_insensitive:!0}}};case"empty":return{bool:{must_not:[{exists:{field:this.field}}]}};case"n_empty":return{exists:{field:this.field}};case"less_than":return{range:{[this.field]:{lt:this.value}}};case"less_than_equal":return{range:{[this.field]:{lte:this.value}}};case"greater_than":return{range:{[this.field]:{gt:this.value}}};case"greater_than_equal":return{range:{[this.field]:{gte:this.value}}};case"between":return{range:{[this.field]:{gte:this.value?.start,lte:this.value?.end}}};case"in":return{terms:{[this.field]:this.value??[]}};case"n_in":return{bool:{must_not:[{terms:{[this.field]:this.value??[]}}]}};default:throw Error(`${this.operator} operator not supported by opensearch data.`)}}_buildText(){this.isEmpty()?this.text="":"between"===this.operator?this.text=`${this._format(this.value?.start)} - ${this._format(this.value?.end)}`:"in"===this.operator||"n_in"===this.operator?this.text=this.value.map((e=>this._format(e))).join(","):this.text=this._format(this.value)}_format(e){if(e instanceof Date&&!isNaN(e.getTime())){return`${String(e.getUTCMonth()+1).padStart(2,"0")}/${String(e.getUTCDate()).padStart(2,"0")}/${e.getUTCFullYear()}`}return"boolean"==typeof e?e?"Yes":"No":String(e??"")}_parse(e){if(null==e||""===e)return null;if(this.type)switch(this.type){case"boolean":{const t=e.toString().toLowerCase();return!0===e||!1!==e&&("yes"===t||"no"!==t&&("1"===t||"0"!==t&&null))}case"date":return this._parseDate(e);case"number":{const t=Number(e.toString().replace(/[$,]+/g,""));return isNaN(t)?null:t}default:return e.toString()}return e}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2])));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){let e=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==e&&(e+=12),"AM"===i[6].toUpperCase()&&12===e&&(e=0)),new Date(Date.UTC(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]),e,parseInt(i[5])))}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*(AM|PM)?$/i),i){const e=t[i[1].toLowerCase()];if(void 0!==e){let t=parseInt(i[4]);return i[6]&&("PM"===i[6].toUpperCase()&&12!==t&&(t+=12),"AM"===i[6].toUpperCase()&&12===t&&(t=0)),new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2]),t,parseInt(i[5])))}}if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[3]),e,parseInt(i[2])))}if(i=e.match(/^(\d{2})$/),i)return new Date(Date.UTC(2e3+parseInt(i[1]),0,1));if(i=e.match(/^(\d{4})$/),i)return new Date(Date.UTC(parseInt(i[1]),0,1));if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(Date.UTC(parseInt(i[2]),e,1))}return null}_buildKql(){if(this.isEmpty())this.kql="";else switch(this.operator){case"equals":this.kql=`= ${this.text}`;break;case"n_equals":this.kql=`!= ${this.text}`;break;case"contains":this.kql=`~ ${this.text}`;break;case"n_contains":this.kql=`!~ ${this.text}`;break;case"starts_with":this.kql=`${this.text}*`;break;case"ends_with":this.kql=`*${this.text}`;break;case"empty":this.kql="EMPTY";break;case"n_empty":this.kql="NOT EMPTY";break;case"less_than":this.kql=`< ${this.text}`;break;case"less_than_equal":this.kql=`<= ${this.text}`;break;case"greater_than":this.kql=`> ${this.text}`;break;case"greater_than_equal":this.kql=`>= ${this.text}`;break;case"between":this.kql=`[${this._format(this.value?.start??"")} TO ${this._format(this.value?.end??"")}]`;break;case"in":this.kql=`(${this.value.map((e=>this._format(e))).join(",")})`;break;case"n_in":this.kql=`!(${this.value.map((e=>this._format(e))).join(",")})`;break;default:throw Error(`Unknown operator ${this.operator}`)}}}var Di=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Ti{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null}}class Oi extends ne{constructor(){super(...arguments),this._scrollStyle="edge",this._filterPanelPos={top:0,left:0},this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._measuredColumnIds=new Set,this._model=new Ti,this.def={columns:[]},this.variant="default",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._sorts=[],this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this._measuredColumnIds.delete(t.id),this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition(),this._unlockColumnWidths()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._measuredColumnIds.clear(),this._model=new Ti,this._buckets=new Map,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable||e.options?.length)&&(t.filter=new zi,t.filter.field=e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):!e.facetable&&!e.options?.length||e.filterable?"string"===t.filter.type&&(t.filter.operator="contains"):(t.filter.operator="in",t.filter.value=[])),e.options?.length&&this._buckets.set(e.id,e.options.map((e=>({val:e})))),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._measuredColumnIds.add(t[i].id))}))}_unlockColumnWidths(){0!==this._measuredColumnIds.size&&(this.getDisplayedColumns().forEach((e=>{this._measuredColumnIds.has(e.id)&&(e.width=void 0)})),this._measuredColumnIds.clear(),this.requestUpdate())}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:re(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:wi(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"opensearch":throw Error("Opensearch not supported yet");case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error";let t="Failed to load data";e instanceof Error&&(t=e.message),hi.show({message:t,type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_handleColumnPickerClick(){this._columnPickerOpen=!this._columnPickerOpen}_handleColumnToggle(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault(),this.getDisplayedColumns().forEach((e=>{if(e.width||"actions"===e.type)return;const t=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${e.id}"]`);t?.offsetWidth&&(e.width=`${t.offsetWidth}px`)}));const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return U;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return N`
|
|
2262
2262
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
2263
2263
|
<svg
|
|
2264
2264
|
class="header-cell__sort-arrow header-cell__sort-arrow--ghost"
|
|
@@ -2268,7 +2268,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2268
2268
|
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
2269
2269
|
</svg>
|
|
2270
2270
|
</span>
|
|
2271
|
-
`;let i={};return"desc"===this._sorts[t].sortDirection&&(i={transform:"rotate(180deg)"}),
|
|
2271
|
+
`;let i={};return"desc"===this._sorts[t].sortDirection&&(i={transform:"rotate(180deg)"}),N`
|
|
2272
2272
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
2273
2273
|
<svg
|
|
2274
2274
|
class="header-cell__sort-arrow"
|
|
@@ -2278,11 +2278,11 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2278
2278
|
>
|
|
2279
2279
|
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
2280
2280
|
</svg>
|
|
2281
|
-
${this._sorts.length>1?
|
|
2281
|
+
${this._sorts.length>1?N`
|
|
2282
2282
|
<span class="header-cell__sort-priority">${t+1}</span>
|
|
2283
2283
|
`:U}
|
|
2284
2284
|
</span>
|
|
2285
|
-
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let s=202;t.filterable&&(s=328),this._filterPanelPos={top:i.bottom+4,left:Math.max(0,i.right-s)},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const s=t[e.id];if(e.render)return
|
|
2285
|
+
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let s=202;t.filterable&&(s=328),this._filterPanelPos={top:i.bottom+4,left:Math.max(0,i.right-s)},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const s=t[e.id];if(e.render)return N`<slot name="cell-${i}-${e.id}"></slot>`;if(null==s)return"";switch(e.type){case"number":return"currency"===e.format&&"number"==typeof s?s.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(s);case"date":{let e;if(s instanceof Date)e=s;else if("string"==typeof s&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(s)){const t=s.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/,"$1.$2").replace(" ","T")+"Z";e=new Date(t)}else e=new Date(s);return e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}case"boolean":return!0===s?"Yes":!1===s?"No":"";default:return String(s)}}_getCellStyle(e,t){const i={};if("left"===e.sticky){let e=0;for(let i=0;i<t;i++){const t=this.getDisplayedColumns()[i];"left"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.left=`${e}px`}if("right"===e.sticky){let e=0;for(let i=t+1;i<this.getDisplayedColumns().length;i++){const t=this.getDisplayedColumns()[i];"right"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.right=`${e}px`}return i}_renderPagination(){const e=(this._page-1)*this._pageSize+1,t=Math.min(this._page*this._pageSize,this._totalItems);return N`
|
|
2286
2286
|
<div class="pagination">
|
|
2287
2287
|
<span
|
|
2288
2288
|
class=${ye({"pagination-icon":!0,"pagination-icon--disabled":1===this._page})}
|
|
@@ -2302,15 +2302,15 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2302
2302
|
</svg>
|
|
2303
2303
|
</span>
|
|
2304
2304
|
</div>
|
|
2305
|
-
`}_renderCardHeader(){return"card"!==this.variant?U:this._model.title||this._model.description?
|
|
2305
|
+
`}_renderCardHeader(){return"card"!==this.variant?U:this._model.title||this._model.description?N`
|
|
2306
2306
|
<div class="card-header">
|
|
2307
|
-
${this._model.title?
|
|
2308
|
-
${this._model.description?
|
|
2307
|
+
${this._model.title?N`<h2 class="card-header__title">${this._model.title}</h2>`:U}
|
|
2308
|
+
${this._model.description?N`<p class="card-header__description">${this._model.description}</p>`:U}
|
|
2309
2309
|
</div>
|
|
2310
|
-
`:U}_renderHeader(){return!this._model.title&&!this._model.actions?.length&&this._totalPages<=1?U:
|
|
2310
|
+
`:U}_renderHeader(){return!this._model.title&&!this._model.actions?.length&&this._totalPages<=1?U:N`
|
|
2311
2311
|
<div class="header">
|
|
2312
|
-
${this._model.title&&"card"!==this.variant?
|
|
2313
|
-
${"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))?
|
|
2312
|
+
${this._model.title&&"card"!==this.variant?N`<div class="title">${this._model.title}</div>`:U}
|
|
2313
|
+
${"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))?N`
|
|
2314
2314
|
<div class="search">
|
|
2315
2315
|
<!-- TODO: Saved views dropdown
|
|
2316
2316
|
<div class="views">
|
|
@@ -2337,7 +2337,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2337
2337
|
/>
|
|
2338
2338
|
</div>
|
|
2339
2339
|
</div>
|
|
2340
|
-
`:
|
|
2340
|
+
`:N`<div class="search"></div>`}
|
|
2341
2341
|
<div class="tools">
|
|
2342
2342
|
${this._renderPagination()}
|
|
2343
2343
|
<span
|
|
@@ -2360,7 +2360,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2360
2360
|
</svg>
|
|
2361
2361
|
</span>
|
|
2362
2362
|
<div class=${ye({"column-picker":!0,open:this._columnPickerOpen})}>
|
|
2363
|
-
${[...this._model.columns].filter((e=>"actions"!==e.type)).sort(((e,t)=>(e.label??e.id).localeCompare(t.label??t.id))).map((e=>
|
|
2363
|
+
${[...this._model.columns].filter((e=>"actions"!==e.type)).sort(((e,t)=>(e.label??e.id).localeCompare(t.label??t.id))).map((e=>N`
|
|
2364
2364
|
<div class="column-picker-item" @click=${()=>this._handleColumnToggle(e.id)}>
|
|
2365
2365
|
<div class=${ye({"column-picker-checkbox":!0,checked:this._model.displayedColumns.includes(e.id)})}>
|
|
2366
2366
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
@@ -2372,7 +2372,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2372
2372
|
`))}
|
|
2373
2373
|
</div>
|
|
2374
2374
|
</div>
|
|
2375
|
-
${1===this._model.actions?.length?
|
|
2375
|
+
${1===this._model.actions?.length?N`
|
|
2376
2376
|
<krs-button
|
|
2377
2377
|
class="actions"
|
|
2378
2378
|
.href=${this._model.actions[0].href}
|
|
@@ -2381,7 +2381,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2381
2381
|
>
|
|
2382
2382
|
${this._model.actions[0].label}
|
|
2383
2383
|
</krs-button>
|
|
2384
|
-
`:this._model.actions?.length?
|
|
2384
|
+
`:this._model.actions?.length?N`
|
|
2385
2385
|
<krs-button
|
|
2386
2386
|
class="actions"
|
|
2387
2387
|
.options=${this._model.actions.map((e=>({id:e.id,label:e.label,href:e.href,hrefTarget:e.target})))}
|
|
@@ -2392,14 +2392,14 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2392
2392
|
`:U}
|
|
2393
2393
|
</div>
|
|
2394
2394
|
</div>
|
|
2395
|
-
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?
|
|
2395
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?N`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?N`<div class="status status--error">Error loading data</div>`:0===this._data.length?N`<div class="status">No data available</div>`:U}_renderFilterPanel(){if(!this._filterPanelOpened)return U;const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));let t=N``;t="empty"===e.filter.operator||"n_empty"===e.filter.operator?N`
|
|
2396
2396
|
<input
|
|
2397
2397
|
type="text"
|
|
2398
2398
|
class="filter-panel__input"
|
|
2399
2399
|
disabled
|
|
2400
2400
|
.value=${e.filter.text}
|
|
2401
2401
|
/>
|
|
2402
|
-
`:"between"===e.filter.operator&&"date"===e.type?
|
|
2402
|
+
`:"between"===e.filter.operator&&"date"===e.type?N`
|
|
2403
2403
|
<input
|
|
2404
2404
|
type="date"
|
|
2405
2405
|
class="filter-panel__input"
|
|
@@ -2412,7 +2412,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2412
2412
|
.valueAsDate=${e.filter.value?.end??null}
|
|
2413
2413
|
@change=${t=>this._handleFilterDateEndChange(t,e)}
|
|
2414
2414
|
/>
|
|
2415
|
-
`:"between"===e.filter.operator&&"number"===e.type?
|
|
2415
|
+
`:"between"===e.filter.operator&&"number"===e.type?N`
|
|
2416
2416
|
<input
|
|
2417
2417
|
type="number"
|
|
2418
2418
|
class="filter-panel__input"
|
|
@@ -2429,7 +2429,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2429
2429
|
@input=${t=>this._handleFilterNumberEndChange(t,e)}
|
|
2430
2430
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
2431
2431
|
/>
|
|
2432
|
-
`:"in"===e.filter.operator||"n_in"===e.filter.operator?
|
|
2432
|
+
`:"in"===e.filter.operator||"n_in"===e.filter.operator?N`
|
|
2433
2433
|
<textarea
|
|
2434
2434
|
class="filter-panel__textarea"
|
|
2435
2435
|
rows="3"
|
|
@@ -2438,7 +2438,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2438
2438
|
@input=${t=>this._handleFilterListChange(t,e)}
|
|
2439
2439
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
2440
2440
|
></textarea>
|
|
2441
|
-
`:"boolean"===e.type?
|
|
2441
|
+
`:"boolean"===e.type?N`
|
|
2442
2442
|
<krs-select-field
|
|
2443
2443
|
placeholder="Value"
|
|
2444
2444
|
.value=${String(e.filter.value??"")}
|
|
@@ -2447,14 +2447,14 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2447
2447
|
<krs-select-option value="true">Yes</krs-select-option>
|
|
2448
2448
|
<krs-select-option value="false">No</krs-select-option>
|
|
2449
2449
|
</krs-select-field>
|
|
2450
|
-
`:"date"===e.type?
|
|
2450
|
+
`:"date"===e.type?N`
|
|
2451
2451
|
<input
|
|
2452
2452
|
type="date"
|
|
2453
2453
|
class="filter-panel__input"
|
|
2454
2454
|
.valueAsDate=${e.filter.value}
|
|
2455
2455
|
@change=${t=>this._handleFilterDateChange(t,e)}
|
|
2456
2456
|
/>
|
|
2457
|
-
`:"number"===e.type?
|
|
2457
|
+
`:"number"===e.type?N`
|
|
2458
2458
|
<input
|
|
2459
2459
|
type="number"
|
|
2460
2460
|
class="filter-panel__input"
|
|
@@ -2464,7 +2464,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2464
2464
|
@input=${t=>this._handleFilterNumberChange(t,e)}
|
|
2465
2465
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
2466
2466
|
/>
|
|
2467
|
-
`:
|
|
2467
|
+
`:N`
|
|
2468
2468
|
<input
|
|
2469
2469
|
type="text"
|
|
2470
2470
|
class="filter-panel__input"
|
|
@@ -2473,25 +2473,25 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2473
2473
|
@input=${t=>this._handleFilterStringChange(t,e)}
|
|
2474
2474
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
2475
2475
|
/>
|
|
2476
|
-
`;const i=
|
|
2476
|
+
`;const i=N`
|
|
2477
2477
|
<div class="filter-panel__content">
|
|
2478
2478
|
<krs-select-field
|
|
2479
2479
|
.value=${e.filter.operator}
|
|
2480
2480
|
@change=${t=>this._handleOperatorChange(t,e)}
|
|
2481
2481
|
>
|
|
2482
|
-
${yi(e.type).map((e=>
|
|
2482
|
+
${yi(e.type).map((e=>N`
|
|
2483
2483
|
<krs-select-option value=${e.key}>${e.label}</krs-select-option>
|
|
2484
2484
|
`))}
|
|
2485
2485
|
</krs-select-field>
|
|
2486
2486
|
${t}
|
|
2487
2487
|
</div>
|
|
2488
|
-
`,s=this._buckets.get(e.id)||[];let o,r;if(o=s.length?
|
|
2488
|
+
`,s=this._buckets.get(e.id)||[];let o,r;if(o=s.length?N`
|
|
2489
2489
|
<div class="buckets">
|
|
2490
|
-
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let o=U;s&&(o=
|
|
2490
|
+
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let o=U;s&&(o=N`
|
|
2491
2491
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
2492
2492
|
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
2493
2493
|
</svg>
|
|
2494
|
-
`);let r=U;return(t.count||0===t.count)&&(r=
|
|
2494
|
+
`);let r=U;return(t.count||0===t.count)&&(r=N`<span class="bucket__count">${t.count}</span>`),N`
|
|
2495
2495
|
<div
|
|
2496
2496
|
class="bucket"
|
|
2497
2497
|
@click=${i=>this._handleBucketToggle(i,e,t)}
|
|
@@ -2504,7 +2504,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2504
2504
|
</div>
|
|
2505
2505
|
`}))}
|
|
2506
2506
|
</div>
|
|
2507
|
-
`:
|
|
2507
|
+
`:N`<div class="bucket-empty">No data</div>`,(e.facetable||e.options?.length)&&e.filterable){let t="Values";e.facetable&&(t="Counts"),r=N`
|
|
2508
2508
|
<krs-tab-group
|
|
2509
2509
|
size="small"
|
|
2510
2510
|
active-tab-id=${this._filterPanelTab}
|
|
@@ -2517,7 +2517,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2517
2517
|
${o}
|
|
2518
2518
|
</krs-tab>
|
|
2519
2519
|
</krs-tab-group>
|
|
2520
|
-
`}else r=e.facetable||e.options?.length?o:i;let a=U;return e.filterable&&(a=
|
|
2520
|
+
`}else r=e.facetable||e.options?.length?o:i;let a=U;return e.filterable&&(a=N`
|
|
2521
2521
|
<div class="filter-panel__actions">
|
|
2522
2522
|
<krs-button
|
|
2523
2523
|
variant="outline"
|
|
@@ -2531,7 +2531,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2531
2531
|
Apply
|
|
2532
2532
|
</krs-button>
|
|
2533
2533
|
</div>
|
|
2534
|
-
`),
|
|
2534
|
+
`),N`
|
|
2535
2535
|
<div
|
|
2536
2536
|
class=${ye({"filter-panel":!0,"filter-panel--values":!e.filterable})}
|
|
2537
2537
|
style=${we({top:this._filterPanelPos.top+"px",left:this._filterPanelPos.left+"px"})}
|
|
@@ -2539,9 +2539,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2539
2539
|
${r}
|
|
2540
2540
|
${a}
|
|
2541
2541
|
</div>
|
|
2542
|
-
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable||e.options?.length))?
|
|
2542
|
+
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable||e.options?.length))?N`
|
|
2543
2543
|
<div class="filter-row">
|
|
2544
|
-
${e.map(((t,i)=>t.filterable||t.facetable||t.options?.length?
|
|
2544
|
+
${e.map(((t,i)=>t.filterable||t.facetable||t.options?.length?N`
|
|
2545
2545
|
<div
|
|
2546
2546
|
class=${ye({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
2547
2547
|
style=${we(this._getCellStyle(t,i))}
|
|
@@ -2553,7 +2553,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2553
2553
|
.value=${t.filter.kql}
|
|
2554
2554
|
@change=${e=>this._handleKqlChange(e,t)}
|
|
2555
2555
|
/>
|
|
2556
|
-
${t.filter?.kql?.length>0?
|
|
2556
|
+
${t.filter?.kql?.length>0?N`
|
|
2557
2557
|
<button
|
|
2558
2558
|
class="filter-cell__clear"
|
|
2559
2559
|
@click=${()=>this._handleKqlClear(t)}
|
|
@@ -2573,14 +2573,14 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2573
2573
|
</button>
|
|
2574
2574
|
</div>
|
|
2575
2575
|
</div>
|
|
2576
|
-
`:
|
|
2576
|
+
`:N`
|
|
2577
2577
|
<div
|
|
2578
2578
|
class=${ye({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
2579
2579
|
style=${we(this._getCellStyle(t,i))}
|
|
2580
2580
|
></div>
|
|
2581
2581
|
`))}
|
|
2582
2582
|
</div>
|
|
2583
|
-
`:U}_renderGrid(){return
|
|
2583
|
+
`:U}_renderGrid(){return N`
|
|
2584
2584
|
<div class="wrapper">
|
|
2585
2585
|
<div class="overlay-left"></div>
|
|
2586
2586
|
<div class="overlay-right"></div>
|
|
@@ -2588,7 +2588,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2588
2588
|
<div class="content" @scroll=${this._handleScroll}>
|
|
2589
2589
|
<div class="table" style=${we({"grid-template-columns":this.getDisplayedColumns().map(((e,t,i)=>{if("actions"===e.type)return"max-content";const s=!i.slice(t+1).some((e=>"actions"!==e.type));return e.width?s?`minmax(${e.width}, 1fr)`:e.width:"minmax(min-content, auto)"})).join(" ")})}>
|
|
2590
2590
|
<div class="header-row">
|
|
2591
|
-
${this.getDisplayedColumns().map(((e,t)=>
|
|
2591
|
+
${this.getDisplayedColumns().map(((e,t)=>N`
|
|
2592
2592
|
<div
|
|
2593
2593
|
class=${ye({"header-cell":!0,"header-cell--sortable":!!e.sortable,"header-cell--align-center":"center"===e.align,"header-cell--align-right":"right"===e.align,"header-cell--sticky-left":"left"===e.sticky,"header-cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some((e=>"left"===e.sticky)),"header-cell--sticky-right":"right"===e.sticky,"header-cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some((e=>"right"===e.sticky))})}
|
|
2594
2594
|
style=${we(this._getCellStyle(e,t))}
|
|
@@ -2596,7 +2596,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2596
2596
|
>
|
|
2597
2597
|
<span class="header-cell__label">${e.label??e.id}</span>
|
|
2598
2598
|
${this._renderSortIndicator(e)}
|
|
2599
|
-
${!1!==e.resizable?
|
|
2599
|
+
${!1!==e.resizable?N`<div
|
|
2600
2600
|
class="header-cell__resize"
|
|
2601
2601
|
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
2602
2602
|
></div>`:U}
|
|
@@ -2604,7 +2604,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2604
2604
|
`))}
|
|
2605
2605
|
</div>
|
|
2606
2606
|
${this._renderFilterRow()}
|
|
2607
|
-
${this._data.map(((e,t)=>{const i=this.getDisplayedColumns().map(((i,s)=>
|
|
2607
|
+
${this._data.map(((e,t)=>{const i=this.getDisplayedColumns().map(((i,s)=>N`
|
|
2608
2608
|
<div
|
|
2609
2609
|
class=${ye({cell:!0,"cell--actions":"actions"===i.type,"cell--align-center":"center"===i.align,"cell--align-right":"right"===i.align,"cell--sticky-left":"left"===i.sticky,"cell--sticky-left-last":"left"===i.sticky&&!this.getDisplayedColumns().slice(s+1).some((e=>"left"===e.sticky)),"cell--sticky-right":"right"===i.sticky,"cell--sticky-right-first":"right"===i.sticky&&!this.getDisplayedColumns().slice(0,s).some((e=>"right"===e.sticky))})}
|
|
2610
2610
|
style=${we(this._getCellStyle(i,s))}
|
|
@@ -2612,7 +2612,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2612
2612
|
>
|
|
2613
2613
|
${this._renderCellContent(i,e,t)}
|
|
2614
2614
|
</div>
|
|
2615
|
-
`));return this._model.rowHref?
|
|
2615
|
+
`));return this._model.rowHref?N`
|
|
2616
2616
|
<a
|
|
2617
2617
|
href=${this._model.rowHref(e)}
|
|
2618
2618
|
draggable="false"
|
|
@@ -2620,7 +2620,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2620
2620
|
@mousedown=${this._handleRowMouseDown}
|
|
2621
2621
|
@click=${i=>this._handleRowClick(i,e,t)}
|
|
2622
2622
|
>${i}</a>
|
|
2623
|
-
`:
|
|
2623
|
+
`:N`
|
|
2624
2624
|
<div
|
|
2625
2625
|
class=${ye({row:!0,"row--clickable":!!this._model.rowClickable})}
|
|
2626
2626
|
@mousedown=${this._handleRowMouseDown}
|
|
@@ -2630,12 +2630,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
2630
2630
|
</div>
|
|
2631
2631
|
</div>
|
|
2632
2632
|
</div>
|
|
2633
|
-
`}render(){return this._model.columns.length?
|
|
2633
|
+
`}render(){return this._model.columns.length?N`
|
|
2634
2634
|
${this._renderCardHeader()}
|
|
2635
2635
|
${this._renderHeader()}
|
|
2636
2636
|
${this._renderGrid()}
|
|
2637
2637
|
${this._renderFilterPanel()}
|
|
2638
|
-
`:
|
|
2638
|
+
`:N`<slot></slot>`}}Oi.styles=[Ut,a`
|
|
2639
2639
|
/* -------------------------------------------------------------------------
|
|
2640
2640
|
* Host
|
|
2641
2641
|
* ----------------------------------------------------------------------- */
|
|
@@ -3551,7 +3551,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3551
3551
|
height: auto;
|
|
3552
3552
|
}
|
|
3553
3553
|
|
|
3554
|
-
`],Di([ce({type:Object})],Oi.prototype,"def",void 0),Di([ce({type:String,reflect:!0})],Oi.prototype,"variant",void 0),Di([pe()],Oi.prototype,"_data",void 0),Di([pe()],Oi.prototype,"_dataState",void 0),Di([pe()],Oi.prototype,"_page",void 0),Di([pe()],Oi.prototype,"_pageSize",void 0),Di([pe()],Oi.prototype,"_totalItems",void 0),Di([pe()],Oi.prototype,"_totalPages",void 0),Di([pe()],Oi.prototype,"_searchQuery",void 0),Di([pe()],Oi.prototype,"_canScrollLeft",void 0),Di([pe()],Oi.prototype,"_canScrollRight",void 0),Di([pe()],Oi.prototype,"_canScrollHorizontal",void 0),Di([pe()],Oi.prototype,"_columnPickerOpen",void 0),Di([pe()],Oi.prototype,"_filterPanelOpened",void 0),Di([pe()],Oi.prototype,"_filterPanelTab",void 0),Di([pe()],Oi.prototype,"_buckets",void 0),Di([pe()],Oi.prototype,"_sorts",void 0),customElements.get("krs-table")||customElements.define("krs-table",Oi);var Ai=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class
|
|
3554
|
+
`],Di([ce({type:Object})],Oi.prototype,"def",void 0),Di([ce({type:String,reflect:!0})],Oi.prototype,"variant",void 0),Di([pe()],Oi.prototype,"_data",void 0),Di([pe()],Oi.prototype,"_dataState",void 0),Di([pe()],Oi.prototype,"_page",void 0),Di([pe()],Oi.prototype,"_pageSize",void 0),Di([pe()],Oi.prototype,"_totalItems",void 0),Di([pe()],Oi.prototype,"_totalPages",void 0),Di([pe()],Oi.prototype,"_searchQuery",void 0),Di([pe()],Oi.prototype,"_canScrollLeft",void 0),Di([pe()],Oi.prototype,"_canScrollRight",void 0),Di([pe()],Oi.prototype,"_canScrollHorizontal",void 0),Di([pe()],Oi.prototype,"_columnPickerOpen",void 0),Di([pe()],Oi.prototype,"_filterPanelOpened",void 0),Di([pe()],Oi.prototype,"_filterPanelTab",void 0),Di([pe()],Oi.prototype,"_buckets",void 0),Di([pe()],Oi.prototype,"_sorts",void 0),customElements.get("krs-table")||customElements.define("krs-table",Oi);var Ai=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Mi extends ne{static fromJSON(e){const t=new Mi;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.checked&&(t.checked=e.checked),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.required&&(t.required=e.required),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyChecked=!1,this.label="",this.name="",this.value="on",this.checked=!1,this.disabled=!1,this.required=!1,this.hint="",this.dirty=!1,this.saving=!1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._syncFormValue(),this._updateValidity()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("checked")&&this.dirty&&this.checked!==this._dirtyChecked&&"autosave"===t&&(this.checked=this._dirtyChecked)}updated(e){(e.has("checked")||e.has("value"))&&this._syncFormValue(),(e.has("required")||e.has("checked"))&&this._updateValidity()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.checked=!1,this._touched=!1,this.dirty=!1,this.saving=!1,this._internals.setFormValue(""),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyChecked=this.checked}formStateRestoreCallback(e){this.checked=e===this.value}focus(){this.shadowRoot?.querySelector(".checkbox")?.focus()}blur(){this.shadowRoot?.querySelector(".checkbox")?.blur()}_syncFormValue(){this.checked?this._internals.setFormValue(this.value):this._internals.setFormValue("")}_updateValidity(){this.required&&!this.checked?this._internals.setValidity({valueMissing:!0},"This field is required"):this._internals.setValidity({})}_handleClick(e){this.disabled||(this.checked=!this.checked,this._touched=!0,this.dirty=!0,this._dirtyChecked=this.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleKeyDown(e){this.disabled||" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),this._handleClick(e))}render(){return N`
|
|
3555
3555
|
<div class="wrapper">
|
|
3556
3556
|
<div
|
|
3557
3557
|
class=${ye({checkbox:!0,"checkbox--disabled":this.disabled})}
|
|
@@ -3578,16 +3578,16 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3578
3578
|
<polyline points="20 6 9 17 4 12"></polyline>
|
|
3579
3579
|
</svg>
|
|
3580
3580
|
</div>
|
|
3581
|
-
${this.label?
|
|
3581
|
+
${this.label?N`
|
|
3582
3582
|
<span class="checkbox__label">
|
|
3583
3583
|
${this.label}
|
|
3584
|
-
${this.required?
|
|
3584
|
+
${this.required?N`<span class="required" aria-hidden="true">*</span>`:U}
|
|
3585
3585
|
</span>
|
|
3586
3586
|
`:U}
|
|
3587
3587
|
</div>
|
|
3588
|
-
${this._touched&&this.required&&!this.checked?
|
|
3588
|
+
${this._touched&&this.required&&!this.checked?N`<div class="validation-message">This field is required</div>`:this.hint?N`<div class="hint">${this.hint}</div>`:U}
|
|
3589
3589
|
</div>
|
|
3590
|
-
`}}
|
|
3590
|
+
`}}Mi.styles=[Ut,a`
|
|
3591
3591
|
:host {
|
|
3592
3592
|
display: inline-block;
|
|
3593
3593
|
font-family: inherit;
|
|
@@ -3670,7 +3670,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3670
3670
|
color: var(--kr-checkbox-error-color, #ef4444);
|
|
3671
3671
|
margin-left: 26px;
|
|
3672
3672
|
}
|
|
3673
|
-
`],Ii.formAssociated=!0,Ai([ce({type:String})],Ii.prototype,"label",void 0),Ai([ce({type:String})],Ii.prototype,"name",void 0),Ai([ce({type:String})],Ii.prototype,"value",void 0),Ai([ce({type:Boolean})],Ii.prototype,"checked",void 0),Ai([ce({type:Boolean})],Ii.prototype,"disabled",void 0),Ai([ce({type:Boolean})],Ii.prototype,"required",void 0),Ai([ce({type:String})],Ii.prototype,"hint",void 0),Ai([ce({type:Boolean,reflect:!0})],Ii.prototype,"dirty",void 0),Ai([ce({attribute:"save-mode"})],Ii.prototype,"saveMode",void 0),Ai([ce({type:Boolean,reflect:!0})],Ii.prototype,"saving",void 0),Ai([pe()],Ii.prototype,"_touched",void 0),customElements.get("krs-checkbox")||customElements.define("krs-checkbox",Ii);var Mi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Ri{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null,this.rowSelectable=!1,this.rowKey=null}}class Pi extends ne{constructor(){super(...arguments),this._scrollStyle="edge",this._filterPanelPos={top:0,left:0},this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new Ri,this._selectedRows=new Set,this.def={columns:[]},this.variant="default",this.scrollMode="contain",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._sorts=[],this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new Ri,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this.def.rowKey&&(this._model.rowKey=this.def.rowKey),this.def.rowSelectable&&this.def.rowKey&&(this._model.rowSelectable=!0),this._selectedRows.clear(),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new zi,t.filter.field=e.searchField??e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this.classList.toggle("kr-table--page","page"===this.variant),this.classList.toggle("kr-table--dialog","dialog"===this.variant),this.classList.toggle("kr-table--scroll-auto","auto"===this.scrollMode&&"page"!==this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell:not(.header-cell--select)");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:re(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}getSelectedRows(){return this._model.rowSelectable?this._data.filter((e=>this._selectedRows.has(this._model.rowKey(e)))):[]}clearSelection(){this._selectedRows.clear(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:[]},bubbles:!0,composed:!0}))}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:wi(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_toOpensearchParams(){const e={from:(this._page-1)*this._pageSize,size:this._pageSize,sort:this._sorts.map((e=>({[this._model.columns.find((t=>t.id===e.sortBy))?.searchField??e.sortBy]:e.sortDirection}))),query:{bool:{must:[],filter:[]}}};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.query.bool.filter.push(t.filter.toOpensearchData());const t=this._searchQuery?.trim().replace(/([*?\\])/g,"\\$1");return t?e.query.bool.must.push({bool:{should:this._model.columns.filter((e=>e.searchable)).map((e=>({wildcard:{[e.searchField??e.id]:{value:`*${t}*`,case_insensitive:!0}}}))),minimum_should_match:1}}):e.query.bool.must.push({match_all:{}}),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():"opensearch"===this._model.dataSource.mode?this._toOpensearchParams():"array"===this._model.dataSource.mode?void 0:this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"array":this._data=e,this._totalItems=e.length,this._totalPages=1,this._pageSize=e.length;break;case"opensearch":this._data=(e?.data?.hits?.hits||[]).map((e=>e._source)),this._totalItems=e?.data?.hits?.total?.value??0,this._totalPages=Math.ceil(this._totalItems/this._pageSize)||1;break;case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error";let t="Failed to load data";e instanceof Error&&(t=e.message),hi.show({message:t,type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant||"dialog"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_handleColumnPickerClick(){this._columnPickerOpen=!this._columnPickerOpen}_handleColumnToggle(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}_handleSelectCellClick(e){e.stopPropagation(),e.preventDefault()}_handleRowSelectToggle(e,t){const i=this._model.rowKey(t);this._selectedRows.has(i)?this._selectedRows.delete(i):this._selectedRows.add(i),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:this.getSelectedRows()},bubbles:!0,composed:!0}))}_handleSelectAllToggle(){this._data.every((e=>this._selectedRows.has(this._model.rowKey(e))))?this._data.forEach((e=>this._selectedRows.delete(this._model.rowKey(e)))):this._data.forEach((e=>this._selectedRows.add(this._model.rowKey(e)))),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:this.getSelectedRows()},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return U;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return j`
|
|
3673
|
+
`],Mi.formAssociated=!0,Ai([ce({type:String})],Mi.prototype,"label",void 0),Ai([ce({type:String})],Mi.prototype,"name",void 0),Ai([ce({type:String})],Mi.prototype,"value",void 0),Ai([ce({type:Boolean})],Mi.prototype,"checked",void 0),Ai([ce({type:Boolean})],Mi.prototype,"disabled",void 0),Ai([ce({type:Boolean})],Mi.prototype,"required",void 0),Ai([ce({type:String})],Mi.prototype,"hint",void 0),Ai([ce({type:Boolean,reflect:!0})],Mi.prototype,"dirty",void 0),Ai([ce({attribute:"save-mode"})],Mi.prototype,"saveMode",void 0),Ai([ce({type:Boolean,reflect:!0})],Mi.prototype,"saving",void 0),Ai([pe()],Mi.prototype,"_touched",void 0),customElements.get("krs-checkbox")||customElements.define("krs-checkbox",Mi);var Ii=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Ri{constructor(){this.title="",this.description="",this.actions=[],this.columns=[],this.displayedColumns=[],this.data=null,this.dataSource=null,this.refreshInterval=0,this.pageSize=0,this.rowClickable=!1,this.rowHref=null,this.rowSelectable=!1,this.rowKey=null}}class Pi extends ne{constructor(){super(...arguments),this._scrollStyle="edge",this._filterPanelPos={top:0,left:0},this._resizing=null,this._resizeObserver=null,this._searchPositionLocked=!1,this._columnWidthsLocked=!1,this._model=new Ri,this._selectedRows=new Set,this.def={columns:[]},this.variant="default",this.scrollMode="contain",this._data=[],this._dataState="idle",this._page=1,this._pageSize=50,this._totalItems=0,this._totalPages=0,this._searchQuery="",this._canScrollLeft=!1,this._canScrollRight=!1,this._canScrollHorizontal=!1,this._columnPickerOpen=!1,this._filterPanelOpened=null,this._filterPanelTab="filter",this._buckets=new Map,this._sorts=[],this._handleClickOutside=e=>{const t=e.composedPath();if(this._columnPickerOpen){const e=this.shadowRoot?.querySelector(".column-picker-wrapper");e&&!t.includes(e)&&(this._columnPickerOpen=!1)}this._filterPanelOpened&&(t.some((e=>e.classList?.contains("filter-panel")))||this._handleFilterApply())},this._handleResizeMove=e=>{if(!this._resizing)return;const t=this._model.columns.find((e=>e.id===this._resizing.columnId));if(t){const i=this._resizing.startWidth+(e.clientX-this._resizing.startX);t.width=`${Math.min(900,Math.max(50,i))}px`,this.requestUpdate()}},this._handleResizeEnd=()=>{this._resizing=null,document.removeEventListener("mousemove",this._handleResizeMove),document.removeEventListener("mouseup",this._handleResizeEnd)}}connectedCallback(){super.connectedCallback(),this.classList.toggle("kr-table--scroll-overlay","overlay"===this._scrollStyle),this.classList.toggle("kr-table--scroll-edge","edge"===this._scrollStyle),this._fetch(),this._initRefresh(),document.addEventListener("click",this._handleClickOutside),this._resizeObserver=new ResizeObserver((()=>{this._searchPositionLocked=!1,this._updateSearchPosition()})),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._refreshTimer),document.removeEventListener("click",this._handleClickOutside),this._resizeObserver?.disconnect()}willUpdate(e){e.has("def")&&(this._columnWidthsLocked=!1,this._model=new Ri,this.def.title&&(this._model.title=this.def.title),this.def.description&&(this._model.description=this.def.description),this.def.actions&&(this._model.actions=this.def.actions),this.def.data&&(this._model.data=this.def.data),this.def.dataSource&&(this._model.dataSource=this.def.dataSource),"number"==typeof this.def.refreshInterval&&(this._model.refreshInterval=this.def.refreshInterval),"number"==typeof this.def.pageSize&&(this._model.pageSize=this.def.pageSize,this._pageSize=this.def.pageSize),this.def.rowClickable&&(this._model.rowClickable=this.def.rowClickable),this.def.rowHref&&(this._model.rowHref=this.def.rowHref),this.def.rowKey&&(this._model.rowKey=this.def.rowKey),this.def.rowSelectable&&this.def.rowKey&&(this._model.rowSelectable=!0),this._selectedRows.clear(),this._sorts=[],this._model.columns=this.def.columns.map((e=>{const t={...e,filter:null};return t.type||(t.type="string"),e.sort&&this._sorts.push({sortBy:e.id,sortDirection:e.sort}),"actions"===t.type?(t.label=e.label??"",t.sticky="right",t.resizable=!1,t):((e.filterable||e.facetable)&&(t.filter=new zi,t.filter.field=e.searchField??e.id,t.filter.type=t.type,e.filter?(t.filter.setOperator(e.filter.operator),t.filter.setValue(e.filter.value)):e.facetable&&!e.filterable?(t.filter.operator="in",t.filter.value=[]):"string"===t.filter.type&&(t.filter.operator="contains")),t)})),this.def.displayedColumns?this._model.displayedColumns=this.def.displayedColumns:this._model.displayedColumns=this._model.columns.map((e=>e.id)),this._fetch(),this._initRefresh())}updated(e){this.classList.toggle("kr-table--card","card"===this.variant),this.classList.toggle("kr-table--page","page"===this.variant),this.classList.toggle("kr-table--dialog","dialog"===this.variant),this.classList.toggle("kr-table--scroll-auto","auto"===this.scrollMode&&"page"!==this.variant),this._updateScrollFlags(),this._syncSlottedContent(),this._lockColumnWidths()}_lockColumnWidths(){if(this._columnWidthsLocked||0===this._data.length)return;const e=this.shadowRoot?.querySelectorAll(".header-row > .header-cell:not(.header-cell--select)");if(!e)return;const t=this.getDisplayedColumns();e.forEach(((e,i)=>{const s=e.offsetWidth;i<t.length&&!t[i].width&&"actions"!==t[i].type&&s>0&&(t[i].width=`${s}px`,this._columnWidthsLocked=!0)}))}_syncSlottedContent(){const e=this.getDisplayedColumns().filter((e=>e.render));e.length&&(this.querySelectorAll('[slot^="cell-"]').forEach((e=>e.remove())),this._data.forEach(((t,i)=>{e.forEach((e=>{const s=e.render(t);if(!s)return;const o=document.createElement("span");o.slot=`cell-${i}-${e.id}`,"actions"===e.type&&(o.style.display="flex",o.style.gap="8px"),"string"==typeof s?o.innerHTML=s:re(s,o),this.appendChild(o)}))})))}refresh(){this._fetch()}goToPrevPage(){this._page>1&&(this._page--,this._fetch())}goToNextPage(){this._page<this._totalPages&&(this._page++,this._fetch())}goToPage(e){e>=1&&e<=this._totalPages&&(this._page=e,this._fetch())}getSelectedRows(){return this._model.rowSelectable?this._data.filter((e=>this._selectedRows.has(this._model.rowKey(e)))):[]}clearSelection(){this._selectedRows.clear(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:[]},bubbles:!0,composed:!0}))}_toSolrData(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns){if(!t.filter||t.filter.isEmpty()||!t.filter.isValid())continue;const i=t.filter.toSolrData();!t.facetable||"in"!==t.filter.operator&&"n_in"!==t.filter.operator||(i.tagged=!0),e.filterFields.push(i)}for(const t of this._model.columns)t.facetable&&e.facetFields.push({name:t.id,type:"FIELD",limit:100,sort:"count",minimumCount:1});return this._searchQuery?.trim().length&&e.queryFields.push({name:"_text_",operation:"IS",value:wi(this._searchQuery,!1)}),e}_toDbParams(){const e={page:this._page-1,size:this._pageSize,sorts:this._sorts,filterFields:[],queryFields:[],facetFields:[]};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.filterFields.push(t.filter.toDbParams());return this._searchQuery?.trim().length&&this._model.columns.filter((e=>e.searchable)).forEach((t=>{e.queryFields.push({name:t.id,operation:"CONTAINS",value:this._searchQuery,and:!1})})),e}_toOpensearchParams(){const e={from:(this._page-1)*this._pageSize,size:this._pageSize,sort:this._sorts.map((e=>({[this._model.columns.find((t=>t.id===e.sortBy))?.searchField??e.sortBy]:e.sortDirection}))),query:{bool:{must:[],filter:[]}}};for(const t of this._model.columns)t.filter&&!t.filter.isEmpty()&&t.filter.isValid()&&e.query.bool.filter.push(t.filter.toOpensearchData());const t=this._searchQuery?.trim().replace(/([*?\\])/g,"\\$1");return t?e.query.bool.must.push({bool:{should:this._model.columns.filter((e=>e.searchable)).map((e=>({wildcard:{[e.searchField??e.id]:{value:`*${t}*`,case_insensitive:!0}}}))),minimum_should_match:1}}):e.query.bool.must.push({match_all:{}}),e}_fetch(){if(this._model.data)return this._data=this._model.data,this._totalItems=this._model.data.length,this._totalPages=Math.ceil(this._model.data.length/this._pageSize),void(this._dataState="success");if(!this._model.dataSource)return;let e;this._dataState="loading",e="db"===this._model.dataSource.mode?this._toDbParams():"opensearch"===this._model.dataSource.mode?this._toOpensearchParams():"array"===this._model.dataSource.mode?void 0:this._toSolrData(),this._model.dataSource.fetch(e).then((e=>{switch(this._model.dataSource?.mode){case"array":this._data=e,this._totalItems=e.length,this._totalPages=1,this._pageSize=e.length;break;case"opensearch":this._data=(e?.data?.hits?.hits||[]).map((e=>e._source)),this._totalItems=e?.data?.hits?.total?.value??0,this._totalPages=Math.ceil(this._totalItems/this._pageSize)||1;break;case"db":{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size;break}default:{const t=e;this._data=t.data.content,this._totalItems=t.data.totalElements,this._totalPages=t.data.totalPages,this._pageSize=t.data.size,this._parseFacetResults(t)}}this._dataState="success",this._updateSearchPosition()})).catch((e=>{this._dataState="error";let t="Failed to load data";e instanceof Error&&(t=e.message),hi.show({message:t,type:"error"})}))}_parseFacetResults(e){if(e.data.facetFields){for(const t of this._model.columns){if(!t.facetable)continue;const i=e.data.facetFields[t.id];if(!i){this._buckets.set(t.id,[]);continue}const s=[];for(const e of i){let i=e.name;"boolean"===t.type&&"string"==typeof e.name&&("true"===e.name?i=!0:"false"===e.name&&(i=!1)),null===e.name&&e.count>0&&s.unshift({val:null,count:e.count}),null!==e.name&&s.push({val:i,count:e.count})}if(t.filter&&("in"===t.filter.operator||"n_in"===t.filter.operator)&&Array.isArray(t.filter.value))for(const e of t.filter.value)s.some((t=>t.val===e))||s.push({val:e,count:0});this._buckets.set(t.id,s)}this._buckets=new Map(this._buckets)}}_initRefresh(){clearInterval(this._refreshTimer),this._model.refreshInterval&&this._model.refreshInterval>0&&(this._refreshTimer=window.setInterval((()=>{this._fetch()}),this._model.refreshInterval))}_handleSearch(e){const t=e.target;this._searchQuery=t.value,this._page=1,this._fetch()}_updateSearchPosition(){if(this._searchPositionLocked)return;if("card"===this.variant||"dialog"===this.variant)return;const e=this.shadowRoot?.querySelector(".search"),t=e?.querySelector(".search-field");e&&t&&(e.style.justifyContent="center",t.style.marginLeft="",requestAnimationFrame((()=>{const i=e.getBoundingClientRect(),s=t.getBoundingClientRect().left-i.left;e.style.justifyContent="flex-start",t.style.marginLeft=`${s}px`,this._searchPositionLocked=!0})))}_handleColumnPickerClick(){this._columnPickerOpen=!this._columnPickerOpen}_handleColumnToggle(e){this._model.displayedColumns.includes(e)?this._model.displayedColumns=this._model.displayedColumns.filter((t=>t!==e)):this._model.displayedColumns=[...this._model.displayedColumns,e],this.requestUpdate()}_handleRowMouseDown(){(this._model.rowClickable||this._model.rowHref)&&window.getSelection()?.removeAllRanges()}_handleRowClick(e,t,i){if(!this._model.rowClickable&&!this._model.rowHref)return;const s=window.getSelection();s&&s.toString().length>0?e.preventDefault():this.dispatchEvent(new CustomEvent("row-click",{detail:{row:t,rowIndex:i},bubbles:!0,composed:!0}))}_handleSelectCellClick(e){e.stopPropagation(),e.preventDefault()}_handleRowSelectToggle(e,t){const i=this._model.rowKey(t);this._selectedRows.has(i)?this._selectedRows.delete(i):this._selectedRows.add(i),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:this.getSelectedRows()},bubbles:!0,composed:!0}))}_handleSelectAllToggle(){this._data.every((e=>this._selectedRows.has(this._model.rowKey(e))))?this._data.forEach((e=>this._selectedRows.delete(this._model.rowKey(e)))):this._data.forEach((e=>this._selectedRows.add(this._model.rowKey(e)))),this.requestUpdate(),this.dispatchEvent(new CustomEvent("selection-change",{detail:{rows:this.getSelectedRows()},bubbles:!0,composed:!0}))}getDisplayedColumns(){return this._model.displayedColumns.map((e=>this._model.columns.find((t=>t.id===e)))).sort(((e,t)=>"actions"===e.type&&"actions"!==t.type?1:"actions"!==e.type&&"actions"===t.type?-1:0))}_handleScroll(e){const t=e.target;this._canScrollLeft=t.scrollLeft>0,this._canScrollRight=t.scrollLeft<t.scrollWidth-t.clientWidth-1}_updateScrollFlags(){const e=this.shadowRoot?.querySelector(".content");e&&(this._canScrollLeft=e.scrollLeft>0,this._canScrollRight=e.scrollWidth>e.clientWidth&&e.scrollLeft<e.scrollWidth-e.clientWidth-1,this._canScrollHorizontal=e.scrollWidth>e.clientWidth),this.classList.toggle("kr-table--scroll-left-available",this._canScrollLeft),this.classList.toggle("kr-table--scroll-right-available",this._canScrollRight),this.classList.toggle("kr-table--scroll-horizontal-available",this._canScrollHorizontal),this.classList.toggle("kr-table--sticky-left",this.getDisplayedColumns().some((e=>"left"===e.sticky))),this.classList.toggle("kr-table--sticky-right",this.getDisplayedColumns().some((e=>"right"===e.sticky)))}_handleResizeStart(e,t){e.preventDefault();const i=this.shadowRoot?.querySelector(`.header-cell[data-column-id="${t}"]`);this._resizing={columnId:t,startX:e.clientX,startWidth:i?.offsetWidth||200},document.addEventListener("mousemove",this._handleResizeMove),document.addEventListener("mouseup",this._handleResizeEnd)}_handleSortClick(e,t){if(e.shiftKey){const e=this._sorts.findIndex((e=>e.sortBy===t.id));if(-1===e)this._sorts.push({sortBy:t.id,sortDirection:"asc"});else{const t=this._sorts[e];"asc"===t.sortDirection?t.sortDirection="desc":this._sorts.splice(e,1)}this.requestUpdate()}else{let e=null;1===this._sorts.length&&(e=this._sorts.find((e=>e.sortBy===t.id))),e?"asc"===e.sortDirection?this._sorts=[{sortBy:t.id,sortDirection:"desc"}]:this._sorts=[]:this._sorts=[{sortBy:t.id,sortDirection:"asc"}]}this._page=1,this._fetch()}_renderSortIndicator(e){if(!e.sortable)return U;const t=this._sorts.findIndex((t=>t.sortBy===e.id));if(-1===t)return N`
|
|
3674
3674
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
3675
3675
|
<svg
|
|
3676
3676
|
class="header-cell__sort-arrow header-cell__sort-arrow--ghost"
|
|
@@ -3680,7 +3680,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3680
3680
|
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
3681
3681
|
</svg>
|
|
3682
3682
|
</span>
|
|
3683
|
-
`;let i={};return"desc"===this._sorts[t].sortDirection&&(i={transform:"rotate(180deg)"}),
|
|
3683
|
+
`;let i={};return"desc"===this._sorts[t].sortDirection&&(i={transform:"rotate(180deg)"}),N`
|
|
3684
3684
|
<span class="header-cell__sort" @click=${t=>this._handleSortClick(t,e)}>
|
|
3685
3685
|
<svg
|
|
3686
3686
|
class="header-cell__sort-arrow"
|
|
@@ -3690,11 +3690,11 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3690
3690
|
>
|
|
3691
3691
|
<path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
|
|
3692
3692
|
</svg>
|
|
3693
|
-
${this._sorts.length>1?
|
|
3693
|
+
${this._sorts.length>1?N`
|
|
3694
3694
|
<span class="header-cell__sort-priority">${t+1}</span>
|
|
3695
3695
|
`:U}
|
|
3696
3696
|
</span>
|
|
3697
|
-
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}showActionLoading(){this.shadowRoot?.querySelector(".actions")?.showLoading()}showActionSuccess(e="Done"){this.shadowRoot?.querySelector(".actions")?.showSuccess(e)}showActionError(e="Failed"){this.shadowRoot?.querySelector(".actions")?.showError(e)}resetAction(){this.shadowRoot?.querySelector(".actions")?.reset()}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let s=i.left;s+328>window.innerWidth&&(s=window.innerWidth-328),this._filterPanelPos={top:i.bottom+4,left:s},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const s=t[e.id];if(e.render)return
|
|
3697
|
+
`}_handleAction(e){e.href||this.dispatchEvent(new CustomEvent("action",{detail:{action:e.id},bubbles:!0,composed:!0}))}showActionLoading(){this.shadowRoot?.querySelector(".actions")?.showLoading()}showActionSuccess(e="Done"){this.shadowRoot?.querySelector(".actions")?.showSuccess(e)}showActionError(e="Failed"){this.shadowRoot?.querySelector(".actions")?.showError(e)}resetAction(){this.shadowRoot?.querySelector(".actions")?.reset()}_handleKqlChange(e,t){const i=e.target.value.trim();if(i){if(t.filter.setKql(i),this.requestUpdate(),!t.filter.isValid())return}else t.filter.clear(),this.requestUpdate();this._page=1,this._fetch()}_handleFilterPanelToggle(e,t){if(e.stopPropagation(),this._filterPanelOpened===t.id)this._filterPanelOpened=null;else{const i=e.currentTarget.getBoundingClientRect();let s=i.left;s+328>window.innerWidth&&(s=window.innerWidth-328),this._filterPanelPos={top:i.bottom+4,left:s},this._filterPanelOpened=t.id,t.facetable?this._filterPanelTab="counts":this._filterPanelTab="filter"}}_handleKqlClear(e){e.filter.clear(),this._page=1,this._fetch()}_handleFilterClear(){const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));e&&(e.filter.clear(),e.facetable&&!e.filterable&&(e.filter.operator="in",e.filter.value=[])),this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterTextKeydown(e,t){"Enter"===e.key&&(e.preventDefault(),this._handleFilterApply())}_handleOperatorChange(e,t){t.filter.setOperator(e.target.value),this.requestUpdate()}_handleFilterStringChange(e,t){t.filter.setValue(e.target.value),this.requestUpdate()}_handleFilterNumberChange(e,t){t.filter.setValue(Number(e.target.value)),this.requestUpdate()}_handleFilterDateChange(e,t){t.filter.setValue(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterBooleanChange(e,t){t.filter.setValue("true"===e.target.value),this.requestUpdate()}_handleFilterDateStartChange(e,t){t.filter.setStart(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterDateEndChange(e,t){t.filter.setEnd(new Date(e.target.value),"day"),this.requestUpdate()}_handleFilterNumberStartChange(e,t){t.filter.setStart(Number(e.target.value)),this.requestUpdate()}_handleFilterNumberEndChange(e,t){t.filter.setEnd(Number(e.target.value)),this.requestUpdate()}_handleFilterListChange(e,t){const i=e.target.value.split(",").map((e=>e.trim())).filter((e=>""!==e));"number"===t.type?t.filter.setValue(i.map((e=>Number(e)))):t.filter.setValue(i),this.requestUpdate()}_handleFilterApply(){this._filterPanelOpened=null,this._page=1,this._fetch()}_handleFilterPanelTabChange(e){this._filterPanelTab=e.detail.activeTabId}_handleBucketToggle(e,t,i){t.filter.toggle(i.val),this._page=1,this._fetch()}_renderCellContent(e,t,i){const s=t[e.id];if(e.render)return N`<slot name="cell-${i}-${e.id}"></slot>`;if(null==s)return"";switch(e.type){case"number":return"currency"===e.format&&"number"==typeof s?s.toLocaleString("en-US",{style:"currency",currency:"USD"}):String(s);case"date":{let e;if(s instanceof Date)e=s;else if("string"==typeof s&&/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(s)){const t=s.replace(/(\d{2}:\d{2}:\d{2}):(\d+)$/,"$1.$2").replace(" ","T")+"Z";e=new Date(t)}else e=new Date(s);return e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}case"boolean":return!0===s?"Yes":!1===s?"No":"";default:return String(s)}}_getCellStyle(e,t){const i={};if("left"===e.sticky){let e=0;this._model.rowSelectable&&(e+=54);for(let i=0;i<t;i++){const t=this.getDisplayedColumns()[i];"left"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.left=`${e}px`}if("right"===e.sticky){let e=0;for(let i=t+1;i<this.getDisplayedColumns().length;i++){const t=this.getDisplayedColumns()[i];"right"===t.sticky&&(e+=parseInt(t.width||"0",10))}i.right=`${e}px`}return i}_renderPagination(){const e=(this._page-1)*this._pageSize+1,t=Math.min(this._page*this._pageSize,this._totalItems);return N`
|
|
3698
3698
|
<div class="pagination">
|
|
3699
3699
|
<span
|
|
3700
3700
|
class=${ye({"pagination-icon":!0,"pagination-icon--disabled":1===this._page})}
|
|
@@ -3714,28 +3714,28 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3714
3714
|
</svg>
|
|
3715
3715
|
</span>
|
|
3716
3716
|
</div>
|
|
3717
|
-
`}_renderCardHeader(){return"card"!==this.variant?U:this._model.title||this._model.description?
|
|
3717
|
+
`}_renderCardHeader(){return"card"!==this.variant?U:this._model.title||this._model.description?N`
|
|
3718
3718
|
<div class="card-header">
|
|
3719
|
-
${this._model.title?
|
|
3719
|
+
${this._model.title?N`
|
|
3720
3720
|
<h2 class="card-header__title">
|
|
3721
3721
|
${this._model.title}
|
|
3722
3722
|
</h2>
|
|
3723
3723
|
`:U}
|
|
3724
|
-
${this._model.description?
|
|
3724
|
+
${this._model.description?N`
|
|
3725
3725
|
<p class="card-header__description">
|
|
3726
3726
|
${this._model.description}
|
|
3727
3727
|
</p>
|
|
3728
3728
|
`:U}
|
|
3729
3729
|
</div>
|
|
3730
|
-
`:U}_renderHeader(){if("dialog"!==this.variant&&!this._model.title&&!this._model.actions?.length&&this._totalPages<=1)return U;let e=!0;return"array"===this._model.dataSource?.mode?e=!1:"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))||(e=!1),
|
|
3730
|
+
`:U}_renderHeader(){if("dialog"!==this.variant&&!this._model.title&&!this._model.actions?.length&&this._totalPages<=1)return U;let e=!0;return"array"===this._model.dataSource?.mode?e=!1:"db"!==this._model.dataSource?.mode||this._model.columns.some((e=>e.searchable))||(e=!1),N`
|
|
3731
3731
|
<div class="header">
|
|
3732
|
-
${this._model.title&&"card"!==this.variant&&"dialog"!==this.variant?
|
|
3732
|
+
${this._model.title&&"card"!==this.variant&&"dialog"!==this.variant?N`
|
|
3733
3733
|
<div class="title">
|
|
3734
3734
|
${this._model.title}
|
|
3735
3735
|
</div>
|
|
3736
3736
|
`:U}
|
|
3737
3737
|
${this._renderPagination()}
|
|
3738
|
-
${e?
|
|
3738
|
+
${e?N`
|
|
3739
3739
|
<div class="search">
|
|
3740
3740
|
<!-- TODO: Saved views dropdown
|
|
3741
3741
|
<div class="views">
|
|
@@ -3762,7 +3762,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3762
3762
|
/>
|
|
3763
3763
|
</div>
|
|
3764
3764
|
</div>
|
|
3765
|
-
`:
|
|
3765
|
+
`:N`<div class="search"></div>`}
|
|
3766
3766
|
<div class="tools">
|
|
3767
3767
|
<span
|
|
3768
3768
|
class="refresh"
|
|
@@ -3784,7 +3784,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3784
3784
|
</svg>
|
|
3785
3785
|
</span>
|
|
3786
3786
|
<div class=${ye({"column-picker":!0,open:this._columnPickerOpen})}>
|
|
3787
|
-
${[...this._model.columns].filter((e=>"actions"!==e.type)).sort(((e,t)=>(e.label??e.id).localeCompare(t.label??t.id))).map((e=>
|
|
3787
|
+
${[...this._model.columns].filter((e=>"actions"!==e.type)).sort(((e,t)=>(e.label??e.id).localeCompare(t.label??t.id))).map((e=>N`
|
|
3788
3788
|
<div class="column-picker-item" @click=${()=>this._handleColumnToggle(e.id)}>
|
|
3789
3789
|
<div class=${ye({"column-picker-checkbox":!0,checked:this._model.displayedColumns.includes(e.id)})}>
|
|
3790
3790
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
@@ -3796,7 +3796,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3796
3796
|
`))}
|
|
3797
3797
|
</div>
|
|
3798
3798
|
</div>
|
|
3799
|
-
${1===this._model.actions?.length?
|
|
3799
|
+
${1===this._model.actions?.length?N`
|
|
3800
3800
|
<krs-button
|
|
3801
3801
|
class="actions"
|
|
3802
3802
|
.href=${this._model.actions[0].href}
|
|
@@ -3805,7 +3805,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3805
3805
|
>
|
|
3806
3806
|
${this._model.actions[0].label}
|
|
3807
3807
|
</krs-button>
|
|
3808
|
-
`:this._model.actions?.length?
|
|
3808
|
+
`:this._model.actions?.length?N`
|
|
3809
3809
|
<krs-button
|
|
3810
3810
|
class="actions"
|
|
3811
3811
|
.options=${this._model.actions.map((e=>({id:e.id,label:e.label,href:e.href,hrefTarget:e.target})))}
|
|
@@ -3816,14 +3816,14 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3816
3816
|
`:U}
|
|
3817
3817
|
</div>
|
|
3818
3818
|
</div>
|
|
3819
|
-
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?
|
|
3819
|
+
`}_renderStatus(){return"loading"===this._dataState&&0===this._data.length?N`<div class="status">Loading...</div>`:"error"===this._dataState&&0===this._data.length?N`<div class="status status--error">Error loading data</div>`:0===this._data.length?N`<div class="status">No data available</div>`:U}_renderFilterPanel(){if(!this._filterPanelOpened)return U;const e=this._model.columns.find((e=>e.id===this._filterPanelOpened));let t=N``;t="empty"===e.filter.operator||"n_empty"===e.filter.operator?N`
|
|
3820
3820
|
<input
|
|
3821
3821
|
type="text"
|
|
3822
3822
|
class="filter-panel__input"
|
|
3823
3823
|
disabled
|
|
3824
3824
|
.value=${e.filter.text}
|
|
3825
3825
|
/>
|
|
3826
|
-
`:"between"===e.filter.operator&&"date"===e.type?
|
|
3826
|
+
`:"between"===e.filter.operator&&"date"===e.type?N`
|
|
3827
3827
|
<input
|
|
3828
3828
|
type="date"
|
|
3829
3829
|
class="filter-panel__input"
|
|
@@ -3836,7 +3836,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3836
3836
|
.valueAsDate=${e.filter.value?.end??null}
|
|
3837
3837
|
@change=${t=>this._handleFilterDateEndChange(t,e)}
|
|
3838
3838
|
/>
|
|
3839
|
-
`:"between"===e.filter.operator&&"number"===e.type?
|
|
3839
|
+
`:"between"===e.filter.operator&&"number"===e.type?N`
|
|
3840
3840
|
<input
|
|
3841
3841
|
type="number"
|
|
3842
3842
|
class="filter-panel__input"
|
|
@@ -3853,7 +3853,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3853
3853
|
@input=${t=>this._handleFilterNumberEndChange(t,e)}
|
|
3854
3854
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3855
3855
|
/>
|
|
3856
|
-
`:"in"===e.filter.operator||"n_in"===e.filter.operator?
|
|
3856
|
+
`:"in"===e.filter.operator||"n_in"===e.filter.operator?N`
|
|
3857
3857
|
<textarea
|
|
3858
3858
|
class="filter-panel__textarea"
|
|
3859
3859
|
rows="3"
|
|
@@ -3862,7 +3862,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3862
3862
|
@input=${t=>this._handleFilterListChange(t,e)}
|
|
3863
3863
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3864
3864
|
></textarea>
|
|
3865
|
-
`:"boolean"===e.type?
|
|
3865
|
+
`:"boolean"===e.type?N`
|
|
3866
3866
|
<krs-select-field
|
|
3867
3867
|
placeholder="Value"
|
|
3868
3868
|
.value=${String(e.filter.value??"")}
|
|
@@ -3871,14 +3871,14 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3871
3871
|
<krs-select-option value="true">Yes</krs-select-option>
|
|
3872
3872
|
<krs-select-option value="false">No</krs-select-option>
|
|
3873
3873
|
</krs-select-field>
|
|
3874
|
-
`:"date"===e.type?
|
|
3874
|
+
`:"date"===e.type?N`
|
|
3875
3875
|
<input
|
|
3876
3876
|
type="date"
|
|
3877
3877
|
class="filter-panel__input"
|
|
3878
3878
|
.valueAsDate=${e.filter.value}
|
|
3879
3879
|
@change=${t=>this._handleFilterDateChange(t,e)}
|
|
3880
3880
|
/>
|
|
3881
|
-
`:"number"===e.type?
|
|
3881
|
+
`:"number"===e.type?N`
|
|
3882
3882
|
<input
|
|
3883
3883
|
type="number"
|
|
3884
3884
|
class="filter-panel__input"
|
|
@@ -3888,7 +3888,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3888
3888
|
@input=${t=>this._handleFilterNumberChange(t,e)}
|
|
3889
3889
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3890
3890
|
/>
|
|
3891
|
-
`:
|
|
3891
|
+
`:N`
|
|
3892
3892
|
<input
|
|
3893
3893
|
type="text"
|
|
3894
3894
|
class="filter-panel__input"
|
|
@@ -3897,25 +3897,25 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3897
3897
|
@input=${t=>this._handleFilterStringChange(t,e)}
|
|
3898
3898
|
@keydown=${t=>this._handleFilterTextKeydown(t,e)}
|
|
3899
3899
|
/>
|
|
3900
|
-
`;const i=
|
|
3900
|
+
`;const i=N`
|
|
3901
3901
|
<div class="filter-panel__content">
|
|
3902
3902
|
<krs-select-field
|
|
3903
3903
|
.value=${e.filter.operator}
|
|
3904
3904
|
@change=${t=>this._handleOperatorChange(t,e)}
|
|
3905
3905
|
>
|
|
3906
|
-
${yi(e.type).map((e=>
|
|
3906
|
+
${yi(e.type).map((e=>N`
|
|
3907
3907
|
<krs-select-option value=${e.key}>${e.label}</krs-select-option>
|
|
3908
3908
|
`))}
|
|
3909
3909
|
</krs-select-field>
|
|
3910
3910
|
${t}
|
|
3911
3911
|
</div>
|
|
3912
|
-
`,s=this._buckets.get(e.id)||[];let o,r;return o=s.length?
|
|
3912
|
+
`,s=this._buckets.get(e.id)||[];let o,r;return o=s.length?N`
|
|
3913
3913
|
<div class="buckets">
|
|
3914
|
-
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let o=U;return s&&(o=
|
|
3914
|
+
${s.map((t=>{let i="(Empty)";null!==t.val&&void 0!==t.val&&(i="boolean"===e.type?!0===t.val||"true"===t.val?"Yes":"No":String(t.val));let s=e.filter.has(t.val);"n_in"===e.filter.operator&&(s=!s);let o=U;return s&&(o=N`
|
|
3915
3915
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
3916
3916
|
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
|
3917
3917
|
</svg>
|
|
3918
|
-
`),
|
|
3918
|
+
`),N`
|
|
3919
3919
|
<div
|
|
3920
3920
|
class="bucket"
|
|
3921
3921
|
@click=${i=>this._handleBucketToggle(i,e,t)}
|
|
@@ -3928,7 +3928,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3928
3928
|
</div>
|
|
3929
3929
|
`}))}
|
|
3930
3930
|
</div>
|
|
3931
|
-
`:
|
|
3931
|
+
`:N`<div class="bucket-empty">No data</div>`,r=e.facetable&&e.filterable?N`
|
|
3932
3932
|
<krs-tab-group
|
|
3933
3933
|
size="small"
|
|
3934
3934
|
active-tab-id=${this._filterPanelTab}
|
|
@@ -3941,7 +3941,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3941
3941
|
${o}
|
|
3942
3942
|
</krs-tab>
|
|
3943
3943
|
</krs-tab-group>
|
|
3944
|
-
`:e.facetable?o:i,
|
|
3944
|
+
`:e.facetable?o:i,N`
|
|
3945
3945
|
<div
|
|
3946
3946
|
class="filter-panel"
|
|
3947
3947
|
style=${we({top:this._filterPanelPos.top+"px",left:this._filterPanelPos.left+"px"})}
|
|
@@ -3961,10 +3961,10 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3961
3961
|
</krs-button>
|
|
3962
3962
|
</div>
|
|
3963
3963
|
</div>
|
|
3964
|
-
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable))?
|
|
3964
|
+
`}_renderFilterRow(){const e=this.getDisplayedColumns();return e.some((e=>e.filterable||e.facetable))?N`
|
|
3965
3965
|
<div class="filter-row">
|
|
3966
|
-
${this._model.rowSelectable?
|
|
3967
|
-
${e.map(((t,i)=>t.filterable||t.facetable?
|
|
3966
|
+
${this._model.rowSelectable?N`<div class="filter-cell filter-cell--select"></div>`:U}
|
|
3967
|
+
${e.map(((t,i)=>t.filterable||t.facetable?N`
|
|
3968
3968
|
<div
|
|
3969
3969
|
class=${ye({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
3970
3970
|
style=${we(this._getCellStyle(t,i))}
|
|
@@ -3976,7 +3976,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3976
3976
|
.value=${t.filter.kql}
|
|
3977
3977
|
@change=${e=>this._handleKqlChange(e,t)}
|
|
3978
3978
|
/>
|
|
3979
|
-
${t.filter?.kql?.length>0?
|
|
3979
|
+
${t.filter?.kql?.length>0?N`
|
|
3980
3980
|
<button
|
|
3981
3981
|
class="filter-cell__clear"
|
|
3982
3982
|
@click=${()=>this._handleKqlClear(t)}
|
|
@@ -3996,12 +3996,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
3996
3996
|
</button>
|
|
3997
3997
|
</div>
|
|
3998
3998
|
</div>
|
|
3999
|
-
`:
|
|
3999
|
+
`:N`<div
|
|
4000
4000
|
class=${ye({"filter-cell":!0,"filter-cell--sticky-left":"left"===t.sticky,"filter-cell--sticky-right":"right"===t.sticky,"filter-cell--sticky-right-first":"right"===t.sticky&&!e.slice(0,i).some((e=>"right"===e.sticky))})}
|
|
4001
4001
|
style=${we(this._getCellStyle(t,i))}
|
|
4002
4002
|
></div>`))}
|
|
4003
4003
|
</div>
|
|
4004
|
-
`:U}_renderTable(){const e=this.getDisplayedColumns().map((e=>e.width?e.width:"actions"===e.type?"max-content":"minmax(80px, auto)"));return this._model.rowSelectable&&e.unshift("54px"),
|
|
4004
|
+
`:U}_renderTable(){const e=this.getDisplayedColumns().map((e=>e.width?e.width:"actions"===e.type?"max-content":"minmax(80px, auto)"));return this._model.rowSelectable&&e.unshift("54px"),N`
|
|
4005
4005
|
<div class="wrapper">
|
|
4006
4006
|
<div class="overlay-left"></div>
|
|
4007
4007
|
<div class="overlay-right"></div>
|
|
@@ -4009,7 +4009,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
4009
4009
|
<div class="content" @scroll=${this._handleScroll}>
|
|
4010
4010
|
<div class="table" style=${we({"grid-template-columns":e.join(" ")})}>
|
|
4011
4011
|
<div class="header-row">
|
|
4012
|
-
${this._model.rowSelectable?
|
|
4012
|
+
${this._model.rowSelectable?N`
|
|
4013
4013
|
<div class="header-cell header-cell--select">
|
|
4014
4014
|
<krs-checkbox
|
|
4015
4015
|
aria-label="Select all rows on this page"
|
|
@@ -4018,7 +4018,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
4018
4018
|
></krs-checkbox>
|
|
4019
4019
|
</div>
|
|
4020
4020
|
`:U}
|
|
4021
|
-
${this.getDisplayedColumns().map(((e,t)=>
|
|
4021
|
+
${this.getDisplayedColumns().map(((e,t)=>N`
|
|
4022
4022
|
<div
|
|
4023
4023
|
class=${ye({"header-cell":!0,"header-cell--sortable":!!e.sortable,"header-cell--align-center":"center"===e.align,"header-cell--align-right":"right"===e.align,"header-cell--sticky-left":"left"===e.sticky,"header-cell--sticky-left-last":"left"===e.sticky&&!this.getDisplayedColumns().slice(t+1).some((e=>"left"===e.sticky)),"header-cell--sticky-right":"right"===e.sticky,"header-cell--sticky-right-first":"right"===e.sticky&&!this.getDisplayedColumns().slice(0,t).some((e=>"right"===e.sticky))})}
|
|
4024
4024
|
style=${we(this._getCellStyle(e,t))}
|
|
@@ -4026,7 +4026,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
4026
4026
|
>
|
|
4027
4027
|
<span class="header-cell__label">${e.label??e.id}</span>
|
|
4028
4028
|
${this._renderSortIndicator(e)}
|
|
4029
|
-
${!1!==e.resizable?
|
|
4029
|
+
${!1!==e.resizable?N`<div
|
|
4030
4030
|
class="header-cell__resize"
|
|
4031
4031
|
@mousedown=${t=>this._handleResizeStart(t,e.id)}
|
|
4032
4032
|
></div>`:U}
|
|
@@ -4034,7 +4034,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
4034
4034
|
`))}
|
|
4035
4035
|
</div>
|
|
4036
4036
|
${this._renderFilterRow()}
|
|
4037
|
-
${this._data.map(((e,t)=>{const i=this._model.rowSelectable&&this._selectedRows.has(this._model.rowKey(e)),s=this.getDisplayedColumns().map(((i,s)=>
|
|
4037
|
+
${this._data.map(((e,t)=>{const i=this._model.rowSelectable&&this._selectedRows.has(this._model.rowKey(e)),s=this.getDisplayedColumns().map(((i,s)=>N`
|
|
4038
4038
|
<div
|
|
4039
4039
|
class=${ye({cell:!0,"cell--actions":"actions"===i.type,"cell--align-center":"center"===i.align,"cell--align-right":"right"===i.align,"cell--sticky-left":"left"===i.sticky,"cell--sticky-left-last":"left"===i.sticky&&!this.getDisplayedColumns().slice(s+1).some((e=>"left"===e.sticky)),"cell--sticky-right":"right"===i.sticky,"cell--sticky-right-first":"right"===i.sticky&&!this.getDisplayedColumns().slice(0,s).some((e=>"right"===e.sticky))})}
|
|
4040
4040
|
style=${we(this._getCellStyle(i,s))}
|
|
@@ -4042,7 +4042,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
4042
4042
|
>
|
|
4043
4043
|
${this._renderCellContent(i,e,t)}
|
|
4044
4044
|
</div>
|
|
4045
|
-
`));return this._model.rowSelectable&&s.unshift(
|
|
4045
|
+
`));return this._model.rowSelectable&&s.unshift(N`
|
|
4046
4046
|
<div class="cell cell--select" @click=${this._handleSelectCellClick}>
|
|
4047
4047
|
<krs-checkbox
|
|
4048
4048
|
aria-label="Select row"
|
|
@@ -4050,7 +4050,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
4050
4050
|
@change=${t=>this._handleRowSelectToggle(t,e)}
|
|
4051
4051
|
></krs-checkbox>
|
|
4052
4052
|
</div>
|
|
4053
|
-
`),this._model.rowHref?
|
|
4053
|
+
`),this._model.rowHref?N`
|
|
4054
4054
|
<a
|
|
4055
4055
|
href=${this._model.rowHref(e)}
|
|
4056
4056
|
draggable="false"
|
|
@@ -4058,7 +4058,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
4058
4058
|
@mousedown=${this._handleRowMouseDown}
|
|
4059
4059
|
@click=${i=>this._handleRowClick(i,e,t)}
|
|
4060
4060
|
>${s}</a>
|
|
4061
|
-
`:
|
|
4061
|
+
`:N`
|
|
4062
4062
|
<div
|
|
4063
4063
|
class=${ye({row:!0,"row--clickable":!!this._model.rowClickable,"row--selected":i})}
|
|
4064
4064
|
@mousedown=${this._handleRowMouseDown}
|
|
@@ -4068,12 +4068,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
4068
4068
|
</div>
|
|
4069
4069
|
</div>
|
|
4070
4070
|
</div>
|
|
4071
|
-
`}render(){return this._model.columns.length?
|
|
4071
|
+
`}render(){return this._model.columns.length?N`
|
|
4072
4072
|
${this._renderCardHeader()}
|
|
4073
4073
|
${this._renderHeader()}
|
|
4074
4074
|
${this._renderTable()}
|
|
4075
4075
|
${this._renderFilterPanel()}
|
|
4076
|
-
`:
|
|
4076
|
+
`:N`<slot></slot>`}}Pi.styles=[Ut,a`
|
|
4077
4077
|
/* -------------------------------------------------------------------------
|
|
4078
4078
|
* Host
|
|
4079
4079
|
* ----------------------------------------------------------------------- */
|
|
@@ -5146,7 +5146,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5146
5146
|
overflow: auto;
|
|
5147
5147
|
}
|
|
5148
5148
|
|
|
5149
|
-
`],
|
|
5149
|
+
`],Ii([ce({type:Object})],Pi.prototype,"def",void 0),Ii([ce({type:String,reflect:!0})],Pi.prototype,"variant",void 0),Ii([ce({type:String,attribute:"scroll-mode",reflect:!0})],Pi.prototype,"scrollMode",void 0),Ii([pe()],Pi.prototype,"_data",void 0),Ii([pe()],Pi.prototype,"_dataState",void 0),Ii([pe()],Pi.prototype,"_page",void 0),Ii([pe()],Pi.prototype,"_pageSize",void 0),Ii([pe()],Pi.prototype,"_totalItems",void 0),Ii([pe()],Pi.prototype,"_totalPages",void 0),Ii([pe()],Pi.prototype,"_searchQuery",void 0),Ii([pe()],Pi.prototype,"_canScrollLeft",void 0),Ii([pe()],Pi.prototype,"_canScrollRight",void 0),Ii([pe()],Pi.prototype,"_canScrollHorizontal",void 0),Ii([pe()],Pi.prototype,"_columnPickerOpen",void 0),Ii([pe()],Pi.prototype,"_filterPanelOpened",void 0),Ii([pe()],Pi.prototype,"_filterPanelTab",void 0),Ii([pe()],Pi.prototype,"_buckets",void 0),Ii([pe()],Pi.prototype,"_sorts",void 0),customElements.get("krs-grid")||customElements.define("krs-grid",Pi);var Li=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class qi{constructor(){this._resolvePromise=null,this._dialogElement=null,this._handlers=[],this._promise=new Promise((e=>{this._resolvePromise=e}))}setDialogElement(e){this._dialogElement=e}onAction(e){return this._handlers.push(e),this}close(e){this._resolvePromise&&(this._resolvePromise(e),this._resolvePromise=null),this._dialogElement?.remove()}afterClosed(){return this._promise}emitAction(e,t){this._handlers.forEach((i=>i({action:e,grid:t})))}showActionLoading(e={}){this._dialogElement?.showActionLoading(e)}showActionSuccess(e={}){this._dialogElement?.showActionSuccess(e)}showActionError(e={}){this._dialogElement?.showActionError(e)}resetAction(e={}){this._dialogElement?.resetAction(e)}}class Vi extends ne{constructor(){super(...arguments),this._dialogRef=null,this.opened=!1,this.title="",this.description="",this.def={columns:[]},this.actions=[],this._handleDocumentKeyDown=e=>{"Escape"===e.key&&this.close()},this._handleClose=()=>{this.close()}}static open(e){document.querySelectorAll("krs-grid-dialog").forEach((e=>{e._dialogRef&&e.remove()}));const t=new qi,i=document.createElement("krs-grid-dialog");return t.setDialogElement(i),i._dialogRef=t,i.title=e.title??"",i.description=e.description??"",i.def=e.def,i.actions=e.actions??[],i.opened=!0,document.body.appendChild(i),t}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleDocumentKeyDown)}updated(e){super.updated(e),e.has("opened")&&(this.opened?document.addEventListener("keydown",this._handleDocumentKeyDown):document.removeEventListener("keydown",this._handleDocumentKeyDown))}open(){this.opened=!0}close(){this._dialogRef?this._dialogRef.close(void 0):(this.opened=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}showActionLoading(e={}){this.shadowRoot?.querySelector(`.dialog__footer krs-button[data-action="${e.action??this.actions[0]?.id}"]`)?.showLoading()}showActionSuccess(e={}){this.shadowRoot?.querySelector(`.dialog__footer krs-button[data-action="${e.action??this.actions[0]?.id}"]`)?.showSuccess(e.text??"Done")}showActionError(e={}){this.shadowRoot?.querySelector(`.dialog__footer krs-button[data-action="${e.action??this.actions[0]?.id}"]`)?.showError(e.text??"Failed")}resetAction(e={}){this.shadowRoot?.querySelector(`.dialog__footer krs-button[data-action="${e.action??this.actions[0]?.id}"]`)?.reset()}_handleAction(e){const t=this.shadowRoot?.querySelector("krs-grid");t&&(this._dialogRef?this._dialogRef.emitAction(e,t):this.dispatchEvent(new CustomEvent("action",{detail:{action:e,grid:t},bubbles:!0,composed:!0})))}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return N`
|
|
5150
5150
|
<div class="backdrop" @click=${this._handleBackdropClick}></div>
|
|
5151
5151
|
<div class="dialog">
|
|
5152
5152
|
<button
|
|
@@ -5165,17 +5165,17 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5165
5165
|
<path d="M6 18 18 6M6 6l12 12" />
|
|
5166
5166
|
</svg>
|
|
5167
5167
|
</button>
|
|
5168
|
-
${this.title||this.description?
|
|
5168
|
+
${this.title||this.description?N`
|
|
5169
5169
|
<div class="dialog__header">
|
|
5170
|
-
${this.title?
|
|
5171
|
-
${this.description?
|
|
5170
|
+
${this.title?N`<h2 class="dialog__title">${this.title}</h2>`:U}
|
|
5171
|
+
${this.description?N`<p class="dialog__description">${this.description}</p>`:U}
|
|
5172
5172
|
</div>
|
|
5173
5173
|
`:U}
|
|
5174
5174
|
<div class="dialog__body">
|
|
5175
5175
|
<krs-grid variant="dialog" .def=${this.def}></krs-grid>
|
|
5176
|
-
${this.actions.length?
|
|
5176
|
+
${this.actions.length?N`
|
|
5177
5177
|
<div class="dialog__footer">
|
|
5178
|
-
${this.actions.map((e=>
|
|
5178
|
+
${this.actions.map((e=>N`
|
|
5179
5179
|
<krs-button
|
|
5180
5180
|
data-action=${e.id}
|
|
5181
5181
|
color=${e.color??"primary"}
|
|
@@ -5298,7 +5298,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5298
5298
|
flex-shrink: 0;
|
|
5299
5299
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
5300
5300
|
}
|
|
5301
|
-
`],Li([ce({type:Boolean,reflect:!0})],Vi.prototype,"opened",void 0),Li([ce({type:String})],Vi.prototype,"title",void 0),Li([ce({type:String})],Vi.prototype,"description",void 0),Li([ce({attribute:!1})],Vi.prototype,"def",void 0),Li([ce({attribute:!1})],Vi.prototype,"actions",void 0),customElements.get("krs-grid-dialog")||customElements.define("krs-grid-dialog",Vi);var
|
|
5301
|
+
`],Li([ce({type:Boolean,reflect:!0})],Vi.prototype,"opened",void 0),Li([ce({type:String})],Vi.prototype,"title",void 0),Li([ce({type:String})],Vi.prototype,"description",void 0),Li([ce({attribute:!1})],Vi.prototype,"def",void 0),Li([ce({attribute:!1})],Vi.prototype,"actions",void 0),customElements.get("krs-grid-dialog")||customElements.define("krs-grid-dialog",Vi);var Bi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Fi extends ne{constructor(){super(...arguments),this.size="md",this.color="dark"}render(){var e="",t="";return e="sm"==this.size?"16px":"md"==this.size?"24px":"lg"==this.size?"32px":"xl"==this.size?"48px":this.size,t="dark"==this.color?"#163052":"light"==this.color?"#ffffff":this.color,N`
|
|
5302
5302
|
<svg
|
|
5303
5303
|
class="spinner"
|
|
5304
5304
|
style=${we({width:e,height:e,color:t})}
|
|
@@ -5315,7 +5315,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5315
5315
|
stroke-width="4"
|
|
5316
5316
|
/>
|
|
5317
5317
|
</svg>
|
|
5318
|
-
`}}
|
|
5318
|
+
`}}Fi.styles=a`
|
|
5319
5319
|
:host {
|
|
5320
5320
|
display: inline-flex;
|
|
5321
5321
|
align-items: center;
|
|
@@ -5358,7 +5358,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5358
5358
|
stroke: currentColor;
|
|
5359
5359
|
stroke-linecap: round;
|
|
5360
5360
|
}
|
|
5361
|
-
`,
|
|
5361
|
+
`,Bi([ce({type:String,reflect:!0})],Fi.prototype,"size",void 0),Bi([ce({type:String,reflect:!0})],Fi.prototype,"color",void 0),customElements.get("krs-spinner")||customElements.define("krs-spinner",Fi);var Ni=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ji extends ne{constructor(){super(...arguments),this.color="dark"}render(){let e="",t="";return e="dark"===this.color?"#163052":"light"===this.color?"#ffffff":this.color,t=this.trackColor?this.trackColor:"light"===this.color?"#ffffff4d":"#0000001a",N`
|
|
5362
5362
|
<div
|
|
5363
5363
|
class="progress-bar"
|
|
5364
5364
|
style=${we({background:t})}
|
|
@@ -5367,7 +5367,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5367
5367
|
>
|
|
5368
5368
|
<div class="fill" style=${we({background:e})}></div>
|
|
5369
5369
|
</div>
|
|
5370
|
-
`}}
|
|
5370
|
+
`}}ji.styles=a`
|
|
5371
5371
|
:host {
|
|
5372
5372
|
display: block;
|
|
5373
5373
|
width: 100%;
|
|
@@ -5399,43 +5399,43 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5399
5399
|
left: 100%;
|
|
5400
5400
|
}
|
|
5401
5401
|
}
|
|
5402
|
-
`,
|
|
5402
|
+
`,Ni([ce({type:String,reflect:!0})],ji.prototype,"color",void 0),Ni([ce({type:String,reflect:!0})],ji.prototype,"trackColor",void 0),customElements.get("krs-progress-bar")||customElements.define("krs-progress-bar",ji);var Ui=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Hi extends ne{constructor(){super(...arguments),this._zoom=100,this._panX=0,this._panY=0,this._dragging=!1,this._dragStartX=0,this._dragStartY=0,this._panStartX=0,this._panStartY=0,this.src="",this.name="",this._zoomLevel=100,this._textContent=null,this._handleKeydown=e=>{"Escape"===e.key&&this._close()},this._close=()=>{this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})),Hi._activePreview===this&&(Hi._activePreview=null),this.remove()},this._handleDragMove=e=>{this._dragging&&(this._panX=this._panStartX+(e.clientX-this._dragStartX),this._panY=this._panStartY+(e.clientY-this._dragStartY),this.requestUpdate())},this._handleDragEnd=()=>{this._dragging=!1,document.removeEventListener("mousemove",this._handleDragMove),document.removeEventListener("mouseup",this._handleDragEnd)}}static open(e){this._activePreview&&this._activePreview._close();const t=document.createElement("krs-file-preview");return t.src=e.src,t.name=e.name,document.body.appendChild(t),this._activePreview=t,t}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._handleKeydown),this._isText()&&this._loadTextContent()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleKeydown)}_handleDownload(){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{src:this.src,name:this.name}}))}_handleZoomIn(){this._zoomLevel=Math.min(this._zoomLevel+25,300),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomOut(){this._zoomLevel=Math.max(this._zoomLevel-25,25),this._zoomLevel<=100&&(this._panX=0,this._panY=0)}_handleZoomReset(){this._zoomLevel=100,this._panX=0,this._panY=0}_handleDragStart(e){this._zoomLevel<=100||(e.preventDefault(),this._dragging=!0,this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._panStartX=this._panX,this._panStartY=this._panY,document.addEventListener("mousemove",this._handleDragMove),document.addEventListener("mouseup",this._handleDragEnd))}_handleBackdropClick(e){e.target===e.currentTarget&&this._close()}_getExtension(){return(this.name||"").split(".").pop()?.toLowerCase()||""}_isImage(){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(this._getExtension())}_isText(){return["csv","txt","json","xml","log","md","yml","yaml","ini","cfg","conf","env","sh","bat"].includes(this._getExtension())}_loadTextContent(){fetch(this.src).then((e=>e.text())).then((e=>{if(this._textContent=e,"csv"!==this._getExtension())return;const t=e.trim().split("\n");if(!t.length)return;const i=t.map((e=>e.split(",").map((e=>e.trim())))),s=Math.max(...i.map((e=>e.length))),o=[];for(let e=0;e<s;e++){let t=0;for(const s of i){const i=(s[e]||"").length;i>t&&(t=i)}o.push(t)}this._textContent=i.map((e=>e.map(((e,t)=>e.padEnd(o[t]||0))).join(" "))).join("\n")})).catch((()=>{this._textContent="Failed to load file content."}))}_renderFallbackIcon(e){return["doc","docx","rtf","txt"].includes(e)?N`<svg
|
|
5403
5403
|
xmlns="http://www.w3.org/2000/svg"
|
|
5404
5404
|
viewBox="0 0 24 24"
|
|
5405
5405
|
fill="currentColor"
|
|
5406
5406
|
>
|
|
5407
5407
|
<path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm2-6h8v2H8v-2zm0-4h8v2H8v-2zm0 8h5v2H8v-2z"/>
|
|
5408
|
-
</svg>`:["xls","xlsx","csv"].includes(e)?
|
|
5408
|
+
</svg>`:["xls","xlsx","csv"].includes(e)?N`<svg
|
|
5409
5409
|
xmlns="http://www.w3.org/2000/svg"
|
|
5410
5410
|
viewBox="0 0 24 24"
|
|
5411
5411
|
fill="currentColor"
|
|
5412
5412
|
>
|
|
5413
5413
|
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h14zm0 5v4H5v-4h14zM5 19v-3h14v3H5zm2-8h4v2H7v-2zm0 5h4v2H7v-2z"/>
|
|
5414
|
-
</svg>`:["zip","rar","7z","gz","tar"].includes(e)?
|
|
5414
|
+
</svg>`:["zip","rar","7z","gz","tar"].includes(e)?N`<svg
|
|
5415
5415
|
xmlns="http://www.w3.org/2000/svg"
|
|
5416
5416
|
viewBox="0 0 24 24"
|
|
5417
5417
|
fill="currentColor"
|
|
5418
5418
|
>
|
|
5419
5419
|
<path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-8-4h2v2h-2v-2zm0-4h2v2h-2v-2zm-2 2h2v2h-2v-2z"/>
|
|
5420
|
-
</svg>`:
|
|
5420
|
+
</svg>`:N`<svg
|
|
5421
5421
|
xmlns="http://www.w3.org/2000/svg"
|
|
5422
5422
|
viewBox="0 0 24 24"
|
|
5423
5423
|
fill="currentColor"
|
|
5424
5424
|
>
|
|
5425
5425
|
<path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/>
|
|
5426
|
-
</svg>`}render(){let e;if(this._isImage()){const t=this._zoomLevel/100,i=this._panX/t,s=this._panY/t;let o="default";this._zoomLevel>100&&(o="grab"),e=
|
|
5426
|
+
</svg>`}render(){let e;if(this._isImage()){const t=this._zoomLevel/100,i=this._panX/t,s=this._panY/t;let o="default";this._zoomLevel>100&&(o="grab"),e=N`<img
|
|
5427
5427
|
class="body__image"
|
|
5428
5428
|
src="${this.src}"
|
|
5429
5429
|
alt="${this.name}"
|
|
5430
5430
|
style=${we({transform:`scale(${t}) translate(${i}px, ${s}px)`,cursor:o})}
|
|
5431
5431
|
@mousedown=${this._handleDragStart}
|
|
5432
|
-
/>`}else if(["mp4","webm","ogg","mov"].includes(this._getExtension()))e=
|
|
5432
|
+
/>`}else if(["mp4","webm","ogg","mov"].includes(this._getExtension()))e=N`<video
|
|
5433
5433
|
class="body__video"
|
|
5434
5434
|
src="${this.src}"
|
|
5435
5435
|
controls
|
|
5436
5436
|
autoplay
|
|
5437
5437
|
playsinline
|
|
5438
|
-
></video>`;else if("pdf"===this._getExtension())e=
|
|
5438
|
+
></video>`;else if("pdf"===this._getExtension())e=N`<iframe class="body__iframe" src="${this.src}"></iframe>`;else if(this._isText())e=null===this._textContent?N`<div class="body__text-loading">Loading...</div>`:N`<pre class="body__text">${this._textContent}</pre>`;else{const t=this._getExtension();let i="fallback__icon--default";["doc","docx","rtf","txt"].includes(t)&&(i="fallback__icon--doc"),["xls","xlsx","csv"].includes(t)&&(i="fallback__icon--xls"),["zip","rar","7z","gz","tar"].includes(t)&&(i="fallback__icon--zip"),e=N`
|
|
5439
5439
|
<div class="fallback">
|
|
5440
5440
|
<div class=${ye({fallback__icon:!0,[i]:!0})}>
|
|
5441
5441
|
${this._renderFallbackIcon(t)}
|
|
@@ -5453,11 +5453,11 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5453
5453
|
Download
|
|
5454
5454
|
</krs-button>
|
|
5455
5455
|
</div>
|
|
5456
|
-
`}return
|
|
5456
|
+
`}return N`
|
|
5457
5457
|
<div class="toolbar">
|
|
5458
5458
|
<div class="toolbar__name">${this.name}</div>
|
|
5459
5459
|
<div class="toolbar__controls">
|
|
5460
|
-
${this._isImage()?
|
|
5460
|
+
${this._isImage()?N`
|
|
5461
5461
|
<button
|
|
5462
5462
|
class="toolbar__btn"
|
|
5463
5463
|
@click=${this._handleZoomOut}
|
|
@@ -5708,7 +5708,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5708
5708
|
height: 18px;
|
|
5709
5709
|
fill: currentColor;
|
|
5710
5710
|
}
|
|
5711
|
-
`,Hi._activePreview=null,Ui([ce({type:String})],Hi.prototype,"src",void 0),Ui([ce({type:String})],Hi.prototype,"name",void 0),Ui([pe()],Hi.prototype,"_zoomLevel",void 0),Ui([pe()],Hi.prototype,"_textContent",void 0),customElements.get("krs-file-preview")||customElements.define("krs-file-preview",Hi);var Wi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Yi extends ne{constructor(){super(...arguments),this.files=[],this.emptyMessage="No files"}_handleFileClick(e){if(this.dispatchEvent(new CustomEvent("file-click",{bubbles:!0,composed:!0,detail:{file:e}})),e.url){Hi.open({src:e.url,name:e.name}).addEventListener("download",(()=>{this._handleDownload(e)}))}}_handleDownload(e){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{file:e}}))}_handleDelete(e){this.dispatchEvent(new CustomEvent("delete",{bubbles:!0,composed:!0,detail:{file:e}}))}_renderExtIcon(e){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?
|
|
5711
|
+
`,Hi._activePreview=null,Ui([ce({type:String})],Hi.prototype,"src",void 0),Ui([ce({type:String})],Hi.prototype,"name",void 0),Ui([pe()],Hi.prototype,"_zoomLevel",void 0),Ui([pe()],Hi.prototype,"_textContent",void 0),customElements.get("krs-file-preview")||customElements.define("krs-file-preview",Hi);var Wi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Yi extends ne{constructor(){super(...arguments),this.files=[],this.emptyMessage="No files"}_handleFileClick(e){if(this.dispatchEvent(new CustomEvent("file-click",{bubbles:!0,composed:!0,detail:{file:e}})),e.url){Hi.open({src:e.url,name:e.name}).addEventListener("download",(()=>{this._handleDownload(e)}))}}_handleDownload(e){this.dispatchEvent(new CustomEvent("download",{bubbles:!0,composed:!0,detail:{file:e}}))}_handleDelete(e){this.dispatchEvent(new CustomEvent("delete",{bubbles:!0,composed:!0,detail:{file:e}}))}_renderExtIcon(e){return["jpg","jpeg","png","gif","webp","svg","bmp"].includes(e)?N`
|
|
5712
5712
|
<svg
|
|
5713
5713
|
xmlns="http://www.w3.org/2000/svg"
|
|
5714
5714
|
viewBox="0 0 24 24"
|
|
@@ -5716,7 +5716,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5716
5716
|
>
|
|
5717
5717
|
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
|
|
5718
5718
|
</svg>
|
|
5719
|
-
`:["pdf"].includes(e)?
|
|
5719
|
+
`:["pdf"].includes(e)?N`
|
|
5720
5720
|
<svg
|
|
5721
5721
|
xmlns="http://www.w3.org/2000/svg"
|
|
5722
5722
|
viewBox="0 0 24 24"
|
|
@@ -5724,7 +5724,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5724
5724
|
>
|
|
5725
5725
|
<path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"/>
|
|
5726
5726
|
</svg>
|
|
5727
|
-
`:["doc","docx","rtf","txt"].includes(e)?
|
|
5727
|
+
`:["doc","docx","rtf","txt"].includes(e)?N`
|
|
5728
5728
|
<svg
|
|
5729
5729
|
xmlns="http://www.w3.org/2000/svg"
|
|
5730
5730
|
viewBox="0 0 24 24"
|
|
@@ -5732,7 +5732,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5732
5732
|
>
|
|
5733
5733
|
<path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm2-6h8v2H8v-2zm0-4h8v2H8v-2zm0 8h5v2H8v-2z"/>
|
|
5734
5734
|
</svg>
|
|
5735
|
-
`:["xls","xlsx","csv"].includes(e)?
|
|
5735
|
+
`:["xls","xlsx","csv"].includes(e)?N`
|
|
5736
5736
|
<svg
|
|
5737
5737
|
xmlns="http://www.w3.org/2000/svg"
|
|
5738
5738
|
viewBox="0 0 24 24"
|
|
@@ -5740,7 +5740,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5740
5740
|
>
|
|
5741
5741
|
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h14zm0 5v4H5v-4h14zM5 19v-3h14v3H5zm2-8h4v2H7v-2zm0 5h4v2H7v-2z"/>
|
|
5742
5742
|
</svg>
|
|
5743
|
-
`:["zip","rar","7z","gz","tar"].includes(e)?
|
|
5743
|
+
`:["zip","rar","7z","gz","tar"].includes(e)?N`
|
|
5744
5744
|
<svg
|
|
5745
5745
|
xmlns="http://www.w3.org/2000/svg"
|
|
5746
5746
|
viewBox="0 0 24 24"
|
|
@@ -5748,7 +5748,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5748
5748
|
>
|
|
5749
5749
|
<path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-8-4h2v2h-2v-2zm0-4h2v2h-2v-2zm-2 2h2v2h-2v-2z"/>
|
|
5750
5750
|
</svg>
|
|
5751
|
-
`:
|
|
5751
|
+
`:N`
|
|
5752
5752
|
<svg
|
|
5753
5753
|
xmlns="http://www.w3.org/2000/svg"
|
|
5754
5754
|
viewBox="0 0 24 24"
|
|
@@ -5756,9 +5756,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5756
5756
|
>
|
|
5757
5757
|
<path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/>
|
|
5758
5758
|
</svg>
|
|
5759
|
-
`}render(){return this.files.length?
|
|
5759
|
+
`}render(){return this.files.length?N`
|
|
5760
5760
|
<div class="file-list">
|
|
5761
|
-
${this.files.map((e=>{const t=e.name.split(".").pop()?.toLowerCase()||"",i=e.meta||e.date||"";let s="file-list__ext--default";return["pdf"].includes(t)&&(s="file-list__ext--pdf"),["doc","docx","rtf","txt"].includes(t)&&(s="file-list__ext--doc"),["xls","xlsx","csv"].includes(t)&&(s="file-list__ext--xls"),["zip","rar","7z","gz","tar"].includes(t)&&(s="file-list__ext--zip"),["jpg","jpeg","png","gif","webp","svg","bmp"].includes(t)&&(s="file-list__ext--img"),
|
|
5761
|
+
${this.files.map((e=>{const t=e.name.split(".").pop()?.toLowerCase()||"",i=e.meta||e.date||"";let s="file-list__ext--default";return["pdf"].includes(t)&&(s="file-list__ext--pdf"),["doc","docx","rtf","txt"].includes(t)&&(s="file-list__ext--doc"),["xls","xlsx","csv"].includes(t)&&(s="file-list__ext--xls"),["zip","rar","7z","gz","tar"].includes(t)&&(s="file-list__ext--zip"),["jpg","jpeg","png","gif","webp","svg","bmp"].includes(t)&&(s="file-list__ext--img"),N`
|
|
5762
5762
|
<div class="file-list__item">
|
|
5763
5763
|
<div
|
|
5764
5764
|
class=${ye({"file-list__ext":!0,[s]:!0})}
|
|
@@ -5772,7 +5772,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5772
5772
|
>
|
|
5773
5773
|
${e.name}
|
|
5774
5774
|
</a>
|
|
5775
|
-
${i?
|
|
5775
|
+
${i?N`<div class="file-list__meta">${i}</div>`:""}
|
|
5776
5776
|
</div>
|
|
5777
5777
|
<div class="file-list__actions">
|
|
5778
5778
|
<svg
|
|
@@ -5797,7 +5797,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5797
5797
|
</div>
|
|
5798
5798
|
`}))}
|
|
5799
5799
|
</div>
|
|
5800
|
-
`:
|
|
5800
|
+
`:N`<div class="file-list__empty">${this.emptyMessage}</div>`}}Yi.styles=a`
|
|
5801
5801
|
*,
|
|
5802
5802
|
*::after,
|
|
5803
5803
|
*::before,
|
|
@@ -5921,12 +5921,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5921
5921
|
* @license
|
|
5922
5922
|
* Copyright 2020 Google LLC
|
|
5923
5923
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5924
|
-
*/,Xi=
|
|
5924
|
+
*/,Xi=be(class extends _e{constructor(e){if(super(e),e.type!==me&&e.type!==ge&&e.type!==ve)throw Error("The `live` directive is not allowed on child or event bindings");if(!(e=>void 0===e.strings)(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===j||t===U)return t;const i=e.element,s=e.name;if(e.type===me){if(t===i[s])return j}else if(e.type===ve){if(!!t===i.hasAttribute(s))return j}else if(e.type===ge&&i.getAttribute(s)===t+"")return j;return Oe(e),t}});var Zi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Ji extends ne{static fromJSON(e){const t=new Ji;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.type&&(t.type=e.type),void 0!==e.required&&(t.required=e.required),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.readonly&&(t.readonly=e.readonly),void 0!==e.minlength&&(t.minlength=e.minlength),void 0!==e.maxlength&&(t.maxlength=e.maxlength),void 0!==e.pattern&&(t.pattern=e.pattern),void 0!==e.autocomplete&&(t.autocomplete=e.autocomplete),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyValue="",this.label="",this.name="",this.value="",this.valueAsNumber=null,this.placeholder="",this.type="text",this.required=!1,this.disabled=!1,this.readonly=!1,this.autocomplete="",this.hint="",this.dirty=!1,this.saving=!1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){if((e.has("required")||e.has("value"))&&this._updateValidity(),e.has("value")){const e=Number(this.value);""===this.value||Number.isNaN(e)?this.valueAsNumber=null:this.valueAsNumber=e}}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this.dirty=!1,this.saving=!1,this._internals.setFormValue(""),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleInput(e){this.value=e.target.value,this.dirty=!0,this._dirtyValue=this.value,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage)}render(){let e="";return this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage),N`
|
|
5925
5925
|
<div class="wrapper">
|
|
5926
|
-
${this.label?
|
|
5926
|
+
${this.label?N`
|
|
5927
5927
|
<label for="input">
|
|
5928
5928
|
${this.label}
|
|
5929
|
-
${this.required?
|
|
5929
|
+
${this.required?N`<span class="required" aria-hidden="true">*</span>`:""}
|
|
5930
5930
|
</label>
|
|
5931
5931
|
`:""}
|
|
5932
5932
|
<input
|
|
@@ -5947,9 +5947,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
5947
5947
|
@change=${this._handleChange}
|
|
5948
5948
|
@blur=${this._handleBlur}
|
|
5949
5949
|
/>
|
|
5950
|
-
${e?
|
|
5950
|
+
${e?N`<div class="validation-message">${e}</div>`:this.hint?N`<div class="hint">${this.hint}</div>`:""}
|
|
5951
5951
|
</div>
|
|
5952
|
-
`}}
|
|
5952
|
+
`}}Ji.styles=a`
|
|
5953
5953
|
:host {
|
|
5954
5954
|
display: block;
|
|
5955
5955
|
font-family: inherit;
|
|
@@ -6017,12 +6017,107 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6017
6017
|
font-size: 0.75rem;
|
|
6018
6018
|
color: var(--kr-text-field-helper-color, #6b7280);
|
|
6019
6019
|
}
|
|
6020
|
-
`,
|
|
6020
|
+
`,Ji.formAssociated=!0,Zi([ce({type:String})],Ji.prototype,"label",void 0),Zi([ce({type:String})],Ji.prototype,"name",void 0),Zi([ce({type:String})],Ji.prototype,"value",void 0),Zi([ce({attribute:!1})],Ji.prototype,"valueAsNumber",void 0),Zi([ce({type:String})],Ji.prototype,"placeholder",void 0),Zi([ce({type:String})],Ji.prototype,"type",void 0),Zi([ce({type:Boolean})],Ji.prototype,"required",void 0),Zi([ce({type:Boolean})],Ji.prototype,"disabled",void 0),Zi([ce({type:Boolean})],Ji.prototype,"readonly",void 0),Zi([ce({type:Number})],Ji.prototype,"minlength",void 0),Zi([ce({type:Number})],Ji.prototype,"maxlength",void 0),Zi([ce({type:String})],Ji.prototype,"pattern",void 0),Zi([ce({type:String})],Ji.prototype,"autocomplete",void 0),Zi([ce({type:String})],Ji.prototype,"hint",void 0),Zi([ce({type:Boolean,reflect:!0})],Ji.prototype,"dirty",void 0),Zi([ce({attribute:"save-mode"})],Ji.prototype,"saveMode",void 0),Zi([ce({type:Boolean,reflect:!0})],Ji.prototype,"saving",void 0),Zi([pe()],Ji.prototype,"_touched",void 0),Zi([ue("input")],Ji.prototype,"_input",void 0),customElements.get("krs-text-field")||customElements.define("krs-text-field",Ji);var Qi=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class Gi extends ne{static fromJSON(e){const t=new Gi;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=String(e.value)),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.min&&(t.min=e.min),void 0!==e.max&&(t.max=e.max),void 0!==e.step&&(t.step=e.step),void 0!==e.required&&(t.required=e.required),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.readonly&&(t.readonly=e.readonly),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyValue="",this.label="",this.name="",this.value="",this.valueAsNumber=null,this.placeholder="",this.required=!1,this.disabled=!1,this.readonly=!1,this.hint="",this.dirty=!1,this.saving=!1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){if((e.has("required")||e.has("value")||e.has("min")||e.has("max")||e.has("step"))&&this._updateValidity(),e.has("value")){const e=Number(this.value);""===this.value||Number.isNaN(e)?this.valueAsNumber=null:this.valueAsNumber=e}}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this.dirty=!1,this.saving=!1,this._internals.setFormValue(""),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e}focus(){this._input?.focus()}blur(){this._input?.blur()}select(){this._input?.select()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleInput(e){this.value=e.target.value,this.dirty=!0,this._dirtyValue=this.value,this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage)}render(){let e="";this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage);let t=N``;if(this.label){let e=N``;this.required&&(e=N`<span class="required" aria-hidden="true">*</span>`),t=N`
|
|
6021
|
+
<label for="input">
|
|
6022
|
+
${this.label}
|
|
6023
|
+
${e}
|
|
6024
|
+
</label>
|
|
6025
|
+
`}let i=N``;return e?i=N`<div class="validation-message">${e}</div>`:this.hint&&(i=N`<div class="hint">${this.hint}</div>`),N`
|
|
6021
6026
|
<div class="wrapper">
|
|
6022
|
-
${
|
|
6027
|
+
${t}
|
|
6028
|
+
<input
|
|
6029
|
+
id="input"
|
|
6030
|
+
class=${ye({"input--invalid":this._touched&&this._input&&!this._input.validity.valid})}
|
|
6031
|
+
type="number"
|
|
6032
|
+
name=${this.name}
|
|
6033
|
+
.value=${Xi(this.value)}
|
|
6034
|
+
placeholder=${this.placeholder}
|
|
6035
|
+
?required=${this.required}
|
|
6036
|
+
?disabled=${this.disabled}
|
|
6037
|
+
?readonly=${this.readonly}
|
|
6038
|
+
min=${Ki(this.min)}
|
|
6039
|
+
max=${Ki(this.max)}
|
|
6040
|
+
step=${Ki(this.step)}
|
|
6041
|
+
@input=${this._handleInput}
|
|
6042
|
+
@change=${this._handleChange}
|
|
6043
|
+
@blur=${this._handleBlur}
|
|
6044
|
+
/>
|
|
6045
|
+
${i}
|
|
6046
|
+
</div>
|
|
6047
|
+
`}}Gi.styles=a`
|
|
6048
|
+
:host {
|
|
6049
|
+
display: block;
|
|
6050
|
+
font-family: inherit;
|
|
6051
|
+
}
|
|
6052
|
+
|
|
6053
|
+
.wrapper {
|
|
6054
|
+
display: flex;
|
|
6055
|
+
flex-direction: column;
|
|
6056
|
+
gap: 6px;
|
|
6057
|
+
}
|
|
6058
|
+
|
|
6059
|
+
label {
|
|
6060
|
+
font-size: var(--kr-field-font-size, 14px);
|
|
6061
|
+
font-weight: 500;
|
|
6062
|
+
color: black;
|
|
6063
|
+
}
|
|
6064
|
+
|
|
6065
|
+
.required {
|
|
6066
|
+
color: var(--kr-number-field-required-color, #ef4444);
|
|
6067
|
+
margin-left: 0.125rem;
|
|
6068
|
+
}
|
|
6069
|
+
|
|
6070
|
+
input {
|
|
6071
|
+
font-family: inherit;
|
|
6072
|
+
font-size: var(--kr-field-font-size, 14px);
|
|
6073
|
+
line-height: var(--kr-field-line-height, 1.2);
|
|
6074
|
+
padding: var(--kr-field-padding, 10px 12px);
|
|
6075
|
+
border: 1px solid var(--kr-number-field-border-color, #0000003d);
|
|
6076
|
+
border-radius: 8px;
|
|
6077
|
+
background-color: var(--kr-number-field-bg, #fff);
|
|
6078
|
+
color: var(--kr-number-field-color, #111827);
|
|
6079
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
6080
|
+
}
|
|
6081
|
+
|
|
6082
|
+
input:focus {
|
|
6083
|
+
outline: none;
|
|
6084
|
+
border-color: var(--kr-number-field-focus-border-color, #163052);
|
|
6085
|
+
box-shadow: 0 0 0 3px var(--kr-number-field-focus-ring-color, rgba(22, 48, 82, 0.1));
|
|
6086
|
+
}
|
|
6087
|
+
|
|
6088
|
+
input:disabled {
|
|
6089
|
+
background-color: var(--kr-number-field-disabled-bg, #f3f4f6);
|
|
6090
|
+
color: var(--kr-number-field-disabled-color, #9ca3af);
|
|
6091
|
+
cursor: not-allowed;
|
|
6092
|
+
}
|
|
6093
|
+
|
|
6094
|
+
input::placeholder {
|
|
6095
|
+
color: var(--kr-number-field-placeholder-color, #9ca3af);
|
|
6096
|
+
}
|
|
6097
|
+
|
|
6098
|
+
input.input--invalid {
|
|
6099
|
+
border-color: var(--kr-number-field-error-border-color, #ef4444);
|
|
6100
|
+
}
|
|
6101
|
+
|
|
6102
|
+
input.input--invalid:focus {
|
|
6103
|
+
box-shadow: 0 0 0 3px var(--kr-number-field-error-ring-color, rgba(239, 68, 68, 0.1));
|
|
6104
|
+
}
|
|
6105
|
+
|
|
6106
|
+
.validation-message {
|
|
6107
|
+
font-size: 0.75rem;
|
|
6108
|
+
color: var(--kr-number-field-error-color, #ef4444);
|
|
6109
|
+
}
|
|
6110
|
+
|
|
6111
|
+
.hint {
|
|
6112
|
+
font-size: 0.75rem;
|
|
6113
|
+
color: var(--kr-number-field-helper-color, #6b7280);
|
|
6114
|
+
}
|
|
6115
|
+
`,Gi.formAssociated=!0,Qi([ce({type:String})],Gi.prototype,"label",void 0),Qi([ce({type:String})],Gi.prototype,"name",void 0),Qi([ce({type:String})],Gi.prototype,"value",void 0),Qi([ce({attribute:!1})],Gi.prototype,"valueAsNumber",void 0),Qi([ce({type:String})],Gi.prototype,"placeholder",void 0),Qi([ce({type:Number})],Gi.prototype,"min",void 0),Qi([ce({type:Number})],Gi.prototype,"max",void 0),Qi([ce({type:String})],Gi.prototype,"step",void 0),Qi([ce({type:Boolean})],Gi.prototype,"required",void 0),Qi([ce({type:Boolean})],Gi.prototype,"disabled",void 0),Qi([ce({type:Boolean})],Gi.prototype,"readonly",void 0),Qi([ce({type:String})],Gi.prototype,"hint",void 0),Qi([ce({type:Boolean,reflect:!0})],Gi.prototype,"dirty",void 0),Qi([ce({attribute:"save-mode"})],Gi.prototype,"saveMode",void 0),Qi([ce({type:Boolean,reflect:!0})],Gi.prototype,"saving",void 0),Qi([pe()],Gi.prototype,"_touched",void 0),Qi([ue("input")],Gi.prototype,"_input",void 0),customElements.get("krs-number-field")||customElements.define("krs-number-field",Gi);var es=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ts extends ne{static fromJSON(e){const t=new ts;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.required&&(t.required=e.required),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.readonly&&(t.readonly=e.readonly),void 0!==e.rows&&(t.rows=e.rows),void 0!==e.cols&&(t.cols=e.cols),void 0!==e.minlength&&(t.minlength=e.minlength),void 0!==e.maxlength&&(t.maxlength=e.maxlength),void 0!==e.autocomplete&&(t.autocomplete=e.autocomplete),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyValue="",this.label="",this.name="",this.value="",this.placeholder="",this.required=!1,this.disabled=!1,this.readonly=!1,this.rows=3,this.autocomplete="",this.hint="",this.dirty=!1,this.saving=!1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this.dirty=!1,this.saving=!1,this._internals.setFormValue(""),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e}focus(){this._textarea?.focus()}blur(){this._textarea?.blur()}select(){this._textarea?.select()}_updateValidity(){this._textarea&&this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}_handleInput(e){this.value=e.target.value,this.dirty=!0,this._dirtyValue=this.value,this._internals.setFormValue(this.value),this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}_handleChange(e){this.value=e.target.value,this._internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}_handleBlur(){this._touched=!0,this._internals.setValidity(this._textarea.validity,this._textarea.validationMessage)}render(){let e="";return this._touched&&this._textarea&&!this._textarea.validity.valid&&(e=this._textarea.validationMessage),N`
|
|
6116
|
+
<div class="wrapper">
|
|
6117
|
+
${this.label?N`
|
|
6023
6118
|
<label for="textarea">
|
|
6024
6119
|
${this.label}
|
|
6025
|
-
${this.required?
|
|
6120
|
+
${this.required?N`<span class="required" aria-hidden="true">*</span>`:U}
|
|
6026
6121
|
</label>
|
|
6027
6122
|
`:U}
|
|
6028
6123
|
<textarea
|
|
@@ -6043,9 +6138,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6043
6138
|
@change=${this._handleChange}
|
|
6044
6139
|
@blur=${this._handleBlur}
|
|
6045
6140
|
></textarea>
|
|
6046
|
-
${e?
|
|
6141
|
+
${e?N`<div class="validation-message">${e}</div>`:this.hint?N`<div class="hint">${this.hint}</div>`:U}
|
|
6047
6142
|
</div>
|
|
6048
|
-
`}}
|
|
6143
|
+
`}}ts.styles=a`
|
|
6049
6144
|
:host {
|
|
6050
6145
|
display: block;
|
|
6051
6146
|
font-family: inherit;
|
|
@@ -6115,12 +6210,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6115
6210
|
font-size: 0.75rem;
|
|
6116
6211
|
color: var(--kr-textarea-field-helper-color, #6b7280);
|
|
6117
6212
|
}
|
|
6118
|
-
`,
|
|
6213
|
+
`,ts.formAssociated=!0,es([ce({type:String})],ts.prototype,"label",void 0),es([ce({type:String})],ts.prototype,"name",void 0),es([ce({type:String})],ts.prototype,"value",void 0),es([ce({type:String})],ts.prototype,"placeholder",void 0),es([ce({type:Boolean})],ts.prototype,"required",void 0),es([ce({type:Boolean})],ts.prototype,"disabled",void 0),es([ce({type:Boolean})],ts.prototype,"readonly",void 0),es([ce({type:Number})],ts.prototype,"rows",void 0),es([ce({type:Number})],ts.prototype,"cols",void 0),es([ce({type:Number})],ts.prototype,"minlength",void 0),es([ce({type:Number})],ts.prototype,"maxlength",void 0),es([ce({type:String})],ts.prototype,"autocomplete",void 0),es([ce({type:String})],ts.prototype,"hint",void 0),es([ce({type:Boolean,reflect:!0})],ts.prototype,"dirty",void 0),es([ce({attribute:"save-mode"})],ts.prototype,"saveMode",void 0),es([ce({type:Boolean,reflect:!0})],ts.prototype,"saving",void 0),es([pe()],ts.prototype,"_touched",void 0),es([ue("textarea")],ts.prototype,"_textarea",void 0),customElements.get("krs-textarea-field")||customElements.define("krs-textarea-field",ts);var is=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ss extends ne{constructor(){super(...arguments),this.label="",this.value=""}static fromJSON(e){const t=new ss;return void 0!==e.label&&(t.label=e.label),void 0!==e.value&&(t.value=e.value),t}render(){let e=!1;""!==this.value&&null!==this.value&&void 0!==this.value||(e=!0);let t=this.value;return e&&(t="None"),N`
|
|
6119
6214
|
<div class="wrapper">
|
|
6120
|
-
${this.label?
|
|
6215
|
+
${this.label?N`<label>${this.label}</label>`:U}
|
|
6121
6216
|
<div class=${ye({value:!0,"value--empty":e})}>${t}</div>
|
|
6122
6217
|
</div>
|
|
6123
|
-
`}}
|
|
6218
|
+
`}}ss.styles=a`
|
|
6124
6219
|
:host {
|
|
6125
6220
|
display: block;
|
|
6126
6221
|
font-family: inherit;
|
|
@@ -6146,7 +6241,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6146
6241
|
.value--empty {
|
|
6147
6242
|
font-style: italic;
|
|
6148
6243
|
}
|
|
6149
|
-
`,
|
|
6244
|
+
`,is([ce({type:String})],ss.prototype,"label",void 0),is([ce({type:String})],ss.prototype,"value",void 0),customElements.get("krs-detail-field")||customElements.define("krs-detail-field",ss);var os=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class rs extends ne{static fromJSON(e){const t=new rs;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.readonly&&(t.readonly=e.readonly),void 0!==e.required&&(t.required=e.required),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.options&&(t.options=e.options),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyValue="",this._requestId=0,this.label="",this.name="",this.value="",this.placeholder="",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.options=[],this.fetch=null,this.dirty=!1,this.saving=!1,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._handleDocumentClick=e=>{e.composedPath().includes(this)||(this._isOpen=!1)},this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity(),e.has("options")&&this._isOpen&&this._positionDropdown()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this.dirty=!1,this.saving=!1,this._isOpen=!1,this._highlightedIndex=-1,this._internals.setFormValue(""),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage)}_fetch(){if(!this.fetch)return;this._requestId++;const e=this._requestId;this.fetch(this.value).then((t=>{e===this._requestId&&(this.options=t)})).catch((e=>{console.error("krs-auto-suggest: fetch failed",e)}))}_handleInput(e){this.value=e.target.value,this.dirty=!0,this._dirtyValue=this.value,this._isOpen=!0,this._highlightedIndex=-1,this._positionDropdown(),this._internals.setFormValue(this.value),this._internals.setValidity(this._input.validity,this._input.validationMessage),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._fetch()}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._input.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8,s=t.top-4-8;e.style.left=t.left+"px",e.style.width=t.width+"px",s>i?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.maxHeight=s+"px"):(e.style.bottom="",e.style.top=t.bottom+4+"px",e.style.maxHeight=i+"px")}))}_handleFocus(){this._isOpen=!0,this._positionDropdown(),this._fetch()}_handleBlur(){this._touched=!0,this._internals.setValidity(this._input.validity,this._input.validationMessage),setTimeout((()=>{this._isOpen=!1,this._highlightedIndex=-1}),200)}_handleKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._isOpen=!0,this._highlightedIndex=Math.min(this._highlightedIndex+1,this.options.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),-1===this._highlightedIndex?(this._isOpen=!0,this._highlightedIndex=this.options.length-1):this._highlightedIndex=Math.max(this._highlightedIndex-1,0),this._scrollToHighlighted();break;case"Enter":this._highlightedIndex>=0&&this.options[this._highlightedIndex]&&(e.preventDefault(),this._selectOption(this.options[this._highlightedIndex]));break;case"Escape":e.preventDefault(),this._isOpen=!1,this._highlightedIndex=-1;break;case"Tab":this._isOpen=!1,this._highlightedIndex=-1}}_scrollToHighlighted(){this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".dropdown"),t=this.shadowRoot?.querySelector(".option--highlighted");if(e&&t){const i=e.getBoundingClientRect(),s=t.getBoundingClientRect();(s.bottom>i.bottom||s.top<i.top)&&t.scrollIntoView({block:"nearest"})}}))}_selectOption(e){e.disabled||(this.value=e.value,this.dirty=!0,this._dirtyValue=this.value,this._isOpen=!1,this._highlightedIndex=-1,this._internals.setFormValue(this.value),this.dispatchEvent(new CustomEvent("select",{detail:{value:e.value,option:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleClear(){this.value="",this.dirty=!0,this._dirtyValue=this.value,this._internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._input?.focus()}_handleOptionMouseEnter(e,t){this._highlightedIndex=t}_renderOption(e,t){return N`
|
|
6150
6245
|
<button
|
|
6151
6246
|
class=${ye({option:!0,"option--highlighted":t===this._highlightedIndex})}
|
|
6152
6247
|
type="button"
|
|
@@ -6158,12 +6253,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6158
6253
|
>
|
|
6159
6254
|
${e.label||e.value}
|
|
6160
6255
|
</button>
|
|
6161
|
-
`}render(){let e=U;return this._touched&&this._input&&!this._input.validity.valid?e=
|
|
6256
|
+
`}render(){let e=U;return this._touched&&this._input&&!this._input.validity.valid?e=N`<div class="validation-message">${this._input.validationMessage}</div>`:this.hint&&(e=N`<div class="hint">${this.hint}</div>`),N`
|
|
6162
6257
|
<div class="wrapper">
|
|
6163
|
-
${this.label?
|
|
6258
|
+
${this.label?N`
|
|
6164
6259
|
<label>
|
|
6165
6260
|
${this.label}
|
|
6166
|
-
${this.required?
|
|
6261
|
+
${this.required?N`<span class="required">*</span>`:U}
|
|
6167
6262
|
</label>
|
|
6168
6263
|
`:U}
|
|
6169
6264
|
|
|
@@ -6188,7 +6283,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6188
6283
|
@keydown=${this._handleKeyDown}
|
|
6189
6284
|
/>
|
|
6190
6285
|
<div class="icon-wrapper">
|
|
6191
|
-
${!this.value||this.disabled||this.readonly?U:
|
|
6286
|
+
${!this.value||this.disabled||this.readonly?U:N`
|
|
6192
6287
|
<svg
|
|
6193
6288
|
class="clear"
|
|
6194
6289
|
viewBox="0 0 24 24"
|
|
@@ -6199,7 +6294,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6199
6294
|
<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"/>
|
|
6200
6295
|
</svg>
|
|
6201
6296
|
`}
|
|
6202
|
-
${this.value||this.disabled||this.readonly?U:
|
|
6297
|
+
${this.value||this.disabled||this.readonly?U:N`
|
|
6203
6298
|
<svg
|
|
6204
6299
|
class="search-icon"
|
|
6205
6300
|
viewBox="0 0 24 24"
|
|
@@ -6221,7 +6316,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6221
6316
|
|
|
6222
6317
|
${e}
|
|
6223
6318
|
</div>
|
|
6224
|
-
`}}
|
|
6319
|
+
`}}rs.styles=a`
|
|
6225
6320
|
:host {
|
|
6226
6321
|
display: block;
|
|
6227
6322
|
font-family: inherit;
|
|
@@ -6380,7 +6475,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6380
6475
|
font-size: 0.75rem;
|
|
6381
6476
|
color: var(--kr-text-field-error-color, #ef4444);
|
|
6382
6477
|
}
|
|
6383
|
-
`,
|
|
6478
|
+
`,rs.formAssociated=!0,os([ce({type:String})],rs.prototype,"label",void 0),os([ce({type:String})],rs.prototype,"name",void 0),os([ce({type:String})],rs.prototype,"value",void 0),os([ce({type:String})],rs.prototype,"placeholder",void 0),os([ce({type:Boolean})],rs.prototype,"disabled",void 0),os([ce({type:Boolean})],rs.prototype,"readonly",void 0),os([ce({type:Boolean})],rs.prototype,"required",void 0),os([ce({type:String})],rs.prototype,"hint",void 0),os([ce({type:Array})],rs.prototype,"options",void 0),os([ce({attribute:!1})],rs.prototype,"fetch",void 0),os([ce({type:Boolean,reflect:!0})],rs.prototype,"dirty",void 0),os([ce({attribute:"save-mode"})],rs.prototype,"saveMode",void 0),os([ce({type:Boolean,reflect:!0})],rs.prototype,"saving",void 0),os([pe()],rs.prototype,"_isOpen",void 0),os([pe()],rs.prototype,"_highlightedIndex",void 0),os([pe()],rs.prototype,"_touched",void 0),os([ue("input")],rs.prototype,"_input",void 0),customElements.get("krs-auto-suggest")||customElements.define("krs-auto-suggest",rs);var as=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ns extends ne{static fromJSON(e){const t=new ns;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.multiple&&(t.multiple=e.multiple),void 0!==e.clearable&&(t.clearable=e.clearable),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.readonly&&(t.readonly=e.readonly),void 0!==e.required&&(t.required=e.required),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.optionValue&&(t.optionValue=e.optionValue),void 0!==e.optionLabel&&(t.optionLabel=e.optionLabel),void 0!==e.options&&(t.options=e.options),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyValue="",this._requestId=0,this._selectedOption=null,this._selectedOptions=new Map,this.label="",this.name="",this.value="",this.multiple=!1,this.clearable=!1,this.placeholder="Select an option",this.disabled=!1,this.readonly=!1,this.required=!1,this.hint="",this.optionValue="value",this.optionLabel="label",this.options=[],this.fetch=null,this.fetchSelection=null,this.dirty=!1,this.saving=!1,this._isOpen=!1,this._highlightedIndex=-1,this._touched=!1,this._searchQuery="",this._handleDocumentClick=e=>{e.composedPath().includes(this)||this._close()},this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),document.addEventListener("click",this._handleDocumentClick),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity(),this._resolveSelection()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity(),e.has("value")&&(this.multiple?this._resolveSelection():this.value?this._selectedOption&&this._getOptionValue(this._selectedOption)===this.value||this._resolveSelection():this._selectedOption=null),e.has("options")&&this._isOpen&&this._positionDropdown()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.multiple?this.value=[]:this.value="",this._selectedOption=null,this._selectedOptions.clear(),this._touched=!1,this.dirty=!1,this.saving=!1,this._isOpen=!1,this._highlightedIndex=-1,this._searchQuery="",this._internals.setFormValue(""),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e}focus(){this._triggerElement?.focus()}blur(){this._triggerElement?.blur()}_updateValidity(){let e=!this.value;this.multiple&&(e=!Array.isArray(this.value)||0===this.value.length),this.required&&e?this._internals.setValidity({valueMissing:!0},"Please select an option",this._triggerElement):this._internals.setValidity({})}_handleTriggerClick(){this.disabled||this.readonly||(this._isOpen?this._close():this._open())}_open(){this._isOpen=!0,this._searchQuery="",this._highlightedIndex=-1,this._fetch(),this.updateComplete.then((()=>{this._positionDropdown(),this._searchInput&&this._searchInput.focus()}))}_close(){this._isOpen=!1,this._highlightedIndex=-1,this._searchQuery=""}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._triggerElement.getBoundingClientRect(),i=window.innerHeight-t.bottom-4-8,s=t.top-4-8;e.style.left=t.left+"px",e.style.width=t.width+"px",i<200&&s>i?(e.style.top="",e.style.bottom=window.innerHeight-t.top+4+"px",e.style.maxHeight=s+"px"):(e.style.bottom="",e.style.top=t.bottom+4+"px",e.style.maxHeight=i+"px")}))}_fetch(){if(!this.fetch)return;this._requestId++;const e=this._requestId;this.fetch(this._searchQuery).then((t=>{e===this._requestId&&(this.options=t)})).catch((e=>{console.error("krs-combo-box: fetch failed",e)}))}_handleSearchInput(e){this._searchQuery=e.target.value,this._highlightedIndex=-1,this._fetch()}_handleSearchKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._highlightedIndex=Math.min(this._highlightedIndex+1,this.options.length-1),this._scrollToHighlighted();break;case"ArrowUp":e.preventDefault(),-1===this._highlightedIndex?this._highlightedIndex=this.options.length-1:this._highlightedIndex=Math.max(this._highlightedIndex-1,0),this._scrollToHighlighted();break;case"Enter":e.preventDefault(),this._highlightedIndex>=0&&this.options[this._highlightedIndex]&&this._selectOption(this.options[this._highlightedIndex]);break;case"Escape":e.preventDefault(),this._close(),this._triggerElement?.focus();break;case"Tab":this._close()}}_handleTriggerKeyDown(e){"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._isOpen||this._open())}_handleTriggerBlur(){this._touched=!0,this._updateValidity()}_scrollToHighlighted(){this.updateComplete.then((()=>{const e=this.shadowRoot?.querySelector(".options"),t=this.shadowRoot?.querySelector(".option--highlighted");if(e&&t){const i=e.getBoundingClientRect(),s=t.getBoundingClientRect();(s.bottom>i.bottom||s.top<i.top)&&t.scrollIntoView({block:"nearest"})}}))}_getOptionValue(e){return"function"==typeof this.optionValue?this.optionValue(e):e[this.optionValue]}_getOptionLabel(e){let t;return t="function"==typeof this.optionLabel?this.optionLabel(e):e[this.optionLabel],t||this._getOptionValue(e)}_resolveSelection(){if(!this.fetchSelection)return;if(this.multiple){if(!Array.isArray(this.value))return;for(const e of this.value)this._selectedOptions.has(e)||this.fetchSelection(e).then((t=>{t&&Array.isArray(this.value)&&this.value.includes(e)&&(this._selectedOptions.set(e,t),this.requestUpdate())})).catch((e=>{console.error("krs-combo-box: fetchSelection failed",e)}));return}if(!this.value)return;const e=this.value;this.fetchSelection(this.value).then((t=>{this.value===e&&t&&(this._selectedOption=t,this.requestUpdate())})).catch((e=>{console.error("krs-combo-box: fetchSelection failed",e)}))}_selectOption(e){if(e.disabled)return;this.dirty=!0;const t=this._getOptionValue(e);if(this.multiple){let i=[];Array.isArray(this.value)&&(i=this.value);const s=i.indexOf(t);s>=0?(i.splice(s,1),this._selectedOptions.delete(t)):(i.push(t),this._selectedOptions.set(t,e)),this.value=i,this._dirtyValue=i,this.requestUpdate();const o=new FormData;if(this.name)for(const e of i)o.append(this.name,e);return this._internals.setFormValue(o),this._updateValidity(),this.dispatchEvent(new CustomEvent("select",{detail:{option:e,value:i},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),void this._searchInput?.focus()}this.value=t,this._dirtyValue=t,this._selectedOption=e,this._close(),this._internals.setFormValue(t),this._updateValidity(),this.dispatchEvent(new CustomEvent("select",{detail:{option:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._triggerElement?.focus()}_handleClearClick(e){e.stopPropagation(),this.dirty=!0,this.value="",this._dirtyValue="",this._selectedOption=null,this._internals.setFormValue(""),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._triggerElement?.focus()}_handleCheckboxClick(e,t){e.stopPropagation(),this._selectOption(t)}_handleOptionMouseEnter(e,t){this._highlightedIndex=t}_renderOption(e,t){const i=this._getOptionValue(e);let s=i===this.value;return this.multiple&&(s=Array.isArray(this.value)&&this.value.includes(i)),N`
|
|
6384
6479
|
<button
|
|
6385
6480
|
class=${ye({option:!0,"option--highlighted":t===this._highlightedIndex,"option--selected":s})}
|
|
6386
6481
|
type="button"
|
|
@@ -6390,7 +6485,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6390
6485
|
@click=${t=>this._selectOption(e)}
|
|
6391
6486
|
@mouseenter=${e=>this._handleOptionMouseEnter(e,t)}
|
|
6392
6487
|
>
|
|
6393
|
-
${this.multiple?
|
|
6488
|
+
${this.multiple?N`
|
|
6394
6489
|
<krs-checkbox
|
|
6395
6490
|
class="option__checkbox"
|
|
6396
6491
|
.checked=${s}
|
|
@@ -6400,12 +6495,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6400
6495
|
`:U}
|
|
6401
6496
|
${this._getOptionLabel(e)}
|
|
6402
6497
|
</button>
|
|
6403
|
-
`}render(){let e=!!this._selectedOption,t=this.placeholder;if(this.multiple){let i=[];Array.isArray(this.value)&&(i=this.value),e=i.length>0,e&&(t=i.map((e=>{const t=this._selectedOptions.get(e);return t?this._getOptionLabel(t):e})).join(", "))}else this._selectedOption?t=this._getOptionLabel(this._selectedOption):this.value&&!this.fetchSelection&&(e=!0,t=this.value);let i=U;return this._touched&&this.required&&!e?i=
|
|
6498
|
+
`}render(){let e=!!this._selectedOption,t=this.placeholder;if(this.multiple){let i=[];Array.isArray(this.value)&&(i=this.value),e=i.length>0,e&&(t=i.map((e=>{const t=this._selectedOptions.get(e);return t?this._getOptionLabel(t):e})).join(", "))}else this._selectedOption?t=this._getOptionLabel(this._selectedOption):this.value&&!this.fetchSelection&&(e=!0,t=this.value);let i=U;return this._touched&&this.required&&!e?i=N`<div class="validation-message">Please select an option</div>`:this.hint&&(i=N`<div class="hint">${this.hint}</div>`),N`
|
|
6404
6499
|
<div class="wrapper">
|
|
6405
|
-
${this.label?
|
|
6500
|
+
${this.label?N`
|
|
6406
6501
|
<label>
|
|
6407
6502
|
${this.label}
|
|
6408
|
-
${this.required?
|
|
6503
|
+
${this.required?N`<span class="required">*</span>`:U}
|
|
6409
6504
|
</label>
|
|
6410
6505
|
`:U}
|
|
6411
6506
|
|
|
@@ -6422,7 +6517,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6422
6517
|
<span class=${ye({trigger__value:!0,trigger__placeholder:!e})}>
|
|
6423
6518
|
${t}
|
|
6424
6519
|
</span>
|
|
6425
|
-
${!this.clearable||this.multiple||!e||this.disabled||this.readonly?U:
|
|
6520
|
+
${!this.clearable||this.multiple||!e||this.disabled||this.readonly?U:N`
|
|
6426
6521
|
<svg
|
|
6427
6522
|
class="trigger__clear"
|
|
6428
6523
|
viewBox="0 0 24 24"
|
|
@@ -6467,13 +6562,13 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6467
6562
|
</div>
|
|
6468
6563
|
|
|
6469
6564
|
<div class="options">
|
|
6470
|
-
${0===this.options.length?
|
|
6565
|
+
${0===this.options.length?N`<div class="empty">No options found</div>`:this.options.map(((e,t)=>this._renderOption(e,t)))}
|
|
6471
6566
|
</div>
|
|
6472
6567
|
</div>
|
|
6473
6568
|
|
|
6474
6569
|
${i}
|
|
6475
6570
|
</div>
|
|
6476
|
-
`}}
|
|
6571
|
+
`}}ns.styles=a`
|
|
6477
6572
|
:host {
|
|
6478
6573
|
display: block;
|
|
6479
6574
|
font-family: inherit;
|
|
@@ -6704,12 +6799,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6704
6799
|
font-size: 0.75rem;
|
|
6705
6800
|
color: var(--kr-text-field-error-color, #ef4444);
|
|
6706
6801
|
}
|
|
6707
|
-
`,
|
|
6802
|
+
`,ns.formAssociated=!0,as([ce({type:String})],ns.prototype,"label",void 0),as([ce({type:String})],ns.prototype,"name",void 0),as([ce({type:String})],ns.prototype,"value",void 0),as([ce({type:Boolean})],ns.prototype,"multiple",void 0),as([ce({type:Boolean})],ns.prototype,"clearable",void 0),as([ce({type:String})],ns.prototype,"placeholder",void 0),as([ce({type:Boolean})],ns.prototype,"disabled",void 0),as([ce({type:Boolean})],ns.prototype,"readonly",void 0),as([ce({type:Boolean})],ns.prototype,"required",void 0),as([ce({type:String})],ns.prototype,"hint",void 0),as([ce({attribute:"option-value"})],ns.prototype,"optionValue",void 0),as([ce({attribute:"option-label"})],ns.prototype,"optionLabel",void 0),as([ce({type:Array})],ns.prototype,"options",void 0),as([ce({attribute:!1})],ns.prototype,"fetch",void 0),as([ce({attribute:!1})],ns.prototype,"fetchSelection",void 0),as([ce({type:Boolean,reflect:!0})],ns.prototype,"dirty",void 0),as([ce({attribute:"save-mode"})],ns.prototype,"saveMode",void 0),as([ce({type:Boolean,reflect:!0})],ns.prototype,"saving",void 0),as([pe()],ns.prototype,"_isOpen",void 0),as([pe()],ns.prototype,"_highlightedIndex",void 0),as([pe()],ns.prototype,"_touched",void 0),as([pe()],ns.prototype,"_searchQuery",void 0),as([ue(".trigger")],ns.prototype,"_triggerElement",void 0),as([ue(".search__input")],ns.prototype,"_searchInput",void 0),customElements.get("krs-combo-box")||customElements.define("krs-combo-box",ns);var ls=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ds extends ne{static fromJSON(e){const t=new ds;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.options&&(t.options=e.options),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.required&&(t.required=e.required),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.direction&&(t.direction=e.direction),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyValue="",this._focusedIndex=-1,this.label="",this.name="",this.value="",this.options=[],this.disabled=!1,this.required=!1,this.hint="",this.direction="row",this.dirty=!1,this.saving=!1,this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){(e.has("required")||e.has("value"))&&this._updateValidity()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value="",this._touched=!1,this.dirty=!1,this.saving=!1,this._internals.setFormValue(""),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e}_updateValidity(){this.required&&!this.value?this._internals.setValidity({valueMissing:!0},"Please select an option"):this._internals.setValidity({})}_handleCardClick(e,t){this.disabled||t.disabled||(this.value=t.value,this._touched=!0,this.dirty=!0,this._dirtyValue=this.value,this._internals.setFormValue(this.value),this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleKeyDown(e,t){if(this.disabled)return;if(" "===e.key||"Enter"===e.key)return e.preventDefault(),void(this.options[t].disabled||this._handleCardClick(e,this.options[t]));let i=-1;if("row"===this.direction?"ArrowRight"===e.key?i=this._findNextEnabledIndex(t,1):"ArrowLeft"===e.key&&(i=this._findNextEnabledIndex(t,-1)):"ArrowDown"===e.key?i=this._findNextEnabledIndex(t,1):"ArrowUp"===e.key&&(i=this._findNextEnabledIndex(t,-1)),i>=0){e.preventDefault(),this._focusedIndex=i;const t=this.shadowRoot?.querySelectorAll(".card");t[i]&&t[i].focus()}}_findNextEnabledIndex(e,t){let i=e+t;for(;i>=0&&i<this.options.length;){if(!this.options[i].disabled)return i;i+=t}return-1}render(){return N`
|
|
6708
6803
|
<div class="wrapper">
|
|
6709
|
-
${this.label?
|
|
6804
|
+
${this.label?N`
|
|
6710
6805
|
<label>
|
|
6711
6806
|
${this.label}
|
|
6712
|
-
${this.required?
|
|
6807
|
+
${this.required?N`<span class="required" aria-hidden="true">*</span>`:U}
|
|
6713
6808
|
</label>
|
|
6714
6809
|
`:U}
|
|
6715
6810
|
<div
|
|
@@ -6717,7 +6812,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6717
6812
|
role="radiogroup"
|
|
6718
6813
|
aria-label=${this.label}
|
|
6719
6814
|
>
|
|
6720
|
-
${this.options.map(((e,t)=>{const i=e.value===this.value,s=this.disabled||!!e.disabled;return
|
|
6815
|
+
${this.options.map(((e,t)=>{const i=e.value===this.value,s=this.disabled||!!e.disabled;return N`
|
|
6721
6816
|
<div
|
|
6722
6817
|
class=${ye({card:!0,"card--selected":i,"card--disabled":s})}
|
|
6723
6818
|
role="radio"
|
|
@@ -6728,18 +6823,18 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6728
6823
|
@keydown=${e=>this._handleKeyDown(e,t)}
|
|
6729
6824
|
>
|
|
6730
6825
|
<div class="card__radio">
|
|
6731
|
-
${i?
|
|
6826
|
+
${i?N`<div class="card__radio-dot"></div>`:U}
|
|
6732
6827
|
</div>
|
|
6733
6828
|
<div class="card__content">
|
|
6734
6829
|
<div class="card__label">${e.label}</div>
|
|
6735
|
-
${e.description?
|
|
6830
|
+
${e.description?N`<div class="card__description">${e.description}</div>`:U}
|
|
6736
6831
|
</div>
|
|
6737
6832
|
</div>
|
|
6738
6833
|
`}))}
|
|
6739
6834
|
</div>
|
|
6740
|
-
${this._touched&&this.required&&!this.value?
|
|
6835
|
+
${this._touched&&this.required&&!this.value?N`<div class="validation-message">Please select an option</div>`:this.hint?N`<div class="hint">${this.hint}</div>`:U}
|
|
6741
6836
|
</div>
|
|
6742
|
-
`}}
|
|
6837
|
+
`}}ds.styles=[Ut,a`
|
|
6743
6838
|
:host {
|
|
6744
6839
|
display: block;
|
|
6745
6840
|
font-family: inherit;
|
|
@@ -6862,26 +6957,26 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6862
6957
|
font-size: 0.75rem;
|
|
6863
6958
|
color: var(--kr-radio-cards-error-color, #ef4444);
|
|
6864
6959
|
}
|
|
6865
|
-
`],ns.formAssociated=!0,as([ce({type:String})],ns.prototype,"label",void 0),as([ce({type:String})],ns.prototype,"name",void 0),as([ce({type:String})],ns.prototype,"value",void 0),as([ce({attribute:!1})],ns.prototype,"options",void 0),as([ce({type:Boolean})],ns.prototype,"disabled",void 0),as([ce({type:Boolean})],ns.prototype,"required",void 0),as([ce({type:String})],ns.prototype,"hint",void 0),as([ce({type:String})],ns.prototype,"direction",void 0),as([ce({type:Boolean,reflect:!0})],ns.prototype,"dirty",void 0),as([ce({attribute:"save-mode"})],ns.prototype,"saveMode",void 0),as([ce({type:Boolean,reflect:!0})],ns.prototype,"saving",void 0),as([pe()],ns.prototype,"_touched",void 0),customElements.get("krs-radio-cards")||customElements.define("krs-radio-cards",ns);var ls=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class ds extends ne{static fromJSON(e){const t=new ds;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.required&&(t.required=e.required),void 0!==e.readonly&&(t.readonly=e.readonly),void 0!==e.min&&(t.min=e.min),void 0!==e.max&&(t.max=e.max),void 0!==e.format&&(t.format=e.format),void 0!==e.step&&(t.step=e.step),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.disableWeekends&&(t.disableWeekends=e.disableWeekends),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyValue="",this._defaultValue="",this.valueAsDate=null,this.valueAsNumber=NaN,this.label="",this.name="",this.value="",this.placeholder="",this.disabled=!1,this.required=!1,this.readonly=!1,this.min="",this.max="",this.format="YYYY-MM-DD",this.step=1,this.hint="",this.disableWeekends=!1,this.dirty=!1,this.saving=!1,this._isOpen=!1,this._viewYear=(new Date).getFullYear(),this._viewMonth=(new Date).getMonth(),this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._handleClickOutside=e=>{e.composedPath().includes(this)||(this._isOpen=!1)},this._handleKeyDown=e=>{this._isOpen&&"Escape"===e.key&&(this._isOpen=!1,this._inputElement?.focus())},this._handleScroll=()=>{this._isOpen&&this._positionDropdown()},this._internals=this.attachInternals()}connectedCallback(){if(super.connectedCallback(),this.classList.add("kr-form-field"),document.addEventListener("click",this._handleClickOutside),document.addEventListener("keydown",this._handleKeyDown),document.addEventListener("scroll",this._handleScroll,{passive:!0,capture:!0}),this.addEventListener("invalid",this._handleInvalid),this.value){const e=this._parseDate(this.value);e&&(this.valueAsDate=e,this.valueAsNumber=e.getTime())}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleClickOutside),document.removeEventListener("keydown",this._handleKeyDown),document.removeEventListener("scroll",this._handleScroll,!0),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._defaultValue=this.value}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){if(e.has("value"))if(this.value){const e=this._parseDate(this.value);e?(this.valueAsDate=e,this.valueAsNumber=e.getTime()):(this.value="",this.valueAsDate=null,this.valueAsNumber=NaN)}else this.valueAsDate=null,this.valueAsNumber=NaN;(e.has("value")||e.has("disabled"))&&this._updateFormValue(),(e.has("required")||e.has("value")||e.has("min")||e.has("max")||e.has("step"))&&this._updateValidity()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value=this._defaultValue,this.valueAsDate=this._parseDate(this._defaultValue),this.valueAsDate?this.valueAsNumber=this.valueAsDate.getTime():this.valueAsNumber=NaN,this._touched=!1,this.dirty=!1,this.saving=!1,this._updateFormValue(),this._updateValidity()}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e,this.valueAsDate=this._parseDate(e),this.valueAsDate?this.valueAsNumber=this.valueAsDate.getTime():this.valueAsNumber=NaN}focus(){this._inputElement?.focus()}blur(){this._inputElement?.blur()}_handleCalendarClick(){if(!this.disabled&&!this.readonly)if(this._isOpen)this._isOpen=!1;else{const e=this._parseDate(this.value||this.min);e&&(this._viewYear=e.getFullYear(),this._viewMonth=e.getMonth()),this._isOpen=!0,this._positionDropdown()}}_handleInputChange(e){this.dirty=!0,this._dirtyValue=this.value;const t=e.target.value.trim();if(!t)return this.value="",this.valueAsDate=null,this.valueAsNumber=NaN,this._dirtyValue=this.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const i=this._parseDate(t);i&&(this.value=this._formatValue(i),this.valueAsDate=i,this.valueAsNumber=i.getTime(),this._dirtyValue=this.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleInputKeydown(e){if("Enter"===e.key){this.dirty=!0,this._dirtyValue=this.value;const t=e.target.value.trim();if(t){const e=this._parseDate(t);e&&(this.value=this._formatValue(e),this.valueAsDate=e,this.valueAsNumber=e.getTime(),this._dirtyValue=this.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}else this.value="",this.valueAsDate=null,this.valueAsNumber=NaN,this._dirtyValue=this.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}}_handleBlur(e){const t=e.relatedTarget;if(!t||!this.shadowRoot?.contains(t)){if(this._touched=!0,this._inputElement){const e=this._inputElement.value.trim();if(e){const t=this._parseDate(e);t?(this.value=this._formatValue(t),this.valueAsDate=t,this.valueAsNumber=t.getTime()):this.requestUpdate()}else this.value="",this.valueAsDate=null,this.valueAsNumber=NaN}this._updateValidity()}}_handlePrevMonth(){0===this._viewMonth?(this._viewMonth=11,this._viewYear--):this._viewMonth--}_handleNextMonth(){11===this._viewMonth?(this._viewMonth=0,this._viewYear++):this._viewMonth++}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._triggerElement.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.left=t.left+"px"}))}_isDateDisabled(e){if(this.min){if(e<new Date(this.min+"T00:00:00"))return!0}if(this.max){if(e>new Date(this.max+"T00:00:00"))return!0}if(this.disableWeekends){const t=e.getDay();if(0===t||6===t)return!0}return!!this.isDateDisabled&&this.isDateDisabled(e)}_selectDate(e){this._isDateDisabled(e)||this.readonly||(this.value=this._formatValue(e),this.valueAsDate=e,this.valueAsNumber=e.getTime(),this.dirty=!0,this._dirtyValue=this.value,this._isOpen=!1,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._inputElement?.focus())}_updateFormValue(){this.disabled?this._internals.setFormValue(null):this._internals.setFormValue(this.value)}_updateValidity(){if(!this.required||this.value){if(this.value&&this.valueAsDate){if(this.min){const e=this._parseDate(this.min);if(e&&this.valueAsDate<e)return void this._internals.setValidity({rangeUnderflow:!0},`Value must be ${this.min} or later`,this._triggerElement)}if(this.max){const e=this._parseDate(this.max);if(e&&this.valueAsDate>e)return void this._internals.setValidity({rangeOverflow:!0},`Value must be ${this.max} or earlier`,this._triggerElement)}if(this.step>1&&this.min){const e=this._parseDate(this.min);if(e){const t=Math.round((this.valueAsDate.getTime()-e.getTime())/864e5);if(t%this.step!=0)return void this._internals.setValidity({stepMismatch:!0},`Please select a valid date. The nearest valid dates are ${this._formatValue(new Date(e.getTime()+Math.floor(t/this.step)*this.step*864e5))} and ${this._formatValue(new Date(e.getTime()+Math.ceil(t/this.step)*this.step*864e5))}`,this._triggerElement)}}if(this.disableWeekends){const e=this.valueAsDate.getDay();if(0===e||6===e)return void this._internals.setValidity({customError:!0},"Weekends are not available",this._triggerElement)}if(this.isDateDisabled&&this.isDateDisabled(this.valueAsDate))return void this._internals.setValidity({customError:!0},"This date is not available",this._triggerElement)}this._internals.setValidity({})}else this._internals.setValidity({valueMissing:!0},"Please select a date",this._triggerElement)}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{4})-(\d{2})-(\d{2})$/),i){const e=new Date(parseInt(i[1]),parseInt(i[2])-1,parseInt(i[3]));return e.getFullYear()===parseInt(i[1])&&e.getMonth()===parseInt(i[2])-1&&e.getDate()===parseInt(i[3])?e:null}if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]));if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(parseInt(i[3]),e,parseInt(i[2]))}if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(parseInt(i[2]),e,1)}return null}_formatValue(e){const t=String(e.getFullYear()),i=e.getMonth()+1,s=e.getDate();return this.format.replace(/YYYY|YY|MM|M|DD|D/g,(e=>"YYYY"===e?t:"YY"===e?t.slice(-2):"MM"===e?String(i).padStart(2,"0"):"M"===e?String(i):"DD"===e?String(s).padStart(2,"0"):String(s)))}_renderCalendar(){const e=new Date(this._viewYear,this._viewMonth+1,0).getDate(),t=new Date(this._viewYear,this._viewMonth,1).getDay(),i=new Date;i.setHours(0,0,0,0);const s=[];let o=this._viewYear,r=this._viewMonth-1;0===this._viewMonth&&(o=this._viewYear-1,r=11);const a=new Date(o,r+1,0).getDate();for(let e=t-1;e>=0;e--){const t=new Date(o,r,a-e);s.push(this._renderDay(t,!0))}for(let t=1;t<=e;t++){const e=new Date(this._viewYear,this._viewMonth,t),o=e.getTime()===i.getTime(),r=this.value===this._formatValue(e),a=this._isDateDisabled(e);s.push(j`
|
|
6960
|
+
`],ds.formAssociated=!0,ls([ce({type:String})],ds.prototype,"label",void 0),ls([ce({type:String})],ds.prototype,"name",void 0),ls([ce({type:String})],ds.prototype,"value",void 0),ls([ce({attribute:!1})],ds.prototype,"options",void 0),ls([ce({type:Boolean})],ds.prototype,"disabled",void 0),ls([ce({type:Boolean})],ds.prototype,"required",void 0),ls([ce({type:String})],ds.prototype,"hint",void 0),ls([ce({type:String})],ds.prototype,"direction",void 0),ls([ce({type:Boolean,reflect:!0})],ds.prototype,"dirty",void 0),ls([ce({attribute:"save-mode"})],ds.prototype,"saveMode",void 0),ls([ce({type:Boolean,reflect:!0})],ds.prototype,"saving",void 0),ls([pe()],ds.prototype,"_touched",void 0),customElements.get("krs-radio-cards")||customElements.define("krs-radio-cards",ds);var hs=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class cs extends ne{static fromJSON(e){const t=new cs;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.value&&(t.value=e.value),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.required&&(t.required=e.required),void 0!==e.readonly&&(t.readonly=e.readonly),void 0!==e.min&&(t.min=e.min),void 0!==e.max&&(t.max=e.max),void 0!==e.format&&(t.format=e.format),void 0!==e.step&&(t.step=e.step),void 0!==e.hint&&(t.hint=e.hint),void 0!==e.disableWeekends&&(t.disableWeekends=e.disableWeekends),void 0!==e.saveMode&&(t.saveMode=e.saveMode),t}constructor(){super(),this._dirtyValue="",this._defaultValue="",this.valueAsDate=null,this.valueAsNumber=NaN,this.label="",this.name="",this.value="",this.placeholder="",this.disabled=!1,this.required=!1,this.readonly=!1,this.min="",this.max="",this.format="YYYY-MM-DD",this.step=1,this.hint="",this.disableWeekends=!1,this.dirty=!1,this.saving=!1,this._isOpen=!1,this._viewYear=(new Date).getFullYear(),this._viewMonth=(new Date).getMonth(),this._touched=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._handleClickOutside=e=>{e.composedPath().includes(this)||(this._isOpen=!1)},this._handleKeyDown=e=>{this._isOpen&&"Escape"===e.key&&(this._isOpen=!1,this._inputElement?.focus())},this._handleScroll=()=>{this._isOpen&&this._positionDropdown()},this._internals=this.attachInternals()}connectedCallback(){if(super.connectedCallback(),this.classList.add("kr-form-field"),document.addEventListener("click",this._handleClickOutside),document.addEventListener("keydown",this._handleKeyDown),document.addEventListener("scroll",this._handleScroll,{passive:!0,capture:!0}),this.addEventListener("invalid",this._handleInvalid),this.value){const e=this._parseDate(this.value);e&&(this.valueAsDate=e,this.valueAsNumber=e.getTime())}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleClickOutside),document.removeEventListener("keydown",this._handleKeyDown),document.removeEventListener("scroll",this._handleScroll,!0),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._defaultValue=this.value}willUpdate(e){let t=this.saveMode;t||(t=this.closest("krs-form")?.saveMode),e.has("value")&&this.dirty&&this.value!==this._dirtyValue&&"autosave"===t&&(this.value=this._dirtyValue)}updated(e){if(e.has("value"))if(this.value){const e=this._parseDate(this.value);e?(this.valueAsDate=e,this.valueAsNumber=e.getTime()):(this.value="",this.valueAsDate=null,this.valueAsNumber=NaN)}else this.valueAsDate=null,this.valueAsNumber=NaN;(e.has("value")||e.has("disabled"))&&this._updateFormValue(),(e.has("required")||e.has("value")||e.has("min")||e.has("max")||e.has("step"))&&this._updateValidity()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this.value=this._defaultValue,this.valueAsDate=this._parseDate(this._defaultValue),this.valueAsDate?this.valueAsNumber=this.valueAsDate.getTime():this.valueAsNumber=NaN,this._touched=!1,this.dirty=!1,this.saving=!1,this._updateFormValue(),this._updateValidity()}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0,this._dirtyValue=this.value}formStateRestoreCallback(e){this.value=e,this.valueAsDate=this._parseDate(e),this.valueAsDate?this.valueAsNumber=this.valueAsDate.getTime():this.valueAsNumber=NaN}focus(){this._inputElement?.focus()}blur(){this._inputElement?.blur()}_handleCalendarClick(){if(!this.disabled&&!this.readonly)if(this._isOpen)this._isOpen=!1;else{const e=this._parseDate(this.value||this.min);e&&(this._viewYear=e.getFullYear(),this._viewMonth=e.getMonth()),this._isOpen=!0,this._positionDropdown()}}_handleInputChange(e){this.dirty=!0,this._dirtyValue=this.value;const t=e.target.value.trim();if(!t)return this.value="",this.valueAsDate=null,this.valueAsNumber=NaN,this._dirtyValue=this.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const i=this._parseDate(t);i&&(this.value=this._formatValue(i),this.valueAsDate=i,this.valueAsNumber=i.getTime(),this._dirtyValue=this.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}_handleInputKeydown(e){if("Enter"===e.key){this.dirty=!0,this._dirtyValue=this.value;const t=e.target.value.trim();if(t){const e=this._parseDate(t);e&&(this.value=this._formatValue(e),this.valueAsDate=e,this.valueAsNumber=e.getTime(),this._dirtyValue=this.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}else this.value="",this.valueAsDate=null,this.valueAsNumber=NaN,this._dirtyValue=this.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}}_handleBlur(e){const t=e.relatedTarget;if(!t||!this.shadowRoot?.contains(t)){if(this._touched=!0,this._inputElement){const e=this._inputElement.value.trim();if(e){const t=this._parseDate(e);t?(this.value=this._formatValue(t),this.valueAsDate=t,this.valueAsNumber=t.getTime()):this.requestUpdate()}else this.value="",this.valueAsDate=null,this.valueAsNumber=NaN}this._updateValidity()}}_handlePrevMonth(){0===this._viewMonth?(this._viewMonth=11,this._viewYear--):this._viewMonth--}_handleNextMonth(){11===this._viewMonth?(this._viewMonth=0,this._viewYear++):this._viewMonth++}_positionDropdown(){requestAnimationFrame((()=>{const e=this.shadowRoot?.querySelector(".dropdown");if(!e)return;const t=this._triggerElement.getBoundingClientRect();e.style.top=t.bottom+4+"px",e.style.left=t.left+"px"}))}_isDateDisabled(e){if(this.min){if(e<new Date(this.min+"T00:00:00"))return!0}if(this.max){if(e>new Date(this.max+"T00:00:00"))return!0}if(this.disableWeekends){const t=e.getDay();if(0===t||6===t)return!0}return!!this.isDateDisabled&&this.isDateDisabled(e)}_selectDate(e){this._isDateDisabled(e)||this.readonly||(this.value=this._formatValue(e),this.valueAsDate=e,this.valueAsNumber=e.getTime(),this.dirty=!0,this._dirtyValue=this.value,this._isOpen=!1,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this._inputElement?.focus())}_updateFormValue(){this.disabled?this._internals.setFormValue(null):this._internals.setFormValue(this.value)}_updateValidity(){if(!this.required||this.value){if(this.value&&this.valueAsDate){if(this.min){const e=this._parseDate(this.min);if(e&&this.valueAsDate<e)return void this._internals.setValidity({rangeUnderflow:!0},`Value must be ${this.min} or later`,this._triggerElement)}if(this.max){const e=this._parseDate(this.max);if(e&&this.valueAsDate>e)return void this._internals.setValidity({rangeOverflow:!0},`Value must be ${this.max} or earlier`,this._triggerElement)}if(this.step>1&&this.min){const e=this._parseDate(this.min);if(e){const t=Math.round((this.valueAsDate.getTime()-e.getTime())/864e5);if(t%this.step!=0)return void this._internals.setValidity({stepMismatch:!0},`Please select a valid date. The nearest valid dates are ${this._formatValue(new Date(e.getTime()+Math.floor(t/this.step)*this.step*864e5))} and ${this._formatValue(new Date(e.getTime()+Math.ceil(t/this.step)*this.step*864e5))}`,this._triggerElement)}}if(this.disableWeekends){const e=this.valueAsDate.getDay();if(0===e||6===e)return void this._internals.setValidity({customError:!0},"Weekends are not available",this._triggerElement)}if(this.isDateDisabled&&this.isDateDisabled(this.valueAsDate))return void this._internals.setValidity({customError:!0},"This date is not available",this._triggerElement)}this._internals.setValidity({})}else this._internals.setValidity({valueMissing:!0},"Please select a date",this._triggerElement)}_parseDate(e){if(null==e||""===e)return null;const t={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11};let i;if(i=e.match(/^(\d{4})-(\d{2})-(\d{2})$/),i){const e=new Date(parseInt(i[1]),parseInt(i[2])-1,parseInt(i[3]));return e.getFullYear()===parseInt(i[1])&&e.getMonth()===parseInt(i[2])-1&&e.getDate()===parseInt(i[3])?e:null}if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2})$/),i)return new Date(2e3+parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]));if(i=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/),i)return new Date(parseInt(i[3]),parseInt(i[1])-1,parseInt(i[2]));if(i=e.match(/^(?:[A-Za-z]+,\s+)?([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(parseInt(i[3]),e,parseInt(i[2]))}if(i=e.match(/^([A-Za-z]+)\s+(\d{4})$/),i){const e=t[i[1].toLowerCase()];if(void 0!==e)return new Date(parseInt(i[2]),e,1)}return null}_formatValue(e){const t=String(e.getFullYear()),i=e.getMonth()+1,s=e.getDate();return this.format.replace(/YYYY|YY|MM|M|DD|D/g,(e=>"YYYY"===e?t:"YY"===e?t.slice(-2):"MM"===e?String(i).padStart(2,"0"):"M"===e?String(i):"DD"===e?String(s).padStart(2,"0"):String(s)))}_renderCalendar(){const e=new Date(this._viewYear,this._viewMonth+1,0).getDate(),t=new Date(this._viewYear,this._viewMonth,1).getDay(),i=new Date;i.setHours(0,0,0,0);const s=[];let o=this._viewYear,r=this._viewMonth-1;0===this._viewMonth&&(o=this._viewYear-1,r=11);const a=new Date(o,r+1,0).getDate();for(let e=t-1;e>=0;e--){const t=new Date(o,r,a-e);s.push(this._renderDay(t,!0))}for(let t=1;t<=e;t++){const e=new Date(this._viewYear,this._viewMonth,t),o=e.getTime()===i.getTime(),r=this.value===this._formatValue(e),a=this._isDateDisabled(e);s.push(N`
|
|
6866
6961
|
<button
|
|
6867
6962
|
type="button"
|
|
6868
6963
|
class=${ye({day:!0,"day--today":o,"day--selected":r,"day--disabled":a})}
|
|
6869
6964
|
?disabled=${a}
|
|
6870
6965
|
@click=${()=>this._selectDate(e)}
|
|
6871
6966
|
>${t}</button>
|
|
6872
|
-
`)}let n=this._viewYear,l=this._viewMonth+1;11===this._viewMonth&&(n=this._viewYear+1,l=0);const d=42-s.length;for(let e=1;e<=d;e++){const t=new Date(n,l,e);s.push(this._renderDay(t,!0))}return s}_renderDay(e,t){const i=this._isDateDisabled(e);return
|
|
6967
|
+
`)}let n=this._viewYear,l=this._viewMonth+1;11===this._viewMonth&&(n=this._viewYear+1,l=0);const d=42-s.length;for(let e=1;e<=d;e++){const t=new Date(n,l,e);s.push(this._renderDay(t,!0))}return s}_renderDay(e,t){const i=this._isDateDisabled(e);return N`
|
|
6873
6968
|
<button
|
|
6874
6969
|
type="button"
|
|
6875
6970
|
class=${ye({day:!0,"day--outside":t,"day--disabled":i})}
|
|
6876
6971
|
?disabled=${i}
|
|
6877
6972
|
@click=${()=>this._selectDate(e)}
|
|
6878
6973
|
>${e.getDate()}</button>
|
|
6879
|
-
`}render(){let e="";this.valueAsDate?e=String(this.valueAsDate.getMonth()+1).padStart(2,"0")+"/"+String(this.valueAsDate.getDate()).padStart(2,"0")+"/"+this.valueAsDate.getFullYear():this.value&&(e=this.value);const t=new Date(2e3,this._viewMonth,1).toLocaleDateString(void 0,{month:"long"});let i="";return this._touched&&!this._internals.validity.valid&&(i=this._internals.validationMessage),
|
|
6974
|
+
`}render(){let e="";this.valueAsDate?e=String(this.valueAsDate.getMonth()+1).padStart(2,"0")+"/"+String(this.valueAsDate.getDate()).padStart(2,"0")+"/"+this.valueAsDate.getFullYear():this.value&&(e=this.value);const t=new Date(2e3,this._viewMonth,1).toLocaleDateString(void 0,{month:"long"});let i="";return this._touched&&!this._internals.validity.valid&&(i=this._internals.validationMessage),N`
|
|
6880
6975
|
<div class="wrapper">
|
|
6881
|
-
${this.label?
|
|
6976
|
+
${this.label?N`
|
|
6882
6977
|
<label>
|
|
6883
6978
|
${this.label}
|
|
6884
|
-
${this.required?
|
|
6979
|
+
${this.required?N`<span class="required" aria-hidden="true">*</span>`:""}
|
|
6885
6980
|
</label>
|
|
6886
6981
|
`:U}
|
|
6887
6982
|
<div
|
|
@@ -6926,7 +7021,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6926
7021
|
</button>
|
|
6927
7022
|
</div>
|
|
6928
7023
|
|
|
6929
|
-
${i?
|
|
7024
|
+
${i?N`<div class="validation-message">${i}</div>`:this.hint?N`<div class="hint">${this.hint}</div>`:""}
|
|
6930
7025
|
</div>
|
|
6931
7026
|
|
|
6932
7027
|
<div
|
|
@@ -6999,7 +7094,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
6999
7094
|
${this._renderCalendar()}
|
|
7000
7095
|
</div>
|
|
7001
7096
|
</div>
|
|
7002
|
-
`}}
|
|
7097
|
+
`}}cs.styles=[Ut,a`
|
|
7003
7098
|
:host {
|
|
7004
7099
|
display: block;
|
|
7005
7100
|
font-family: inherit;
|
|
@@ -7228,12 +7323,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7228
7323
|
font-size: 12px;
|
|
7229
7324
|
color: var(--kr-date-picker-error-color, #ef4444);
|
|
7230
7325
|
}
|
|
7231
|
-
`],
|
|
7326
|
+
`],cs.formAssociated=!0,hs([ce({type:String})],cs.prototype,"label",void 0),hs([ce({type:String})],cs.prototype,"name",void 0),hs([ce({type:String})],cs.prototype,"value",void 0),hs([ce({type:String})],cs.prototype,"placeholder",void 0),hs([ce({type:Boolean})],cs.prototype,"disabled",void 0),hs([ce({type:Boolean})],cs.prototype,"required",void 0),hs([ce({type:Boolean})],cs.prototype,"readonly",void 0),hs([ce({type:String})],cs.prototype,"min",void 0),hs([ce({type:String})],cs.prototype,"max",void 0),hs([ce({type:String})],cs.prototype,"format",void 0),hs([ce({type:Number})],cs.prototype,"step",void 0),hs([ce({type:String})],cs.prototype,"hint",void 0),hs([ce({type:Boolean})],cs.prototype,"disableWeekends",void 0),hs([ce({attribute:!1})],cs.prototype,"isDateDisabled",void 0),hs([ce({type:Boolean,reflect:!0})],cs.prototype,"dirty",void 0),hs([ce({attribute:"save-mode"})],cs.prototype,"saveMode",void 0),hs([ce({type:Boolean,reflect:!0})],cs.prototype,"saving",void 0),hs([pe()],cs.prototype,"_isOpen",void 0),hs([pe()],cs.prototype,"_viewYear",void 0),hs([pe()],cs.prototype,"_viewMonth",void 0),hs([pe()],cs.prototype,"_touched",void 0),hs([ue(".trigger")],cs.prototype,"_triggerElement",void 0),hs([ue(".trigger-input")],cs.prototype,"_inputElement",void 0),customElements.get("krs-date-picker")||customElements.define("krs-date-picker",cs);var ps=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class us extends ne{static fromJSON(e){const t=new us;return void 0!==e.label&&(t.label=e.label),void 0!==e.name&&(t.name=e.name),void 0!==e.accept&&(t.accept=e.accept),void 0!==e.multiple&&(t.multiple=e.multiple),void 0!==e.placeholder&&(t.placeholder=e.placeholder),void 0!==e.value&&(t.value=e.value),void 0!==e.buttonLabel&&(t.buttonLabel=e.buttonLabel),void 0!==e.required&&(t.required=e.required),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.hint&&(t.hint=e.hint),t}constructor(){super(),this.label="",this.name="",this.accept="",this.multiple=!1,this.placeholder="No file chosen",this.value="",this.buttonLabel="Choose File",this.required=!1,this.disabled=!1,this.hint="",this.files=[],this.dirty=!1,this.saving=!1,this._touched=!1,this._focused=!1,this._handleInvalid=e=>{e.preventDefault(),this._touched=!0},this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.classList.add("kr-form-field"),this.addEventListener("invalid",this._handleInvalid)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("invalid",this._handleInvalid)}firstUpdated(){this._updateValidity()}updated(e){e.has("required")&&this._updateValidity()}get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this._input&&(this._input.value=""),this.files=[],this._touched=!1,this.dirty=!1,this.saving=!1,this._internals.setFormValue(null),this._internals.setValidity({})}markPristine(){this.dirty=!1}markSaving(){this.saving=!0,this.dirty=!1}markSaved(){this.saving=!1}markSaveFailed(){this.saving=!1,this.dirty=!0}open(){this._input?.click()}clear(){this.formResetCallback(),this._updateValidity()}_updateValidity(){this._input&&this._internals.setValidity(this._input.validity,this._input.validationMessage,this._input)}_handleClick(){this.disabled||this._input.click()}_handleFocus(){this._focused=!0}_handleBlur(){this._focused=!1,this._touched=!0}_handleChange(){if(this.files=Array.from(this._input.files||[]),this.dirty=!0,this.files.length){const e=new FormData;for(const t of this.files)e.append(this.name,t,t.name);this._internals.setFormValue(e)}else this._internals.setFormValue(null);this._updateValidity(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}render(){let e="";return this._touched&&this._input&&!this._input.validity.valid&&(e=this._input.validationMessage),N`
|
|
7232
7327
|
<div class="wrapper">
|
|
7233
|
-
${this.label?
|
|
7328
|
+
${this.label?N`
|
|
7234
7329
|
<label for="input">
|
|
7235
7330
|
${this.label}
|
|
7236
|
-
${this.required?
|
|
7331
|
+
${this.required?N`<span class="required" aria-hidden="true">*</span>`:""}
|
|
7237
7332
|
</label>
|
|
7238
7333
|
`:""}
|
|
7239
7334
|
<div
|
|
@@ -7266,9 +7361,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7266
7361
|
@focus=${this._handleFocus}
|
|
7267
7362
|
@blur=${this._handleBlur}
|
|
7268
7363
|
/>
|
|
7269
|
-
${e?
|
|
7364
|
+
${e?N`<div class="validation-message">${e}</div>`:this.hint?N`<div class="hint">${this.hint}</div>`:""}
|
|
7270
7365
|
</div>
|
|
7271
|
-
`}}
|
|
7366
|
+
`}}us.styles=a`
|
|
7272
7367
|
:host {
|
|
7273
7368
|
display: block;
|
|
7274
7369
|
font-family: inherit;
|
|
@@ -7369,15 +7464,15 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7369
7464
|
font-size: 0.75rem;
|
|
7370
7465
|
color: var(--kr-text-field-helper-color, #6b7280);
|
|
7371
7466
|
}
|
|
7372
|
-
`,
|
|
7467
|
+
`,us.formAssociated=!0,ps([ce({type:String})],us.prototype,"label",void 0),ps([ce({type:String})],us.prototype,"name",void 0),ps([ce({type:String})],us.prototype,"accept",void 0),ps([ce({type:Boolean})],us.prototype,"multiple",void 0),ps([ce({type:String})],us.prototype,"placeholder",void 0),ps([ce({type:String})],us.prototype,"value",void 0),ps([ce({type:String})],us.prototype,"buttonLabel",void 0),ps([ce({type:Boolean})],us.prototype,"required",void 0),ps([ce({type:Boolean})],us.prototype,"disabled",void 0),ps([ce({type:String})],us.prototype,"hint",void 0),ps([ce({attribute:!1})],us.prototype,"files",void 0),ps([ce({type:Boolean,reflect:!0})],us.prototype,"dirty",void 0),ps([ce({type:Boolean,reflect:!0})],us.prototype,"saving",void 0),ps([pe()],us.prototype,"_touched",void 0),ps([pe()],us.prototype,"_focused",void 0),ps([ue("input")],us.prototype,"_input",void 0),customElements.get("krs-file-field")||customElements.define("krs-file-field",us);var gs=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};class fs extends ne{constructor(){super(...arguments),this._saveQueue=Promise.resolve(),this.save=null,this.saveMode="autosave",this._handleChange=()=>{this.save&&(this._saveQueue=this._saveQueue.then((()=>{const e=Array.from(this.querySelectorAll(".kr-form-field")).filter((e=>e.dirty&&e.name));if(!e.length)return;const t=this.getChanges();for(const t of e)t.markSaving?.();return Promise.resolve().then((()=>this.save(t))).then((()=>{for(const t of e)t.markSaved?.()}),(t=>{for(const t of e)t.markSaveFailed?.();return t instanceof Response?(console.error("krs-form save failed",t.status,t.url),t.json()):(console.error("krs-form save failed",t),{errors:[]})})).then((e=>{e&&hi.show({message:e.errors?.[0]||"Save failed.",type:"error"})}),(e=>{console.error("krs-form save failed with an unreadable response body",e),hi.show({message:"Save failed.",type:"error"})}))})))}}static fromJSON(e){if("text-field"===e.type)return Ji.fromJSON(e);if("textarea-field"===e.type)return ts.fromJSON(e);if("number-field"===e.type)return Gi.fromJSON(e);if("checkbox"===e.type)return Mi.fromJSON(e);if("select-field"===e.type)return bi.fromJSON(e);if("combo-box"===e.type)return ns.fromJSON(e);if("date-picker"===e.type)return cs.fromJSON(e);if("date-range-picker"===e.type)return li.fromJSON(e);if("auto-suggest"===e.type)return rs.fromJSON(e);if("radio-cards"===e.type)return ds.fromJSON(e);if("file-field"===e.type)return us.fromJSON(e);if("detail-field"===e.type)return ss.fromJSON(e);if("monaco"===e.type){const t=customElements.get("kr-monaco");if(!t)return;return t.fromJSON(e)}}connectedCallback(){super.connectedCallback(),this.addEventListener("change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",this._handleChange)}getChanges(){const e={};for(const t of Array.from(this.querySelectorAll(".kr-form-field")))t.dirty&&t.name&&("checked"in t&&"boolean"==typeof t.checked?e[t.name]=t.checked:"KR-DATE-PICKER"===t.tagName?e[t.name]=t.valueAsDate:"KR-NUMBER-FIELD"===t.tagName?e[t.name]=t.valueAsNumber:e[t.name]=t.value);return e}hasChanges(){for(const e of Array.from(this.querySelectorAll(".kr-form-field")))if(e.dirty&&e.name)return!0;return!1}markPristine(){for(const e of Array.from(this.querySelectorAll(".kr-form-field")))e.markPristine?.()}render(){return N`<slot></slot>`}}fs.styles=a`
|
|
7373
7468
|
:host {
|
|
7374
7469
|
display: block;
|
|
7375
7470
|
}
|
|
7376
|
-
`,ps([ce({attribute:!1})],us.prototype,"save",void 0),ps([ce({attribute:"save-mode"})],us.prototype,"saveMode",void 0),customElements.get("krs-form")||customElements.define("krs-form",us);class gs{static configure(e){void 0!==e.baseUrl&&(gs._baseUrl=e.baseUrl),void 0!==e.devUrl&&(gs._devUrl=e.devUrl)}static getBaseUrl(){return"localhost"===window.location.hostname&&window.location.port.startsWith("4")&&gs._devUrl?gs._devUrl:gs._baseUrl}static fetch(e){let t=e.url;var i="localhost"===window.location.hostname&&window.location.port.startsWith("4");let s=gs.getBaseUrl();0!==t.indexOf("http")&&(t=s+t),e.params&&(t+="?",Object.keys(e.params).forEach(((i,s)=>{s>0&&(t+="&"),t+=`${i}=${e.params[i]}`})));var o={};let r;return e.headers&&(e.headers instanceof Headers?e.headers.forEach(((e,t)=>{o[t]=e})):Array.isArray(e.headers)?e.headers.forEach((([e,t])=>{o[e]=t})):Object.assign(o,e.headers)),!e.body||"object"!=typeof e.body||e.body instanceof ReadableStream||e.body instanceof Blob||e.body instanceof ArrayBuffer||e.body instanceof FormData||e.body instanceof URLSearchParams||(e.body=JSON.stringify(e.body),o["Content-Type"]||(o["Content-Type"]="application/json")),e.headers=o,i&&!e.credentials&&(e.credentials="include"),r=t.indexOf("/api/user/")>-1||t.indexOf("/api/account/")>-1?fetch(`${s}/api/user/customer/authToken`,{credentials:"include"}):Promise.resolve(null),r.then((e=>e?.json())).then((i=>(i?.data&&(o["X-CSRF-TOKEN"]=i.data),fetch(t,e)))).then((e=>e.ok?e:Promise.reject(e)))}}gs._baseUrl="",gs._devUrl="";var fs=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};const ms=[{decision:"approve",label:"Yes"},{decision:"approveAlways",label:"Always allow"},{decision:"reject",label:"No"}],bs=[{mode:"NORMAL",label:"Ask",description:"Asks before making changes"},{mode:"EDIT",label:"Auto",description:"Makes changes automatically"},{mode:"PLAN",label:"Plan",description:"Suggests a plan, makes no changes"}],vs=["jpg","jpeg","png","gif","webp"],_s=["pdf","doc","docx","xls","xlsx","csv","html","md","txt","json","xml","vtt","srt",...vs,"mp4","webm","ogg","mov"];class ys extends ne{constructor(){super(...arguments),this._inlineConfirm=!0,this._reasoningAsMessage=!0,this._reader=null,this._decoder=new TextDecoder,this._buffer="",this._turnFinishedCleanly=!1,this._reconnectAttempts=0,this._userHasScrolledUp=!1,this._followStream=!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._drawerResizeStartX=0,this._drawerResizeStartW=0,this._dragDepth=0,this._pendingSeq=0,this._pendingAttachAnalyze=!0,this._orgSkillRequestId=0,this._globalSkillRequestId=0,this._invocableSkillRequestId=0,this._suggestedActionRequestId=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._conversationTitle="",this._contextWarning="",this._contextLimitReached=!1,this._contextLimitMessage="",this._pendingActions=[],this._confirmationHighlighted=-1,this._confirmationInFlight=!1,this._telemetry=null,this._iterationLog=[],this._cacheCheckpoints={},this._drawerOpen=!1,this._drawerView="settings",this._conversations=[],this._conversationsLoading=!1,this._toolDetail=null,this._toolDetailCopied=null,this._toolDetailInputOpen=!0,this._toolDetailOutputOpen=!0,this._drawerWidth=430,this._isDrawerResizing=!1,this._pendingConversationFiles=[],this._isDraggingFile=!1,this._skillMenuOpened=!1,this._skillQuery="",this._orgSkills=[],this._globalSkills=[],this._invocableSkills=[],this._suggestedActions=[],this._aiFrameworkConfig={},this._skillHighlighted=0,this._copiedIndex=-1,this._skillBrowseOpened=!1,this._skillBrowseDetail=null,this._skillInstallConfirm=null,this._skillOfferConfirm=null,this._skillBrowseSource="org",this._skillBrowseQuery="",this._isDictating=!1,this._mode="NORMAL",this._modeMenuOpened=!1,this._showTools=!0,this._showToolInputs=!1,this._showConfirmationInput=!1,this._handleDocumentClick=e=>{if(this._modeMenuOpened){e.composedPath().some((e=>e instanceof HTMLElement&&e.classList.contains("mode")))||(this._modeMenuOpened=!1)}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,o=380,r=.9*window.innerWidth,a=window.innerHeight-72;let n=this._resizeStartW,l=this._resizeStartH,d=this._dragStartLeft,h=this._dragStartTop;this._resizeDir.includes("e")&&(n=Math.max(s,Math.min(this._resizeStartW+t,r))),this._resizeDir.includes("w")&&(n=Math.max(s,Math.min(this._resizeStartW-t,r)),d=this._dragStartLeft+(this._resizeStartW-n)),this._resizeDir.includes("s")&&(l=Math.max(o,Math.min(this._resizeStartH+i,a))),this._resizeDir.includes("n")&&(l=Math.max(o,Math.min(this._resizeStartH-i,a)),h=this._dragStartTop+(this._resizeStartH-l)),d=Math.max(0,d),h=Math.max(0,h),this._panelEl.style.width=n+"px",this._panelEl.style.height=l+"px",this._panelEl.style.left=d+"px",this._panelEl.style.top=h+"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._handleDocumentKeydown=e=>{if(this._pendingActions.length&&!this._confirmationInFlight){if("ArrowRight"===e.key)return e.preventDefault(),void(this._confirmationHighlighted=(this._confirmationHighlighted+1)%ms.length);if("ArrowLeft"===e.key)return e.preventDefault(),void(this._confirmationHighlighted=(this._confirmationHighlighted-1+ms.length)%ms.length);if("Enter"===e.key){e.preventDefault();const t=ms[this._confirmationHighlighted];t&&this._handleConfirmationDecision(t.decision)}}},this._handleDrawerResizeMouseMove=e=>{if(!this._isDrawerResizing)return;const t=e.clientX-this._drawerResizeStartX,i=Math.max(300,this.offsetWidth-300);this._drawerWidth=Math.max(300,Math.min(this._drawerResizeStartW-t,i))},this._handleDrawerResizeMouseUp=()=>{this._isDrawerResizing=!1,document.removeEventListener("mousemove",this._handleDrawerResizeMouseMove),document.removeEventListener("mouseup",this._handleDrawerResizeMouseUp),this._saveState()}}connectedCallback(){super.connectedCallback(),this.load||(this.load=()=>null==this.conversationId?Promise.resolve([]):gs.fetch({url:`/api/system/conversation/${this.conversationId}/messages`}).then((e=>e.json())).then((e=>Promise.all((e?.data||[]).map((e=>{if("tool_use"===e.type||"tool_result"===e.type){let t={};try{t=JSON.parse(e.content||"{}")}catch{}return Promise.resolve({type:e.type,content:"",data:t})}if("reasoning"===e.type)return Promise.resolve({type:"assistant",content:"",reasoning:e.content||""});if("action_decision"===e.type){let t={};try{t=JSON.parse(e.content||"{}")}catch{}return Promise.resolve({type:"action_decision",content:"",data:t})}let t=[];try{t=JSON.parse(e.conversationFileIDs||"[]")}catch{}return t.length?Promise.all(t.map((e=>gs.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)}))))));let e=Promise.resolve();if("floating"===this.variant&&null==this.conversationId){const t=Number(sessionStorage.getItem("kr-chatbot-conversation-id"));t>0&&(this.conversationId=t,e=gs.fetch({url:`/api/system/conversation/${t}`}).then((e=>e.json())).then((e=>{this._conversationTitle=e?.data?.title||""})).catch((()=>{})))}e.then((()=>this.load())).then((e=>{e&&e.length&&(this.messages=e),this.conversationId&&!this._isStreaming&&this._reconnectStream()})).catch((()=>{})),gs.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),document.addEventListener("keydown",this._handleDocumentKeydown)}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),document.removeEventListener("keydown",this._handleDocumentKeydown),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)}))),this._isStreaming&&this._followStream&&this._messagesEl&&requestAnimationFrame((()=>{const e=this._messagesEl;if(!e||!this._isStreaming||!this._followStream)return;const t=e.querySelectorAll(".agent-turn"),i=t[t.length-1],s=i?.lastElementChild;if(!s)return;const o=s.getBoundingClientRect().bottom-e.getBoundingClientRect().top+e.scrollTop+24;o>e.scrollTop+e.clientHeight&&(e.scrollTop=Math.min(o-e.clientHeight,e.scrollHeight-e.clientHeight))})),e.has("opened")&&this.opened&&this._inputEl&&setTimeout((()=>{this._inputEl&&this._inputEl.focus()}),200),e.has("opened")&&this.opened&&0===this.messages.length&&this._loadSuggestedActions(),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(),o=Math.max(t,e.top-s.height-8);this._skillMenuEl.style.top=o+"px"}))}stop(){this._handleStop()}isStreaming(){return this._isStreaming}open(){this.opened||this._handleToggle()}close(){this.opened&&this._handleToggle()}toggle(){this._handleToggle()}prompt(e){this.open(),this._inputValue=e.message,this._handleSubmit()}draft(e){this.open(),this._inputValue=e.message,this._saveState(),this.updateComplete.then((()=>{setTimeout((()=>{this._inputEl&&(this._inputEl.focus(),this._inputEl.select())}),200)}))}_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()}_persistConversationId(){if("floating"===this.variant)try{null!=this.conversationId?sessionStorage.setItem("kr-chatbot-conversation-id",String(this.conversationId)):sessionStorage.removeItem("kr-chatbot-conversation-id")}catch{}}_saveState(){let e="kr-chatbot-state",t="kr-chatbot-tab";"inline"===this.variant&&(e="kr-chatbot-state-inline",t="kr-chatbot-tab-inline");try{const t={message:this._inputValue,mode:this._mode,showTools:String(this._showTools),showToolInputs:String(this._showToolInputs),showConfirmationInput:String(this._showConfirmationInput)};localStorage.setItem(e,JSON.stringify(t))}catch{}try{let e=this._drawerView;"toolDetail"===e&&(e="settings");const i={drawerOpen:String(this._drawerOpen),drawerView:e,drawerWidth:String(this._drawerWidth)};if("floating"===this.variant&&(i.opened=String(this.opened),this._panelEl)){const e=this._panelEl.style;e.left&&(i.left=e.left),e.top&&(i.top=e.top),e.width&&(i.width=e.width),e.height&&(i.height=e.height),e.position&&(i.position=e.position)}sessionStorage.setItem(t,JSON.stringify(i))}catch{}}_restoreState(){let e="kr-chatbot-state",t="kr-chatbot-tab";"inline"===this.variant&&(e="kr-chatbot-state-inline",t="kr-chatbot-tab-inline");try{const t=localStorage.getItem(e);if(t){const e=JSON.parse(t);"string"==typeof e.message&&"/"!==e.message.trim()&&(this._inputValue=e.message),"NORMAL"!==e.mode&&"EDIT"!==e.mode&&"PLAN"!==e.mode||(this._mode=e.mode),this._showTools="true"===e.showTools,this._showToolInputs="true"===e.showToolInputs,this._showConfirmationInput="true"===e.showConfirmationInput}}catch{}try{const e=sessionStorage.getItem(t);if(!e)return;const i=JSON.parse(e);this._drawerOpen="true"===i.drawerOpen,"settings"!==i.drawerView&&"debug"!==i.drawerView&&"history"!==i.drawerView||(this._drawerView=i.drawerView,"history"===i.drawerView&&this._loadConversations());const s=Number(i.drawerWidth);s>=300&&(this._drawerWidth=s),"floating"===this.variant&&"true"===i.opened&&(this.opened=!0,this.updateComplete.then((()=>this._applyStoredLayout())))}catch{}}_applyStoredLayout(){try{const e=sessionStorage.getItem("kr-chatbot-tab");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;gs.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("krs-chatbot: skill search failed",e)}))}_searchInvocableSkills(e){this._invocableSkillRequestId++;const t=this._invocableSkillRequestId;gs.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("krs-chatbot: invocable skill search failed",e)}))}_loadSuggestedActions(){this._suggestedActionRequestId++;const e=this._suggestedActionRequestId,t=this._captureContext();gs.fetch({url:"/api/system/conversation/suggestedActions",method:"POST",body:{pageContext:t.pageContext,selectionContext:t.selectionContext}}).then((e=>e.json())).then((t=>{e!==this._suggestedActionRequestId||this.messages.length>0||(this._suggestedActions=t?.data||[])})).catch((e=>{console.error("krs-chatbot: suggested actions load failed",e)}))}_searchGlobalSkills(e){this._globalSkillRequestId++;const t=this._globalSkillRequestId;gs.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("krs-chatbot: global skill search failed",e)}))}_handleGlobalSkillEnable(e,t){if(t.stopPropagation(),!e.canEnable)return void hi.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;if(!e.enabled&&e.billable)return void(this._skillInstallConfirm=e);const i=t.currentTarget;this._globalSkillPending.add(e.code),i?.showLoading(),gs.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(),e.enabled?hi.show({title:"Skill Installed",message:`${e.name} is now available to use.`,type:"success"}):hi.show({title:"Skill Uninstalled",message:`${e.name} is no longer available to use.`,type:"success"})})).catch((e=>{console.error("krs-chatbot: global skill enable failed",e),i?.showError("Error")})).finally((()=>{this._globalSkillPending.delete(e.code)}))}_handleSkillInstallCancel(){this._skillInstallConfirm=null}_handleSkillInstallConfirm(e){if(!this._skillInstallConfirm)return;if(this._globalSkillPending.has(this._skillInstallConfirm.code))return;const t=this._skillInstallConfirm,i=e.currentTarget;this._globalSkillPending.add(t.code),i?.showLoading(),gs.fetch({url:`/api/system/opensearch/aiskills/global/${encodeURIComponent(t.code)}/enabled`,method:"POST",body:{enabled:!0}}).then((e=>e.json())).then((e=>{t.enabled=e?.data?.enabled,i?.reset(),this._skillInstallConfirm=null,this.requestUpdate(),hi.show({title:"Skill Installed",message:`${t.name} is now available to use.`,type:"success"})})).catch((e=>{console.error("krs-chatbot: global skill install failed",e),i?.showError("Error")})).finally((()=>{this._globalSkillPending.delete(t.code)}))}_handleOfferedSkillsInstall(e,t){const i=JSON.parse(e.data.toolResultString);i.canInstall?i.skills.some((e=>this._globalSkillPending.has(e.code)))||(i.skills.some((e=>e.billable))?this._skillOfferConfirm=e:this._installOfferedSkills(e,t.currentTarget)):hi.show({title:"Permission Required",message:"You do not have permission to install skills. Please contact your site administrator.",type:"error"})}_handleSkillOfferCancel(){this._skillOfferConfirm=null}_handleSkillOfferConfirm(e){this._skillOfferConfirm&&this._installOfferedSkills(this._skillOfferConfirm,e.currentTarget)}_installOfferedSkills(e,t){const i=JSON.parse(e.data.toolResultString).skills;for(const e of i)this._globalSkillPending.add(e.code);t?.showLoading();let s=Promise.resolve();for(const e of i)s=s.then((()=>gs.fetch({url:`/api/system/opensearch/aiskills/global/${encodeURIComponent(e.code)}/enabled`,method:"POST",body:{enabled:!0}})));s.then((()=>{t?.reset(),this._skillOfferConfirm=null,e.data.skillOfferOutcome="installed",this.requestUpdate(),null!=this.conversationId&&gs.fetch({url:`/api/system/conversation/${this.conversationId}/skillOffer/${encodeURIComponent(e.data.toolUseId)}`,method:"POST",body:{outcome:"installed"}}).catch((e=>{console.error("krs-chatbot: failed to record skill offer outcome",e)})),this._inputValue=`I installed ${i.map((e=>e.name)).join(" and ")}. Please continue.`,this._handleSubmit()})).catch((e=>{console.error("krs-chatbot: skill offer install failed",e),t?.showError("Error")})).finally((()=>{for(const e of i)this._globalSkillPending.delete(e.code)}))}_handleOfferedSkillsDecline(e){e.data.skillOfferOutcome="declined",this.requestUpdate(),null!=this.conversationId&&gs.fetch({url:`/api/system/conversation/${this.conversationId}/skillOffer/${encodeURIComponent(e.data.toolUseId)}`,method:"POST",body:{outcome:"declined"}}).catch((e=>{console.error("krs-chatbot: failed to record skill offer outcome",e)})),this._inputValue=`I don't want to install ${JSON.parse(e.data.toolResultString).skills.map((e=>e.name)).join(" and ")} right now.`,this._handleSubmit()}_handlePlusClick(){this._skillMenuOpened?this._skillMenuOpened=!1:(this._skillQuery="",this._skillHighlighted=0,this._skillMenuOpened=!0,this._searchInvocableSkills(""))}_handleModeToggle(){this._modeMenuOpened=!this._modeMenuOpened}_handleModeSelect(e){this._mode=e,this._modeMenuOpened=!1,this._saveState()}_handleShowToolsChange(e){this._showTools=e.target.checked,this._saveState()}_handleShowToolInputsChange(e){this._showToolInputs=e.target.checked,this._saveState()}_handleShowConfirmationInputChange(e){this._showConfirmationInput=e.target.checked,this._saveState()}_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 hi.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()):hi.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._handleSkillCardOpen(t))}_handleSuggestedActionClick(e){this._inputValue=`/${e.code} `,this._saveState(),this._inputEl?.focus()}_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||gs.getBaseUrl().includes("localhost"))&&this._searchGlobalSkills("")}_handleSkillBrowseClose(){this._skillBrowseOpened=!1,this._skillBrowseDetail=null}_handleSkillCardOpen(e){this._skillBrowseDetail=e}_handleSkillDetailBack(){this._skillBrowseDetail=null}_handleSkillDetailTry(){this._skillBrowseDetail&&this._handleSkillSelect(this._skillBrowseDetail)}_handleSkillDetailEnable(e){this._skillBrowseDetail&&this._handleGlobalSkillEnable(this._skillBrowseDetail,e)}_handleSkillBrowseSearch(e){this._skillBrowseQuery=e.target.value,this._searchOrgSkills(this._skillBrowseQuery),(!0!==this._aiFrameworkConfig.registryServer||gs.getBaseUrl().includes("localhost"))&&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=>_s.includes(this._getFileExtension(e.name))));i.length&&i.forEach((e=>{let i;(e.type.startsWith("image/")||vs.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||`${gs.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view`;Hi.open({src:t,name:e.niceName||"file"}).addEventListener("download",(()=>{window.open(`${gs.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view?download=true`,"_blank")}))}_handleSubmit(){if(this._isStreaming)return;if(this._pendingActions.length)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._suggestedActions=[],this._saveState(),this._error="",this._userHasScrolledUp=!1,this._followStream=!0,this._pendingConversationFiles=[],this._inputEl&&(this._inputEl.style.height="auto"),this.messages=[...this.messages,{type:"assistant",content:""}],this._isStreaming=!0,this._turnFinishedCleanly=!1,this._reconnectAttempts=0,this.updateComplete.then((()=>{if(!this._messagesEl)return;this._messagesEl.querySelectorAll(".agent-turn").forEach((e=>{e.style.minHeight=""}));const e=this._messagesEl.querySelectorAll(".message--user"),t=e[e.length-1],i=this._messagesEl.querySelectorAll(".agent-turn"),s=i[i.length-1];s&&(s.style.minHeight=this._messagesEl.clientHeight+"px"),t&&(this._messagesEl.scrollTop=t.offsetTop-this._messagesEl.offsetTop-24)})),this.send||(this.send=e=>{if(e.confirmation)return gs.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState",method:"POST",headers:{Accept:"text/event-stream"},body:{confirmation:e.confirmation,conversationID:this.conversationId}});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"),gs.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)),mode:this._mode};return e.pageContext&&(i.pageContext=e.pageContext),e.selectionContext&&(i.selectionContext=e.selectionContext),null!=this.conversationId?i.conversationID=this.conversationId:i.createNew=!0,gs.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState",method:"POST",headers:{Accept:"text/event-stream"},body:i}).then((e=>(null==this.conversationId&&gs.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._persistConversationId(),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)}))}_handleConfirmationDecision(e){if(this._confirmationInFlight)return;this._confirmationInFlight=!0,this._error="";const t=this._messagesEl?.querySelector(`.confirmation__btn[data-decision="${e}"]`);t?.showLoading(),this._isStreaming=!0,this._turnFinishedCleanly=!1,this._reconnectAttempts=0,this._userHasScrolledUp=!1,this._followStream=!0,this.send({message:"",messages:this.messages,conversationFiles:[],pageContext:"",selectionContext:"",confirmation:e}).then((e=>e.ok?e.body?(this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",void this._readStreamChunk()):(this._confirmationInFlight=!1,t?.reset(),void this._handleStreamError("No response body")):(this._confirmationInFlight=!1,t?.reset(),void this._handleStreamError("Request failed: "+e.status)))).catch((e=>{this._confirmationInFlight=!1,t?.reset(),"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;t.scrollHeight-t.scrollTop-t.clientHeight>50?this._userHasScrolledUp=!0:(this._userHasScrolledUp=!1,this._isStreaming&&(this._followStream=!0))}_handleMessagesWheel(e){this._isStreaming&&e.deltaY<0&&(this._followStream=!1)}_handleMessagesTouchMove(){this._isStreaming&&(this._followStream=!1)}_handleMessagesPointerDown(e){const t=e.currentTarget;this._isStreaming&&e.offsetX>=t.clientWidth&&(this._followStream=!1)}_handleErrorDismiss(){this._error=""}_handleContextWarningDismiss(){this._contextWarning=""}_toggleDrawer(e){this._drawerOpen&&this._drawerView===e?this._drawerOpen=!1:(this._drawerOpen=!0,this._drawerView=e,"history"===e&&this._loadConversations()),this._saveState()}_loadConversations(){this._conversationsLoading=!0,gs.fetch({url:"/api/system/conversation/list",method:"POST",body:{page:0,size:50,sortBy:"lastModified",sortDirection:"desc",filterFields:[{name:"active",operation:"IS",value:"true"}]}}).then((e=>e.json())).then((e=>{this._conversations=e?.data?.content||[]})).catch((()=>{this._conversations=[]})).then((()=>{this._conversationsLoading=!1}))}_handleSwitchConversation(e){e!==this.conversationId?(this._handleStop(),this.conversationId=e,this._conversationTitle=this._conversations.find((t=>t.conversationID===e))?.title||"",this._persistConversationId(),this._pendingActions=[],this._inlineConfirm=!0,this._contextWarning="",this._contextLimitReached=!1,this._contextLimitMessage="",this._error="",this._reconnectAttempts=0,this._pendingConversationFiles.forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),this._pendingConversationFiles=[],this._drawerOpen=!1,this._saveState(),this.load&&this.load().then((e=>{this.messages=e||[],this.conversationId&&!this._isStreaming&&this._reconnectStream()})).catch((()=>{}))):this._handleCloseDrawer()}_handleNewConversation(){this._handleStop(),this.conversationId=null,this._conversationTitle="",this._persistConversationId(),this.messages=[],this._pendingActions=[],this._inlineConfirm=!0,this._contextWarning="",this._contextLimitReached=!1,this._contextLimitMessage="",this._error="",this._reconnectAttempts=0,this._pendingConversationFiles.forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),this._pendingConversationFiles=[],this._drawerOpen=!1,this._saveState()}_handleCloseDrawer(){this._drawerOpen=!1,this._saveState()}_openToolDetail(e){const t=this.messages[this.messages.indexOf(e)+1];this._toolDetail={use:e,result:null},"tool_result"===t?.type&&t.data?.toolUseId===e.data?.toolUseId&&(this._toolDetail.result=t),this._toolDetailCopied=null,this._toolDetailInputOpen=!0,this._toolDetailOutputOpen=!0,this._drawerView="toolDetail",this._drawerOpen=!0,this._saveState(),this.updateComplete.then((()=>{this._drawerBodyEl&&(this._drawerBodyEl.scrollTop=0)}))}_handleToggleToolDetailInput(){this._toolDetailInputOpen=!this._toolDetailInputOpen}_handleToggleToolDetailOutput(){this._toolDetailOutputOpen=!this._toolDetailOutputOpen}_formatToolJson(e){if(null==e)return"";const t=String(e),i=t.match(/(<<<[0-9a-f-]+_BEGIN>>>\n?)([\s\S]*?)(\n?<<<[0-9a-f-]+_END>>>)/);if(i&&null!=i.index){const e=i.index+i[1].length,s=e+i[2].length;return t.slice(0,e)+this._reindentJson(i[2])+t.slice(s)}return this._reindentJson(t)}_reindentJson(e){const t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{}let i="",s=0,o=!1,r=!1;const a=e=>"\n"+" ".repeat(Math.max(0,e));for(let e=0;e<t.length;e++){const n=t[e];o?(i+=n,r?r=!1:"\\"===n?r=!0:'"'===n&&(o=!1)):'"'===n?(o=!0,i+=n):"{"===n||"["===n?(s++,i+=n+a(s)):"}"===n||"]"===n?(s--,i+=a(s)+n):","===n?i+=n+a(s):":"===n?i+=": ":" "===n||"\n"===n||"\t"===n||"\r"===n||(i+=n)}return i}_handleCopyToolDetailInput(e){e.stopPropagation(),this._copyToolDetail("input",this._formatToolJson(this._toolDetail?.use.data?.toolInput))}_handleCopyToolDetailOutput(e){e.stopPropagation(),this._copyToolDetail("output",this._formatToolJson(this._toolDetail?.result?.data?.toolResultString))}_copyToolDetail(e,t){navigator.clipboard.writeText(t).then((()=>{this._toolDetailCopied=e,setTimeout((()=>{this._toolDetailCopied===e&&(this._toolDetailCopied=null)}),2e3)})).catch((()=>{}))}_handleDrawerResizeMouseDown(e){this._isDrawerResizing=!0,this._drawerResizeStartX=e.clientX,this._drawerResizeStartW=this._drawerWidth,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleDrawerResizeMouseMove),document.addEventListener("mouseup",this._handleDrawerResizeMouseUp)}_readStreamChunk(){this._reader&&this._reader.read().then((e=>{if(e.done){if(this._turnFinishedCleanly)return;return void this._reconnectStream()}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._ensureAssistantBubble();e.reasoning||(e.reasoning=""),e.reasoning+=String(s.message),this.requestUpdate()}}else if("RESPONSE_PART"===s.type)s.message&&(this._ensureAssistantBubble().content+=String(s.message),this.requestUpdate());else if("tool_use"===s.type||"tool_result"===s.type)this.messages.push(s),this.requestUpdate();else if("action_decision"===s.type)this._pendingActions=[],this._confirmationHighlighted=-1,this._confirmationInFlight=!1,this.messages.push(s),this.requestUpdate();else if("ERROR"===s.type)this._handleStreamError(String(s.message||"Unknown error"));else if("CONVERSATION_STATE"===s.type)"NORMAL"!==s.data?.mode&&"EDIT"!==s.data?.mode&&"PLAN"!==s.data?.mode||(this._mode=s.data.mode);else if("CONVERSATION_TOKEN_WARNING"===s.type)this._contextWarning=String(s.message||"");else if("CONVERSATION_TITLE"===s.type)s.data?.title&&(this._conversationTitle=s.data.title,this.dispatchEvent(new CustomEvent("conversation-title",{detail:{title:s.data.title},bubbles:!0,composed:!0})));else if("CONVERSATION_LIMIT_REACHED"===s.type)this._contextLimitReached=!0,this._contextLimitMessage=String(s.message||""),this._contextWarning="";else if("ACTION_CONFIRMATION_REQUIRED"===s.type){const e=s.data?.actions;Array.isArray(e)&&e.length&&(this._pendingActions=e,this._confirmationHighlighted=0)}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._turnFinishedCleanly=!0,this._finishStream())}}this._reader&&this._readStreamChunk()})).catch((e=>{"AbortError"!==e.name&&(this._turnFinishedCleanly?this._handleStreamError(e.message):this._reconnectStream())}))}_reconnectStream(){this.conversationId?this._reconnectAttempts>=5?this._handleStreamError("Lost connection to the assistant. Please reload the conversation."):(this._reconnectAttempts=this._reconnectAttempts+1,gs.fetch({url:`/api/system/integration/aws/bedrock/stream/attach/${this.conversationId}`,method:"GET",headers:{Accept:"text/event-stream"}}).then((e=>{if(204===e.status)return this._reconnectAttempts=0,this.load&&this.load().then((e=>{this.messages=e,this.requestUpdate()})).catch((()=>{})),void this._finishStream();e.ok&&e.body?(this._reconnectAttempts=0,this._isStreaming=!0,this._followStream=!0,this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",this.load?this.load().then((e=>{this.messages=e,this.requestUpdate(),this._readStreamChunk()})).catch((()=>{this._readStreamChunk()})):this._readStreamChunk()):setTimeout((()=>this._reconnectStream()),1e3)})).catch((()=>{setTimeout((()=>this._reconnectStream()),1e3)}))):this._finishStream()}_ensureAssistantBubble(){const e=this.messages[this.messages.length-1];if(e&&"assistant"===e.type)return e;const t={type:"assistant",content:""};return this.messages=[...this.messages,t],t}_finishStream(){if(this._isStreaming=!1,this._reader=null,this._pendingActions.length){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&!this.messages[e].content&&!this.messages[e].reasoning&&(this.messages=this.messages.slice(0,-1)),this._inlineConfirm&&this.updateComplete.then((()=>{this._messagesEl?.querySelector('.confirmation[role="alertdialog"]')?.scrollIntoView({behavior:"smooth",block:"end"})}))}}_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))}}_renderModeSelector(){const e=bs.find((e=>e.mode===this._mode))||bs[0];return j`
|
|
7471
|
+
`,gs([ce({attribute:!1})],fs.prototype,"save",void 0),gs([ce({attribute:"save-mode"})],fs.prototype,"saveMode",void 0),customElements.get("krs-form")||customElements.define("krs-form",fs);class ms{static configure(e){void 0!==e.baseUrl&&(ms._baseUrl=e.baseUrl),void 0!==e.devUrl&&(ms._devUrl=e.devUrl)}static getBaseUrl(){return"localhost"===window.location.hostname&&window.location.port.startsWith("4")&&ms._devUrl?ms._devUrl:ms._baseUrl}static fetch(e){let t=e.url;var i="localhost"===window.location.hostname&&window.location.port.startsWith("4");let s=ms.getBaseUrl();0!==t.indexOf("http")&&(t=s+t),e.params&&(t+="?",Object.keys(e.params).forEach(((i,s)=>{s>0&&(t+="&"),t+=`${i}=${e.params[i]}`})));var o={};let r;return e.headers&&(e.headers instanceof Headers?e.headers.forEach(((e,t)=>{o[t]=e})):Array.isArray(e.headers)?e.headers.forEach((([e,t])=>{o[e]=t})):Object.assign(o,e.headers)),!e.body||"object"!=typeof e.body||e.body instanceof ReadableStream||e.body instanceof Blob||e.body instanceof ArrayBuffer||e.body instanceof FormData||e.body instanceof URLSearchParams||(e.body=JSON.stringify(e.body),o["Content-Type"]||(o["Content-Type"]="application/json")),e.headers=o,i&&!e.credentials&&(e.credentials="include"),r=t.indexOf("/api/user/")>-1||t.indexOf("/api/account/")>-1?fetch(`${s}/api/user/customer/authToken`,{credentials:"include"}):Promise.resolve(null),r.then((e=>e?.json())).then((i=>(i?.data&&(o["X-CSRF-TOKEN"]=i.data),fetch(t,e)))).then((e=>e.ok?e:Promise.reject(e)))}}ms._baseUrl="",ms._devUrl="";var vs=function(e,t,i,s){var o,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 n=e.length-1;n>=0;n--)(o=e[n])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};const bs=[{decision:"approve",label:"Yes"},{decision:"approveAlways",label:"Always allow"},{decision:"reject",label:"No"}],_s=[{mode:"NORMAL",label:"Ask",description:"Asks before making changes"},{mode:"EDIT",label:"Auto",description:"Makes changes automatically"},{mode:"PLAN",label:"Plan",description:"Suggests a plan, makes no changes"}],ys=["jpg","jpeg","png","gif","webp"],ks=["pdf","doc","docx","xls","xlsx","csv","html","md","txt","json","xml","vtt","srt",...ys,"mp4","webm","ogg","mov"];class xs extends ne{constructor(){super(...arguments),this._inlineConfirm=!0,this._reasoningAsMessage=!0,this._reader=null,this._decoder=new TextDecoder,this._buffer="",this._turnFinishedCleanly=!1,this._reconnectAttempts=0,this._userHasScrolledUp=!1,this._followStream=!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._drawerResizeStartX=0,this._drawerResizeStartW=0,this._dragDepth=0,this._pendingSeq=0,this._pendingAttachAnalyze=!0,this._orgSkillRequestId=0,this._globalSkillRequestId=0,this._invocableSkillRequestId=0,this._suggestedActionRequestId=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._conversationTitle="",this._contextWarning="",this._contextLimitReached=!1,this._contextLimitMessage="",this._pendingActions=[],this._confirmationHighlighted=-1,this._confirmationInFlight=!1,this._telemetry=null,this._iterationLog=[],this._cacheCheckpoints={},this._drawerOpen=!1,this._drawerView="settings",this._conversations=[],this._conversationsLoading=!1,this._toolDetail=null,this._toolDetailCopied=null,this._toolDetailInputOpen=!0,this._toolDetailOutputOpen=!0,this._drawerWidth=430,this._isDrawerResizing=!1,this._pendingConversationFiles=[],this._isDraggingFile=!1,this._skillMenuOpened=!1,this._skillQuery="",this._orgSkills=[],this._globalSkills=[],this._invocableSkills=[],this._suggestedActions=[],this._aiFrameworkConfig={},this._skillHighlighted=0,this._copiedIndex=-1,this._skillBrowseOpened=!1,this._skillBrowseDetail=null,this._skillInstallConfirm=null,this._skillOfferConfirm=null,this._skillBrowseSource="org",this._skillBrowseQuery="",this._isDictating=!1,this._mode="NORMAL",this._modeMenuOpened=!1,this._showTools=!0,this._showToolInputs=!1,this._showConfirmationInput=!1,this._handleDocumentClick=e=>{if(this._modeMenuOpened){e.composedPath().some((e=>e instanceof HTMLElement&&e.classList.contains("mode")))||(this._modeMenuOpened=!1)}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,o=380,r=.9*window.innerWidth,a=window.innerHeight-72;let n=this._resizeStartW,l=this._resizeStartH,d=this._dragStartLeft,h=this._dragStartTop;this._resizeDir.includes("e")&&(n=Math.max(s,Math.min(this._resizeStartW+t,r))),this._resizeDir.includes("w")&&(n=Math.max(s,Math.min(this._resizeStartW-t,r)),d=this._dragStartLeft+(this._resizeStartW-n)),this._resizeDir.includes("s")&&(l=Math.max(o,Math.min(this._resizeStartH+i,a))),this._resizeDir.includes("n")&&(l=Math.max(o,Math.min(this._resizeStartH-i,a)),h=this._dragStartTop+(this._resizeStartH-l)),d=Math.max(0,d),h=Math.max(0,h),this._panelEl.style.width=n+"px",this._panelEl.style.height=l+"px",this._panelEl.style.left=d+"px",this._panelEl.style.top=h+"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._handleDocumentKeydown=e=>{if(this._pendingActions.length&&!this._confirmationInFlight){if("ArrowRight"===e.key)return e.preventDefault(),void(this._confirmationHighlighted=(this._confirmationHighlighted+1)%bs.length);if("ArrowLeft"===e.key)return e.preventDefault(),void(this._confirmationHighlighted=(this._confirmationHighlighted-1+bs.length)%bs.length);if("Enter"===e.key){e.preventDefault();const t=bs[this._confirmationHighlighted];t&&this._handleConfirmationDecision(t.decision)}}},this._handleDrawerResizeMouseMove=e=>{if(!this._isDrawerResizing)return;const t=e.clientX-this._drawerResizeStartX,i=Math.max(300,this.offsetWidth-300);this._drawerWidth=Math.max(300,Math.min(this._drawerResizeStartW-t,i))},this._handleDrawerResizeMouseUp=()=>{this._isDrawerResizing=!1,document.removeEventListener("mousemove",this._handleDrawerResizeMouseMove),document.removeEventListener("mouseup",this._handleDrawerResizeMouseUp),this._saveState()}}connectedCallback(){super.connectedCallback(),this.load||(this.load=()=>null==this.conversationId?Promise.resolve([]):ms.fetch({url:`/api/system/conversation/${this.conversationId}/messages`}).then((e=>e.json())).then((e=>Promise.all((e?.data||[]).map((e=>{if("tool_use"===e.type||"tool_result"===e.type){let t={};try{t=JSON.parse(e.content||"{}")}catch{}return Promise.resolve({type:e.type,content:"",data:t})}if("reasoning"===e.type)return Promise.resolve({type:"assistant",content:"",reasoning:e.content||""});if("action_decision"===e.type){let t={};try{t=JSON.parse(e.content||"{}")}catch{}return Promise.resolve({type:"action_decision",content:"",data:t})}let t=[];try{t=JSON.parse(e.conversationFileIDs||"[]")}catch{}return t.length?Promise.all(t.map((e=>ms.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)}))))));let e=Promise.resolve();if("floating"===this.variant&&null==this.conversationId){const t=Number(sessionStorage.getItem("kr-chatbot-conversation-id"));t>0&&(this.conversationId=t,e=ms.fetch({url:`/api/system/conversation/${t}`}).then((e=>e.json())).then((e=>{this._conversationTitle=e?.data?.title||""})).catch((()=>{})))}e.then((()=>this.load())).then((e=>{e&&e.length&&(this.messages=e),this.conversationId&&!this._isStreaming&&this._reconnectStream()})).catch((()=>{})),ms.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),document.addEventListener("keydown",this._handleDocumentKeydown)}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),document.removeEventListener("keydown",this._handleDocumentKeydown),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)}))),this._isStreaming&&this._followStream&&this._messagesEl&&requestAnimationFrame((()=>{const e=this._messagesEl;if(!e||!this._isStreaming||!this._followStream)return;const t=e.querySelectorAll(".agent-turn"),i=t[t.length-1],s=i?.lastElementChild;if(!s)return;const o=s.getBoundingClientRect().bottom-e.getBoundingClientRect().top+e.scrollTop+24;o>e.scrollTop+e.clientHeight&&(e.scrollTop=Math.min(o-e.clientHeight,e.scrollHeight-e.clientHeight))})),e.has("opened")&&this.opened&&this._inputEl&&setTimeout((()=>{this._inputEl&&this._inputEl.focus()}),200),e.has("opened")&&this.opened&&0===this.messages.length&&this._loadSuggestedActions(),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(),o=Math.max(t,e.top-s.height-8);this._skillMenuEl.style.top=o+"px"}))}stop(){this._handleStop()}isStreaming(){return this._isStreaming}open(){this.opened||this._handleToggle()}close(){this.opened&&this._handleToggle()}toggle(){this._handleToggle()}prompt(e){this.open(),this._inputValue=e.message,this._handleSubmit()}draft(e){this.open(),this._inputValue=e.message,this._saveState(),this.updateComplete.then((()=>{setTimeout((()=>{this._inputEl&&(this._inputEl.focus(),this._inputEl.select())}),200)}))}_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()}_persistConversationId(){if("floating"===this.variant)try{null!=this.conversationId?sessionStorage.setItem("kr-chatbot-conversation-id",String(this.conversationId)):sessionStorage.removeItem("kr-chatbot-conversation-id")}catch{}}_saveState(){let e="kr-chatbot-state",t="kr-chatbot-tab";"inline"===this.variant&&(e="kr-chatbot-state-inline",t="kr-chatbot-tab-inline");try{const t={message:this._inputValue,mode:this._mode,showTools:String(this._showTools),showToolInputs:String(this._showToolInputs),showConfirmationInput:String(this._showConfirmationInput)};localStorage.setItem(e,JSON.stringify(t))}catch{}try{let e=this._drawerView;"toolDetail"===e&&(e="settings");const i={drawerOpen:String(this._drawerOpen),drawerView:e,drawerWidth:String(this._drawerWidth)};if("floating"===this.variant&&(i.opened=String(this.opened),this._panelEl)){const e=this._panelEl.style;e.left&&(i.left=e.left),e.top&&(i.top=e.top),e.width&&(i.width=e.width),e.height&&(i.height=e.height),e.position&&(i.position=e.position)}sessionStorage.setItem(t,JSON.stringify(i))}catch{}}_restoreState(){let e="kr-chatbot-state",t="kr-chatbot-tab";"inline"===this.variant&&(e="kr-chatbot-state-inline",t="kr-chatbot-tab-inline");try{const t=localStorage.getItem(e);if(t){const e=JSON.parse(t);"string"==typeof e.message&&"/"!==e.message.trim()&&(this._inputValue=e.message),"NORMAL"!==e.mode&&"EDIT"!==e.mode&&"PLAN"!==e.mode||(this._mode=e.mode),this._showTools="true"===e.showTools,this._showToolInputs="true"===e.showToolInputs,this._showConfirmationInput="true"===e.showConfirmationInput}}catch{}try{const e=sessionStorage.getItem(t);if(!e)return;const i=JSON.parse(e);this._drawerOpen="true"===i.drawerOpen,"settings"!==i.drawerView&&"debug"!==i.drawerView&&"history"!==i.drawerView||(this._drawerView=i.drawerView,"history"===i.drawerView&&this._loadConversations());const s=Number(i.drawerWidth);s>=300&&(this._drawerWidth=s),"floating"===this.variant&&"true"===i.opened&&(this.opened=!0,this.updateComplete.then((()=>this._applyStoredLayout())))}catch{}}_applyStoredLayout(){try{const e=sessionStorage.getItem("kr-chatbot-tab");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;ms.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("krs-chatbot: skill search failed",e)}))}_searchInvocableSkills(e){this._invocableSkillRequestId++;const t=this._invocableSkillRequestId;ms.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("krs-chatbot: invocable skill search failed",e)}))}_loadSuggestedActions(){this._suggestedActionRequestId++;const e=this._suggestedActionRequestId,t=this._captureContext();ms.fetch({url:"/api/system/conversation/suggestedActions",method:"POST",body:{pageContext:t.pageContext,selectionContext:t.selectionContext}}).then((e=>e.json())).then((t=>{e!==this._suggestedActionRequestId||this.messages.length>0||(this._suggestedActions=t?.data||[])})).catch((e=>{console.error("krs-chatbot: suggested actions load failed",e)}))}_searchGlobalSkills(e){this._globalSkillRequestId++;const t=this._globalSkillRequestId;ms.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("krs-chatbot: global skill search failed",e)}))}_handleGlobalSkillEnable(e,t){if(t.stopPropagation(),!e.canEnable)return void hi.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;if(!e.enabled&&e.billable)return void(this._skillInstallConfirm=e);const i=t.currentTarget;this._globalSkillPending.add(e.code),i?.showLoading(),ms.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(),e.enabled?hi.show({title:"Skill Installed",message:`${e.name} is now available to use.`,type:"success"}):hi.show({title:"Skill Uninstalled",message:`${e.name} is no longer available to use.`,type:"success"})})).catch((e=>{console.error("krs-chatbot: global skill enable failed",e),i?.showError("Error")})).finally((()=>{this._globalSkillPending.delete(e.code)}))}_handleSkillInstallCancel(){this._skillInstallConfirm=null}_handleSkillInstallConfirm(e){if(!this._skillInstallConfirm)return;if(this._globalSkillPending.has(this._skillInstallConfirm.code))return;const t=this._skillInstallConfirm,i=e.currentTarget;this._globalSkillPending.add(t.code),i?.showLoading(),ms.fetch({url:`/api/system/opensearch/aiskills/global/${encodeURIComponent(t.code)}/enabled`,method:"POST",body:{enabled:!0}}).then((e=>e.json())).then((e=>{t.enabled=e?.data?.enabled,i?.reset(),this._skillInstallConfirm=null,this.requestUpdate(),hi.show({title:"Skill Installed",message:`${t.name} is now available to use.`,type:"success"})})).catch((e=>{console.error("krs-chatbot: global skill install failed",e),i?.showError("Error")})).finally((()=>{this._globalSkillPending.delete(t.code)}))}_handleOfferedSkillsInstall(e,t){const i=JSON.parse(e.data.toolResultString);i.canInstall?i.skills.some((e=>this._globalSkillPending.has(e.code)))||(i.skills.some((e=>e.billable))?this._skillOfferConfirm=e:this._installOfferedSkills(e,t.currentTarget)):hi.show({title:"Permission Required",message:"You do not have permission to install skills. Please contact your site administrator.",type:"error"})}_handleSkillOfferCancel(){this._skillOfferConfirm=null}_handleSkillOfferConfirm(e){this._skillOfferConfirm&&this._installOfferedSkills(this._skillOfferConfirm,e.currentTarget)}_installOfferedSkills(e,t){const i=JSON.parse(e.data.toolResultString).skills;for(const e of i)this._globalSkillPending.add(e.code);t?.showLoading();let s=Promise.resolve();for(const e of i)s=s.then((()=>ms.fetch({url:`/api/system/opensearch/aiskills/global/${encodeURIComponent(e.code)}/enabled`,method:"POST",body:{enabled:!0}})));s.then((()=>{t?.reset(),this._skillOfferConfirm=null,e.data.skillOfferOutcome="installed",this.requestUpdate(),null!=this.conversationId&&ms.fetch({url:`/api/system/conversation/${this.conversationId}/skillOffer/${encodeURIComponent(e.data.toolUseId)}`,method:"POST",body:{outcome:"installed"}}).catch((e=>{console.error("krs-chatbot: failed to record skill offer outcome",e)})),this._inputValue=`I installed ${i.map((e=>e.name)).join(" and ")}. Please continue.`,this._handleSubmit()})).catch((e=>{console.error("krs-chatbot: skill offer install failed",e),t?.showError("Error")})).finally((()=>{for(const e of i)this._globalSkillPending.delete(e.code)}))}_handleOfferedSkillsDecline(e){e.data.skillOfferOutcome="declined",this.requestUpdate(),null!=this.conversationId&&ms.fetch({url:`/api/system/conversation/${this.conversationId}/skillOffer/${encodeURIComponent(e.data.toolUseId)}`,method:"POST",body:{outcome:"declined"}}).catch((e=>{console.error("krs-chatbot: failed to record skill offer outcome",e)})),this._inputValue=`I don't want to install ${JSON.parse(e.data.toolResultString).skills.map((e=>e.name)).join(" and ")} right now.`,this._handleSubmit()}_handlePlusClick(){this._skillMenuOpened?this._skillMenuOpened=!1:(this._skillQuery="",this._skillHighlighted=0,this._skillMenuOpened=!0,this._searchInvocableSkills(""))}_handleModeToggle(){this._modeMenuOpened=!this._modeMenuOpened}_handleModeSelect(e){this._mode=e,this._modeMenuOpened=!1,this._saveState()}_handleShowToolsChange(e){this._showTools=e.target.checked,this._saveState()}_handleShowToolInputsChange(e){this._showToolInputs=e.target.checked,this._saveState()}_handleShowConfirmationInputChange(e){this._showConfirmationInput=e.target.checked,this._saveState()}_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 hi.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()):hi.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._handleSkillCardOpen(t))}_handleSuggestedActionClick(e){this._inputValue=`/${e.code} `,this._saveState(),this._inputEl?.focus()}_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||ms.getBaseUrl().includes("localhost"))&&this._searchGlobalSkills("")}_handleSkillBrowseClose(){this._skillBrowseOpened=!1,this._skillBrowseDetail=null}_handleSkillCardOpen(e){this._skillBrowseDetail=e}_handleSkillDetailBack(){this._skillBrowseDetail=null}_handleSkillDetailTry(){this._skillBrowseDetail&&this._handleSkillSelect(this._skillBrowseDetail)}_handleSkillDetailEnable(e){this._skillBrowseDetail&&this._handleGlobalSkillEnable(this._skillBrowseDetail,e)}_handleSkillBrowseSearch(e){this._skillBrowseQuery=e.target.value,this._searchOrgSkills(this._skillBrowseQuery),(!0!==this._aiFrameworkConfig.registryServer||ms.getBaseUrl().includes("localhost"))&&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=>ks.includes(this._getFileExtension(e.name))));i.length&&i.forEach((e=>{let i;(e.type.startsWith("image/")||ys.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||`${ms.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view`;Hi.open({src:t,name:e.niceName||"file"}).addEventListener("download",(()=>{window.open(`${ms.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view?download=true`,"_blank")}))}_handleSubmit(){if(this._isStreaming)return;if(this._pendingActions.length)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._suggestedActions=[],this._saveState(),this._error="",this._userHasScrolledUp=!1,this._followStream=!0,this._pendingConversationFiles=[],this._inputEl&&(this._inputEl.style.height="auto"),this.messages=[...this.messages,{type:"assistant",content:""}],this._isStreaming=!0,this._turnFinishedCleanly=!1,this._reconnectAttempts=0,this.updateComplete.then((()=>{if(!this._messagesEl)return;this._messagesEl.querySelectorAll(".agent-turn").forEach((e=>{e.style.minHeight=""}));const e=this._messagesEl.querySelectorAll(".message--user"),t=e[e.length-1],i=this._messagesEl.querySelectorAll(".agent-turn"),s=i[i.length-1];s&&(s.style.minHeight=this._messagesEl.clientHeight+"px"),t&&(this._messagesEl.scrollTop=t.offsetTop-this._messagesEl.offsetTop-24)})),this.send||(this.send=e=>{if(e.confirmation)return ms.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState",method:"POST",headers:{Accept:"text/event-stream"},body:{confirmation:e.confirmation,conversationID:this.conversationId}});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"),ms.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)),mode:this._mode};return e.pageContext&&(i.pageContext=e.pageContext),e.selectionContext&&(i.selectionContext=e.selectionContext),null!=this.conversationId?i.conversationID=this.conversationId:i.createNew=!0,ms.fetch({url:"/api/system/integration/aws/bedrock/stream/invokeModelForConversationWithState",method:"POST",headers:{Accept:"text/event-stream"},body:i}).then((e=>(null==this.conversationId&&ms.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._persistConversationId(),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)}))}_handleConfirmationDecision(e){if(this._confirmationInFlight)return;this._confirmationInFlight=!0,this._error="";const t=this._messagesEl?.querySelector(`.confirmation__btn[data-decision="${e}"]`);t?.showLoading(),this._isStreaming=!0,this._turnFinishedCleanly=!1,this._reconnectAttempts=0,this._userHasScrolledUp=!1,this._followStream=!0,this.send({message:"",messages:this.messages,conversationFiles:[],pageContext:"",selectionContext:"",confirmation:e}).then((e=>e.ok?e.body?(this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",void this._readStreamChunk()):(this._confirmationInFlight=!1,t?.reset(),void this._handleStreamError("No response body")):(this._confirmationInFlight=!1,t?.reset(),void this._handleStreamError("Request failed: "+e.status)))).catch((e=>{this._confirmationInFlight=!1,t?.reset(),"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;t.scrollHeight-t.scrollTop-t.clientHeight>50?this._userHasScrolledUp=!0:(this._userHasScrolledUp=!1,this._isStreaming&&(this._followStream=!0))}_handleMessagesWheel(e){this._isStreaming&&e.deltaY<0&&(this._followStream=!1)}_handleMessagesTouchMove(){this._isStreaming&&(this._followStream=!1)}_handleMessagesPointerDown(e){const t=e.currentTarget;this._isStreaming&&e.offsetX>=t.clientWidth&&(this._followStream=!1)}_handleErrorDismiss(){this._error=""}_handleContextWarningDismiss(){this._contextWarning=""}_toggleDrawer(e){this._drawerOpen&&this._drawerView===e?this._drawerOpen=!1:(this._drawerOpen=!0,this._drawerView=e,"history"===e&&this._loadConversations()),this._saveState()}_loadConversations(){this._conversationsLoading=!0,ms.fetch({url:"/api/system/conversation/list",method:"POST",body:{page:0,size:50,sortBy:"lastModified",sortDirection:"desc",filterFields:[{name:"active",operation:"IS",value:"true"}]}}).then((e=>e.json())).then((e=>{this._conversations=e?.data?.content||[]})).catch((()=>{this._conversations=[]})).then((()=>{this._conversationsLoading=!1}))}_handleSwitchConversation(e){e!==this.conversationId?(this._handleStop(),this.conversationId=e,this._conversationTitle=this._conversations.find((t=>t.conversationID===e))?.title||"",this._persistConversationId(),this._pendingActions=[],this._inlineConfirm=!0,this._contextWarning="",this._contextLimitReached=!1,this._contextLimitMessage="",this._error="",this._reconnectAttempts=0,this._pendingConversationFiles.forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),this._pendingConversationFiles=[],this._drawerOpen=!1,this._saveState(),this.load&&this.load().then((e=>{this.messages=e||[],this.conversationId&&!this._isStreaming&&this._reconnectStream()})).catch((()=>{}))):this._handleCloseDrawer()}_handleNewConversation(){this._handleStop(),this.conversationId=null,this._conversationTitle="",this._persistConversationId(),this.messages=[],this._pendingActions=[],this._inlineConfirm=!0,this._contextWarning="",this._contextLimitReached=!1,this._contextLimitMessage="",this._error="",this._reconnectAttempts=0,this._pendingConversationFiles.forEach((e=>{e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),this._pendingConversationFiles=[],this._drawerOpen=!1,this._saveState()}_handleCloseDrawer(){this._drawerOpen=!1,this._saveState()}_openToolDetail(e){const t=this.messages[this.messages.indexOf(e)+1];this._toolDetail={use:e,result:null},"tool_result"===t?.type&&t.data?.toolUseId===e.data?.toolUseId&&(this._toolDetail.result=t),this._toolDetailCopied=null,this._toolDetailInputOpen=!0,this._toolDetailOutputOpen=!0,this._drawerView="toolDetail",this._drawerOpen=!0,this._saveState(),this.updateComplete.then((()=>{this._drawerBodyEl&&(this._drawerBodyEl.scrollTop=0)}))}_handleToggleToolDetailInput(){this._toolDetailInputOpen=!this._toolDetailInputOpen}_handleToggleToolDetailOutput(){this._toolDetailOutputOpen=!this._toolDetailOutputOpen}_formatToolJson(e){if(null==e)return"";const t=String(e),i=t.match(/(<<<[0-9a-f-]+_BEGIN>>>\n?)([\s\S]*?)(\n?<<<[0-9a-f-]+_END>>>)/);if(i&&null!=i.index){const e=i.index+i[1].length,s=e+i[2].length;return t.slice(0,e)+this._reindentJson(i[2])+t.slice(s)}return this._reindentJson(t)}_reindentJson(e){const t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{}let i="",s=0,o=!1,r=!1;const a=e=>"\n"+" ".repeat(Math.max(0,e));for(let e=0;e<t.length;e++){const n=t[e];o?(i+=n,r?r=!1:"\\"===n?r=!0:'"'===n&&(o=!1)):'"'===n?(o=!0,i+=n):"{"===n||"["===n?(s++,i+=n+a(s)):"}"===n||"]"===n?(s--,i+=a(s)+n):","===n?i+=n+a(s):":"===n?i+=": ":" "===n||"\n"===n||"\t"===n||"\r"===n||(i+=n)}return i}_handleCopyToolDetailInput(e){e.stopPropagation(),this._copyToolDetail("input",this._formatToolJson(this._toolDetail?.use.data?.toolInput))}_handleCopyToolDetailOutput(e){e.stopPropagation(),this._copyToolDetail("output",this._formatToolJson(this._toolDetail?.result?.data?.toolResultString))}_copyToolDetail(e,t){navigator.clipboard.writeText(t).then((()=>{this._toolDetailCopied=e,setTimeout((()=>{this._toolDetailCopied===e&&(this._toolDetailCopied=null)}),2e3)})).catch((()=>{}))}_handleDrawerResizeMouseDown(e){this._isDrawerResizing=!0,this._drawerResizeStartX=e.clientX,this._drawerResizeStartW=this._drawerWidth,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleDrawerResizeMouseMove),document.addEventListener("mouseup",this._handleDrawerResizeMouseUp)}_readStreamChunk(){this._reader&&this._reader.read().then((e=>{if(e.done){if(this._turnFinishedCleanly)return;return void this._reconnectStream()}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._ensureAssistantBubble();e.reasoning||(e.reasoning=""),e.reasoning+=String(s.message),this.requestUpdate()}}else if("RESPONSE_PART"===s.type)s.message&&(this._ensureAssistantBubble().content+=String(s.message),this.requestUpdate());else if("tool_use"===s.type||"tool_result"===s.type)this.messages.push(s),this.requestUpdate();else if("action_decision"===s.type)this._pendingActions=[],this._confirmationHighlighted=-1,this._confirmationInFlight=!1,this.messages.push(s),this.requestUpdate();else if("ERROR"===s.type)this._handleStreamError(String(s.message||"Unknown error"));else if("CONVERSATION_STATE"===s.type)"NORMAL"!==s.data?.mode&&"EDIT"!==s.data?.mode&&"PLAN"!==s.data?.mode||(this._mode=s.data.mode);else if("CONVERSATION_TOKEN_WARNING"===s.type)this._contextWarning=String(s.message||"");else if("CONVERSATION_TITLE"===s.type)s.data?.title&&(this._conversationTitle=s.data.title,this.dispatchEvent(new CustomEvent("conversation-title",{detail:{title:s.data.title},bubbles:!0,composed:!0})));else if("CONVERSATION_LIMIT_REACHED"===s.type)this._contextLimitReached=!0,this._contextLimitMessage=String(s.message||""),this._contextWarning="";else if("ACTION_CONFIRMATION_REQUIRED"===s.type){const e=s.data?.actions;Array.isArray(e)&&e.length&&(this._pendingActions=e,this._confirmationHighlighted=0)}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._turnFinishedCleanly=!0,this._finishStream())}}this._reader&&this._readStreamChunk()})).catch((e=>{"AbortError"!==e.name&&(this._turnFinishedCleanly?this._handleStreamError(e.message):this._reconnectStream())}))}_reconnectStream(){this.conversationId?this._reconnectAttempts>=5?this._handleStreamError("Lost connection to the assistant. Please reload the conversation."):(this._reconnectAttempts=this._reconnectAttempts+1,ms.fetch({url:`/api/system/integration/aws/bedrock/stream/attach/${this.conversationId}`,method:"GET",headers:{Accept:"text/event-stream"}}).then((e=>{if(204===e.status)return this._reconnectAttempts=0,this.load&&this.load().then((e=>{this.messages=e,this.requestUpdate()})).catch((()=>{})),void this._finishStream();e.ok&&e.body?(this._reconnectAttempts=0,this._isStreaming=!0,this._followStream=!0,this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",this.load?this.load().then((e=>{this.messages=e,this.requestUpdate(),this._readStreamChunk()})).catch((()=>{this._readStreamChunk()})):this._readStreamChunk()):setTimeout((()=>this._reconnectStream()),1e3)})).catch((()=>{setTimeout((()=>this._reconnectStream()),1e3)}))):this._finishStream()}_ensureAssistantBubble(){const e=this.messages[this.messages.length-1];if(e&&"assistant"===e.type)return e;const t={type:"assistant",content:""};return this.messages=[...this.messages,t],t}_finishStream(){if(this._isStreaming=!1,this._reader=null,this._pendingActions.length){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].type&&!this.messages[e].content&&!this.messages[e].reasoning&&(this.messages=this.messages.slice(0,-1)),this._inlineConfirm&&this.updateComplete.then((()=>{this._messagesEl?.querySelector('.confirmation[role="alertdialog"]')?.scrollIntoView({behavior:"smooth",block:"end"})}))}}_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))}}_renderModeSelector(){const e=_s.find((e=>e.mode===this._mode))||_s[0];return N`
|
|
7377
7472
|
<div class="mode">
|
|
7378
|
-
${this._modeMenuOpened?
|
|
7473
|
+
${this._modeMenuOpened?N`
|
|
7379
7474
|
<div class="mode-menu">
|
|
7380
|
-
${
|
|
7475
|
+
${_s.map((e=>N`
|
|
7381
7476
|
<button
|
|
7382
7477
|
class=${ye({"mode-menu__item":!0,"mode-menu__item--active":e.mode===this._mode})}
|
|
7383
7478
|
@click=${()=>this._handleModeSelect(e.mode)}
|
|
@@ -7409,29 +7504,29 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7409
7504
|
</svg>
|
|
7410
7505
|
</button>
|
|
7411
7506
|
</div>
|
|
7412
|
-
`}_renderConfirmation(){let e="Run this action?";return this._pendingActions.length>1?e="These actions need your approval":this._pendingActions[0]&&(e=`Run "${this._pendingActions[0].displayName||this._pendingActions[0].toolName}"?`),
|
|
7507
|
+
`}_renderConfirmation(){let e="Run this action?";return this._pendingActions.length>1?e="These actions need your approval":this._pendingActions[0]&&(e=`Run "${this._pendingActions[0].displayName||this._pendingActions[0].toolName}"?`),N`
|
|
7413
7508
|
<div
|
|
7414
7509
|
class=${ye({confirmation:!0,"confirmation--inline":this._inlineConfirm})}
|
|
7415
7510
|
role="alertdialog"
|
|
7416
7511
|
aria-label="Confirm before continuing"
|
|
7417
7512
|
>
|
|
7418
7513
|
<div class="confirmation__title">${e}</div>
|
|
7419
|
-
${this._pendingActions.length>1?
|
|
7514
|
+
${this._pendingActions.length>1?N`
|
|
7420
7515
|
<ol class="confirmation__list">
|
|
7421
|
-
${this._pendingActions.map((e=>
|
|
7516
|
+
${this._pendingActions.map((e=>N`
|
|
7422
7517
|
<li class="confirmation__list-item">
|
|
7423
7518
|
<span class="confirmation__list-name">${e.displayName||e.toolName}</span>
|
|
7424
|
-
${e.confirmationMessage?
|
|
7425
|
-
${this._showConfirmationInput&&this._inlineConfirm&&e.input&&Object.keys(e.input).length?
|
|
7519
|
+
${e.confirmationMessage?N`<span class="confirmation__list-desc">${e.confirmationMessage}</span>`:U}
|
|
7520
|
+
${this._showConfirmationInput&&this._inlineConfirm&&e.input&&Object.keys(e.input).length?N`<pre class="confirmation__details-input">${JSON.stringify(e.input,null,2)}</pre>`:U}
|
|
7426
7521
|
</li>
|
|
7427
7522
|
`))}
|
|
7428
7523
|
</ol>
|
|
7429
|
-
`:
|
|
7524
|
+
`:N`
|
|
7430
7525
|
<p class="confirmation__message">${this._pendingActions[0]?.confirmationMessage||"The assistant wants to take an action. Is that OK?"}</p>
|
|
7431
|
-
${this._showConfirmationInput&&this._inlineConfirm&&this._pendingActions[0]?.input&&Object.keys(this._pendingActions[0].input).length?
|
|
7526
|
+
${this._showConfirmationInput&&this._inlineConfirm&&this._pendingActions[0]?.input&&Object.keys(this._pendingActions[0].input).length?N`<pre class="confirmation__details-input">${JSON.stringify(this._pendingActions[0].input,null,2)}</pre>`:U}
|
|
7432
7527
|
`}
|
|
7433
7528
|
<div class="confirmation__actions">
|
|
7434
|
-
${
|
|
7529
|
+
${bs.map(((e,t)=>N`
|
|
7435
7530
|
<krs-button
|
|
7436
7531
|
class=${ye({confirmation__btn:!0,"confirmation__btn--highlighted":t===this._confirmationHighlighted})}
|
|
7437
7532
|
variant=${"approve"===e.decision?"flat":"outline"}
|
|
@@ -7443,7 +7538,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7443
7538
|
`))}
|
|
7444
7539
|
</div>
|
|
7445
7540
|
</div>
|
|
7446
|
-
`}_renderSkillMenu(){const e=this._invocableSkills,t="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;let i=3;return t&&(i=5),
|
|
7541
|
+
`}_renderSkillMenu(){const e=this._invocableSkills,t="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;let i=3;return t&&(i=5),N`
|
|
7447
7542
|
<div class="skill-menu">
|
|
7448
7543
|
<div class="skill-menu__actions">
|
|
7449
7544
|
<button
|
|
@@ -7466,7 +7561,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7466
7561
|
>
|
|
7467
7562
|
Browse All Skills
|
|
7468
7563
|
</button>
|
|
7469
|
-
${t?
|
|
7564
|
+
${t?N`
|
|
7470
7565
|
<button
|
|
7471
7566
|
class=${ye({"skill-menu__action":!0,"skill-menu__item--highlighted":3===this._skillHighlighted})}
|
|
7472
7567
|
@click=${()=>this._activateSkillMenuItem(3)}
|
|
@@ -7481,16 +7576,16 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7481
7576
|
</button>
|
|
7482
7577
|
`:U}
|
|
7483
7578
|
</div>
|
|
7484
|
-
${e.length?
|
|
7579
|
+
${e.length?N`
|
|
7485
7580
|
<ul class="skill-menu__list">
|
|
7486
|
-
${e.map(((e,t)=>
|
|
7581
|
+
${e.map(((e,t)=>N`
|
|
7487
7582
|
<li>
|
|
7488
7583
|
<button
|
|
7489
7584
|
class=${ye({"skill-menu__item":!0,"skill-menu__item--highlighted":t+i===this._skillHighlighted})}
|
|
7490
7585
|
@click=${()=>this._handleSkillSelect(e)}
|
|
7491
7586
|
>
|
|
7492
7587
|
<span class="skill-menu__name">${e.name}</span>
|
|
7493
|
-
${e.summary?
|
|
7588
|
+
${e.summary?N`
|
|
7494
7589
|
<span class="skill-menu__desc">${e.summary}</span>
|
|
7495
7590
|
`:U}
|
|
7496
7591
|
</button>
|
|
@@ -7499,7 +7594,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7499
7594
|
</ul>
|
|
7500
7595
|
`:U}
|
|
7501
7596
|
</div>
|
|
7502
|
-
`}_renderSkillBrowse(){return
|
|
7597
|
+
`}_renderSkillBrowse(){return N`
|
|
7503
7598
|
<krs-dialog
|
|
7504
7599
|
opened
|
|
7505
7600
|
width="720px"
|
|
@@ -7507,7 +7602,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7507
7602
|
>
|
|
7508
7603
|
<krs-dialog-header>
|
|
7509
7604
|
<div class="skill-browse__header">
|
|
7510
|
-
${this._skillBrowseDetail?
|
|
7605
|
+
${this._skillBrowseDetail?N`
|
|
7511
7606
|
<button
|
|
7512
7607
|
type="button"
|
|
7513
7608
|
class="skill-browse__back"
|
|
@@ -7527,7 +7622,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7527
7622
|
<path d="M19 12H5M12 19l-7-7 7-7"/>
|
|
7528
7623
|
</svg>
|
|
7529
7624
|
</button>
|
|
7530
|
-
`:
|
|
7625
|
+
`:N`
|
|
7531
7626
|
<h2>Browse Skills</h2>
|
|
7532
7627
|
`}
|
|
7533
7628
|
<button
|
|
@@ -7550,12 +7645,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7550
7645
|
</div>
|
|
7551
7646
|
</krs-dialog-header>
|
|
7552
7647
|
<div class="skill-browse">
|
|
7553
|
-
${this._skillBrowseDetail?
|
|
7648
|
+
${this._skillBrowseDetail?N`
|
|
7554
7649
|
<div class="skill-detail">
|
|
7555
7650
|
<div class="skill-detail__body">
|
|
7556
7651
|
<div class="skill-detail__section">
|
|
7557
7652
|
<span class="skill-detail__title">${this._skillBrowseDetail.name}</span>
|
|
7558
|
-
${this._skillBrowseDetail.summary?
|
|
7653
|
+
${this._skillBrowseDetail.summary?N`
|
|
7559
7654
|
<p class="skill-detail__summary">${this._skillBrowseDetail.summary}</p>
|
|
7560
7655
|
`:U}
|
|
7561
7656
|
</div>
|
|
@@ -7563,17 +7658,17 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7563
7658
|
<span class="skill-detail__label">Author</span>
|
|
7564
7659
|
<span class="skill-detail__value">${this._skillBrowseDetail.global?"Kodaris":"Your organization"}</span>
|
|
7565
7660
|
</div>
|
|
7566
|
-
${this._skillBrowseDetail.global?
|
|
7661
|
+
${this._skillBrowseDetail.global?N`
|
|
7567
7662
|
<div class="skill-detail__row">
|
|
7568
7663
|
<span class="skill-detail__label">Price</span>
|
|
7569
7664
|
<span class="skill-detail__value">${this._skillBrowseDetail.priceLabel}</span>
|
|
7570
7665
|
</div>
|
|
7571
7666
|
`:U}
|
|
7572
|
-
${this._skillBrowseDetail.allowedRoles?.length?
|
|
7667
|
+
${this._skillBrowseDetail.allowedRoles?.length?N`
|
|
7573
7668
|
<div class="skill-detail__row">
|
|
7574
7669
|
<span class="skill-detail__label">Roles</span>
|
|
7575
7670
|
<div class="skill-detail__chips">
|
|
7576
|
-
${this._skillBrowseDetail.allowedRoles.map((e=>
|
|
7671
|
+
${this._skillBrowseDetail.allowedRoles.map((e=>N`
|
|
7577
7672
|
<span class="skill-detail__chip">${e}</span>
|
|
7578
7673
|
`))}
|
|
7579
7674
|
</div>
|
|
@@ -7581,14 +7676,14 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7581
7676
|
`:U}
|
|
7582
7677
|
</div>
|
|
7583
7678
|
<div class="skill-detail__footer">
|
|
7584
|
-
${!1===this._skillBrowseDetail.canRun||this._skillBrowseDetail.global&&!this._skillBrowseDetail.enabled?U:
|
|
7679
|
+
${!1===this._skillBrowseDetail.canRun||this._skillBrowseDetail.global&&!this._skillBrowseDetail.enabled?U:N`
|
|
7585
7680
|
<krs-button
|
|
7586
7681
|
variant="flat"
|
|
7587
7682
|
color="primary"
|
|
7588
7683
|
@click=${this._handleSkillDetailTry}
|
|
7589
7684
|
>Try It</krs-button>
|
|
7590
7685
|
`}
|
|
7591
|
-
${this._skillBrowseDetail.global?
|
|
7686
|
+
${this._skillBrowseDetail.global?N`
|
|
7592
7687
|
<krs-button
|
|
7593
7688
|
variant=${this._skillBrowseDetail.enabled?"outline":"flat"}
|
|
7594
7689
|
color=${this._skillBrowseDetail.enabled?"secondary":"primary"}
|
|
@@ -7597,7 +7692,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7597
7692
|
`:U}
|
|
7598
7693
|
</div>
|
|
7599
7694
|
</div>
|
|
7600
|
-
`:
|
|
7695
|
+
`:N`
|
|
7601
7696
|
<krs-text-field
|
|
7602
7697
|
placeholder="Search skills..."
|
|
7603
7698
|
.value=${this._skillBrowseQuery}
|
|
@@ -7610,7 +7705,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7610
7705
|
<krs-tab id="org" label="Your Org">
|
|
7611
7706
|
${this._renderSkillGrid()}
|
|
7612
7707
|
</krs-tab>
|
|
7613
|
-
${!0!==this._aiFrameworkConfig.registryServer||
|
|
7708
|
+
${!0!==this._aiFrameworkConfig.registryServer||ms.getBaseUrl().includes("localhost")?N`
|
|
7614
7709
|
<krs-tab id="kodaris" label="Kodaris">
|
|
7615
7710
|
${this._renderSkillGrid(!0)}
|
|
7616
7711
|
</krs-tab>
|
|
@@ -7619,9 +7714,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7619
7714
|
`}
|
|
7620
7715
|
</div>
|
|
7621
7716
|
</krs-dialog>
|
|
7622
|
-
`}_renderSkillGrid(e=!1){let t=this._orgSkills;return e&&(t=this._globalSkills),t.length?
|
|
7717
|
+
`}_renderSkillGrid(e=!1){let t=this._orgSkills;return e&&(t=this._globalSkills),t.length?N`
|
|
7623
7718
|
<div class="skill-browse__grid">
|
|
7624
|
-
${t.map((t=>
|
|
7719
|
+
${t.map((t=>N`
|
|
7625
7720
|
<div
|
|
7626
7721
|
class="skill-card"
|
|
7627
7722
|
role="button"
|
|
@@ -7630,13 +7725,13 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7630
7725
|
@keydown=${e=>this._handleSkillCardKeydown(e,t)}
|
|
7631
7726
|
>
|
|
7632
7727
|
<span class="skill-card__name">${t.name}</span>
|
|
7633
|
-
${t.summary?
|
|
7728
|
+
${t.summary?N`
|
|
7634
7729
|
<span class="skill-card__desc">${t.summary}</span>
|
|
7635
7730
|
`:U}
|
|
7636
|
-
${!e&&t.global?
|
|
7731
|
+
${!e&&t.global?N`
|
|
7637
7732
|
<span class="skill-card__badge">Global</span>
|
|
7638
7733
|
`:U}
|
|
7639
|
-
${e?
|
|
7734
|
+
${e?N`
|
|
7640
7735
|
<div class="skill-card__footer">
|
|
7641
7736
|
<span class="skill-card__price">${t.priceLabel}</span>
|
|
7642
7737
|
<krs-button
|
|
@@ -7651,7 +7746,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7651
7746
|
</div>
|
|
7652
7747
|
`))}
|
|
7653
7748
|
</div>
|
|
7654
|
-
`:U}_renderUserContent(e){const t=e.match(/^\/(\S+)(\s[\s\S]*)?$/);return t?
|
|
7749
|
+
`:U}_renderUserContent(e){const t=e.match(/^\/(\S+)(\s[\s\S]*)?$/);return t?N`<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)}_fmtPrice(e){return null==e||isNaN(e)?"—":"$"+e.toFixed(2)}_fmtPriceDetail(e){return null==e||isNaN(e)?"—":"$"+e.toFixed(4)}_getCustomerPriceLabel(){const e=this._telemetry?.customerPricePerThousandTokens;return null==e||isNaN(e)?"Customer price":`Customer price ($${e}/1K)`}_getMarkupPriceLabel(){const e=this._telemetry?.customerMarkupPercent;return null==e||isNaN(e)?"Customer price (markup)":`Customer price (${e}% markup)`}_getTurnCacheWriteTokens(){return this._iterationLog.reduce(((e,t)=>e+(t.iterationCacheWrite||0)),0)}_renderMarkupBreakdown(e,t,i,s){return N`
|
|
7655
7750
|
<span class="debug-metrics__key debug-metrics__key--sub">Input</span>
|
|
7656
7751
|
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(e)}</span>
|
|
7657
7752
|
<span class="debug-metrics__key debug-metrics__key--sub">Output</span>
|
|
@@ -7660,22 +7755,22 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7660
7755
|
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(i)}</span>
|
|
7661
7756
|
<span class="debug-metrics__key debug-metrics__key--sub">Cache write</span>
|
|
7662
7757
|
<span class="debug-metrics__val debug-metrics__val--sub">${this._fmtPriceDetail(s)}</span>
|
|
7663
|
-
`}_renderHistoryContent(){return
|
|
7758
|
+
`}_renderHistoryContent(){return N`
|
|
7664
7759
|
<div class="history">
|
|
7665
|
-
${this._conversationsLoading?
|
|
7760
|
+
${this._conversationsLoading?N`
|
|
7666
7761
|
<div class="history__empty">Loading…</div>
|
|
7667
|
-
`:0===this._conversations.length?
|
|
7762
|
+
`:0===this._conversations.length?N`
|
|
7668
7763
|
<div class="history__empty">No previous conversations</div>
|
|
7669
|
-
`:
|
|
7764
|
+
`:N`
|
|
7670
7765
|
<div class="history__list">
|
|
7671
|
-
${this._conversations.map((e=>{let t="";if(e.lastModified){const i=new Date(e.lastModified),s=new Date;t=isNaN(i.getTime())?e.lastModified:i.toDateString()===s.toDateString()?i.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}):i.getFullYear()===s.getFullYear()?i.toLocaleDateString("en-US",{month:"short",day:"numeric"}):i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}return
|
|
7766
|
+
${this._conversations.map((e=>{let t="";if(e.lastModified){const i=new Date(e.lastModified),s=new Date;t=isNaN(i.getTime())?e.lastModified:i.toDateString()===s.toDateString()?i.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}):i.getFullYear()===s.getFullYear()?i.toLocaleDateString("en-US",{month:"short",day:"numeric"}):i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}return N`
|
|
7672
7767
|
<button
|
|
7673
7768
|
type="button"
|
|
7674
7769
|
class=${ye({history__item:!0,"history__item--active":e.conversationID===this.conversationId})}
|
|
7675
7770
|
@click=${()=>this._handleSwitchConversation(e.conversationID)}
|
|
7676
7771
|
>
|
|
7677
7772
|
<span class="history__item-title">${e.title||"Untitled conversation"}</span>
|
|
7678
|
-
${t?
|
|
7773
|
+
${t?N`
|
|
7679
7774
|
<span class="history__item-date">${t}</span>
|
|
7680
7775
|
`:U}
|
|
7681
7776
|
</button>
|
|
@@ -7683,19 +7778,19 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7683
7778
|
</div>
|
|
7684
7779
|
`}
|
|
7685
7780
|
</div>
|
|
7686
|
-
`}_renderDrawer(){const e="debug"===this._drawerView&&"inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;let t="Settings",i=this._renderSettingsContent();return e?(t="Debug",i=this._renderDebugContent()):"toolDetail"===this._drawerView&&this._toolDetail?(t=this._toolDetail.use.data?.displayName||this._toolDetail.use.data?.toolName||"Tool",i=this._renderToolDetailContent()):"history"===this._drawerView&&(t="Conversations",i=this._renderHistoryContent()),
|
|
7781
|
+
`}_renderDrawer(){const e="debug"===this._drawerView&&"inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled;let t="Settings",i=this._renderSettingsContent();return e?(t="Debug",i=this._renderDebugContent()):"toolDetail"===this._drawerView&&this._toolDetail?(t=this._toolDetail.use.data?.displayName||this._toolDetail.use.data?.toolName||"Tool",i=this._renderToolDetailContent()):"history"===this._drawerView&&(t="Conversations",i=this._renderHistoryContent()),N`
|
|
7687
7782
|
<div
|
|
7688
7783
|
class=${ye({drawer:!0,"drawer--open":this._drawerOpen,"drawer--resizing":this._isDrawerResizing,"drawer--full":"floating"===this.variant})}
|
|
7689
7784
|
style=${we("floating"===this.variant?{}:{width:`${this._drawerWidth}px`})}
|
|
7690
7785
|
>
|
|
7691
|
-
${"floating"===this.variant?U:
|
|
7786
|
+
${"floating"===this.variant?U:N`
|
|
7692
7787
|
<div
|
|
7693
7788
|
class="drawer__resize"
|
|
7694
7789
|
@mousedown=${this._handleDrawerResizeMouseDown}
|
|
7695
7790
|
></div>
|
|
7696
7791
|
`}
|
|
7697
7792
|
<div class="drawer__header">
|
|
7698
|
-
${"floating"===this.variant?
|
|
7793
|
+
${"floating"===this.variant?N`
|
|
7699
7794
|
<button
|
|
7700
7795
|
class="header-action"
|
|
7701
7796
|
@click=${this._handleCloseDrawer}
|
|
@@ -7718,7 +7813,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7718
7813
|
</button>
|
|
7719
7814
|
`:U}
|
|
7720
7815
|
<span class="drawer__title">${t}</span>
|
|
7721
|
-
${"history"===this._drawerView?
|
|
7816
|
+
${"history"===this._drawerView?N`
|
|
7722
7817
|
<krs-button
|
|
7723
7818
|
class="history__new"
|
|
7724
7819
|
variant="flat"
|
|
@@ -7743,7 +7838,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7743
7838
|
New conversation
|
|
7744
7839
|
</krs-button>
|
|
7745
7840
|
`:U}
|
|
7746
|
-
${"floating"===this.variant?U:
|
|
7841
|
+
${"floating"===this.variant?U:N`
|
|
7747
7842
|
<button
|
|
7748
7843
|
class="header-action"
|
|
7749
7844
|
@click=${this._handleCloseDrawer}
|
|
@@ -7770,7 +7865,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7770
7865
|
${i}
|
|
7771
7866
|
</div>
|
|
7772
7867
|
</div>
|
|
7773
|
-
`}_renderSettingsContent(){return
|
|
7868
|
+
`}_renderSettingsContent(){return N`
|
|
7774
7869
|
<div class="settings-section">
|
|
7775
7870
|
<div class="settings-section__title">Tools</div>
|
|
7776
7871
|
<div class="settings-row">
|
|
@@ -7795,7 +7890,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7795
7890
|
></krs-checkbox>
|
|
7796
7891
|
</div>
|
|
7797
7892
|
</div>
|
|
7798
|
-
`}_renderToolDetailContent(){return
|
|
7893
|
+
`}_renderToolDetailContent(){return N`
|
|
7799
7894
|
<div class="tool-detail">
|
|
7800
7895
|
<div class="tool-detail__section">
|
|
7801
7896
|
<button
|
|
@@ -7811,7 +7906,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7811
7906
|
role="button"
|
|
7812
7907
|
@click=${this._handleCopyToolDetailInput}
|
|
7813
7908
|
>
|
|
7814
|
-
${"input"===this._toolDetailCopied?
|
|
7909
|
+
${"input"===this._toolDetailCopied?N`
|
|
7815
7910
|
<svg
|
|
7816
7911
|
viewBox="0 0 24 24"
|
|
7817
7912
|
fill="none"
|
|
@@ -7822,7 +7917,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7822
7917
|
>
|
|
7823
7918
|
<path d="M20 6 9 17l-5-5" />
|
|
7824
7919
|
</svg>
|
|
7825
|
-
`:
|
|
7920
|
+
`:N`
|
|
7826
7921
|
<svg
|
|
7827
7922
|
viewBox="0 0 24 24"
|
|
7828
7923
|
fill="none"
|
|
@@ -7843,7 +7938,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7843
7938
|
`}
|
|
7844
7939
|
</span>
|
|
7845
7940
|
</button>
|
|
7846
|
-
${this._toolDetailInputOpen?
|
|
7941
|
+
${this._toolDetailInputOpen?N`<pre class="tool-detail__code">${this._formatToolJson(this._toolDetail.use.data?.toolInput)||"(no input)"}</pre>`:U}
|
|
7847
7942
|
</div>
|
|
7848
7943
|
<div class="tool-detail__section">
|
|
7849
7944
|
<button
|
|
@@ -7859,7 +7954,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7859
7954
|
role="button"
|
|
7860
7955
|
@click=${this._handleCopyToolDetailOutput}
|
|
7861
7956
|
>
|
|
7862
|
-
${"output"===this._toolDetailCopied?
|
|
7957
|
+
${"output"===this._toolDetailCopied?N`
|
|
7863
7958
|
<svg
|
|
7864
7959
|
viewBox="0 0 24 24"
|
|
7865
7960
|
fill="none"
|
|
@@ -7870,7 +7965,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7870
7965
|
>
|
|
7871
7966
|
<path d="M20 6 9 17l-5-5" />
|
|
7872
7967
|
</svg>
|
|
7873
|
-
`:
|
|
7968
|
+
`:N`
|
|
7874
7969
|
<svg
|
|
7875
7970
|
viewBox="0 0 24 24"
|
|
7876
7971
|
fill="none"
|
|
@@ -7891,11 +7986,11 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7891
7986
|
`}
|
|
7892
7987
|
</span>
|
|
7893
7988
|
</button>
|
|
7894
|
-
${this._toolDetailOutputOpen?
|
|
7989
|
+
${this._toolDetailOutputOpen?N`<pre class="tool-detail__code">${this._formatToolJson(this._toolDetail.result?.data?.toolResultString)||"(no output yet)"}</pre>`:U}
|
|
7895
7990
|
</div>
|
|
7896
7991
|
</div>
|
|
7897
|
-
`}_renderDebugContent(){return
|
|
7898
|
-
${this._telemetry?
|
|
7992
|
+
`}_renderDebugContent(){return N`
|
|
7993
|
+
${this._telemetry?N`
|
|
7899
7994
|
<div class="debug-section">
|
|
7900
7995
|
<div class="debug-section__label">Context</div>
|
|
7901
7996
|
<div class="debug-gauge">
|
|
@@ -7961,11 +8056,11 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7961
8056
|
${this._renderMarkupBreakdown(this._telemetry.conversationMarkupInputUsd,this._telemetry.conversationMarkupOutputUsd,this._telemetry.conversationMarkupCacheReadUsd,this._telemetry.conversationMarkupCacheWriteUsd)}
|
|
7962
8057
|
</div>
|
|
7963
8058
|
</div>
|
|
7964
|
-
`:
|
|
8059
|
+
`:N`
|
|
7965
8060
|
<div class="debug-empty">No telemetry yet — send a message to populate.</div>
|
|
7966
8061
|
`}
|
|
7967
8062
|
|
|
7968
|
-
${this._iterationLog.length?
|
|
8063
|
+
${this._iterationLog.length?N`
|
|
7969
8064
|
<div class="debug-section">
|
|
7970
8065
|
<div class="debug-section__label">Iterations (this turn)</div>
|
|
7971
8066
|
<div class="debug-iterations-scroll">
|
|
@@ -7987,7 +8082,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
7987
8082
|
</tr>
|
|
7988
8083
|
</thead>
|
|
7989
8084
|
<tbody>
|
|
7990
|
-
${this._iterationLog.map((e=>{const t=this._cacheCheckpoints[e.iteration];return
|
|
8085
|
+
${this._iterationLog.map((e=>{const t=this._cacheCheckpoints[e.iteration];return N`
|
|
7991
8086
|
<tr>
|
|
7992
8087
|
<td>${e.iteration}</td>
|
|
7993
8088
|
<td>${this._fmtTokens(e.iterationInput)}</td>
|
|
@@ -8008,8 +8103,8 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8008
8103
|
</div>
|
|
8009
8104
|
</div>
|
|
8010
8105
|
`:U}
|
|
8011
|
-
`}render(){const e="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled,t={};this._drawerOpen&&"inline"===this.variant&&(t.paddingRight=`${this._drawerWidth}px`);const i=[];return this.messages.forEach((e=>{const t=i[i.length-1];"user"!==e.type&&t&&"user"!==t[0].type?t.push(e):i.push([e])})),
|
|
8012
|
-
${this.hideToggle||"inline"===this.variant?U:
|
|
8106
|
+
`}render(){const e="inline"===this.variant&&!0===this._aiFrameworkConfig.debugTelemetryEnabled,t={};this._drawerOpen&&"inline"===this.variant&&(t.paddingRight=`${this._drawerWidth}px`);const i=[];return this.messages.forEach((e=>{const t=i[i.length-1];"user"!==e.type&&t&&"user"!==t[0].type?t.push(e):i.push([e])})),N`
|
|
8107
|
+
${this.hideToggle||"inline"===this.variant?U:N`
|
|
8013
8108
|
<button
|
|
8014
8109
|
class=${ye({toggle:!0,"toggle--hidden":this.opened})}
|
|
8015
8110
|
@click=${this._handleToggle}
|
|
@@ -8037,7 +8132,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8037
8132
|
@dragleave=${this._handleDragLeave}
|
|
8038
8133
|
@drop=${this._handleDrop}
|
|
8039
8134
|
>
|
|
8040
|
-
${this._isDraggingFile?
|
|
8135
|
+
${this._isDraggingFile?N`
|
|
8041
8136
|
<div class="drop-overlay">
|
|
8042
8137
|
<svg
|
|
8043
8138
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -8055,7 +8150,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8055
8150
|
<span>Drop images to attach</span>
|
|
8056
8151
|
</div>
|
|
8057
8152
|
`:U}
|
|
8058
|
-
${"inline"===this.variant?U:
|
|
8153
|
+
${"inline"===this.variant?U:N`
|
|
8059
8154
|
<div
|
|
8060
8155
|
class="resize resize--n"
|
|
8061
8156
|
data-dir="n"
|
|
@@ -8104,7 +8199,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8104
8199
|
</div>
|
|
8105
8200
|
</div>
|
|
8106
8201
|
<div class="header-actions">
|
|
8107
|
-
${"floating"===this.variant?
|
|
8202
|
+
${"floating"===this.variant?N`
|
|
8108
8203
|
<button
|
|
8109
8204
|
class="header-action"
|
|
8110
8205
|
@click=${this._handleNewConversation}
|
|
@@ -8171,7 +8266,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8171
8266
|
/>
|
|
8172
8267
|
</svg>
|
|
8173
8268
|
</button>
|
|
8174
|
-
${e?
|
|
8269
|
+
${e?N`
|
|
8175
8270
|
<button
|
|
8176
8271
|
class="header-action"
|
|
8177
8272
|
@click=${()=>this._toggleDrawer("debug")}
|
|
@@ -8193,7 +8288,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8193
8288
|
</svg>
|
|
8194
8289
|
</button>
|
|
8195
8290
|
`:U}
|
|
8196
|
-
${"inline"===this.variant?U:
|
|
8291
|
+
${"inline"===this.variant?U:N`
|
|
8197
8292
|
<button
|
|
8198
8293
|
class="header-action"
|
|
8199
8294
|
@click=${this._handleToggle}
|
|
@@ -8226,12 +8321,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8226
8321
|
@pointerdown=${this._handleMessagesPointerDown}
|
|
8227
8322
|
>
|
|
8228
8323
|
<div class="messages-inner">
|
|
8229
|
-
${0===this.messages.length?
|
|
8324
|
+
${0===this.messages.length?N`
|
|
8230
8325
|
<div class="empty">
|
|
8231
8326
|
<span class="empty-text">What can I help you with?</span>
|
|
8232
|
-
${this._suggestedActions.length?
|
|
8327
|
+
${this._suggestedActions.length?N`
|
|
8233
8328
|
<div class="empty-suggestions">
|
|
8234
|
-
${this._suggestedActions.map((e=>
|
|
8329
|
+
${this._suggestedActions.map((e=>N`
|
|
8235
8330
|
<button
|
|
8236
8331
|
type="button"
|
|
8237
8332
|
class="empty-suggestions__chip"
|
|
@@ -8242,9 +8337,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8242
8337
|
`:U}
|
|
8243
8338
|
</div>
|
|
8244
8339
|
`:U}
|
|
8245
|
-
${i.map((e=>{const t=e.map((e=>{const t=this.messages.indexOf(e);if(!("assistant"!==e.type||e.content||e.reasoning||this._isStreaming&&e===this.messages[this.messages.length-1]))return U;let i,s=[];if("tool_result"===e.type&&"offer_skill"===e.data?.toolName)try{s=JSON.parse(e.data.toolResultString).skills||[]}catch{}if(!("tool_use"!==e.type&&"tool_result"!==e.type||this._showTools||s.length))return U;if("tool_result"===e.type&&!s.length)return U;let o="",r="",a=0;if("tool_use"===e.type&&("tool_result"===this.messages[t+1]?.type&&this.messages[t+1].data?.toolUseId===e.data?.toolUseId&&(i=this.messages[t+1].data),this._showToolInputs&&e.data?.toolInput&&(o=String(e.data.toolInput).replace(/\s+/g," ").trim(),o.length>80&&(o=`${o.slice(0,79)}…`)),this._showToolInputs&&i?.toolResultString)){let e;try{e=JSON.stringify(JSON.parse(i.toolResultString),null,2)}catch{e=String(i.toolResultString)}const t=e.split("\n");r=t.slice(0,3).join("\n"),r.length>200&&(r=`${r.slice(0,200)}…`),a=Math.max(0,t.length-3)}let n="Approved",l=[];return"action_decision"===e.type&&("denied"===e.data?.outcome?n="Denied":"alwaysAllowed"===e.data?.outcome&&(n="Always allowed"),l=(e.data?.tools||[]).map((e=>e.displayName||e.toolName))),
|
|
8340
|
+
${i.map((e=>{const t=e.map((e=>{const t=this.messages.indexOf(e);if(!("assistant"!==e.type||e.content||e.reasoning||this._isStreaming&&e===this.messages[this.messages.length-1]))return U;let i,s=[];if("tool_result"===e.type&&"offer_skill"===e.data?.toolName)try{s=JSON.parse(e.data.toolResultString).skills||[]}catch{}if(!("tool_use"!==e.type&&"tool_result"!==e.type||this._showTools||s.length))return U;if("tool_result"===e.type&&!s.length)return U;let o="",r="",a=0;if("tool_use"===e.type&&("tool_result"===this.messages[t+1]?.type&&this.messages[t+1].data?.toolUseId===e.data?.toolUseId&&(i=this.messages[t+1].data),this._showToolInputs&&e.data?.toolInput&&(o=String(e.data.toolInput).replace(/\s+/g," ").trim(),o.length>80&&(o=`${o.slice(0,79)}…`)),this._showToolInputs&&i?.toolResultString)){let e;try{e=JSON.stringify(JSON.parse(i.toolResultString),null,2)}catch{e=String(i.toolResultString)}const t=e.split("\n");r=t.slice(0,3).join("\n"),r.length>200&&(r=`${r.slice(0,200)}…`),a=Math.max(0,t.length-3)}let n="Approved",l=[];return"action_decision"===e.type&&("denied"===e.data?.outcome?n="Denied":"alwaysAllowed"===e.data?.outcome&&(n="Always allowed"),l=(e.data?.tools||[]).map((e=>e.displayName||e.toolName))),N`
|
|
8246
8341
|
<div class=${ye({message:!0,"message--user":"user"===e.type,"message--assistant":"user"!==e.type})}>
|
|
8247
|
-
${"tool_use"===e.type?
|
|
8342
|
+
${"tool_use"===e.type?N`
|
|
8248
8343
|
<div class="tool-activity-block">
|
|
8249
8344
|
<button
|
|
8250
8345
|
type="button"
|
|
@@ -8253,21 +8348,21 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8253
8348
|
>
|
|
8254
8349
|
<span class="tool-activity__chevron">›</span>
|
|
8255
8350
|
<span class="tool-activity__label">${e.data?.displayName||e.data?.toolName||"Tool"}</span>
|
|
8256
|
-
${o?
|
|
8351
|
+
${o?N`<span class="tool-activity__input">(${o})</span>`:U}
|
|
8257
8352
|
</button>
|
|
8258
|
-
${this._showToolInputs&&i?.toolResultString?
|
|
8353
|
+
${this._showToolInputs&&i?.toolResultString?N`
|
|
8259
8354
|
<button
|
|
8260
8355
|
type="button"
|
|
8261
8356
|
class=${ye({"tool-activity__result":!0,"tool-activity__result--error":"error"===i.toolResultStatus})}
|
|
8262
8357
|
@click=${()=>this._openToolDetail(e)}
|
|
8263
8358
|
>
|
|
8264
8359
|
<span class="tool-activity__connector">⎿</span>
|
|
8265
|
-
<pre class="tool-activity__result-body">${r}${a>0?
|
|
8360
|
+
<pre class="tool-activity__result-body">${r}${a>0?N`\n<span class="tool-activity__more">… +${a} lines</span>`:U}</pre>
|
|
8266
8361
|
</button>
|
|
8267
8362
|
`:U}
|
|
8268
8363
|
</div>
|
|
8269
8364
|
`:U}
|
|
8270
|
-
${s.length?
|
|
8365
|
+
${s.length?N`
|
|
8271
8366
|
<div
|
|
8272
8367
|
class="confirmation confirmation--inline skill-offer"
|
|
8273
8368
|
role="group"
|
|
@@ -8276,12 +8371,12 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8276
8371
|
<div class="confirmation__title">
|
|
8277
8372
|
${s.length>1?"Install These Skills?":`Install "${s[0].name}" Skill?`}
|
|
8278
8373
|
</div>
|
|
8279
|
-
${s.length>1?
|
|
8374
|
+
${s.length>1?N`
|
|
8280
8375
|
<ol class="confirmation__list">
|
|
8281
|
-
${s.map((e=>
|
|
8376
|
+
${s.map((e=>N`
|
|
8282
8377
|
<li class="confirmation__list-item">
|
|
8283
8378
|
<span class="confirmation__list-name">${e.name}</span>
|
|
8284
|
-
${e.summary?
|
|
8379
|
+
${e.summary?N`
|
|
8285
8380
|
<span class="confirmation__list-desc">${e.summary}</span>
|
|
8286
8381
|
`:U}
|
|
8287
8382
|
<span class="confirmation__list-desc">
|
|
@@ -8291,8 +8386,8 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8291
8386
|
</li>
|
|
8292
8387
|
`))}
|
|
8293
8388
|
</ol>
|
|
8294
|
-
`:
|
|
8295
|
-
${s[0].summary?
|
|
8389
|
+
`:N`
|
|
8390
|
+
${s[0].summary?N`
|
|
8296
8391
|
<p class="confirmation__message">${s[0].summary}</p>
|
|
8297
8392
|
`:U}
|
|
8298
8393
|
<p class="confirmation__message">
|
|
@@ -8301,11 +8396,11 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8301
8396
|
</p>
|
|
8302
8397
|
`}
|
|
8303
8398
|
<div class="confirmation__actions">
|
|
8304
|
-
${"installed"===e.data.skillOfferOutcome?
|
|
8399
|
+
${"installed"===e.data.skillOfferOutcome?N`
|
|
8305
8400
|
<span class="skill-offer__installed">Installed</span>
|
|
8306
|
-
`:"declined"===e.data.skillOfferOutcome?
|
|
8401
|
+
`:"declined"===e.data.skillOfferOutcome?N`
|
|
8307
8402
|
<span class="skill-offer__declined">Declined</span>
|
|
8308
|
-
`:
|
|
8403
|
+
`:N`
|
|
8309
8404
|
<krs-button
|
|
8310
8405
|
variant="flat"
|
|
8311
8406
|
color="primary"
|
|
@@ -8322,7 +8417,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8322
8417
|
</div>
|
|
8323
8418
|
</div>
|
|
8324
8419
|
`:U}
|
|
8325
|
-
${"action_decision"===e.type?
|
|
8420
|
+
${"action_decision"===e.type?N`
|
|
8326
8421
|
<div class=${ye({decision:!0,"decision--denied":"denied"===e.data?.outcome})}>
|
|
8327
8422
|
<span class="decision__icon">
|
|
8328
8423
|
<svg
|
|
@@ -8333,23 +8428,23 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8333
8428
|
stroke-linecap="round"
|
|
8334
8429
|
stroke-linejoin="round"
|
|
8335
8430
|
>
|
|
8336
|
-
${"denied"===e.data?.outcome?
|
|
8431
|
+
${"denied"===e.data?.outcome?N`<path d="M18 6 6 18M6 6l12 12" />`:N`<path d="M20 6 9 17l-5-5" />`}
|
|
8337
8432
|
</svg>
|
|
8338
8433
|
</span>
|
|
8339
8434
|
<span class="decision__label">${n}${l.length?" "+l.join(", "):U}</span>
|
|
8340
8435
|
</div>
|
|
8341
8436
|
`:U}
|
|
8342
|
-
${e.reasoning?this._reasoningAsMessage?
|
|
8437
|
+
${e.reasoning?this._reasoningAsMessage?N`
|
|
8343
8438
|
<div class="message-content">${e.reasoning}</div>
|
|
8344
|
-
`:
|
|
8439
|
+
`:N`
|
|
8345
8440
|
<details class="reasoning">
|
|
8346
8441
|
<summary>Thinking</summary>
|
|
8347
8442
|
<div class="reasoning-content">${e.reasoning}</div>
|
|
8348
8443
|
</details>
|
|
8349
8444
|
`:U}
|
|
8350
|
-
${e.conversationFiles&&e.conversationFiles.length?
|
|
8445
|
+
${e.conversationFiles&&e.conversationFiles.length?N`
|
|
8351
8446
|
<div class="attachments">
|
|
8352
|
-
${e.conversationFiles.map((e=>{const t=e.niceName||e.name||"File";let i=
|
|
8447
|
+
${e.conversationFiles.map((e=>{const t=e.niceName||e.name||"File";let i=ys.includes(this._getFileExtension(t));return e.mimeType&&(i=e.mimeType.startsWith("image/")),i?N`
|
|
8353
8448
|
<button
|
|
8354
8449
|
class="attachment"
|
|
8355
8450
|
type="button"
|
|
@@ -8357,11 +8452,11 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8357
8452
|
@click=${()=>this._handleFileOpen(e)}
|
|
8358
8453
|
>
|
|
8359
8454
|
<img
|
|
8360
|
-
src=${e.previewUrl||`${
|
|
8455
|
+
src=${e.previewUrl||`${ms.getBaseUrl()}/api/system/conversationFile/${e.conversationFileID}/view`}
|
|
8361
8456
|
alt=${e.niceName||""}
|
|
8362
8457
|
/>
|
|
8363
8458
|
</button>
|
|
8364
|
-
`:
|
|
8459
|
+
`:N`
|
|
8365
8460
|
<button
|
|
8366
8461
|
class="attachment attachment--doc attachment--openable"
|
|
8367
8462
|
type="button"
|
|
@@ -8374,25 +8469,25 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8374
8469
|
`}))}
|
|
8375
8470
|
</div>
|
|
8376
8471
|
`:U}
|
|
8377
|
-
${e.content?
|
|
8472
|
+
${e.content?N`
|
|
8378
8473
|
<div class="message-content">
|
|
8379
|
-
${"user"===e.type?this._renderUserContent(e.content):Se(
|
|
8474
|
+
${"user"===e.type?this._renderUserContent(e.content):Se(jt.parse(e.content,{breaks:!0}))}
|
|
8380
8475
|
</div>
|
|
8381
8476
|
`:U}
|
|
8382
|
-
${"assistant"===e.type&&this._isStreaming&&e===this.messages[this.messages.length-1]?
|
|
8477
|
+
${"assistant"===e.type&&this._isStreaming&&e===this.messages[this.messages.length-1]?N`
|
|
8383
8478
|
<div class="typing">
|
|
8384
8479
|
<span></span>
|
|
8385
8480
|
<span></span>
|
|
8386
8481
|
<span></span>
|
|
8387
8482
|
</div>
|
|
8388
8483
|
`:U}
|
|
8389
|
-
${e.content?
|
|
8484
|
+
${e.content?N`
|
|
8390
8485
|
<button
|
|
8391
8486
|
class="message-copy"
|
|
8392
8487
|
title=${this._copiedIndex===t?"Copied":"Copy"}
|
|
8393
8488
|
@click=${()=>this._handleCopyMessage(e.content,t)}
|
|
8394
8489
|
>
|
|
8395
|
-
${this._copiedIndex===t?
|
|
8490
|
+
${this._copiedIndex===t?N`
|
|
8396
8491
|
<svg
|
|
8397
8492
|
viewBox="0 0 24 24"
|
|
8398
8493
|
fill="none"
|
|
@@ -8403,7 +8498,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8403
8498
|
>
|
|
8404
8499
|
<path d="M20 6 9 17l-5-5" />
|
|
8405
8500
|
</svg>
|
|
8406
|
-
`:
|
|
8501
|
+
`:N`
|
|
8407
8502
|
<svg
|
|
8408
8503
|
viewBox="0 0 24 24"
|
|
8409
8504
|
fill="none"
|
|
@@ -8425,17 +8520,17 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8425
8520
|
</button>
|
|
8426
8521
|
`:U}
|
|
8427
8522
|
</div>
|
|
8428
|
-
`})),s=e===i[i.length-1],o=s&&this._pendingActions.length&&this._inlineConfirm;if("user"===e[0].type)return
|
|
8523
|
+
`})),s=e===i[i.length-1],o=s&&this._pendingActions.length&&this._inlineConfirm;if("user"===e[0].type)return N`
|
|
8429
8524
|
${t}
|
|
8430
|
-
${o?
|
|
8525
|
+
${o?N`
|
|
8431
8526
|
<div class="agent-turn">
|
|
8432
8527
|
${this._renderConfirmation()}
|
|
8433
8528
|
</div>
|
|
8434
8529
|
`:U}
|
|
8435
|
-
`;const r=this.messages[this.messages.length-1],a=s&&this._isStreaming&&!this._pendingActions.length&&"assistant"!==r?.type;return
|
|
8530
|
+
`;const r=this.messages[this.messages.length-1],a=s&&this._isStreaming&&!this._pendingActions.length&&"assistant"!==r?.type;return N`
|
|
8436
8531
|
<div class="agent-turn">
|
|
8437
8532
|
${t}
|
|
8438
|
-
${a?
|
|
8533
|
+
${a?N`
|
|
8439
8534
|
<div class="typing">
|
|
8440
8535
|
<span></span>
|
|
8441
8536
|
<span></span>
|
|
@@ -8450,7 +8545,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8450
8545
|
|
|
8451
8546
|
${this._pendingActions.length&&!this._inlineConfirm?this._renderConfirmation():U}
|
|
8452
8547
|
|
|
8453
|
-
${this._error?
|
|
8548
|
+
${this._error?N`
|
|
8454
8549
|
<div class="error">
|
|
8455
8550
|
<span>${this._error}</span>
|
|
8456
8551
|
<button class="error-dismiss" @click=${this._handleErrorDismiss}>
|
|
@@ -8470,11 +8565,11 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8470
8565
|
</svg>
|
|
8471
8566
|
</button>
|
|
8472
8567
|
</div>
|
|
8473
|
-
`:this._contextLimitReached?
|
|
8568
|
+
`:this._contextLimitReached?N`
|
|
8474
8569
|
<div class="context-limit" role="alert">
|
|
8475
8570
|
${this._contextLimitMessage||"This conversation has reached its limit. Please start a new one to continue."}
|
|
8476
8571
|
</div>
|
|
8477
|
-
`:this._contextWarning?
|
|
8572
|
+
`:this._contextWarning?N`
|
|
8478
8573
|
<div class="context-warning" role="status">
|
|
8479
8574
|
<span>${this._contextWarning}</span>
|
|
8480
8575
|
<button
|
|
@@ -8501,9 +8596,9 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8501
8596
|
`:U}
|
|
8502
8597
|
|
|
8503
8598
|
<div class="footer">
|
|
8504
|
-
${this._pendingConversationFiles.length?
|
|
8599
|
+
${this._pendingConversationFiles.length?N`
|
|
8505
8600
|
<div class="composer-attachments">
|
|
8506
|
-
${
|
|
8601
|
+
${Ie(this._pendingConversationFiles,(e=>e.localId),(e=>N`
|
|
8507
8602
|
<div
|
|
8508
8603
|
class=${ye({chip:!0,"chip--doc":!e.previewUrl})}
|
|
8509
8604
|
title=${e.name}
|
|
@@ -8511,7 +8606,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8511
8606
|
<div
|
|
8512
8607
|
class=${ye({"chip-body":!0,"chip-body--image":Boolean(e.previewUrl)})}
|
|
8513
8608
|
>
|
|
8514
|
-
${e.previewUrl?
|
|
8609
|
+
${e.previewUrl?N`<img src=${e.previewUrl} alt=${e.name} />`:N`
|
|
8515
8610
|
<span class="chip-type">${this._getFileExtension(e.name)||"File"}</span>
|
|
8516
8611
|
<span class="chip-name">${e.name}</span>
|
|
8517
8612
|
`}
|
|
@@ -8542,7 +8637,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8542
8637
|
<input
|
|
8543
8638
|
class="file-input"
|
|
8544
8639
|
type="file"
|
|
8545
|
-
accept=${
|
|
8640
|
+
accept=${ks.map((e=>"."+e)).join(",")}
|
|
8546
8641
|
multiple
|
|
8547
8642
|
hidden
|
|
8548
8643
|
@change=${this._handleFileInputChange}
|
|
@@ -8563,8 +8658,8 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8563
8658
|
@paste=${this._handlePaste}
|
|
8564
8659
|
></textarea>
|
|
8565
8660
|
${this._renderModeSelector()}
|
|
8566
|
-
${window.SpeechRecognition||window.webkitSpeechRecognition?
|
|
8567
|
-
${this._isDictating?
|
|
8661
|
+
${window.SpeechRecognition||window.webkitSpeechRecognition?N`
|
|
8662
|
+
${this._isDictating?N`
|
|
8568
8663
|
<button
|
|
8569
8664
|
class="mic-stop"
|
|
8570
8665
|
title="Stop dictation"
|
|
@@ -8587,7 +8682,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8587
8682
|
/>
|
|
8588
8683
|
</svg>
|
|
8589
8684
|
</button>
|
|
8590
|
-
`:
|
|
8685
|
+
`:N`
|
|
8591
8686
|
<button
|
|
8592
8687
|
class="mic"
|
|
8593
8688
|
title="Dictate a message"
|
|
@@ -8612,7 +8707,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8612
8707
|
</button>
|
|
8613
8708
|
`}
|
|
8614
8709
|
`:U}
|
|
8615
|
-
${this._isStreaming?
|
|
8710
|
+
${this._isStreaming?N`
|
|
8616
8711
|
<button
|
|
8617
8712
|
class="stop"
|
|
8618
8713
|
@click=${this._handleStop}
|
|
@@ -8633,7 +8728,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8633
8728
|
/>
|
|
8634
8729
|
</svg>
|
|
8635
8730
|
</button>
|
|
8636
|
-
`:
|
|
8731
|
+
`:N`
|
|
8637
8732
|
<button
|
|
8638
8733
|
class=${ye({send:!0,"send--disabled":!this._inputValue.trim()&&!this._pendingConversationFiles.length||this._pendingActions.length>0})}
|
|
8639
8734
|
@click=${this._handleSubmit}
|
|
@@ -8656,7 +8751,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8656
8751
|
</div>
|
|
8657
8752
|
</div>
|
|
8658
8753
|
${this._skillBrowseOpened?this._renderSkillBrowse():U}
|
|
8659
|
-
${this._skillInstallConfirm?
|
|
8754
|
+
${this._skillInstallConfirm?N`
|
|
8660
8755
|
<krs-dialog
|
|
8661
8756
|
opened
|
|
8662
8757
|
label="Install Paid Skill"
|
|
@@ -8667,7 +8762,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8667
8762
|
<div class="skill-install-confirm">
|
|
8668
8763
|
<p>
|
|
8669
8764
|
<strong>${this._skillInstallConfirm.name}</strong> is a paid skill. Installing it will
|
|
8670
|
-
charge your account <strong>${this._skillInstallConfirm.priceLabel}</strong>${this._skillInstallConfirm.minimumLabel&&
|
|
8765
|
+
charge your account <strong>${this._skillInstallConfirm.priceLabel}</strong>${this._skillInstallConfirm.minimumLabel&&N`, with a <strong>${this._skillInstallConfirm.minimumLabel}</strong>`}.
|
|
8671
8766
|
</p>
|
|
8672
8767
|
<p>Please confirm you would like to proceed.</p>
|
|
8673
8768
|
</div>
|
|
@@ -8682,7 +8777,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8682
8777
|
</krs-dialog-footer>
|
|
8683
8778
|
</krs-dialog>
|
|
8684
8779
|
`:U}
|
|
8685
|
-
${this._skillOfferConfirm?
|
|
8780
|
+
${this._skillOfferConfirm?N`
|
|
8686
8781
|
<krs-dialog
|
|
8687
8782
|
opened
|
|
8688
8783
|
label="Install Paid Skills"
|
|
@@ -8693,10 +8788,10 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8693
8788
|
<div class="skill-install-confirm">
|
|
8694
8789
|
<p>These are paid skills. Installing them will charge your account:</p>
|
|
8695
8790
|
<ul class="skill-install-confirm__list">
|
|
8696
|
-
${JSON.parse(this._skillOfferConfirm.data.toolResultString).skills.filter((e=>e.billable)).map((e=>
|
|
8791
|
+
${JSON.parse(this._skillOfferConfirm.data.toolResultString).skills.filter((e=>e.billable)).map((e=>N`
|
|
8697
8792
|
<li>
|
|
8698
8793
|
<strong>${e.name}</strong>
|
|
8699
|
-
${e.priceLabel}${e.minimumLabel&&
|
|
8794
|
+
${e.priceLabel}${e.minimumLabel&&N`, with a <strong>${e.minimumLabel}</strong>`}
|
|
8700
8795
|
</li>
|
|
8701
8796
|
`))}
|
|
8702
8797
|
</ul>
|
|
@@ -8715,7 +8810,7 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
8715
8810
|
`:U}
|
|
8716
8811
|
${this._renderDrawer()}
|
|
8717
8812
|
</div>
|
|
8718
|
-
`}}
|
|
8813
|
+
`}}xs.styles=a`
|
|
8719
8814
|
*,
|
|
8720
8815
|
*::before,
|
|
8721
8816
|
*::after {
|
|
@@ -10928,5 +11023,5 @@ class $e extends _e{constructor(e){if(super(e),this.it=U,e.type!==fe)throw Error
|
|
|
10928
11023
|
height: 32px;
|
|
10929
11024
|
}
|
|
10930
11025
|
|
|
10931
|
-
`,
|
|
11026
|
+
`,vs([ce({attribute:!1})],xs.prototype,"send",void 0),vs([ce({attribute:!1})],xs.prototype,"load",void 0),vs([ce({attribute:!1})],xs.prototype,"messages",void 0),vs([ce({type:String})],xs.prototype,"label",void 0),vs([ce({type:String})],xs.prototype,"placeholder",void 0),vs([ce({type:Boolean,reflect:!0})],xs.prototype,"opened",void 0),vs([ce({type:Boolean,attribute:"hide-toggle",reflect:!0})],xs.prototype,"hideToggle",void 0),vs([ce({type:String,reflect:!0})],xs.prototype,"variant",void 0),vs([ce({type:Number,attribute:"conversation-id",reflect:!0})],xs.prototype,"conversationId",void 0),vs([pe()],xs.prototype,"_inputValue",void 0),vs([pe()],xs.prototype,"_isStreaming",void 0),vs([pe()],xs.prototype,"_error",void 0),vs([pe()],xs.prototype,"_conversationTitle",void 0),vs([pe()],xs.prototype,"_contextWarning",void 0),vs([pe()],xs.prototype,"_contextLimitReached",void 0),vs([pe()],xs.prototype,"_contextLimitMessage",void 0),vs([pe()],xs.prototype,"_pendingActions",void 0),vs([pe()],xs.prototype,"_confirmationHighlighted",void 0),vs([pe()],xs.prototype,"_confirmationInFlight",void 0),vs([pe()],xs.prototype,"_telemetry",void 0),vs([pe()],xs.prototype,"_iterationLog",void 0),vs([pe()],xs.prototype,"_cacheCheckpoints",void 0),vs([pe()],xs.prototype,"_drawerOpen",void 0),vs([pe()],xs.prototype,"_drawerView",void 0),vs([pe()],xs.prototype,"_conversations",void 0),vs([pe()],xs.prototype,"_conversationsLoading",void 0),vs([pe()],xs.prototype,"_toolDetail",void 0),vs([pe()],xs.prototype,"_toolDetailCopied",void 0),vs([pe()],xs.prototype,"_toolDetailInputOpen",void 0),vs([pe()],xs.prototype,"_toolDetailOutputOpen",void 0),vs([pe()],xs.prototype,"_drawerWidth",void 0),vs([pe()],xs.prototype,"_isDrawerResizing",void 0),vs([pe()],xs.prototype,"_pendingConversationFiles",void 0),vs([pe()],xs.prototype,"_isDraggingFile",void 0),vs([pe()],xs.prototype,"_skillMenuOpened",void 0),vs([pe()],xs.prototype,"_skillQuery",void 0),vs([pe()],xs.prototype,"_orgSkills",void 0),vs([pe()],xs.prototype,"_globalSkills",void 0),vs([pe()],xs.prototype,"_invocableSkills",void 0),vs([pe()],xs.prototype,"_suggestedActions",void 0),vs([pe()],xs.prototype,"_aiFrameworkConfig",void 0),vs([pe()],xs.prototype,"_skillHighlighted",void 0),vs([pe()],xs.prototype,"_copiedIndex",void 0),vs([pe()],xs.prototype,"_skillBrowseOpened",void 0),vs([pe()],xs.prototype,"_skillBrowseDetail",void 0),vs([pe()],xs.prototype,"_skillInstallConfirm",void 0),vs([pe()],xs.prototype,"_skillOfferConfirm",void 0),vs([pe()],xs.prototype,"_skillBrowseSource",void 0),vs([pe()],xs.prototype,"_skillBrowseQuery",void 0),vs([pe()],xs.prototype,"_isDictating",void 0),vs([pe()],xs.prototype,"_mode",void 0),vs([pe()],xs.prototype,"_modeMenuOpened",void 0),vs([pe()],xs.prototype,"_showTools",void 0),vs([pe()],xs.prototype,"_showToolInputs",void 0),vs([pe()],xs.prototype,"_showConfirmationInput",void 0),vs([ue(".panel")],xs.prototype,"_panelEl",void 0),vs([ue(".messages")],xs.prototype,"_messagesEl",void 0),vs([ue(".input")],xs.prototype,"_inputEl",void 0),vs([ue(".file-input")],xs.prototype,"_fileInputEl",void 0),vs([ue(".input-wrapper")],xs.prototype,"_inputWrapperEl",void 0),vs([ue(".skill-menu")],xs.prototype,"_skillMenuEl",void 0),vs([ue(".drawer__body")],xs.prototype,"_drawerBodyEl",void 0),customElements.get("krs-chatbot")||customElements.define("krs-chatbot",xs),e.KRChatbot=xs}));
|
|
10932
11027
|
//# sourceMappingURL=krubble-shell-chatbot.umd.min.js.map
|