@kodaris/krubble-app-components 1.0.150 → 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 +16 -0
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +114 -88
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +124 -102
- 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 +127 -104
- 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
package/dist/krubble-app.umd.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Copyright 2019 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
11
|
*/
|
|
12
|
-
const t$
|
|
12
|
+
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;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Copyright 2017 Google LLC
|
|
23
23
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
24
24
|
*/
|
|
25
|
-
const t$
|
|
25
|
+
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};
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* @license
|
|
@@ -30,13 +30,6 @@
|
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
31
|
*/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");
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* @license
|
|
35
|
-
* Copyright 2017 Google LLC
|
|
36
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
|
-
*/
|
|
38
|
-
const t$2=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
|
|
39
|
-
|
|
40
33
|
/**
|
|
41
34
|
* @license
|
|
42
35
|
* Copyright 2017 Google LLC
|
|
@@ -3444,13 +3437,15 @@
|
|
|
3444
3437
|
};
|
|
3445
3438
|
}
|
|
3446
3439
|
// Tab-scoped resume (floating only): a reload should redisplay the exact
|
|
3447
|
-
// conversation this tab was on
|
|
3448
|
-
//
|
|
3449
|
-
//
|
|
3450
|
-
//
|
|
3451
|
-
//
|
|
3452
|
-
//
|
|
3453
|
-
//
|
|
3440
|
+
// conversation this tab was on. The pinned id lives in sessionStorage (per-tab —
|
|
3441
|
+
// unlike localStorage it isn't shared across tabs, so two tabs can sit on
|
|
3442
|
+
// different conversations). A brand-new tab has nothing pinned and starts blank:
|
|
3443
|
+
// the user is likely opening the chat to ask about something new, and the
|
|
3444
|
+
// history drawer gets them back to earlier conversations. We resolve the id
|
|
3445
|
+
// FIRST, then run the built-in load so it rebuilds the right transcript. Skipped
|
|
3446
|
+
// when the consumer owns targeting (an explicit `conversation-id`) or in inline
|
|
3447
|
+
// mode (embedded as a page — the host route, not the tab, decides the
|
|
3448
|
+
// conversation).
|
|
3454
3449
|
let resolveConversationId = Promise.resolve();
|
|
3455
3450
|
if (this.variant === 'floating' && this.conversationId == null) {
|
|
3456
3451
|
const stored = Number(sessionStorage.getItem('kr-chatbot-conversation-id'));
|
|
@@ -3466,25 +3461,6 @@
|
|
|
3466
3461
|
})
|
|
3467
3462
|
.catch(() => { });
|
|
3468
3463
|
}
|
|
3469
|
-
else {
|
|
3470
|
-
// Fresh tab, nothing pinned yet — resume the user's most recent conversation
|
|
3471
|
-
// (404 when they have none, which leaves us blank for a new one).
|
|
3472
|
-
resolveConversationId = krubbleHttp.Http.fetch({ url: '/api/system/conversation/last' })
|
|
3473
|
-
.then((r) => {
|
|
3474
|
-
if (!r.ok) {
|
|
3475
|
-
return;
|
|
3476
|
-
}
|
|
3477
|
-
return r.json().then((res) => {
|
|
3478
|
-
const id = res?.data?.conversationID;
|
|
3479
|
-
if (typeof id === 'number') {
|
|
3480
|
-
this.conversationId = id;
|
|
3481
|
-
this._conversationTitle = res?.data?.title || '';
|
|
3482
|
-
this._persistConversationId();
|
|
3483
|
-
}
|
|
3484
|
-
});
|
|
3485
|
-
})
|
|
3486
|
-
.catch(() => { });
|
|
3487
|
-
}
|
|
3488
3464
|
}
|
|
3489
3465
|
// `this.load` is always set by here (defaulted above when the consumer didn't
|
|
3490
3466
|
// supply one); the `!` is because TS can't narrow the nullable property across
|
|
@@ -3799,116 +3775,159 @@
|
|
|
3799
3775
|
}
|
|
3800
3776
|
catch { /* sessionStorage not available */ }
|
|
3801
3777
|
}
|
|
3778
|
+
/**
|
|
3779
|
+
* Two stores, split by lifetime:
|
|
3780
|
+
*
|
|
3781
|
+
* - Preferences (composer draft, mode, tool toggles) go to localStorage so they
|
|
3782
|
+
* follow the user across tabs.
|
|
3783
|
+
* - Per-tab state goes to sessionStorage: the debug drawer (open flag, view,
|
|
3784
|
+
* width) and, for the floating widget only, the panel's open flag and its
|
|
3785
|
+
* dragged/resized layout. A reload brings the tab back exactly as it was, but a
|
|
3786
|
+
* brand-new tab starts with the panel closed in the default spot and the drawer
|
|
3787
|
+
* shut. Inline embeds are always open and fill their container, so they never
|
|
3788
|
+
* write the panel fields.
|
|
3789
|
+
*
|
|
3790
|
+
* Both stores use separate keys for the floating widget and inline embeds so
|
|
3791
|
+
* neither clobbers the other.
|
|
3792
|
+
*/
|
|
3802
3793
|
_saveState() {
|
|
3794
|
+
let storageKey = 'kr-chatbot-state';
|
|
3795
|
+
let tabKey = 'kr-chatbot-tab';
|
|
3796
|
+
if (this.variant === 'inline') {
|
|
3797
|
+
storageKey = 'kr-chatbot-state-inline';
|
|
3798
|
+
tabKey = 'kr-chatbot-tab-inline';
|
|
3799
|
+
}
|
|
3803
3800
|
try {
|
|
3804
|
-
// `toolDetail` is a transient peek, not a saved view — persist only the two
|
|
3805
|
-
// real preference views so a reload never reopens a stale tool.
|
|
3806
|
-
let persistedDrawerView = this._drawerView;
|
|
3807
|
-
if (persistedDrawerView === 'toolDetail') {
|
|
3808
|
-
persistedDrawerView = 'settings';
|
|
3809
|
-
}
|
|
3810
3801
|
const state = {
|
|
3811
|
-
opened: String(this.opened),
|
|
3812
3802
|
message: this._inputValue,
|
|
3813
3803
|
mode: this._mode,
|
|
3814
3804
|
showTools: String(this._showTools),
|
|
3815
3805
|
showToolInputs: String(this._showToolInputs),
|
|
3816
3806
|
showConfirmationInput: String(this._showConfirmationInput),
|
|
3807
|
+
};
|
|
3808
|
+
localStorage.setItem(storageKey, JSON.stringify(state));
|
|
3809
|
+
}
|
|
3810
|
+
catch { /* localStorage not available */ }
|
|
3811
|
+
try {
|
|
3812
|
+
// `toolDetail` is a transient peek, not a saved view — persist only the two
|
|
3813
|
+
// real preference views so a reload never reopens a stale tool.
|
|
3814
|
+
let persistedDrawerView = this._drawerView;
|
|
3815
|
+
if (persistedDrawerView === 'toolDetail') {
|
|
3816
|
+
persistedDrawerView = 'settings';
|
|
3817
|
+
}
|
|
3818
|
+
const tab = {
|
|
3817
3819
|
drawerOpen: String(this._drawerOpen),
|
|
3818
3820
|
drawerView: persistedDrawerView,
|
|
3819
3821
|
drawerWidth: String(this._drawerWidth),
|
|
3820
3822
|
};
|
|
3821
|
-
if (this.
|
|
3822
|
-
|
|
3823
|
-
if (
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3823
|
+
if (this.variant === 'floating') {
|
|
3824
|
+
tab.opened = String(this.opened);
|
|
3825
|
+
if (this._panelEl) {
|
|
3826
|
+
const s = this._panelEl.style;
|
|
3827
|
+
if (s.left) {
|
|
3828
|
+
tab.left = s.left;
|
|
3829
|
+
}
|
|
3830
|
+
if (s.top) {
|
|
3831
|
+
tab.top = s.top;
|
|
3832
|
+
}
|
|
3833
|
+
if (s.width) {
|
|
3834
|
+
tab.width = s.width;
|
|
3835
|
+
}
|
|
3836
|
+
if (s.height) {
|
|
3837
|
+
tab.height = s.height;
|
|
3838
|
+
}
|
|
3839
|
+
if (s.position) {
|
|
3840
|
+
tab.position = s.position;
|
|
3841
|
+
}
|
|
3831
3842
|
}
|
|
3832
|
-
|
|
3833
|
-
|
|
3843
|
+
}
|
|
3844
|
+
sessionStorage.setItem(tabKey, JSON.stringify(tab));
|
|
3845
|
+
}
|
|
3846
|
+
catch { /* sessionStorage not available */ }
|
|
3847
|
+
}
|
|
3848
|
+
_restoreState() {
|
|
3849
|
+
let storageKey = 'kr-chatbot-state';
|
|
3850
|
+
let tabKey = 'kr-chatbot-tab';
|
|
3851
|
+
if (this.variant === 'inline') {
|
|
3852
|
+
storageKey = 'kr-chatbot-state-inline';
|
|
3853
|
+
tabKey = 'kr-chatbot-tab-inline';
|
|
3854
|
+
}
|
|
3855
|
+
try {
|
|
3856
|
+
const raw = localStorage.getItem(storageKey);
|
|
3857
|
+
if (raw) {
|
|
3858
|
+
const state = JSON.parse(raw);
|
|
3859
|
+
// A lone `/` is dropped — it's the in-progress half of a menu interaction,
|
|
3860
|
+
// not a draft, and restoring it would revive a stale menu the user never
|
|
3861
|
+
// used. Anything with an actual command after the slash (`/code`, `/code do
|
|
3862
|
+
// the thing`) is a real draft and restores normally. Trimmed before testing
|
|
3863
|
+
// so a stray space around the slash doesn't defeat the check.
|
|
3864
|
+
if (typeof state.message === 'string' && state.message.trim() !== '/') {
|
|
3865
|
+
this._inputValue = state.message;
|
|
3834
3866
|
}
|
|
3835
|
-
if (
|
|
3836
|
-
|
|
3867
|
+
if (state.mode === 'NORMAL' || state.mode === 'EDIT' || state.mode === 'PLAN') {
|
|
3868
|
+
this._mode = state.mode;
|
|
3837
3869
|
}
|
|
3870
|
+
this._showTools = state.showTools === 'true';
|
|
3871
|
+
this._showToolInputs = state.showToolInputs === 'true';
|
|
3872
|
+
this._showConfirmationInput = state.showConfirmationInput === 'true';
|
|
3838
3873
|
}
|
|
3839
|
-
localStorage.setItem('kr-chatbot-state', JSON.stringify(state));
|
|
3840
3874
|
}
|
|
3841
3875
|
catch { /* localStorage not available */ }
|
|
3842
|
-
}
|
|
3843
|
-
_restoreState() {
|
|
3844
3876
|
try {
|
|
3845
|
-
const raw =
|
|
3877
|
+
const raw = sessionStorage.getItem(tabKey);
|
|
3846
3878
|
if (!raw) {
|
|
3847
3879
|
return;
|
|
3848
3880
|
}
|
|
3849
|
-
const
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
// used. Anything with an actual command after the slash (`/code`, `/code do
|
|
3854
|
-
// the thing`) is a real draft and restores normally. Trimmed before testing
|
|
3855
|
-
// so a stray space around the slash doesn't defeat the check.
|
|
3856
|
-
if (typeof state.message === 'string' && state.message.trim() !== '/') {
|
|
3857
|
-
this._inputValue = state.message;
|
|
3858
|
-
}
|
|
3859
|
-
if (state.mode === 'NORMAL' || state.mode === 'EDIT' || state.mode === 'PLAN') {
|
|
3860
|
-
this._mode = state.mode;
|
|
3861
|
-
}
|
|
3862
|
-
this._showTools = state.showTools === 'true';
|
|
3863
|
-
this._showToolInputs = state.showToolInputs === 'true';
|
|
3864
|
-
this._showConfirmationInput = state.showConfirmationInput === 'true';
|
|
3865
|
-
this._drawerOpen = state.drawerOpen === 'true';
|
|
3866
|
-
if (state.drawerView === 'settings' || state.drawerView === 'debug' || state.drawerView === 'history') {
|
|
3867
|
-
this._drawerView = state.drawerView;
|
|
3881
|
+
const tab = JSON.parse(raw);
|
|
3882
|
+
this._drawerOpen = tab.drawerOpen === 'true';
|
|
3883
|
+
if (tab.drawerView === 'settings' || tab.drawerView === 'debug' || tab.drawerView === 'history') {
|
|
3884
|
+
this._drawerView = tab.drawerView;
|
|
3868
3885
|
// History's list isn't persisted (it can go stale); refetch it so a reload
|
|
3869
3886
|
// that was on the conversations panel comes back to a populated list rather
|
|
3870
3887
|
// than an empty one.
|
|
3871
|
-
if (
|
|
3888
|
+
if (tab.drawerView === 'history') {
|
|
3872
3889
|
this._loadConversations();
|
|
3873
3890
|
}
|
|
3874
3891
|
}
|
|
3875
|
-
const w = Number(
|
|
3892
|
+
const w = Number(tab.drawerWidth);
|
|
3876
3893
|
if (w >= 300) {
|
|
3877
3894
|
this._drawerWidth = w;
|
|
3878
3895
|
}
|
|
3879
|
-
// The
|
|
3880
|
-
|
|
3896
|
+
// The panel's open flag and layout only apply to the floating widget — inline
|
|
3897
|
+
// mode is always open.
|
|
3898
|
+
if (this.variant === 'floating' && tab.opened === 'true') {
|
|
3881
3899
|
this.opened = true;
|
|
3882
3900
|
// Apply layout after first render
|
|
3883
3901
|
this.updateComplete.then(() => this._applyStoredLayout());
|
|
3884
3902
|
}
|
|
3885
3903
|
}
|
|
3886
|
-
catch { /*
|
|
3904
|
+
catch { /* sessionStorage not available */ }
|
|
3887
3905
|
}
|
|
3906
|
+
/** Floating only — inline embeds never store a layout and never reach this. */
|
|
3888
3907
|
_applyStoredLayout() {
|
|
3889
3908
|
try {
|
|
3890
|
-
const raw =
|
|
3909
|
+
const raw = sessionStorage.getItem('kr-chatbot-tab');
|
|
3891
3910
|
if (!raw || !this._panelEl) {
|
|
3892
3911
|
return;
|
|
3893
3912
|
}
|
|
3894
|
-
const
|
|
3895
|
-
if (
|
|
3896
|
-
this._panelEl.style.position =
|
|
3913
|
+
const tab = JSON.parse(raw);
|
|
3914
|
+
if (tab.position) {
|
|
3915
|
+
this._panelEl.style.position = tab.position;
|
|
3897
3916
|
}
|
|
3898
|
-
if (
|
|
3899
|
-
this._panelEl.style.left =
|
|
3917
|
+
if (tab.left) {
|
|
3918
|
+
this._panelEl.style.left = tab.left;
|
|
3900
3919
|
}
|
|
3901
|
-
if (
|
|
3902
|
-
this._panelEl.style.top =
|
|
3920
|
+
if (tab.top) {
|
|
3921
|
+
this._panelEl.style.top = tab.top;
|
|
3903
3922
|
}
|
|
3904
|
-
if (
|
|
3905
|
-
this._panelEl.style.width =
|
|
3923
|
+
if (tab.width) {
|
|
3924
|
+
this._panelEl.style.width = tab.width;
|
|
3906
3925
|
}
|
|
3907
|
-
if (
|
|
3908
|
-
this._panelEl.style.height =
|
|
3926
|
+
if (tab.height) {
|
|
3927
|
+
this._panelEl.style.height = tab.height;
|
|
3909
3928
|
}
|
|
3910
3929
|
}
|
|
3911
|
-
catch { /*
|
|
3930
|
+
catch { /* sessionStorage not available */ }
|
|
3912
3931
|
}
|
|
3913
3932
|
_handleInputChange(e) {
|
|
3914
3933
|
this._inputValue = e.target.value;
|
|
@@ -12698,7 +12717,7 @@
|
|
|
12698
12717
|
// Every matched route level's resolved data, merged into one object for the current navigation. This
|
|
12699
12718
|
// is set before anything mounts — see the merge in handleNavigation.
|
|
12700
12719
|
KRRouter.data = {};
|
|
12701
|
-
|
|
12720
|
+
class KRRouterOutlet extends i$3 {
|
|
12702
12721
|
constructor() {
|
|
12703
12722
|
super(...arguments);
|
|
12704
12723
|
this.level = -1;
|
|
@@ -12746,8 +12765,8 @@
|
|
|
12746
12765
|
}
|
|
12747
12766
|
return b `${this.el}`;
|
|
12748
12767
|
}
|
|
12749
|
-
}
|
|
12750
|
-
|
|
12768
|
+
}
|
|
12769
|
+
KRRouterOutlet.styles = i$6 `
|
|
12751
12770
|
:host {
|
|
12752
12771
|
display: block;
|
|
12753
12772
|
height: 100%;
|
|
@@ -12755,13 +12774,17 @@
|
|
|
12755
12774
|
`;
|
|
12756
12775
|
__decorate([
|
|
12757
12776
|
r()
|
|
12758
|
-
],
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12777
|
+
], KRRouterOutlet.prototype, "el", void 0);
|
|
12778
|
+
// Guarded registration: no-op if the tag is already defined, so a second copy of krubble on
|
|
12779
|
+
// the page (e.g. the Operations shell loads krubble globally while an embedded app bundled its
|
|
12780
|
+
// own copy) doesn't throw. First definition wins.
|
|
12781
|
+
if (!customElements.get('kr-router-outlet')) {
|
|
12782
|
+
customElements.define('kr-router-outlet', KRRouterOutlet);
|
|
12783
|
+
}
|
|
12762
12784
|
|
|
12763
12785
|
exports.Chatbot = KRChatbot;
|
|
12764
12786
|
exports.Router = KRRouter;
|
|
12787
|
+
exports.RouterOutlet = KRRouterOutlet;
|
|
12765
12788
|
exports.Scaffold = KRScaffold;
|
|
12766
12789
|
exports.ScreenDetail = KRScreenDetail;
|
|
12767
12790
|
exports.ScreenNav = KRScreenNav;
|