@kodaris/krubble-app-components 1.0.151 → 1.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chatbot.d.ts +14 -4
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +112 -104
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +122 -118
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +4 -9
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +125 -120
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +4 -9
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +9 -7
- package/dist/router.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { KRHttp } from '@kodaris/krubble-http';
|
|
|
6
6
|
* Copyright 2019 Google LLC
|
|
7
7
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
8
|
*/
|
|
9
|
-
const t$
|
|
9
|
+
const t$3=globalThis,e$7=t$3.ShadowRoot&&(void 0===t$3.ShadyCSS||t$3.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$6=new WeakMap;let n$4 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$6.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$6.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$4("string"==typeof t?t:t+"",void 0,s$3),i$6=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$4(o,t,s$3)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$3.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -19,7 +19,7 @@ const t$4=globalThis,e$7=t$4.ShadowRoot&&(void 0===t$4.ShadyCSS||t$4.ShadyCSS.na
|
|
|
19
19
|
* Copyright 2017 Google LLC
|
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
21
|
*/
|
|
22
|
-
const t$
|
|
22
|
+
const t$2=globalThis,i$4=t=>t,s$2=t$2.trustedTypes,e$5=s$2?s$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,h$1="$lit$",o$4=`lit$${Math.random().toFixed(9).slice(2)}$`,n$2="?"+o$4,r$2=`<${n$2}>`,l=document,c$1=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u$2=Array.isArray,d=t=>u$2(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m$1=/>/g,p$1=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u$2(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$5?e$5.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v$1;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v$1?"!--"===u[1]?c=_:void 0!==u[1]?c=m$1:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p$1):void 0!==u[3]&&(c=p$1):c===p$1?">"===u[0]?(c=n??v$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p$1:'"'===u[3]?$:g):c===$||c===g?c=p$1:c===_||c===m$1?c=v$1:(c=p$1,n=void 0);const x=c===p$1&&t[i+1].startsWith("/>")?" ":"";l+=c===v$1?s+r$2:d>=0?(e.push(a),s.slice(0,d)+h$1+s.slice(d)+o$4+x):s+o$4+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h$1)){const i=v[a++],s=r.getAttribute(t).split(o$4),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$4)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$4),i=t.length-1;if(i>0){r.textContent=s$2?s$2.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c$1()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c$1());}}}else if(8===r.nodeType)if(r.data===n$2)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$4,t+1));)d.push({type:7,index:l}),t+=o$4.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M$1(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M$1(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M$1(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c$1()),this.O(c$1()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$4(t).nextSibling;i$4(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M$1(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M$1(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M$1(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M$1(this,t);}}const j={I:k},B=t$2.litHtmlPolyfillSupport;B?.(S,k),(t$2.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c$1(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
@@ -27,13 +27,6 @@ const t$3=globalThis,i$4=t=>t,s$2=t$3.trustedTypes,e$5=s$2?s$2.createPolicy("lit
|
|
|
27
27
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
28
|
*/const s$1=globalThis;let i$3 = class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};i$3._$litElement$=true,i$3["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i$3});const o$3=s$1.litElementPolyfillSupport;o$3?.({LitElement:i$3});(s$1.litElementVersions??=[]).push("4.2.2");
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
* @license
|
|
32
|
-
* Copyright 2017 Google LLC
|
|
33
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/
|
|
35
|
-
const t$2=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
|
|
36
|
-
|
|
37
30
|
/**
|
|
38
31
|
* @license
|
|
39
32
|
* Copyright 2017 Google LLC
|
|
@@ -3441,13 +3434,15 @@ class KRChatbot extends i$3 {
|
|
|
3441
3434
|
};
|
|
3442
3435
|
}
|
|
3443
3436
|
// Tab-scoped resume (floating only): a reload should redisplay the exact
|
|
3444
|
-
// conversation this tab was on
|
|
3445
|
-
//
|
|
3446
|
-
//
|
|
3447
|
-
//
|
|
3448
|
-
//
|
|
3449
|
-
//
|
|
3450
|
-
//
|
|
3437
|
+
// conversation this tab was on. The pinned id lives in sessionStorage (per-tab —
|
|
3438
|
+
// unlike localStorage it isn't shared across tabs, so two tabs can sit on
|
|
3439
|
+
// different conversations). A brand-new tab has nothing pinned and starts blank:
|
|
3440
|
+
// the user is likely opening the chat to ask about something new, and the
|
|
3441
|
+
// history drawer gets them back to earlier conversations. We resolve the id
|
|
3442
|
+
// FIRST, then run the built-in load so it rebuilds the right transcript. Skipped
|
|
3443
|
+
// when the consumer owns targeting (an explicit `conversation-id`) or in inline
|
|
3444
|
+
// mode (embedded as a page — the host route, not the tab, decides the
|
|
3445
|
+
// conversation).
|
|
3451
3446
|
let resolveConversationId = Promise.resolve();
|
|
3452
3447
|
if (this.variant === 'floating' && this.conversationId == null) {
|
|
3453
3448
|
const stored = Number(sessionStorage.getItem('kr-chatbot-conversation-id'));
|
|
@@ -3463,25 +3458,6 @@ class KRChatbot extends i$3 {
|
|
|
3463
3458
|
})
|
|
3464
3459
|
.catch(() => { });
|
|
3465
3460
|
}
|
|
3466
|
-
else {
|
|
3467
|
-
// Fresh tab, nothing pinned yet — resume the user's most recent conversation
|
|
3468
|
-
// (404 when they have none, which leaves us blank for a new one).
|
|
3469
|
-
resolveConversationId = KRHttp.fetch({ url: '/api/system/conversation/last' })
|
|
3470
|
-
.then((r) => {
|
|
3471
|
-
if (!r.ok) {
|
|
3472
|
-
return;
|
|
3473
|
-
}
|
|
3474
|
-
return r.json().then((res) => {
|
|
3475
|
-
const id = res?.data?.conversationID;
|
|
3476
|
-
if (typeof id === 'number') {
|
|
3477
|
-
this.conversationId = id;
|
|
3478
|
-
this._conversationTitle = res?.data?.title || '';
|
|
3479
|
-
this._persistConversationId();
|
|
3480
|
-
}
|
|
3481
|
-
});
|
|
3482
|
-
})
|
|
3483
|
-
.catch(() => { });
|
|
3484
|
-
}
|
|
3485
3461
|
}
|
|
3486
3462
|
// `this.load` is always set by here (defaulted above when the consumer didn't
|
|
3487
3463
|
// supply one); the `!` is because TS can't narrow the nullable property across
|
|
@@ -3797,133 +3773,158 @@ class KRChatbot extends i$3 {
|
|
|
3797
3773
|
catch { /* sessionStorage not available */ }
|
|
3798
3774
|
}
|
|
3799
3775
|
/**
|
|
3800
|
-
*
|
|
3801
|
-
*
|
|
3802
|
-
*
|
|
3803
|
-
*
|
|
3776
|
+
* Two stores, split by lifetime:
|
|
3777
|
+
*
|
|
3778
|
+
* - Preferences (composer draft, mode, tool toggles) go to localStorage so they
|
|
3779
|
+
* follow the user across tabs.
|
|
3780
|
+
* - Per-tab state goes to sessionStorage: the debug drawer (open flag, view,
|
|
3781
|
+
* width) and, for the floating widget only, the panel's open flag and its
|
|
3782
|
+
* dragged/resized layout. A reload brings the tab back exactly as it was, but a
|
|
3783
|
+
* brand-new tab starts with the panel closed in the default spot and the drawer
|
|
3784
|
+
* shut. Inline embeds are always open and fill their container, so they never
|
|
3785
|
+
* write the panel fields.
|
|
3786
|
+
*
|
|
3787
|
+
* Both stores use separate keys for the floating widget and inline embeds so
|
|
3788
|
+
* neither clobbers the other.
|
|
3804
3789
|
*/
|
|
3805
3790
|
_saveState() {
|
|
3791
|
+
let storageKey = 'kr-chatbot-state';
|
|
3792
|
+
let tabKey = 'kr-chatbot-tab';
|
|
3793
|
+
if (this.variant === 'inline') {
|
|
3794
|
+
storageKey = 'kr-chatbot-state-inline';
|
|
3795
|
+
tabKey = 'kr-chatbot-tab-inline';
|
|
3796
|
+
}
|
|
3806
3797
|
try {
|
|
3807
|
-
// `toolDetail` is a transient peek, not a saved view — persist only the two
|
|
3808
|
-
// real preference views so a reload never reopens a stale tool.
|
|
3809
|
-
let persistedDrawerView = this._drawerView;
|
|
3810
|
-
if (persistedDrawerView === 'toolDetail') {
|
|
3811
|
-
persistedDrawerView = 'settings';
|
|
3812
|
-
}
|
|
3813
3798
|
const state = {
|
|
3814
|
-
opened: String(this.opened),
|
|
3815
3799
|
message: this._inputValue,
|
|
3816
3800
|
mode: this._mode,
|
|
3817
3801
|
showTools: String(this._showTools),
|
|
3818
3802
|
showToolInputs: String(this._showToolInputs),
|
|
3819
3803
|
showConfirmationInput: String(this._showConfirmationInput),
|
|
3804
|
+
};
|
|
3805
|
+
localStorage.setItem(storageKey, JSON.stringify(state));
|
|
3806
|
+
}
|
|
3807
|
+
catch { /* localStorage not available */ }
|
|
3808
|
+
try {
|
|
3809
|
+
// `toolDetail` is a transient peek, not a saved view — persist only the two
|
|
3810
|
+
// real preference views so a reload never reopens a stale tool.
|
|
3811
|
+
let persistedDrawerView = this._drawerView;
|
|
3812
|
+
if (persistedDrawerView === 'toolDetail') {
|
|
3813
|
+
persistedDrawerView = 'settings';
|
|
3814
|
+
}
|
|
3815
|
+
const tab = {
|
|
3820
3816
|
drawerOpen: String(this._drawerOpen),
|
|
3821
3817
|
drawerView: persistedDrawerView,
|
|
3822
3818
|
drawerWidth: String(this._drawerWidth),
|
|
3823
3819
|
};
|
|
3824
|
-
if (this.
|
|
3825
|
-
|
|
3826
|
-
if (
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3820
|
+
if (this.variant === 'floating') {
|
|
3821
|
+
tab.opened = String(this.opened);
|
|
3822
|
+
if (this._panelEl) {
|
|
3823
|
+
const s = this._panelEl.style;
|
|
3824
|
+
if (s.left) {
|
|
3825
|
+
tab.left = s.left;
|
|
3826
|
+
}
|
|
3827
|
+
if (s.top) {
|
|
3828
|
+
tab.top = s.top;
|
|
3829
|
+
}
|
|
3830
|
+
if (s.width) {
|
|
3831
|
+
tab.width = s.width;
|
|
3832
|
+
}
|
|
3833
|
+
if (s.height) {
|
|
3834
|
+
tab.height = s.height;
|
|
3835
|
+
}
|
|
3836
|
+
if (s.position) {
|
|
3837
|
+
tab.position = s.position;
|
|
3838
|
+
}
|
|
3840
3839
|
}
|
|
3841
3840
|
}
|
|
3842
|
-
|
|
3843
|
-
if (this.variant === 'inline') {
|
|
3844
|
-
storageKey = 'kr-chatbot-state-inline';
|
|
3845
|
-
}
|
|
3846
|
-
localStorage.setItem(storageKey, JSON.stringify(state));
|
|
3841
|
+
sessionStorage.setItem(tabKey, JSON.stringify(tab));
|
|
3847
3842
|
}
|
|
3848
|
-
catch { /*
|
|
3843
|
+
catch { /* sessionStorage not available */ }
|
|
3849
3844
|
}
|
|
3850
3845
|
_restoreState() {
|
|
3846
|
+
let storageKey = 'kr-chatbot-state';
|
|
3847
|
+
let tabKey = 'kr-chatbot-tab';
|
|
3848
|
+
if (this.variant === 'inline') {
|
|
3849
|
+
storageKey = 'kr-chatbot-state-inline';
|
|
3850
|
+
tabKey = 'kr-chatbot-tab-inline';
|
|
3851
|
+
}
|
|
3851
3852
|
try {
|
|
3852
|
-
let storageKey = 'kr-chatbot-state';
|
|
3853
|
-
if (this.variant === 'inline') {
|
|
3854
|
-
storageKey = 'kr-chatbot-state-inline';
|
|
3855
|
-
}
|
|
3856
3853
|
const raw = localStorage.getItem(storageKey);
|
|
3854
|
+
if (raw) {
|
|
3855
|
+
const state = JSON.parse(raw);
|
|
3856
|
+
// A lone `/` is dropped — it's the in-progress half of a menu interaction,
|
|
3857
|
+
// not a draft, and restoring it would revive a stale menu the user never
|
|
3858
|
+
// used. Anything with an actual command after the slash (`/code`, `/code do
|
|
3859
|
+
// the thing`) is a real draft and restores normally. Trimmed before testing
|
|
3860
|
+
// so a stray space around the slash doesn't defeat the check.
|
|
3861
|
+
if (typeof state.message === 'string' && state.message.trim() !== '/') {
|
|
3862
|
+
this._inputValue = state.message;
|
|
3863
|
+
}
|
|
3864
|
+
if (state.mode === 'NORMAL' || state.mode === 'EDIT' || state.mode === 'PLAN') {
|
|
3865
|
+
this._mode = state.mode;
|
|
3866
|
+
}
|
|
3867
|
+
this._showTools = state.showTools === 'true';
|
|
3868
|
+
this._showToolInputs = state.showToolInputs === 'true';
|
|
3869
|
+
this._showConfirmationInput = state.showConfirmationInput === 'true';
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
catch { /* localStorage not available */ }
|
|
3873
|
+
try {
|
|
3874
|
+
const raw = sessionStorage.getItem(tabKey);
|
|
3857
3875
|
if (!raw) {
|
|
3858
3876
|
return;
|
|
3859
3877
|
}
|
|
3860
|
-
const
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
// used. Anything with an actual command after the slash (`/code`, `/code do
|
|
3865
|
-
// the thing`) is a real draft and restores normally. Trimmed before testing
|
|
3866
|
-
// so a stray space around the slash doesn't defeat the check.
|
|
3867
|
-
if (typeof state.message === 'string' && state.message.trim() !== '/') {
|
|
3868
|
-
this._inputValue = state.message;
|
|
3869
|
-
}
|
|
3870
|
-
if (state.mode === 'NORMAL' || state.mode === 'EDIT' || state.mode === 'PLAN') {
|
|
3871
|
-
this._mode = state.mode;
|
|
3872
|
-
}
|
|
3873
|
-
this._showTools = state.showTools === 'true';
|
|
3874
|
-
this._showToolInputs = state.showToolInputs === 'true';
|
|
3875
|
-
this._showConfirmationInput = state.showConfirmationInput === 'true';
|
|
3876
|
-
this._drawerOpen = state.drawerOpen === 'true';
|
|
3877
|
-
if (state.drawerView === 'settings' || state.drawerView === 'debug' || state.drawerView === 'history') {
|
|
3878
|
-
this._drawerView = state.drawerView;
|
|
3878
|
+
const tab = JSON.parse(raw);
|
|
3879
|
+
this._drawerOpen = tab.drawerOpen === 'true';
|
|
3880
|
+
if (tab.drawerView === 'settings' || tab.drawerView === 'debug' || tab.drawerView === 'history') {
|
|
3881
|
+
this._drawerView = tab.drawerView;
|
|
3879
3882
|
// History's list isn't persisted (it can go stale); refetch it so a reload
|
|
3880
3883
|
// that was on the conversations panel comes back to a populated list rather
|
|
3881
3884
|
// than an empty one.
|
|
3882
|
-
if (
|
|
3885
|
+
if (tab.drawerView === 'history') {
|
|
3883
3886
|
this._loadConversations();
|
|
3884
3887
|
}
|
|
3885
3888
|
}
|
|
3886
|
-
const w = Number(
|
|
3889
|
+
const w = Number(tab.drawerWidth);
|
|
3887
3890
|
if (w >= 300) {
|
|
3888
3891
|
this._drawerWidth = w;
|
|
3889
3892
|
}
|
|
3890
|
-
// The
|
|
3891
|
-
|
|
3893
|
+
// The panel's open flag and layout only apply to the floating widget — inline
|
|
3894
|
+
// mode is always open.
|
|
3895
|
+
if (this.variant === 'floating' && tab.opened === 'true') {
|
|
3892
3896
|
this.opened = true;
|
|
3893
3897
|
// Apply layout after first render
|
|
3894
3898
|
this.updateComplete.then(() => this._applyStoredLayout());
|
|
3895
3899
|
}
|
|
3896
3900
|
}
|
|
3897
|
-
catch { /*
|
|
3901
|
+
catch { /* sessionStorage not available */ }
|
|
3898
3902
|
}
|
|
3903
|
+
/** Floating only — inline embeds never store a layout and never reach this. */
|
|
3899
3904
|
_applyStoredLayout() {
|
|
3900
3905
|
try {
|
|
3901
|
-
|
|
3902
|
-
if (this.variant === 'inline') {
|
|
3903
|
-
storageKey = 'kr-chatbot-state-inline';
|
|
3904
|
-
}
|
|
3905
|
-
const raw = localStorage.getItem(storageKey);
|
|
3906
|
+
const raw = sessionStorage.getItem('kr-chatbot-tab');
|
|
3906
3907
|
if (!raw || !this._panelEl) {
|
|
3907
3908
|
return;
|
|
3908
3909
|
}
|
|
3909
|
-
const
|
|
3910
|
-
if (
|
|
3911
|
-
this._panelEl.style.position =
|
|
3910
|
+
const tab = JSON.parse(raw);
|
|
3911
|
+
if (tab.position) {
|
|
3912
|
+
this._panelEl.style.position = tab.position;
|
|
3912
3913
|
}
|
|
3913
|
-
if (
|
|
3914
|
-
this._panelEl.style.left =
|
|
3914
|
+
if (tab.left) {
|
|
3915
|
+
this._panelEl.style.left = tab.left;
|
|
3915
3916
|
}
|
|
3916
|
-
if (
|
|
3917
|
-
this._panelEl.style.top =
|
|
3917
|
+
if (tab.top) {
|
|
3918
|
+
this._panelEl.style.top = tab.top;
|
|
3918
3919
|
}
|
|
3919
|
-
if (
|
|
3920
|
-
this._panelEl.style.width =
|
|
3920
|
+
if (tab.width) {
|
|
3921
|
+
this._panelEl.style.width = tab.width;
|
|
3921
3922
|
}
|
|
3922
|
-
if (
|
|
3923
|
-
this._panelEl.style.height =
|
|
3923
|
+
if (tab.height) {
|
|
3924
|
+
this._panelEl.style.height = tab.height;
|
|
3924
3925
|
}
|
|
3925
3926
|
}
|
|
3926
|
-
catch { /*
|
|
3927
|
+
catch { /* sessionStorage not available */ }
|
|
3927
3928
|
}
|
|
3928
3929
|
_handleInputChange(e) {
|
|
3929
3930
|
this._inputValue = e.target.value;
|
|
@@ -12713,7 +12714,7 @@ KRRouter.navToken = 0;
|
|
|
12713
12714
|
// Every matched route level's resolved data, merged into one object for the current navigation. This
|
|
12714
12715
|
// is set before anything mounts — see the merge in handleNavigation.
|
|
12715
12716
|
KRRouter.data = {};
|
|
12716
|
-
|
|
12717
|
+
class KRRouterOutlet extends i$3 {
|
|
12717
12718
|
constructor() {
|
|
12718
12719
|
super(...arguments);
|
|
12719
12720
|
this.level = -1;
|
|
@@ -12761,7 +12762,7 @@ let KRRouterOutlet = class KRRouterOutlet extends i$3 {
|
|
|
12761
12762
|
}
|
|
12762
12763
|
return b `${this.el}`;
|
|
12763
12764
|
}
|
|
12764
|
-
}
|
|
12765
|
+
}
|
|
12765
12766
|
KRRouterOutlet.styles = i$6 `
|
|
12766
12767
|
:host {
|
|
12767
12768
|
display: block;
|
|
@@ -12771,9 +12772,12 @@ KRRouterOutlet.styles = i$6 `
|
|
|
12771
12772
|
__decorate([
|
|
12772
12773
|
r()
|
|
12773
12774
|
], KRRouterOutlet.prototype, "el", void 0);
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
|
|
12775
|
+
// Guarded registration: no-op if the tag is already defined, so a second copy of krubble on
|
|
12776
|
+
// the page (e.g. the Operations shell loads krubble globally while an embedded app bundled its
|
|
12777
|
+
// own copy) doesn't throw. First definition wins.
|
|
12778
|
+
if (!customElements.get('kr-router-outlet')) {
|
|
12779
|
+
customElements.define('kr-router-outlet', KRRouterOutlet);
|
|
12780
|
+
}
|
|
12777
12781
|
|
|
12778
12782
|
export { KRChatbot, KRRouter, KRRouterOutlet, KRScaffold, KRScreenDetail, KRScreenNav, KRSubbar };
|
|
12779
12783
|
//# sourceMappingURL=krubble-app.bundled.js.map
|