kenobi-js 0.1.43 → 0.1.44
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/browser/dist.js +80 -30
- package/browser/dist.js.map +3 -3
- package/browser/dist.min.js +16 -15
- package/package.json +9 -9
package/browser/dist.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Kenobi SDK v0.1.
|
|
2
|
+
* Kenobi SDK v0.1.44
|
|
3
3
|
* (c) 2026 Kenobi.ai
|
|
4
4
|
*/
|
|
5
|
-
"use strict";var KenobiLib=(()=>{var Se=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var Mn=Object.getOwnPropertyNames;var Dn=Object.prototype.hasOwnProperty;var Ln=(t,e,n)=>e in t?Se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Rn=(t,e)=>{for(var n in e)Se(t,n,{get:e[n],enumerable:!0})},In=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Mn(e))!Dn.call(t,i)&&i!==n&&Se(t,i,{get:()=>e[i],enumerable:!(r=An(e,i))||r.enumerable});return t};var Nn=t=>In(Se({},"__esModule",{value:!0}),t);var f=(t,e,n)=>Ln(t,typeof e!="symbol"?e+"":e,n);var Pr={};Rn(Pr,{CueCard:()=>we,Kenobi:()=>ot,TRANSFORMATION_ACTIONS:()=>cn});var gt=11;function On(t,e){var n=e.attributes,r,i,o,a,s;if(!(e.nodeType===gt||t.nodeType===gt)){for(var u=n.length-1;u>=0;u--)r=n[u],i=r.name,o=r.namespaceURI,a=r.value,o?(i=r.localName||i,s=t.getAttributeNS(o,i),s!==a&&(r.prefix==="xmlns"&&(i=r.name),t.setAttributeNS(o,i,a))):(s=t.getAttribute(i),s!==a&&t.setAttribute(i,a));for(var c=t.attributes,m=c.length-1;m>=0;m--)r=c[m],i=r.name,o=r.namespaceURI,o?(i=r.localName||i,e.hasAttributeNS(o,i)||t.removeAttributeNS(o,i)):e.hasAttribute(i)||t.removeAttribute(i)}}var Ee,Hn="http://www.w3.org/1999/xhtml",Q=typeof document>"u"?void 0:document,Fn=!!Q&&"content"in Q.createElement("template"),Un=!!Q&&Q.createRange&&"createContextualFragment"in Q.createRange();function Kn(t){var e=Q.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function $n(t){Ee||(Ee=Q.createRange(),Ee.selectNode(Q.body));var e=Ee.createContextualFragment(t);return e.childNodes[0]}function Vn(t){var e=Q.createElement("body");return e.innerHTML=t,e.childNodes[0]}function jn(t){return t=t.trim(),Fn?Kn(t):Un?$n(t):Vn(t)}function ze(t,e){var n=t.nodeName,r=e.nodeName,i,o;return n===r?!0:(i=n.charCodeAt(0),o=r.charCodeAt(0),i<=90&&o>=97?n===r.toUpperCase():o<=90&&i>=97?r===n.toUpperCase():!1)}function Bn(t,e){return!e||e===Hn?Q.createElement(t):Q.createElementNS(e,t)}function qn(t,e){for(var n=t.firstChild;n;){var r=n.nextSibling;e.appendChild(n),n=r}return e}function je(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n))}var yt={OPTION:function(t,e){var n=t.parentNode;if(n){var r=n.nodeName.toUpperCase();r==="OPTGROUP"&&(n=n.parentNode,r=n&&n.nodeName.toUpperCase()),r==="SELECT"&&!n.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),n.selectedIndex=-1)}je(t,e,"selected")},INPUT:function(t,e){je(t,e,"checked"),je(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var n=e.value;t.value!==n&&(t.value=n);var r=t.firstChild;if(r){var i=r.nodeValue;if(i==n||!n&&i==t.placeholder)return;r.nodeValue=n}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var n=-1,r=0,i=t.firstChild,o,a;i;)if(a=i.nodeName&&i.nodeName.toUpperCase(),a==="OPTGROUP")o=i,i=o.firstChild,i||(i=o.nextSibling,o=null);else{if(a==="OPTION"){if(i.hasAttribute("selected")){n=r;break}r++}i=i.nextSibling,!i&&o&&(i=o.nextSibling,o=null)}t.selectedIndex=n}}},ye=1,_t=11,vt=3,kt=8;function ce(){}function Wn(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function Xn(t){return function(n,r,i){if(i||(i={}),typeof r=="string")if(n.nodeName==="#document"||n.nodeName==="HTML"||n.nodeName==="BODY"){var o=r;r=Q.createElement("html"),r.innerHTML=o}else r=jn(r);else r.nodeType===_t&&(r=r.firstElementChild);var a=i.getNodeKey||Wn,s=i.onBeforeNodeAdded||ce,u=i.onNodeAdded||ce,c=i.onBeforeElUpdated||ce,m=i.onElUpdated||ce,l=i.onBeforeNodeDiscarded||ce,d=i.onNodeDiscarded||ce,h=i.onBeforeElChildrenUpdated||ce,E=i.skipFromChildren||ce,M=i.addChild||function(y,k){return y.appendChild(k)},T=i.childrenOnly===!0,g=Object.create(null),x=[];function P(y){x.push(y)}function O(y,k){if(y.nodeType===ye)for(var L=y.firstChild;L;){var S=void 0;k&&(S=a(L))?P(S):(d(L),L.firstChild&&O(L,k)),L=L.nextSibling}}function D(y,k,L){l(y)!==!1&&(k&&k.removeChild(y),d(y),O(y,L))}function v(y){if(y.nodeType===ye||y.nodeType===_t)for(var k=y.firstChild;k;){var L=a(k);L&&(g[L]=k),v(k),k=k.nextSibling}}v(n);function V(y){u(y);for(var k=y.firstChild;k;){var L=k.nextSibling,S=a(k);if(S){var z=g[S];z&&ze(k,z)?(k.parentNode.replaceChild(z,k),j(z,k)):V(k)}else V(k);k=L}}function J(y,k,L){for(;k;){var S=k.nextSibling;(L=a(k))?P(L):D(k,y,!0),k=S}}function j(y,k,L){var S=a(k);if(S&&delete g[S],!L){var z=c(y,k);if(z===!1||(z instanceof HTMLElement&&(y=z,v(y)),t(y,k),m(y),h(y,k)===!1))return}y.nodeName!=="TEXTAREA"?H(y,k):yt.TEXTAREA(y,k)}function H(y,k){var L=E(y,k),S=k.firstChild,z=y.firstChild,G,Z,F,te,ne;e:for(;S;){for(te=S.nextSibling,G=a(S);!L&&z;){if(F=z.nextSibling,S.isSameNode&&S.isSameNode(z)){S=te,z=F;continue e}Z=a(z);var ee=z.nodeType,q=void 0;if(ee===S.nodeType&&(ee===ye?(G?G!==Z&&((ne=g[G])?F===ne?q=!1:(y.insertBefore(ne,z),Z?P(Z):D(z,y,!0),z=ne,Z=a(z)):q=!1):Z&&(q=!1),q=q!==!1&&ze(z,S),q&&j(z,S)):(ee===vt||ee==kt)&&(q=!0,z.nodeValue!==S.nodeValue&&(z.nodeValue=S.nodeValue))),q){S=te,z=F;continue e}Z?P(Z):D(z,y,!0),z=F}if(G&&(ne=g[G])&&ze(ne,S))L||M(y,ne),j(ne,S);else{var $=s(S);$!==!1&&($&&(S=$),S.actualize&&(S=S.actualize(y.ownerDocument||Q)),M(y,S),V(S))}S=te,z=F}J(y,z,Z);var ae=yt[y.nodeName];ae&&ae(y,k)}var C=n,B=C.nodeType,ge=r.nodeType;if(!T){if(B===ye)ge===ye?ze(n,r)||(d(n),C=qn(n,Bn(r.nodeName,r.namespaceURI))):C=r;else if(B===vt||B===kt){if(ge===B)return C.nodeValue!==r.nodeValue&&(C.nodeValue=r.nodeValue),C;C=r}}if(C===r)d(n);else{if(r.isSameNode&&r.isSameNode(C))return;if(j(C,r,T),x)for(var ue=0,He=x.length;ue<He;ue++){var pe=g[x[ue]];pe&&D(pe,pe.parentNode,!1)}}return!T&&C!==n&&n.parentNode&&(C.actualize&&(C=C.actualize(n.ownerDocument||Q)),n.parentNode.replaceChild(C,n)),C}}var Yn=Xn(On),Pe=Yn;var Re,A,St,Gn,de,wt,Et,zt,Pt,Xe,Be,qe,Qn,_e={},At=[],Jn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ie=Array.isArray;function se(t,e){for(var n in e)t[n]=e[n];return t}function Ye(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Zn(t,e,n){var r,i,o,a={};for(o in e)o=="key"?r=e[o]:o=="ref"?i=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?Re.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)a[o]===void 0&&(a[o]=t.defaultProps[o]);return Me(t,a,r,i,null)}function Me(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++St,__i:-1,__u:0};return i==null&&A.vnode!=null&&A.vnode(o),o}function le(t){return t.children}function De(t,e){this.props=t,this.context=e}function he(t,e){if(e==null)return t.__?he(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?he(t):null}function Mt(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Mt(t)}}function xt(t){(!t.__d&&(t.__d=!0)&&de.push(t)&&!Le.__r++||wt!=A.debounceRendering)&&((wt=A.debounceRendering)||Et)(Le)}function Le(){for(var t,e,n,r,i,o,a,s=1;de.length;)de.length>s&&de.sort(zt),t=de.shift(),s=de.length,t.__d&&(n=void 0,r=void 0,i=(r=(e=t).__v).__e,o=[],a=[],e.__P&&((n=se({},r)).__v=r.__v+1,A.vnode&&A.vnode(n),Ge(e.__P,n,r,e.__n,e.__P.namespaceURI,32&r.__u?[i]:null,o,i??he(r),!!(32&r.__u),a),n.__v=r.__v,n.__.__k[n.__i]=n,Rt(o,n,a),r.__e=r.__=null,n.__e!=i&&Mt(n)));Le.__r=0}function Dt(t,e,n,r,i,o,a,s,u,c,m){var l,d,h,E,M,T,g,x=r&&r.__k||At,P=e.length;for(u=er(n,e,x,u,P),l=0;l<P;l++)(h=n.__k[l])!=null&&(d=h.__i==-1?_e:x[h.__i]||_e,h.__i=l,T=Ge(t,h,d,i,o,a,s,u,c,m),E=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Qe(d.ref,null,h),m.push(h.ref,h.__c||E,h)),M==null&&E!=null&&(M=E),(g=!!(4&h.__u))||d.__k===h.__k?u=Lt(h,u,t,g):typeof h.type=="function"&&T!==void 0?u=T:E&&(u=E.nextSibling),h.__u&=-7);return n.__e=M,u}function er(t,e,n,r,i){var o,a,s,u,c,m=n.length,l=m,d=0;for(t.__k=new Array(i),o=0;o<i;o++)(a=e[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(u=o+d,(a=t.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?Me(null,a,null,null,null):Ie(a)?Me(le,{children:a},null,null,null):a.constructor==null&&a.__b>0?Me(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=t,a.__b=t.__b+1,s=null,(c=a.__i=tr(a,n,u,l))!=-1&&(l--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(i>m?d--:i<m&&d++),typeof a.type!="function"&&(a.__u|=4)):c!=u&&(c==u-1?d--:c==u+1?d++:(c>u?d--:d++,a.__u|=4))):t.__k[o]=null;if(l)for(o=0;o<m;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==r&&(r=he(s)),Nt(s,s));return r}function Lt(t,e,n,r){var i,o;if(typeof t.type=="function"){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=Lt(i[o],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=he(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function tr(t,e,n,r){var i,o,a,s=t.key,u=t.type,c=e[n],m=c!=null&&(2&c.__u)==0;if(c===null&&t.key==null||m&&s==c.key&&u==c.type)return n;if(r>(m?1:0)){for(i=n-1,o=n+1;i>=0||o<e.length;)if((c=e[a=i>=0?i--:o++])!=null&&(2&c.__u)==0&&s==c.key&&u==c.type)return a}return-1}function Ct(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||Jn.test(e)?n:n+"px"}function Ae(t,e,n,r,i){var o,a;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||Ct(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||Ct(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Pt,"$1")),a=e.toLowerCase(),e=a in t||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=Xe,t.addEventListener(e,o?qe:Be,o)):t.removeEventListener(e,o?qe:Be,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function Tt(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=Xe++;else if(e.t<n.u)return;return n(A.event?A.event(e):e)}}}function Ge(t,e,n,r,i,o,a,s,u,c){var m,l,d,h,E,M,T,g,x,P,O,D,v,V,J,j,H,C=e.type;if(e.constructor!=null)return null;128&n.__u&&(u=!!(32&n.__u),o=[s=e.__e=n.__e]),(m=A.__b)&&m(e);e:if(typeof C=="function")try{if(g=e.props,x="prototype"in C&&C.prototype.render,P=(m=C.contextType)&&r[m.__c],O=m?P?P.props.value:m.__:r,n.__c?T=(l=e.__c=n.__c).__=l.__E:(x?e.__c=l=new C(g,O):(e.__c=l=new De(g,O),l.constructor=C,l.render=rr),P&&P.sub(l),l.props=g,l.state||(l.state={}),l.context=O,l.__n=r,d=l.__d=!0,l.__h=[],l._sb=[]),x&&l.__s==null&&(l.__s=l.state),x&&C.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=se({},l.__s)),se(l.__s,C.getDerivedStateFromProps(g,l.__s))),h=l.props,E=l.state,l.__v=e,d)x&&C.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),x&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(x&&C.getDerivedStateFromProps==null&&g!==h&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(g,O),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(g,l.__s,O)===!1||e.__v==n.__v){for(e.__v!=n.__v&&(l.props=g,l.state=l.__s,l.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(B){B&&(B.__=e)}),D=0;D<l._sb.length;D++)l.__h.push(l._sb[D]);l._sb=[],l.__h.length&&a.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(g,l.__s,O),x&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(h,E,M)})}if(l.context=O,l.props=g,l.__P=t,l.__e=!1,v=A.__r,V=0,x){for(l.state=l.__s,l.__d=!1,v&&v(e),m=l.render(l.props,l.state,l.context),J=0;J<l._sb.length;J++)l.__h.push(l._sb[J]);l._sb=[]}else do l.__d=!1,v&&v(e),m=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++V<25);l.state=l.__s,l.getChildContext!=null&&(r=se(se({},r),l.getChildContext())),x&&!d&&l.getSnapshotBeforeUpdate!=null&&(M=l.getSnapshotBeforeUpdate(h,E)),j=m,m!=null&&m.type===le&&m.key==null&&(j=It(m.props.children)),s=Dt(t,Ie(j)?j:[j],e,n,r,i,o,a,s,u,c),l.base=e.__e,e.__u&=-161,l.__h.length&&a.push(l),T&&(l.__E=l.__=null)}catch(B){if(e.__v=null,u||o!=null)if(B.then){for(e.__u|=u?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,e.__e=s}else{for(H=o.length;H--;)Ye(o[H]);We(e)}else e.__e=n.__e,e.__k=n.__k,B.then||We(e);A.__e(B,e,n)}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):s=e.__e=nr(n.__e,e,n,r,i,o,a,u,c);return(m=A.diffed)&&m(e),128&e.__u?void 0:s}function We(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(We)}function Rt(t,e,n){for(var r=0;r<n.length;r++)Qe(n[r],n[++r],n[++r]);A.__c&&A.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){A.__e(o,i.__v)}})}function It(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Ie(t)?t.map(It):se({},t)}function nr(t,e,n,r,i,o,a,s,u){var c,m,l,d,h,E,M,T=n.props,g=e.props,x=e.type;if(x=="svg"?i="http://www.w3.org/2000/svg":x=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!x&&(x?h.localName==x:h.nodeType==3)){t=h,o[c]=null;break}}if(t==null){if(x==null)return document.createTextNode(g);t=document.createElementNS(i,x,g.is&&g),s&&(A.__m&&A.__m(e,o),s=!1),o=null}if(x==null)T===g||s&&t.data==g||(t.data=g);else{if(o=o&&Re.call(t.childNodes),T=n.props||_e,!s&&o!=null)for(T={},c=0;c<t.attributes.length;c++)T[(h=t.attributes[c]).name]=h.value;for(c in T)if(h=T[c],c!="children"){if(c=="dangerouslySetInnerHTML")l=h;else if(!(c in g)){if(c=="value"&&"defaultValue"in g||c=="checked"&&"defaultChecked"in g)continue;Ae(t,c,null,h,i)}}for(c in g)h=g[c],c=="children"?d=h:c=="dangerouslySetInnerHTML"?m=h:c=="value"?E=h:c=="checked"?M=h:s&&typeof h!="function"||T[c]===h||Ae(t,c,h,T[c],i);if(m)s||l&&(m.__html==l.__html||m.__html==t.innerHTML)||(t.innerHTML=m.__html),e.__k=[];else if(l&&(t.innerHTML=""),Dt(e.type=="template"?t.content:t,Ie(d)?d:[d],e,n,r,x=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&he(n,0),s,u),o!=null)for(c=o.length;c--;)Ye(o[c]);s||(c="value",x=="progress"&&E==null?t.removeAttribute("value"):E!=null&&(E!==t[c]||x=="progress"&&!E||x=="option"&&E!=T[c])&&Ae(t,c,E,T[c],i),c="checked",M!=null&&M!=t[c]&&Ae(t,c,M,T[c],i))}return t}function Qe(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(i){A.__e(i,n)}}function Nt(t,e,n){var r,i;if(A.unmount&&A.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||Qe(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){A.__e(o,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&Nt(r[i],e,n||typeof t.type!="function");n||Ye(t.__e),t.__c=t.__=t.__e=void 0}function rr(t,e,n){return this.constructor(t,n)}function Je(t,e,n){var r,i,o,a;e==document&&(e=document.documentElement),A.__&&A.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,o=[],a=[],Ge(e,t=(!r&&n||e).__k=Zn(le,null,[t]),i||_e,_e,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?Re.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,a),Rt(o,t,a)}Re=At.slice,A={__e:function(t,e,n,r){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(s){t=s}throw t}},St=0,Gn=function(t){return t!=null&&t.constructor==null},De.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=se({},this.state),typeof t=="function"&&(t=t(se({},n),this.props)),t&&se(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),xt(this))},De.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),xt(this))},De.prototype.render=le,de=[],Et=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,zt=function(t,e){return t.__v.__b-e.__v.__b},Le.__r=0,Pt=/(PointerCapture)$|Capture$/i,Xe=0,Be=Tt(!1),qe=Tt(!0),Qn=0;var ve,N,Ze,Ot,ke=0,Bt=[],U=A,Ht=U.__b,Ft=U.__r,Ut=U.diffed,Kt=U.__c,$t=U.unmount,Vt=U.__;function tt(t,e){U.__h&&U.__h(N,t,ke||e),ke=0;var n=N.__H||(N.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function ie(t){return ke=1,ir(Yt,t)}function ir(t,e,n){var r=tt(ve++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Yt(void 0,e),function(s){var u=r.__N?r.__N[0]:r.__[0],c=r.t(u,s);u!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=N,!N.__f)){var i=function(s,u,c){if(!r.__c.__H)return!0;var m=r.__c.__H.__.filter(function(d){return!!d.__c});if(m.every(function(d){return!d.__N}))return!o||o.call(this,s,u,c);var l=r.__c.props!==s;return m.forEach(function(d){if(d.__N){var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(l=!0)}}),o&&o.call(this,s,u,c)||l};N.__f=!0;var o=N.shouldComponentUpdate,a=N.componentWillUpdate;N.componentWillUpdate=function(s,u,c){if(this.__e){var m=o;o=void 0,i(s,u,c),o=m}a&&a.call(this,s,u,c)},N.shouldComponentUpdate=i}return r.__N||r.__}function Y(t,e){var n=tt(ve++,3);!U.__s&&Xt(n.__H,e)&&(n.__=t,n.u=e,N.__H.__h.push(n))}function K(t){return ke=5,qt(function(){return{current:t}},[])}function qt(t,e){var n=tt(ve++,7);return Xt(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Wt(t,e){return ke=8,qt(function(){return t},e)}function or(){for(var t;t=Bt.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Ne),t.__H.__h.forEach(et),t.__H.__h=[]}catch(e){t.__H.__h=[],U.__e(e,t.__v)}}U.__b=function(t){N=null,Ht&&Ht(t)},U.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Vt&&Vt(t,e)},U.__r=function(t){Ft&&Ft(t),ve=0;var e=(N=t.__c).__H;e&&(Ze===N?(e.__h=[],N.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(Ne),e.__h.forEach(et),e.__h=[],ve=0)),Ze=N},U.diffed=function(t){Ut&&Ut(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Bt.push(e)!==1&&Ot===U.requestAnimationFrame||((Ot=U.requestAnimationFrame)||ar)(or)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Ze=N=null},U.__c=function(t,e){e.some(function(n){try{n.__h.forEach(Ne),n.__h=n.__h.filter(function(r){return!r.__||et(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],U.__e(r,n.__v)}}),Kt&&Kt(t,e)},U.unmount=function(t){$t&&$t(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Ne(r)}catch(i){e=i}}),n.__H=void 0,e&&U.__e(e,n.__v))};var jt=typeof requestAnimationFrame=="function";function ar(t){var e,n=function(){clearTimeout(r),jt&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);jt&&(e=requestAnimationFrame(n))}function Ne(t){var e=N,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),N=e}function et(t){var e=N;t.__c=t.__(),N=e}function Xt(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Yt(t,e){return typeof e=="function"?e(t):e}var sr=0;function p(t,e,n,r,i,o){e||(e={});var a,s,u=e;if("ref"in u)for(s in u={},e)s=="ref"?a=e[s]:u[s]=e[s];var c={type:t,props:u,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--sr,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(a=t.defaultProps))for(s in a)u[s]===void 0&&(u[s]=a[s]);return A.vnode&&A.vnode(c),c}var Gt=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",width:"16",height:"16",children:p("path",{d:"M5 12h14M12 5l7 7-7 7"})}),lr=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:p("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 0 1 1.04-.208Z",clipRule:"evenodd"})}),Qt=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:p("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),nt=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:p("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),cr=()=>p("svg",{width:"32",height:"32",viewBox:"0 0 900 900",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("circle",{cx:"446",cy:"450",r:"424",fill:"black"}),p("circle",{cx:"450",cy:"450",r:"357",fill:"#E8E8E8"}),p("ellipse",{cx:"579.85",cy:"294.451",rx:"79.778",ry:"108.483",transform:"rotate(-46.2324 579.85 294.451)",fill:"black"})]}),ur=()=>p("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",width:"16",height:"16",children:p("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"})}),Oe="kenobi:identity-resolved",Jt="kenobi-snitcher",dr=1600,rt=(t,e)=>{typeof window>"u"||window.dispatchEvent(new CustomEvent(`kenobi:${t}`,{detail:e,bubbles:!0}))},pr=t=>{if(!t||t.type!=="business")return null;let e=t.company,n=e?.name||t.domain||void 0,r=e?.domain||t.domain||void 0;return n?{name:n,domain:r,logoUrl:e?.logoUrl||(r?`https://logo.clearbit.com/${r}`:void 0)}:null},Zt=t=>t?t.replace(/^https?:\/\//i,"").replace(/\/.*$/,"").replace(/:\d+$/,"").replace(/^www\./i,"").trim().toLowerCase():"",fr=t=>{if(typeof window>"u"||typeof document>"u"||window.__kenobiSnitcherLoaded||window.__kenobiSnitcherLoading)return;if(window.Snitcher||window.SpotterSettings){window.__kenobiSnitcherLoaded=!0;return}if(document.getElementById(Jt)){window.__kenobiSnitcherLoaded=!0;return}let e=t?.snitcher;if(!e?.spotterToken||!e.profileId)return;window.__kenobiSnitcherLoading=!0;let n=t?.logoUrlTemplate||"https://logo.clearbit.com/{domain}",r=e.apiEndpoint||`${window.location.origin}/api/snitcher-proxy/radar`,i=e.cdn||`${window.location.origin}/api/snitcher-proxy/cdn`,o=e.namespace||"Snitcher",a=`
|
|
5
|
+
"use strict";var KenobiLib=(()=>{var Se=Object.defineProperty;var Rn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var Nn=Object.prototype.hasOwnProperty;var On=(t,e,n)=>e in t?Se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Hn=(t,e)=>{for(var n in e)Se(t,n,{get:e[n],enumerable:!0})},Fn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of In(e))!Nn.call(t,i)&&i!==n&&Se(t,i,{get:()=>e[i],enumerable:!(r=Rn(e,i))||r.enumerable});return t};var Un=t=>Fn(Se({},"__esModule",{value:!0}),t);var m=(t,e,n)=>On(t,typeof e!="symbol"?e+"":e,n);var Dr={};Hn(Dr,{CueCard:()=>we,Kenobi:()=>lt,TRANSFORMATION_ACTIONS:()=>dn});var vt=11;function $n(t,e){var n=e.attributes,r,i,o,a,s;if(!(e.nodeType===vt||t.nodeType===vt)){for(var u=n.length-1;u>=0;u--)r=n[u],i=r.name,o=r.namespaceURI,a=r.value,o?(i=r.localName||i,s=t.getAttributeNS(o,i),s!==a&&(r.prefix==="xmlns"&&(i=r.name),t.setAttributeNS(o,i,a))):(s=t.getAttribute(i),s!==a&&t.setAttribute(i,a));for(var c=t.attributes,h=c.length-1;h>=0;h--)r=c[h],i=r.name,o=r.namespaceURI,o?(i=r.localName||i,e.hasAttributeNS(o,i)||t.removeAttributeNS(o,i)):e.hasAttribute(i)||t.removeAttribute(i)}}var Ee,Kn="http://www.w3.org/1999/xhtml",Q=typeof document>"u"?void 0:document,Vn=!!Q&&"content"in Q.createElement("template"),jn=!!Q&&Q.createRange&&"createContextualFragment"in Q.createRange();function Bn(t){var e=Q.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function qn(t){Ee||(Ee=Q.createRange(),Ee.selectNode(Q.body));var e=Ee.createContextualFragment(t);return e.childNodes[0]}function Wn(t){var e=Q.createElement("body");return e.innerHTML=t,e.childNodes[0]}function Xn(t){return t=t.trim(),Vn?Bn(t):jn?qn(t):Wn(t)}function ze(t,e){var n=t.nodeName,r=e.nodeName,i,o;return n===r?!0:(i=n.charCodeAt(0),o=r.charCodeAt(0),i<=90&&o>=97?n===r.toUpperCase():o<=90&&i>=97?r===n.toUpperCase():!1)}function Yn(t,e){return!e||e===Kn?Q.createElement(t):Q.createElementNS(e,t)}function Gn(t,e){for(var n=t.firstChild;n;){var r=n.nextSibling;e.appendChild(n),n=r}return e}function We(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n))}var kt={OPTION:function(t,e){var n=t.parentNode;if(n){var r=n.nodeName.toUpperCase();r==="OPTGROUP"&&(n=n.parentNode,r=n&&n.nodeName.toUpperCase()),r==="SELECT"&&!n.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),n.selectedIndex=-1)}We(t,e,"selected")},INPUT:function(t,e){We(t,e,"checked"),We(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var n=e.value;t.value!==n&&(t.value=n);var r=t.firstChild;if(r){var i=r.nodeValue;if(i==n||!n&&i==t.placeholder)return;r.nodeValue=n}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var n=-1,r=0,i=t.firstChild,o,a;i;)if(a=i.nodeName&&i.nodeName.toUpperCase(),a==="OPTGROUP")o=i,i=o.firstChild,i||(i=o.nextSibling,o=null);else{if(a==="OPTION"){if(i.hasAttribute("selected")){n=r;break}r++}i=i.nextSibling,!i&&o&&(i=o.nextSibling,o=null)}t.selectedIndex=n}}},ye=1,wt=11,xt=3,Ct=8;function ce(){}function Qn(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function Jn(t){return function(n,r,i){if(i||(i={}),typeof r=="string")if(n.nodeName==="#document"||n.nodeName==="HTML"||n.nodeName==="BODY"){var o=r;r=Q.createElement("html"),r.innerHTML=o}else r=Xn(r);else r.nodeType===wt&&(r=r.firstElementChild);var a=i.getNodeKey||Qn,s=i.onBeforeNodeAdded||ce,u=i.onNodeAdded||ce,c=i.onBeforeElUpdated||ce,h=i.onElUpdated||ce,l=i.onBeforeNodeDiscarded||ce,p=i.onNodeDiscarded||ce,b=i.onBeforeElChildrenUpdated||ce,E=i.skipFromChildren||ce,M=i.addChild||function(_,k){return _.appendChild(k)},T=i.childrenOnly===!0,g=Object.create(null),x=[];function P(_){x.push(_)}function O(_,k){if(_.nodeType===ye)for(var D=_.firstChild;D;){var S=void 0;k&&(S=a(D))?P(S):(p(D),D.firstChild&&O(D,k)),D=D.nextSibling}}function L(_,k,D){l(_)!==!1&&(k&&k.removeChild(_),p(_),O(_,D))}function v(_){if(_.nodeType===ye||_.nodeType===wt)for(var k=_.firstChild;k;){var D=a(k);D&&(g[D]=k),v(k),k=k.nextSibling}}v(n);function V(_){u(_);for(var k=_.firstChild;k;){var D=k.nextSibling,S=a(k);if(S){var z=g[S];z&&ze(k,z)?(k.parentNode.replaceChild(z,k),j(z,k)):V(k)}else V(k);k=D}}function J(_,k,D){for(;k;){var S=k.nextSibling;(D=a(k))?P(D):L(k,_,!0),k=S}}function j(_,k,D){var S=a(k);if(S&&delete g[S],!D){var z=c(_,k);if(z===!1||(z instanceof HTMLElement&&(_=z,v(_)),t(_,k),h(_),b(_,k)===!1))return}_.nodeName!=="TEXTAREA"?H(_,k):kt.TEXTAREA(_,k)}function H(_,k){var D=E(_,k),S=k.firstChild,z=_.firstChild,G,Z,F,te,ne;e:for(;S;){for(te=S.nextSibling,G=a(S);!D&&z;){if(F=z.nextSibling,S.isSameNode&&S.isSameNode(z)){S=te,z=F;continue e}Z=a(z);var ee=z.nodeType,q=void 0;if(ee===S.nodeType&&(ee===ye?(G?G!==Z&&((ne=g[G])?F===ne?q=!1:(_.insertBefore(ne,z),Z?P(Z):L(z,_,!0),z=ne,Z=a(z)):q=!1):Z&&(q=!1),q=q!==!1&&ze(z,S),q&&j(z,S)):(ee===xt||ee==Ct)&&(q=!0,z.nodeValue!==S.nodeValue&&(z.nodeValue=S.nodeValue))),q){S=te,z=F;continue e}Z?P(Z):L(z,_,!0),z=F}if(G&&(ne=g[G])&&ze(ne,S))D||M(_,ne),j(ne,S);else{var K=s(S);K!==!1&&(K&&(S=K),S.actualize&&(S=S.actualize(_.ownerDocument||Q)),M(_,S),V(S))}S=te,z=F}J(_,z,Z);var se=kt[_.nodeName];se&&se(_,k)}var C=n,B=C.nodeType,ge=r.nodeType;if(!T){if(B===ye)ge===ye?ze(n,r)||(p(n),C=Gn(n,Yn(r.nodeName,r.namespaceURI))):C=r;else if(B===xt||B===Ct){if(ge===B)return C.nodeValue!==r.nodeValue&&(C.nodeValue=r.nodeValue),C;C=r}}if(C===r)p(n);else{if(r.isSameNode&&r.isSameNode(C))return;if(j(C,r,T),x)for(var ue=0,Fe=x.length;ue<Fe;ue++){var pe=g[x[ue]];pe&&L(pe,pe.parentNode,!1)}}return!T&&C!==n&&n.parentNode&&(C.actualize&&(C=C.actualize(n.ownerDocument||Q)),n.parentNode.replaceChild(C,n)),C}}var Zn=Jn($n),Pe=Zn;var Re,A,Pt,er,de,Tt,At,Mt,Lt,Qe,Xe,Ye,tr,_e={},Dt=[],nr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ie=Array.isArray;function le(t,e){for(var n in e)t[n]=e[n];return t}function Je(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function rr(t,e,n){var r,i,o,a={};for(o in e)o=="key"?r=e[o]:o=="ref"?i=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?Re.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)a[o]===void 0&&(a[o]=t.defaultProps[o]);return Me(t,a,r,i,null)}function Me(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Pt,__i:-1,__u:0};return i==null&&A.vnode!=null&&A.vnode(o),o}function oe(t){return t.children}function Le(t,e){this.props=t,this.context=e}function he(t,e){if(e==null)return t.__?he(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?he(t):null}function Rt(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Rt(t)}}function St(t){(!t.__d&&(t.__d=!0)&&de.push(t)&&!De.__r++||Tt!=A.debounceRendering)&&((Tt=A.debounceRendering)||At)(De)}function De(){for(var t,e,n,r,i,o,a,s=1;de.length;)de.length>s&&de.sort(Mt),t=de.shift(),s=de.length,t.__d&&(n=void 0,r=void 0,i=(r=(e=t).__v).__e,o=[],a=[],e.__P&&((n=le({},r)).__v=r.__v+1,A.vnode&&A.vnode(n),Ze(e.__P,n,r,e.__n,e.__P.namespaceURI,32&r.__u?[i]:null,o,i??he(r),!!(32&r.__u),a),n.__v=r.__v,n.__.__k[n.__i]=n,Ot(o,n,a),r.__e=r.__=null,n.__e!=i&&Rt(n)));De.__r=0}function It(t,e,n,r,i,o,a,s,u,c,h){var l,p,b,E,M,T,g,x=r&&r.__k||Dt,P=e.length;for(u=ir(n,e,x,u,P),l=0;l<P;l++)(b=n.__k[l])!=null&&(p=b.__i==-1?_e:x[b.__i]||_e,b.__i=l,T=Ze(t,b,p,i,o,a,s,u,c,h),E=b.__e,b.ref&&p.ref!=b.ref&&(p.ref&&et(p.ref,null,b),h.push(b.ref,b.__c||E,b)),M==null&&E!=null&&(M=E),(g=!!(4&b.__u))||p.__k===b.__k?u=Nt(b,u,t,g):typeof b.type=="function"&&T!==void 0?u=T:E&&(u=E.nextSibling),b.__u&=-7);return n.__e=M,u}function ir(t,e,n,r,i){var o,a,s,u,c,h=n.length,l=h,p=0;for(t.__k=new Array(i),o=0;o<i;o++)(a=e[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(u=o+p,(a=t.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?Me(null,a,null,null,null):Ie(a)?Me(oe,{children:a},null,null,null):a.constructor==null&&a.__b>0?Me(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=t,a.__b=t.__b+1,s=null,(c=a.__i=or(a,n,u,l))!=-1&&(l--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(i>h?p--:i<h&&p++),typeof a.type!="function"&&(a.__u|=4)):c!=u&&(c==u-1?p--:c==u+1?p++:(c>u?p--:p++,a.__u|=4))):t.__k[o]=null;if(l)for(o=0;o<h;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==r&&(r=he(s)),Ft(s,s));return r}function Nt(t,e,n,r){var i,o;if(typeof t.type=="function"){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=Nt(i[o],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=he(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function or(t,e,n,r){var i,o,a,s=t.key,u=t.type,c=e[n],h=c!=null&&(2&c.__u)==0;if(c===null&&t.key==null||h&&s==c.key&&u==c.type)return n;if(r>(h?1:0)){for(i=n-1,o=n+1;i>=0||o<e.length;)if((c=e[a=i>=0?i--:o++])!=null&&(2&c.__u)==0&&s==c.key&&u==c.type)return a}return-1}function Et(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||nr.test(e)?n:n+"px"}function Ae(t,e,n,r,i){var o,a;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||Et(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||Et(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Lt,"$1")),a=e.toLowerCase(),e=a in t||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=Qe,t.addEventListener(e,o?Ye:Xe,o)):t.removeEventListener(e,o?Ye:Xe,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function zt(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=Qe++;else if(e.t<n.u)return;return n(A.event?A.event(e):e)}}}function Ze(t,e,n,r,i,o,a,s,u,c){var h,l,p,b,E,M,T,g,x,P,O,L,v,V,J,j,H,C=e.type;if(e.constructor!=null)return null;128&n.__u&&(u=!!(32&n.__u),o=[s=e.__e=n.__e]),(h=A.__b)&&h(e);e:if(typeof C=="function")try{if(g=e.props,x="prototype"in C&&C.prototype.render,P=(h=C.contextType)&&r[h.__c],O=h?P?P.props.value:h.__:r,n.__c?T=(l=e.__c=n.__c).__=l.__E:(x?e.__c=l=new C(g,O):(e.__c=l=new Le(g,O),l.constructor=C,l.render=sr),P&&P.sub(l),l.props=g,l.state||(l.state={}),l.context=O,l.__n=r,p=l.__d=!0,l.__h=[],l._sb=[]),x&&l.__s==null&&(l.__s=l.state),x&&C.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=le({},l.__s)),le(l.__s,C.getDerivedStateFromProps(g,l.__s))),b=l.props,E=l.state,l.__v=e,p)x&&C.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),x&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(x&&C.getDerivedStateFromProps==null&&g!==b&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(g,O),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(g,l.__s,O)===!1||e.__v==n.__v){for(e.__v!=n.__v&&(l.props=g,l.state=l.__s,l.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(B){B&&(B.__=e)}),L=0;L<l._sb.length;L++)l.__h.push(l._sb[L]);l._sb=[],l.__h.length&&a.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(g,l.__s,O),x&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(b,E,M)})}if(l.context=O,l.props=g,l.__P=t,l.__e=!1,v=A.__r,V=0,x){for(l.state=l.__s,l.__d=!1,v&&v(e),h=l.render(l.props,l.state,l.context),J=0;J<l._sb.length;J++)l.__h.push(l._sb[J]);l._sb=[]}else do l.__d=!1,v&&v(e),h=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++V<25);l.state=l.__s,l.getChildContext!=null&&(r=le(le({},r),l.getChildContext())),x&&!p&&l.getSnapshotBeforeUpdate!=null&&(M=l.getSnapshotBeforeUpdate(b,E)),j=h,h!=null&&h.type===oe&&h.key==null&&(j=Ht(h.props.children)),s=It(t,Ie(j)?j:[j],e,n,r,i,o,a,s,u,c),l.base=e.__e,e.__u&=-161,l.__h.length&&a.push(l),T&&(l.__E=l.__=null)}catch(B){if(e.__v=null,u||o!=null)if(B.then){for(e.__u|=u?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,e.__e=s}else{for(H=o.length;H--;)Je(o[H]);Ge(e)}else e.__e=n.__e,e.__k=n.__k,B.then||Ge(e);A.__e(B,e,n)}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):s=e.__e=ar(n.__e,e,n,r,i,o,a,u,c);return(h=A.diffed)&&h(e),128&e.__u?void 0:s}function Ge(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(Ge)}function Ot(t,e,n){for(var r=0;r<n.length;r++)et(n[r],n[++r],n[++r]);A.__c&&A.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){A.__e(o,i.__v)}})}function Ht(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Ie(t)?t.map(Ht):le({},t)}function ar(t,e,n,r,i,o,a,s,u){var c,h,l,p,b,E,M,T=n.props,g=e.props,x=e.type;if(x=="svg"?i="http://www.w3.org/2000/svg":x=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((b=o[c])&&"setAttribute"in b==!!x&&(x?b.localName==x:b.nodeType==3)){t=b,o[c]=null;break}}if(t==null){if(x==null)return document.createTextNode(g);t=document.createElementNS(i,x,g.is&&g),s&&(A.__m&&A.__m(e,o),s=!1),o=null}if(x==null)T===g||s&&t.data==g||(t.data=g);else{if(o=o&&Re.call(t.childNodes),T=n.props||_e,!s&&o!=null)for(T={},c=0;c<t.attributes.length;c++)T[(b=t.attributes[c]).name]=b.value;for(c in T)if(b=T[c],c!="children"){if(c=="dangerouslySetInnerHTML")l=b;else if(!(c in g)){if(c=="value"&&"defaultValue"in g||c=="checked"&&"defaultChecked"in g)continue;Ae(t,c,null,b,i)}}for(c in g)b=g[c],c=="children"?p=b:c=="dangerouslySetInnerHTML"?h=b:c=="value"?E=b:c=="checked"?M=b:s&&typeof b!="function"||T[c]===b||Ae(t,c,b,T[c],i);if(h)s||l&&(h.__html==l.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(l&&(t.innerHTML=""),It(e.type=="template"?t.content:t,Ie(p)?p:[p],e,n,r,x=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&he(n,0),s,u),o!=null)for(c=o.length;c--;)Je(o[c]);s||(c="value",x=="progress"&&E==null?t.removeAttribute("value"):E!=null&&(E!==t[c]||x=="progress"&&!E||x=="option"&&E!=T[c])&&Ae(t,c,E,T[c],i),c="checked",M!=null&&M!=t[c]&&Ae(t,c,M,T[c],i))}return t}function et(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(i){A.__e(i,n)}}function Ft(t,e,n){var r,i;if(A.unmount&&A.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||et(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){A.__e(o,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&Ft(r[i],e,n||typeof t.type!="function");n||Je(t.__e),t.__c=t.__=t.__e=void 0}function sr(t,e,n){return this.constructor(t,n)}function tt(t,e,n){var r,i,o,a;e==document&&(e=document.documentElement),A.__&&A.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,o=[],a=[],Ze(e,t=(!r&&n||e).__k=rr(oe,null,[t]),i||_e,_e,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?Re.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,a),Ot(o,t,a)}Re=Dt.slice,A={__e:function(t,e,n,r){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(s){t=s}throw t}},Pt=0,er=function(t){return t!=null&&t.constructor==null},Le.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=le({},this.state),typeof t=="function"&&(t=t(le({},n),this.props)),t&&le(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),St(this))},Le.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),St(this))},Le.prototype.render=oe,de=[],At=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mt=function(t,e){return t.__v.__b-e.__v.__b},De.__r=0,Lt=/(PointerCapture)$|Capture$/i,Qe=0,Xe=zt(!1),Ye=zt(!0),tr=0;var ve,N,nt,Ut,ke=0,Xt=[],U=A,$t=U.__b,Kt=U.__r,Vt=U.diffed,jt=U.__c,Bt=U.unmount,qt=U.__;function it(t,e){U.__h&&U.__h(N,t,ke||e),ke=0;var n=N.__H||(N.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function re(t){return ke=1,lr(Jt,t)}function lr(t,e,n){var r=it(ve++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Jt(void 0,e),function(s){var u=r.__N?r.__N[0]:r.__[0],c=r.t(u,s);u!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=N,!N.__f)){var i=function(s,u,c){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(p){return!!p.__c});if(h.every(function(p){return!p.__N}))return!o||o.call(this,s,u,c);var l=r.__c.props!==s;return h.forEach(function(p){if(p.__N){var b=p.__[0];p.__=p.__N,p.__N=void 0,b!==p.__[0]&&(l=!0)}}),o&&o.call(this,s,u,c)||l};N.__f=!0;var o=N.shouldComponentUpdate,a=N.componentWillUpdate;N.componentWillUpdate=function(s,u,c){if(this.__e){var h=o;o=void 0,i(s,u,c),o=h}a&&a.call(this,s,u,c)},N.shouldComponentUpdate=i}return r.__N||r.__}function X(t,e){var n=it(ve++,3);!U.__s&&Qt(n.__H,e)&&(n.__=t,n.u=e,N.__H.__h.push(n))}function $(t){return ke=5,Yt(function(){return{current:t}},[])}function Yt(t,e){var n=it(ve++,7);return Qt(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Gt(t,e){return ke=8,Yt(function(){return t},e)}function cr(){for(var t;t=Xt.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Ne),t.__H.__h.forEach(rt),t.__H.__h=[]}catch(e){t.__H.__h=[],U.__e(e,t.__v)}}U.__b=function(t){N=null,$t&&$t(t)},U.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),qt&&qt(t,e)},U.__r=function(t){Kt&&Kt(t),ve=0;var e=(N=t.__c).__H;e&&(nt===N?(e.__h=[],N.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(Ne),e.__h.forEach(rt),e.__h=[],ve=0)),nt=N},U.diffed=function(t){Vt&&Vt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Xt.push(e)!==1&&Ut===U.requestAnimationFrame||((Ut=U.requestAnimationFrame)||ur)(cr)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),nt=N=null},U.__c=function(t,e){e.some(function(n){try{n.__h.forEach(Ne),n.__h=n.__h.filter(function(r){return!r.__||rt(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],U.__e(r,n.__v)}}),jt&&jt(t,e)},U.unmount=function(t){Bt&&Bt(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Ne(r)}catch(i){e=i}}),n.__H=void 0,e&&U.__e(e,n.__v))};var Wt=typeof requestAnimationFrame=="function";function ur(t){var e,n=function(){clearTimeout(r),Wt&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Wt&&(e=requestAnimationFrame(n))}function Ne(t){var e=N,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),N=e}function rt(t){var e=N;t.__c=t.__(),N=e}function Qt(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Jt(t,e){return typeof e=="function"?e(t):e}var dr=0;function d(t,e,n,r,i,o){e||(e={});var a,s,u=e;if("ref"in u)for(s in u={},e)s=="ref"?a=e[s]:u[s]=e[s];var c={type:t,props:u,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--dr,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(a=t.defaultProps))for(s in a)u[s]===void 0&&(u[s]=a[s]);return A.vnode&&A.vnode(c),c}var ot=()=>d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",width:"16",height:"16",children:d("path",{d:"M5 12h14M12 5l7 7-7 7"})}),pr=()=>d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:d("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 0 1 1.04-.208Z",clipRule:"evenodd"})}),Zt=()=>d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",children:d("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),Oe=()=>d("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:d("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),fr=()=>d("svg",{width:"32",height:"32",viewBox:"0 0 900 900",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d("circle",{cx:"446",cy:"450",r:"424",fill:"black"}),d("circle",{cx:"450",cy:"450",r:"357",fill:"#E8E8E8"}),d("ellipse",{cx:"579.85",cy:"294.451",rx:"79.778",ry:"108.483",transform:"rotate(-46.2324 579.85 294.451)",fill:"black"})]});var mr=()=>d("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",width:"16",height:"16",children:d("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"})}),He="kenobi:identity-resolved",en="kenobi-snitcher",hr=1600,at=(t,e)=>{typeof window>"u"||window.dispatchEvent(new CustomEvent(`kenobi:${t}`,{detail:e,bubbles:!0}))},br=t=>{if(!t||t.type!=="business")return null;let e=t.company,n=e?.name||t.domain||void 0,r=e?.domain||t.domain||void 0;return n?{name:n,domain:r,logoUrl:e?.logoUrl||(r?`https://logo.clearbit.com/${r}`:void 0)}:null},tn=t=>t?t.replace(/^https?:\/\//i,"").replace(/\/.*$/,"").replace(/:\d+$/,"").replace(/^www\./i,"").trim().toLowerCase():"",gr=t=>{if(typeof window>"u"||typeof document>"u"||window.__kenobiSnitcherLoaded||window.__kenobiSnitcherLoading)return;if(window.Snitcher||window.SpotterSettings){window.__kenobiSnitcherLoaded=!0;return}if(document.getElementById(en)){window.__kenobiSnitcherLoaded=!0;return}let e=t?.snitcher;if(!e?.spotterToken||!e.profileId)return;window.__kenobiSnitcherLoading=!0;let n=t?.logoUrlTemplate||"https://logo.clearbit.com/{domain}",r=e.apiEndpoint||`${window.location.origin}/api/snitcher-proxy/radar`,i=e.cdn||`${window.location.origin}/api/snitcher-proxy/cdn`,o=e.namespace||"Snitcher",a=`
|
|
6
6
|
(function () {
|
|
7
7
|
function spotterCb(response) {
|
|
8
8
|
var rawDomain = (response.company && response.company.domain) || response.domain || "";
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
window.__kenobiIdentityResolution = identity;
|
|
56
56
|
window.dispatchEvent(
|
|
57
|
-
new CustomEvent("${
|
|
57
|
+
new CustomEvent("${He}", {
|
|
58
58
|
detail: identity,
|
|
59
59
|
bubbles: true,
|
|
60
60
|
})
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
profileId: "${e.profileId}",
|
|
140
140
|
});
|
|
141
141
|
})();
|
|
142
|
-
`,s=document.createElement("script");s.id=
|
|
142
|
+
`,s=document.createElement("script");s.id=en,s.type="text/javascript",s.text=a,document.head?.appendChild(s),window.__kenobiSnitcherLoaded=!0,window.__kenobiSnitcherLoading=!1},yr=`
|
|
143
143
|
:host { --kb-font-family: system-ui, -apple-system, sans-serif; --kb-bg-container: rgba(255, 255, 255, 0.05); --kb-border-container: rgba(255, 255, 255, 0.2); --kb-shadow-container: 0 25px 50px -12px rgba(0, 0, 0, 0.25); --kb-backdrop-blur: 16px; --kb-text-title: #ffffff; --kb-text-subtitle: rgba(255, 255, 255, 0.7); --kb-btn-dismiss-bg: rgba(0, 0, 0, 0.7); --kb-btn-dismiss-border: rgba(255, 255, 255, 0.2); --kb-btn-dismiss-text: rgba(255, 255, 255, 0.8); --kb-btn-dismiss-hover-bg: rgba(0, 0, 0, 0.9); --kb-btn-dismiss-hover-text: #ffffff; --kb-btn-trigger-bg: #ffffff; --kb-btn-trigger-text: #000000; --kb-btn-trigger-hover-bg: rgba(255, 255, 255, 0.9); --kb-progress-track: rgba(255, 255, 255, 0.2); --kb-progress-indicator: #ffffff; --kb-popover-bg: rgba(255, 255, 255, 0.05); --kb-popover-border: rgba(255, 255, 255, 0.2); --kb-popover-text: #ffffff; --kb-input-bg: transparent; --kb-input-border: rgba(255, 255, 255, 0.3); --kb-input-text: #ffffff; --kb-input-placeholder: rgba(255, 255, 255, 0.6); --kb-form-label: #ffffff; --kb-success-color: #6ee7b7; --kb-error-text: #ef4444; --kb-focus-blur: 10px; --kb-kbd-bg: rgba(255, 255, 255, 0.15); --kb-kbd-border: rgba(255, 255, 255, 0.4); --kb-kbd-text: #ffffff; --kb-watermark-text: rgba(255, 255, 255, 0.4); font-family: var(--kb-font-family); }
|
|
144
144
|
.theme-light { --kb-bg-container: #ffffff; --kb-border-container: #e2e8f0; --kb-shadow-container: 0 20px 25px -5px rgba(0, 0, 0, 0.1); --kb-backdrop-blur: 0px; --kb-text-title: #0f172a; --kb-text-subtitle: #475569; --kb-btn-dismiss-bg: #ffffff; --kb-btn-dismiss-border: #e2e8f0; --kb-btn-dismiss-text: #64748b; --kb-btn-dismiss-hover-bg: #f1f5f9; --kb-btn-dismiss-hover-text: #0f172a; --kb-btn-trigger-bg: #0f172a; --kb-btn-trigger-text: #ffffff; --kb-btn-trigger-hover-bg: #1e293b; --kb-progress-track: #e2e8f0; --kb-progress-indicator: #0f172a; --kb-popover-bg: #ffffff; --kb-popover-border: #e2e8f0; --kb-popover-text: #0f172a; --kb-input-bg: #ffffff; --kb-input-border: #cbd5e1; --kb-input-text: #0f172a; --kb-input-placeholder: #94a3b8; --kb-form-label: #334155; --kb-success-color: #059669; --kb-error-text: #ef4444; --kb-kbd-bg: #f1f5f9; --kb-kbd-border: #e2e8f0; --kb-kbd-text: #64748b; --kb-watermark-text: #94a3b8; }
|
|
145
145
|
.theme-dark { --kb-bg-container: #0f172a; --kb-border-container: #334155; --kb-shadow-container: 0 25px 50px -12px rgba(0, 0, 0, 0.25); --kb-backdrop-blur: 0px; --kb-text-title: #f1f5f9; --kb-text-subtitle: #94a3b8; --kb-btn-dismiss-bg: #1e293b; --kb-btn-dismiss-border: #334155; --kb-btn-dismiss-text: #cbd5e1; --kb-btn-dismiss-hover-bg: #334155; --kb-btn-dismiss-hover-text: #ffffff; --kb-btn-trigger-bg: #ffffff; --kb-btn-trigger-text: #0f172a; --kb-btn-trigger-hover-bg: #f1f5f9; --kb-progress-track: #1e293b; --kb-progress-indicator: #ffffff; --kb-popover-bg: #0f172a; --kb-popover-border: #334155; --kb-popover-text: #f1f5f9; --kb-input-bg: #0f172a; --kb-input-border: #475569; --kb-input-text: #f1f5f9; --kb-input-placeholder: #94a3b8; --kb-form-label: #e2e8f0; --kb-success-color: #6ee7b7; --kb-error-text: #ef4444; --kb-kbd-bg: #1e293b; --kb-kbd-border: #334155; --kb-kbd-text: #94a3b8; --kb-watermark-text: #64748b; }
|
|
@@ -149,8 +149,6 @@
|
|
|
149
149
|
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); transition: all 0.5s ease; z-index: 0; pointer-events: none; }
|
|
150
150
|
.backdrop.active { background: rgba(0,0,0,0.1); backdrop-filter: blur(var(--kb-focus-blur)); -webkit-backdrop-filter: blur(var(--kb-focus-blur)); }
|
|
151
151
|
.launcher { position: absolute; pointer-events: auto; background-color: var(--kb-bg-container); border: 1px solid var(--kb-border-container); box-shadow: var(--kb-shadow-container); backdrop-filter: blur(var(--kb-backdrop-blur)); -webkit-backdrop-filter: blur(var(--kb-backdrop-blur)); border-radius: 9999px; padding: 0.5rem 1rem; display: flex; align-items: center; gap: 0.75rem; cursor: pointer; transition: transform 0.2s, opacity 0.3s; opacity: 0; z-index: 1; color: var(--kb-text-title); font-weight: 500; font-size: 0.875rem; font-family: var(--kb-font-family); }
|
|
152
|
-
.launcher .kbd-hint .kbd { background: var(--kb-kbd-bg); border: 1px solid var(--kb-kbd-border); color: var(--kb-kbd-text); }
|
|
153
|
-
.launcher .kbd-hint .kbd-text { color: var(--kb-kbd-text); }
|
|
154
152
|
.launcher:hover { transform: scale(1.02); background-color: var(--kb-bg-container); }
|
|
155
153
|
.kb-chip-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
|
|
156
154
|
.kb-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.8rem; border-radius: 9999px; border: 1px solid rgba(255,255,255,0.85); background: linear-gradient(135deg, rgba(255,255,255,0.28), rgba(255,255,255,0.08)); color: var(--kb-text-title); font-size: 0.8rem; font-weight: 600; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 8px 18px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.45); }
|
|
@@ -225,19 +223,17 @@
|
|
|
225
223
|
.popover-watermark { position: absolute; top: 100%; left: 0; right: 0; text-align: center; font-size: 0.625rem; color: var(--kb-watermark-text); opacity: 0.6; font-weight: 500; letter-spacing: 0.025em; padding-top: 0.5rem; }
|
|
226
224
|
.popover-watermark a { color: inherit; text-decoration: none; cursor: pointer; }
|
|
227
225
|
.popover-watermark a:hover { text-decoration: underline; opacity: 1; }
|
|
228
|
-
/* Launcher hint
|
|
229
|
-
.launcher
|
|
230
|
-
.launcher
|
|
231
|
-
.pos-top-right.launcher .kbd-hint { left: auto; right: auto; }
|
|
226
|
+
/* Launcher helper hint (below launcher) */
|
|
227
|
+
.launcher-hint { position: absolute; top: calc(100% + 0.4rem); left: 50%; transform: translateX(-50%); pointer-events: none; white-space: nowrap; }
|
|
228
|
+
.launcher-hint.visible { opacity: 0.65; }
|
|
232
229
|
/* Launcher dismiss button */
|
|
233
230
|
.launcher .btn-dismiss.launcher-dismiss { top: -0.375rem; left: -0.375rem; width: 1.25rem; height: 1.25rem; opacity: 0; transition: opacity 0.2s ease-out, background-color 0.3s ease-out, color 0.3s ease-out; }
|
|
234
231
|
.launcher:hover .btn-dismiss.launcher-dismiss { opacity: 1; }
|
|
235
232
|
/* Launcher logo */
|
|
236
233
|
.launcher-logo { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
|
|
237
234
|
.launcher-logo svg { width: 20px; height: 20px; }
|
|
238
|
-
/* Mobile:
|
|
235
|
+
/* Mobile: show dismiss button */
|
|
239
236
|
@media (max-width: 768px) {
|
|
240
|
-
.launcher .kbd-hint { display: none; }
|
|
241
237
|
.launcher .btn-dismiss.launcher-dismiss { opacity: 1; }
|
|
242
238
|
}
|
|
243
239
|
/* Toggle personalization button */
|
|
@@ -247,7 +243,12 @@
|
|
|
247
243
|
/* Custom tooltip for toggle button */
|
|
248
244
|
.btn-toggle-personalization .toggle-tooltip { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; background-color: var(--kb-bg-container); border: 1px solid var(--kb-border-container); color: var(--kb-text-title); font-size: 0.7rem; font-weight: 500; padding: 0.25rem 0.5rem; border-radius: 4px; opacity: 0; visibility: hidden; transition: opacity 0.15s ease-out, visibility 0.15s ease-out; pointer-events: none; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
|
|
249
245
|
.btn-toggle-personalization:hover .toggle-tooltip { opacity: 1; visibility: visible; }
|
|
250
|
-
`,en=(t,e,n)=>{let r=K(!1),i=K(null);Y(()=>{let o=t.current;if(!o)return;i.current&&(i.current.cancel(),i.current=null);let a=n.direction==="top-to-bottom",s=a?"translateY(-60px)":"translateX(60px)",u=a?"translateY(-20px)":"translateX(20px)",c="translate(0, 0)";if(e){o.style.visibility="visible",r.current=!0;let m=o.animate([{opacity:0,transform:s},{opacity:1,transform:c}],{duration:500,delay:n.entranceDelayMs,easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fill:"forwards"});i.current=m,m.onfinish=()=>{i.current=null,n.onEntranceComplete?.()}}else if(r.current){let m=o.animate([{opacity:1,transform:c},{opacity:0,transform:u}],{duration:350,delay:n.exitDelayMs,easing:"ease-in-out",fill:"forwards"});i.current=m,m.onfinish=()=>{o.style.visibility="hidden",i.current=null,n.onExitComplete?.()}}else o.style.opacity="0",o.style.transform=u,o.style.visibility="hidden"},[e,n.direction])},tn=t=>{if(!t)return{};let e={};return t.fontFamily&&(e["--kb-font-family"]=t.fontFamily),t.backgroundColor&&(e["--kb-bg-container"]=t.backgroundColor,e["--kb-popover-bg"]=t.backgroundColor),t.borderColor&&(e["--kb-border-container"]=t.borderColor,e["--kb-popover-border"]=t.borderColor),t.textColor&&(e["--kb-text-title"]=t.textColor,e["--kb-popover-text"]=t.textColor),t.subtitleColor&&(e["--kb-text-subtitle"]=t.subtitleColor),t.borderRadius&&(e["border-radius"]=t.borderRadius,e["border-bottom-left-radius"]=t.borderRadius,e["border-bottom-right-radius"]=t.borderRadius),t.primaryColor&&(e["--kb-btn-trigger-bg"]=t.primaryColor,e["--kb-progress-indicator"]=t.primaryColor,e["--kb-success-color"]=t.primaryColor),t.primaryTextColor&&(e["--kb-btn-trigger-text"]=t.primaryTextColor),e},hr=({config:t,isOpen:e,skipFocus:n,setIsOpen:r,deanonymizedCompany:i,onClearDeanonymizedCompany:o})=>{let a=t.mountMode==="inline",s=K(null),u=K(null),c=K(null),m=K(null),l=K(null),[d,h]=ie("card"),[E,M]=ie(!1),[T,g]=ie(!1),[x,P]=ie(!1),O=K(!1),D=K(!1),v=K(!1),V=K("card"),J=K(t.status),j=K(!!t.isVisible),H=K(null),C=K(null),B=K(!1),[ge,ue]=ie(!1),[He,pe]=ie(!1),[y,k]=ie({}),[L,S]=ie(0),z=K(0),G=t.enableTimer!==!1,Z=Math.max(500,t.timerDurationMs??2e4),F=t.status==="starting",te=t.status==="success",ne=t.status==="error",ee=!!i,q=!ee,$=q?e:!1,ae=i?.name||i?.domain||"",Ce=i?.domain,fe=Wt(b=>{z.current=b,S(b)},[]);Y(()=>{t.isVisible&&(h("card"),O.current=!1,M(!1))},[t.isVisible]),d==="card"&&V.current==="launcher"&&(D.current=!1),t.status==="success"&&J.current!=="success"?d==="card"&&(D.current=!0):t.status!=="success"&&(D.current=!1),J.current=t.status,Y(()=>{let b=V.current==="launcher",_=d==="card";b&&_&&T&&(v.current=!0,setTimeout(()=>{v.current=!1},100)),d==="launcher"&&ue(!1),b&&_&&G&&(fe(0),H.current=null,B.current=!1)},[d,fe,G]),Y(()=>{if(t.status==="success"&&(g(!0),t.enableLauncher&&d==="card"&&D.current)){let b=setTimeout(()=>{h("launcher")},2e3);return()=>clearTimeout(b)}},[t.status,t.enableLauncher,d]),Y(()=>{t.isVisible&&!j.current&&G&&(fe(0),H.current=null,B.current=!1),j.current=!!t.isVisible},[t.isVisible,fe,G]),Y(()=>{V.current=d},[d]);let Fe=K(!1);n&&(Fe.current=!0),Y(()=>{if($){T&&l.current&&l.current.reset();let b=Fe.current;if(Fe.current=!1,!b){let _=setTimeout(()=>{m.current&&m.current.focus()},100);return()=>clearTimeout(_)}}},[$]);let at=K($);Y(()=>{let b=at.current;at.current=$,!b&&$&&d==="launcher"&&h("card")},[$,d]);let dn=!O.current,pn=V.current==="launcher",fn=dn?t.entranceDelayMs||0:pn&&d==="card"?400:0;a||(en(s,!!t.isVisible&&d==="card"&&!E,{direction:t.direction||"top-to-bottom",position:t.position||"top-center",entranceDelayMs:fn,exitDelayMs:75,onEntranceComplete:()=>{t.onEntranceComplete?.(),O.current=!0},onExitComplete:()=>{(!t.isVisible||E)&&t.onExitComplete?.()}}),en(u,!!t.isVisible&&d==="launcher"&&!E,{direction:t.direction||"top-to-bottom",position:t.position||"top-center",entranceDelayMs:400,exitDelayMs:75})),Y(()=>{let b=c.current;if(!b)return;let _=t.status==="success"&&D.current;if(t.enableFocusMode&&d==="card"&&t.isVisible&&!_){let w=setTimeout(()=>{b.classList.add("active")},t.focusDelayMs||500);return()=>clearTimeout(w)}else b.classList.remove("active")},[t.enableFocusMode,d,t.isVisible,t.focusDelayMs,t.status]),Y(()=>{if(!t.isVisible)return;let b=_=>{if(_.key==="Escape"){d==="card"&&(t.enableLauncher?(P(!0),h("launcher"),setTimeout(()=>{r(!1),P(!1)},500)):(r(!1),t.onDismiss?.()));return}((R,I)=>{let X=I||{key:"p",modifiers:["meta","ctrl"]};if(R.key.toLowerCase()!==X.key.toLowerCase())return!1;let re=X.modifiers||[];if(I){let Sn=re.includes("meta")===R.metaKey,En=re.includes("ctrl")===R.ctrlKey,zn=re.includes("alt")===R.altKey,Pn=re.includes("shift")===R.shiftKey;return Sn&&En&&zn&&Pn}return R.metaKey||R.ctrlKey})(_,t.keyboardShortcut)&&(_.preventDefault(),d==="launcher"?(h("card"),r(q)):d==="card"&&(t.enableLauncher?h("launcher"):t.onDismiss?.()))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t.isVisible,$,d,t.enableLauncher,r,t.onDismiss,q]);let Ue=typeof navigator<"u"&&/Mac/.test(navigator.userAgent),mn=(()=>{if(t.keyboardShortcut){let b=t.keyboardShortcut.modifiers||[],_=[];return b.includes("meta")&&_.push(Ue?"\u2318":"Win"),b.includes("ctrl")&&_.push("Ctrl"),b.includes("alt")&&_.push(Ue?"Opt":"Alt"),b.includes("shift")&&_.push("Shift"),_.push(t.keyboardShortcut.key.toUpperCase()),_}return[Ue?"\u2318":"Ctrl","P"]})(),[hn,st]=ie(!1),[lt,ct]=ie("primary");Y(()=>{st(!1),ct("primary")},[i?.logoUrl,ae,Ce]),Y(()=>{!q&&e&&r(!1)},[q,e,r]);let ut=t.deanonymization?.logoUrlTemplate,Te=Zt(Ce),me=Te?`https://logo.clearbit.com/${Te}`:void 0,Ke=Te&&ut?ut.replace("{domain}",Te):i?.logoUrl||me,dt=lt==="fallback"&&me&&me!==Ke?me:Ke,$e=te&&D.current,W=t.textOverrides||{},bn=te?W.titleSuccess||"Personalization complete":F?"Starting personalization":ne?W.titleError||"Let's try that again":t.hasPersonalization?"Personalization ready":W.titleResting||"Personalization available",gn=te?W.subtitleSuccess||"Take a look":F?"Hang tight...":ne?W.subtitleError||"Something went wrong. Tap to retry.":W.subtitleResting||"This page can adapt to you",Ve=F?W.btnLoading||"Starting...":ne?W.btnError||"Try again":te&&D.current?W.btnSuccess||"Personalised":T?"Show me again":W.btnResting||"Show me",yn=ee?T?W.launcherLabelDeanonymizedSuccess||W.launcherLabelDeanonymized||"See it again for":W.launcherLabelDeanonymized||"See it in action for":T?W.launcherLabelSuccess||W.launcherLabel||"Personalize again":W.launcherLabel||"Personalize",pt=b=>{if(!i||!ae)return null;let _=b==="launcher",w=ae.trim().slice(0,1).toUpperCase();return p("div",{class:`kb-chip ${_?"kb-chip--launcher":""}`,children:[!!dt&&!hn?p("span",{class:"kb-chip-logo",children:p("img",{src:dt,alt:"",referrerPolicy:"no-referrer",onError:()=>{if(lt==="primary"&&me&&me!==Ke){ct("fallback");return}st(!0)}})}):p("span",{class:"kb-chip-fallback",children:w}),p("span",{children:ae}),o&&p("button",{class:"kb-chip-action",type:"button",onClick:I=>{I.stopPropagation(),o(),r(!0)},children:"Not you?"})]})},_n=()=>{let b=Zt(Ce),_=(b||Ce||ae||"").toString(),w={};return t.fields.forEach(R=>{let I=R.name,X=I.toLowerCase();if(X.includes("domain")){w[I]=b||_;return}if(X.includes("company")){w[I]=ae;return}w[I]=_}),w},ft=b=>{let _={},w=!1;if(t.fields.forEach(R=>{let I=b[R.name]??"",X=typeof I=="string"?I:String(I),re=mt(R.name,X,R);re&&(_[R.name]=re,w=!0)}),w){k(_);return}k({}),r(!1),t.onSubmitPersonalization?.(b)},mt=(b,_,w)=>{if(!w)return null;if(w.required&&!_.trim())return w.errorMessage||`${w.label} is required`;if(!_)return null;if(w.type==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(_))return w.errorMessage||"Please enter a valid email address";if(w.type==="url")try{new URL(_)}catch{return w.errorMessage||"Please enter a valid URL (e.g., https://example.com)"}return w.minLength&&_.length<w.minLength?w.errorMessage||`Must be at least ${w.minLength} characters`:w.maxLength&&_.length>w.maxLength?w.errorMessage||`Must be at most ${w.maxLength} characters`:w.pattern&&!new RegExp(w.pattern).test(_)?w.errorMessage||"Invalid format":null},vn=b=>{if(b.preventDefault(),F)return;let _=new FormData(b.target),w={};_.forEach((R,I)=>{let X=R.toString();w[I]=X}),ft(w)},kn=b=>{let _=b.target,w=_.name;if(y[w]){let R=t.fields.find(X=>X.name===w),I=mt(w,_.value,R);k(X=>{let re={...X};return I?re[w]=I:delete re[w],re})}},wn=()=>{F||!ee||ft(_n())},xn=b=>{if(b.stopPropagation(),ee||F||te)return;let _=!$;r(_),_&&t.enableClickSheen&&(pe(!0),setTimeout(()=>pe(!1),600))};Y(()=>{if(!G||B.current)return;if(!(t.isVisible&&d==="card"&&t.status==="resting"&&!$&&!ge)){C.current!==null&&(cancelAnimationFrame(C.current),C.current=null),H.current=null;return}let _=w=>{H.current===null&&(H.current=w-z.current/100*Z);let R=w-H.current,I=Math.min(1,R/Z),X=I*100;if(fe(X),I>=1){B.current=!0,H.current=null,C.current=null,t.enableLauncher?(h("launcher"),r(!1)):t.onDismiss?.();return}C.current=requestAnimationFrame(_)};return C.current=requestAnimationFrame(_),()=>{C.current!==null&&(cancelAnimationFrame(C.current),C.current=null)}},[t.enableLauncher,t.isVisible,t.onDismiss,t.status,ge,$,d,r,Z,G,fe]),Y(()=>()=>{C.current!==null&&cancelAnimationFrame(C.current)},[]);let Cn=Math.max(0,Math.min(100,t.progressPct??0)),Tn=G?L:Cn,ht=!!t.isVisible&&d==="card"&&!E,bt=!!t.isVisible&&d==="launcher"&&!E;return p(le,{children:[p("div",{ref:c,class:"backdrop",style:{display:ht||bt?"block":"none"}}),p("div",{ref:s,class:`container theme-${t.theme||"glass"} pos-${t.position||"top-center"}${$?" popover-open":""}`,style:{...tn(t.customTheme),pointerEvents:ht?"auto":"none"},onClick:()=>!$&&!F&&!te&&q&&r(!0),onMouseEnter:()=>ue(!0),onMouseLeave:()=>ue(!1),children:[t.enableClickSheen&&p("div",{class:`container-sheen${He?" active":""}`}),p("button",{class:"btn-dismiss","aria-label":"Dismiss",onClick:b=>{b.stopPropagation(),B.current=!0,t.enableLauncher?h("launcher"):t.onDismiss?.()},children:p(Qt,{})}),p("div",{class:"content-wrapper",children:p("div",{class:"text-content",children:p("div",{class:"text-row",children:[p("div",{children:[p("div",{class:"title",children:bn}),ee?p("div",{class:"subtitle-chip",children:pt("card")}):p("div",{class:"subtitle-text",children:gn})]}),F?p("span",{class:"status-text",children:[p(nt,{})," ",Ve]}):p("button",{class:`btn btn-trigger ${$e?"success":""}${$||x?" hidden":""}`,disabled:$e,onClick:ee?wn:xn,children:$e?p(le,{children:[p(lr,{})," ",Ve]}):Ve})]})})}),p("div",{class:"progress-clip",children:p("div",{class:"progress-container",children:p("div",{class:"progress-bar",style:{width:`${Tn}%`}})})}),!ee&&p("div",{class:`popover ${$?"open":""}`,onClick:b=>b.stopPropagation(),children:[p("form",{onSubmit:vn,ref:l,children:[t.fields.map((b,_)=>p("div",{class:"form-group",children:[p("label",{class:`form-label ${y[b.name]?"error":""}`,children:b.label}),p("div",{class:"input-row",children:[p("input",{ref:_===0?m:void 0,class:`form-input ${y[b.name]?"error":""}`,name:b.name,type:b.type||"text",placeholder:b.placeholder,required:b.required,onInput:kn}),t.fields.length===1&&p("button",{type:"submit",class:"btn btn-submit",disabled:F,children:F?p(nt,{}):p(Gt,{})})]}),y[b.name]&&p("div",{class:"form-message",children:y[b.name]})]},b.name)),t.fields.length>1&&p("button",{type:"submit",class:"btn btn-submit",style:{width:"100%"},disabled:F,children:F?p(nt,{}):p(Gt,{})})]}),t.showWatermark&&p("div",{class:"popover-watermark",children:["Powered by"," ",p("a",{href:"https://kenobi.ai",target:"_blank",rel:"noopener noreferrer",children:"Kenobi"})]})]}),t.showKeyboardHints&&t.enableFocusMode&&p("div",{class:`kbd-hint ${!$&&!F&&!te?"visible":""}`,children:[p("div",{class:"kbd-group",children:p("div",{class:"kbd",children:"Esc"})}),p("span",{class:"kbd-text",children:"to dismiss"})]})]}),p("div",{ref:u,class:`launcher theme-${t.theme||"glass"} pos-${t.position||"top-center"}`,style:{...tn(t.customTheme),...t.launcherStyles,pointerEvents:bt?"auto":"none"},onClick:b=>{b.stopPropagation(),M(!1),h("card"),r(q)},role:"button",tabIndex:0,children:[t.launcherShineBorder?.enabled&&p("div",{class:"launcher-shine-border",style:{"--shine-duration":`${t.launcherShineBorder.duration||14}s`,"--shine-border-width":`${t.launcherShineBorder.borderWidth||1}px`,backgroundImage:`radial-gradient(transparent, transparent, ${Array.isArray(t.launcherShineBorder.color)?t.launcherShineBorder.color.join(","):t.launcherShineBorder.color||"rgba(255,255,255,0.5)"}, transparent, transparent)`}}),p("button",{class:"btn-dismiss launcher-dismiss","aria-label":"Dismiss",onClick:b=>{b.stopPropagation(),M(!0),t.onDismiss?.()},children:p(Qt,{})}),t.showLauncherLogo!==!1&&p("div",{class:"launcher-logo",children:p(cr,{})}),p("div",{class:"launcher-label",children:[p("span",{children:yn}),ee&&pt("launcher")]}),t.enableUndoToggle&&T&&p("button",{class:"btn-toggle-personalization","aria-label":t.isPersonalized?"Show original":"Show personalized",onClick:b=>{b.stopPropagation(),t.onTogglePersonalization?.()},children:[p(ur,{}),p("span",{class:"toggle-tooltip",children:t.isPersonalized?"Show original":"Show personalized"})]}),t.showKeyboardHints&&p("div",{class:"kbd-hint visible",children:p("div",{class:"kbd-group",children:mn.map((b,_)=>p("div",{class:"kbd",children:b},_))})})]})]})},we=class{constructor(e){f(this,"host");f(this,"shadow");f(this,"config");f(this,"isOpen",!1);f(this,"skipFocus",!1);f(this,"mountTarget",null);f(this,"deanonymizedCompany",null);f(this,"deanonymizationStatus","idle");f(this,"deanonymizationCleanup",null);f(this,"hasStartedDeanonymization",!1);f(this,"clearDeanonymizedCompany",()=>{let e=this.deanonymizedCompany,n=this.config.status==="success"||this.config.isPersonalized;this.config.isPersonalized&&this.config.onTogglePersonalization?.(),this.deanonymizedCompany=null,this.deanonymizationStatus="failed",e&&rt("deanonymization:not-you",{company:e}),n&&(this.config={...this.config,status:"resting",progressPct:0,isPersonalized:!1}),this.render()});this.config={position:"top-center",direction:"top-to-bottom",theme:"glass",entranceDelayMs:0,exitDelayMs:75,hasPersonalization:!1,isVisible:!1,progressPct:0,status:"resting",enableTimer:!0,timerDurationMs:2e4,enableLauncher:!0,enableFocusMode:!1,focusBlurIntensity:"10px",focusDelayMs:500,showKeyboardHints:!1,showWatermark:!0,mountMode:"overlay",...e},this.mountTarget=e.mountNode??null,this.isDeanonymizationEnabled()&&(this.deanonymizationStatus="pending"),this.host=document.createElement("div"),this.host.id="kenobi-cue-card-root",this.applyHostStyles(),this.shadow=this.host.attachShadow({mode:"open"});let n=document.createElement("style");n.textContent=mr,this.shadow.appendChild(n);let r=document.createElement("div");this.shadow.appendChild(r)}applyHostStyles(){let e=this.config.mountMode==="inline";this.host.classList.toggle("kb-inline",e);let n=this.config.focusBlurIntensity??"10px";if(e){this.host.style.cssText=`
|
|
246
|
+
.btn-toggle-personalization.loading { cursor: default; opacity: 0.7; }
|
|
247
|
+
.btn-toggle-personalization.loading:hover { transform: none; }
|
|
248
|
+
.btn-toggle-personalization:disabled { cursor: default; }
|
|
249
|
+
.launcher-domain { text-decoration: underline; text-underline-offset: 2px; }
|
|
250
|
+
.launcher-actions { display: flex; align-items: center; gap: 0.25rem; }
|
|
251
|
+
`,nn=(t,e,n)=>{let r=$(!1),i=$(null);X(()=>{let o=t.current;if(!o)return;i.current&&(i.current.cancel(),i.current=null);let a=n.direction==="top-to-bottom",s=a?"translateY(-60px)":"translateX(60px)",u=a?"translateY(-20px)":"translateX(20px)",c="translate(0, 0)";if(e){o.style.visibility="visible",r.current=!0;let h=o.animate([{opacity:0,transform:s},{opacity:1,transform:c}],{duration:500,delay:n.entranceDelayMs,easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fill:"forwards"});i.current=h,h.onfinish=()=>{i.current=null,n.onEntranceComplete?.()}}else if(r.current){let h=o.animate([{opacity:1,transform:c},{opacity:0,transform:u}],{duration:350,delay:n.exitDelayMs,easing:"ease-in-out",fill:"forwards"});i.current=h,h.onfinish=()=>{o.style.visibility="hidden",i.current=null,n.onExitComplete?.()}}else o.style.opacity="0",o.style.transform=u,o.style.visibility="hidden"},[e,n.direction])},rn=t=>{if(!t)return{};let e={};return t.fontFamily&&(e["--kb-font-family"]=t.fontFamily),t.backgroundColor&&(e["--kb-bg-container"]=t.backgroundColor,e["--kb-popover-bg"]=t.backgroundColor),t.borderColor&&(e["--kb-border-container"]=t.borderColor,e["--kb-popover-border"]=t.borderColor),t.textColor&&(e["--kb-text-title"]=t.textColor,e["--kb-popover-text"]=t.textColor),t.subtitleColor&&(e["--kb-text-subtitle"]=t.subtitleColor),t.borderRadius&&(e["border-radius"]=t.borderRadius,e["border-bottom-left-radius"]=t.borderRadius,e["border-bottom-right-radius"]=t.borderRadius),t.primaryColor&&(e["--kb-btn-trigger-bg"]=t.primaryColor,e["--kb-progress-indicator"]=t.primaryColor,e["--kb-success-color"]=t.primaryColor),t.primaryTextColor&&(e["--kb-btn-trigger-text"]=t.primaryTextColor),e},_r=({config:t,isOpen:e,skipFocus:n,setIsOpen:r,deanonymizedCompany:i,onClearDeanonymizedCompany:o})=>{let a=t.mountMode==="inline",s=$(null),u=$(null),c=$(null),h=$(null),l=$(null),[p,b]=re("card"),[E,M]=re(!1),[T,g]=re(!1),[x,P]=re(!1),O=$(!1),L=$(!1),v=$(!1),V=$("card"),J=$(t.status),j=$(!!t.isVisible),H=$(null),C=$(null),B=$(!1),[ge,ue]=re(!1),[Fe,pe]=re(!1),[_,k]=re({}),[D,S]=re(0),z=$(0),G=t.enableTimer!==!1,Z=Math.max(500,t.timerDurationMs??2e4),F=t.status==="starting",te=t.status==="success",ne=t.status==="error",ee=!!i,q=!ee,K=q?e:!1,se=i?.name||i?.domain||"",Ce=i?.domain,fe=Gt(f=>{z.current=f,S(f)},[]);X(()=>{t.isVisible&&(b("card"),O.current=!1,M(!1))},[t.isVisible]),p==="card"&&V.current==="launcher"&&(L.current=!1),t.status==="success"&&J.current!=="success"?p==="card"&&(L.current=!0):t.status!=="success"&&(L.current=!1),J.current=t.status,X(()=>{let f=V.current==="launcher",y=p==="card";f&&y&&T&&(v.current=!0,setTimeout(()=>{v.current=!1},100)),p==="launcher"&&ue(!1),f&&y&&G&&(fe(0),H.current=null,B.current=!1)},[p,fe,G]),X(()=>{if(t.status==="success"&&(g(!0),t.enableLauncher&&p==="card"&&L.current)){let f=setTimeout(()=>{b("launcher")},2e3);return()=>clearTimeout(f)}},[t.status,t.enableLauncher,p]),X(()=>{t.isVisible&&!j.current&&G&&(fe(0),H.current=null,B.current=!1),j.current=!!t.isVisible},[t.isVisible,fe,G]),X(()=>{V.current=p},[p]);let Ue=$(!1);n&&(Ue.current=!0),X(()=>{if(K){T&&l.current&&l.current.reset();let f=Ue.current;if(Ue.current=!1,!f){let y=setTimeout(()=>{h.current&&h.current.focus()},100);return()=>clearTimeout(y)}}},[K]);let ct=$(K);X(()=>{let f=ct.current;ct.current=K,!f&&K&&p==="launcher"&&b("card")},[K,p]);let fn=!O.current,mn=V.current==="launcher",hn=fn?t.entranceDelayMs||0:mn&&p==="card"?400:0;a||(nn(s,!!t.isVisible&&p==="card"&&!E,{direction:t.direction||"top-to-bottom",position:t.position||"top-center",entranceDelayMs:hn,exitDelayMs:75,onEntranceComplete:()=>{t.onEntranceComplete?.(),O.current=!0},onExitComplete:()=>{(!t.isVisible||E)&&t.onExitComplete?.()}}),nn(u,!!t.isVisible&&p==="launcher"&&!E,{direction:t.direction||"top-to-bottom",position:t.position||"top-center",entranceDelayMs:400,exitDelayMs:75})),X(()=>{let f=c.current;if(!f)return;let y=t.status==="success"&&L.current;if(t.enableFocusMode&&p==="card"&&t.isVisible&&!y){let w=setTimeout(()=>{f.classList.add("active")},t.focusDelayMs||500);return()=>clearTimeout(w)}else f.classList.remove("active")},[t.enableFocusMode,p,t.isVisible,t.focusDelayMs,t.status]),X(()=>{if(!t.isVisible)return;let f=y=>{if(y.key==="Escape"){p==="card"&&(t.enableLauncher?(P(!0),b("launcher"),setTimeout(()=>{r(!1),P(!1)},500)):(r(!1),t.onDismiss?.()));return}((R,I)=>{let Y=I||{key:"p",modifiers:["meta","ctrl"]};if(R.key.toLowerCase()!==Y.key.toLowerCase())return!1;let ie=Y.modifiers||[];if(I){let An=ie.includes("meta")===R.metaKey,Mn=ie.includes("ctrl")===R.ctrlKey,Ln=ie.includes("alt")===R.altKey,Dn=ie.includes("shift")===R.shiftKey;return An&&Mn&&Ln&&Dn}return R.metaKey||R.ctrlKey})(y,t.keyboardShortcut)&&(y.preventDefault(),p==="launcher"?(b("card"),r(q)):p==="card"&&(t.enableLauncher?b("launcher"):t.onDismiss?.()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[t.isVisible,K,p,t.enableLauncher,r,t.onDismiss,q]);let[bn,gn]=re(!1),$e=typeof navigator<"u"&&/Mac/.test(navigator.userAgent);X(()=>{if(typeof window>"u")return;let f=window.matchMedia("(max-width: 768px)"),y=()=>gn(f.matches);return y(),"addEventListener"in f?(f.addEventListener("change",y),()=>f.removeEventListener("change",y)):(window.addEventListener("resize",y),()=>window.removeEventListener("resize",y))},[]);let Ke=(()=>{if(bn)return{keys:[],label:"tap to launch"};if(t.keyboardShortcut){let f=t.keyboardShortcut.modifiers||[],y=[];return f.includes("meta")&&y.push($e?"\u2318":"Ctrl"),f.includes("ctrl")&&y.push("Ctrl"),f.includes("alt")&&y.push($e?"Opt":"Alt"),f.includes("shift")&&y.push("Shift"),y.push(t.keyboardShortcut.key.toUpperCase()),{keys:y,label:"to launch"}}return{keys:[$e?"\u2318":"Ctrl","P"],label:"to launch"}})(),[yn,ut]=re(!1),[dt,pt]=re("primary");X(()=>{ut(!1),pt("primary")},[i?.logoUrl,se,Ce]),X(()=>{!q&&e&&r(!1)},[q,e,r]);let ft=t.deanonymization?.logoUrlTemplate,Te=tn(Ce),me=Te?`https://logo.clearbit.com/${Te}`:void 0,Ve=Te&&ft?ft.replace("{domain}",Te):i?.logoUrl||me,mt=dt==="fallback"&&me&&me!==Ve?me:Ve,je=te&&L.current,W=t.textOverrides||{},_n=te?W.titleSuccess||"Personalization complete":F?"Starting personalization":ne?W.titleError||"Let's try that again":t.hasPersonalization?"Personalization ready":W.titleResting||"Personalization available",vn=te?W.subtitleSuccess||"Take a look":F?"Hang tight...":ne?W.subtitleError||"Something went wrong. Tap to retry.":W.subtitleResting||"This page can adapt to you",Be=F?W.btnLoading||"Starting...":ne?W.btnError||"Try again":te&&L.current?W.btnSuccess||"Personalised":T?"Show me again":W.btnResting||"Show me",ht=ee?T?W.launcherLabelDeanonymizedSuccess||W.launcherLabelDeanonymized||"See it again for":W.launcherLabelDeanonymized||"See it in action for":T?W.launcherLabelSuccess||W.launcherLabel||"Personalize again":W.launcherLabel||"Personalize",bt=f=>{if(!i||!se)return null;let y=f==="launcher",w=se.trim().slice(0,1).toUpperCase();return d("div",{class:`kb-chip ${y?"kb-chip--launcher":""}`,children:[!!mt&&!yn?d("span",{class:"kb-chip-logo",children:d("img",{src:mt,alt:"",referrerPolicy:"no-referrer",onError:()=>{if(dt==="primary"&&me&&me!==Ve){pt("fallback");return}ut(!0)}})}):d("span",{class:"kb-chip-fallback",children:w}),d("span",{children:se}),o&&d("button",{class:"kb-chip-action",type:"button",onClick:I=>{I.stopPropagation(),o(),r(!0)},children:"Not you?"})]})},kn=()=>{let f=tn(Ce),y=(f||Ce||se||"").toString(),w={};return t.fields.forEach(R=>{let I=R.name,Y=I.toLowerCase();if(Y.includes("domain")){w[I]=f||y;return}if(Y.includes("company")){w[I]=se;return}w[I]=y}),w},gt=f=>{let y={},w=!1;if(t.fields.forEach(R=>{let I=f[R.name]??"",Y=typeof I=="string"?I:String(I),ie=yt(R.name,Y,R);ie&&(y[R.name]=ie,w=!0)}),w){k(y);return}k({}),r(!1),t.onSubmitPersonalization?.(f)},yt=(f,y,w)=>{if(!w)return null;if(w.required&&!y.trim())return w.errorMessage||`${w.label} is required`;if(!y)return null;if(w.type==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return w.errorMessage||"Please enter a valid email address";if(w.type==="url")try{new URL(y)}catch{return w.errorMessage||"Please enter a valid URL (e.g., https://example.com)"}return w.minLength&&y.length<w.minLength?w.errorMessage||`Must be at least ${w.minLength} characters`:w.maxLength&&y.length>w.maxLength?w.errorMessage||`Must be at most ${w.maxLength} characters`:w.pattern&&!new RegExp(w.pattern).test(y)?w.errorMessage||"Invalid format":null},wn=f=>{if(f.preventDefault(),F)return;let y=new FormData(f.target),w={};y.forEach((R,I)=>{let Y=R.toString();w[I]=Y}),gt(w)},xn=f=>{let y=f.target,w=y.name;if(_[w]){let R=t.fields.find(Y=>Y.name===w),I=yt(w,y.value,R);k(Y=>{let ie={...Y};return I?ie[w]=I:delete ie[w],ie})}},Cn=()=>{F||!ee||gt(kn())},Tn=f=>{if(f.stopPropagation(),ee||F||te)return;let y=!K;r(y),y&&t.enableClickSheen&&(pe(!0),setTimeout(()=>pe(!1),600))};X(()=>{if(!G||B.current)return;if(!(t.isVisible&&p==="card"&&t.status==="resting"&&!K&&!ge)){C.current!==null&&(cancelAnimationFrame(C.current),C.current=null),H.current=null;return}let y=w=>{H.current===null&&(H.current=w-z.current/100*Z);let R=w-H.current,I=Math.min(1,R/Z),Y=I*100;if(fe(Y),I>=1){B.current=!0,H.current=null,C.current=null,t.enableLauncher?(b("launcher"),r(!1)):t.onDismiss?.();return}C.current=requestAnimationFrame(y)};return C.current=requestAnimationFrame(y),()=>{C.current!==null&&(cancelAnimationFrame(C.current),C.current=null)}},[t.enableLauncher,t.isVisible,t.onDismiss,t.status,ge,K,p,r,Z,G,fe]),X(()=>()=>{C.current!==null&&cancelAnimationFrame(C.current)},[]);let Sn=Math.max(0,Math.min(100,t.progressPct??0)),En=G?D:Sn,_t=!!t.isVisible&&p==="card"&&!E,qe=!!t.isVisible&&p==="launcher"&&!E,zn=_t||qe,Pn=!!t.showKeyboardHints&&qe;return d(oe,{children:[d("div",{ref:c,class:"backdrop",style:{display:zn?"block":"none"}}),d("div",{ref:s,class:`container theme-${t.theme||"glass"} pos-${t.position||"top-center"}${K?" popover-open":""}`,style:{...rn(t.customTheme),pointerEvents:_t?"auto":"none"},onClick:()=>!K&&!F&&!te&&q&&r(!0),onMouseEnter:()=>ue(!0),onMouseLeave:()=>ue(!1),children:[t.enableClickSheen&&d("div",{class:`container-sheen${Fe?" active":""}`}),d("button",{class:"btn-dismiss","aria-label":"Dismiss",onClick:f=>{f.stopPropagation(),B.current=!0,t.enableLauncher?b("launcher"):t.onDismiss?.()},children:d(Zt,{})}),d("div",{class:"content-wrapper",children:d("div",{class:"text-content",children:d("div",{class:"text-row",children:[d("div",{children:[d("div",{class:"title",children:_n}),ee?d("div",{class:"subtitle-chip",children:bt("card")}):d("div",{class:"subtitle-text",children:vn})]}),F?d("span",{class:"status-text",children:[d(Oe,{})," ",Be]}):d("button",{class:`btn btn-trigger ${je?"success":""}${K||x?" hidden":""}`,disabled:je,onClick:ee?Cn:Tn,children:je?d(oe,{children:[d(pr,{})," ",Be]}):Be})]})})}),d("div",{class:"progress-clip",children:d("div",{class:"progress-container",children:d("div",{class:"progress-bar",style:{width:`${En}%`}})})}),!ee&&d("div",{class:`popover ${K?"open":""}`,onClick:f=>f.stopPropagation(),children:[d("form",{onSubmit:wn,ref:l,children:[t.fields.map((f,y)=>d("div",{class:"form-group",children:[d("label",{class:`form-label ${_[f.name]?"error":""}`,children:f.label}),d("div",{class:"input-row",children:[d("input",{ref:y===0?h:void 0,class:`form-input ${_[f.name]?"error":""}`,name:f.name,type:f.type||"text",placeholder:f.placeholder,required:f.required,onInput:xn}),t.fields.length===1&&d("button",{type:"submit",class:"btn btn-submit",disabled:F,children:F?d(Oe,{}):d(ot,{})})]}),_[f.name]&&d("div",{class:"form-message",children:_[f.name]})]},f.name)),t.fields.length>1&&d("button",{type:"submit",class:"btn btn-submit",style:{width:"100%"},disabled:F,children:F?d(Oe,{}):d(ot,{})})]}),t.showWatermark&&d("div",{class:"popover-watermark",children:["Powered by"," ",d("a",{href:"https://kenobi.ai",target:"_blank",rel:"noopener noreferrer",children:"Kenobi"})]})]}),t.showKeyboardHints&&t.enableFocusMode&&d("div",{class:`kbd-hint ${!K&&!F&&!te?"visible":""}`,children:[d("div",{class:"kbd-group",children:d("div",{class:"kbd",children:"Esc"})}),d("span",{class:"kbd-text",children:"to dismiss"})]})]}),d("div",{ref:u,class:`launcher theme-${t.theme||"glass"} pos-${t.position||"top-center"}`,style:{...rn(t.customTheme),...t.launcherStyles,pointerEvents:qe?"auto":"none"},onClick:f=>{f.stopPropagation(),M(!1),b("card"),r(q)},role:"button",tabIndex:0,children:[t.launcherShineBorder?.enabled&&d("div",{class:"launcher-shine-border",style:{"--shine-duration":`${t.launcherShineBorder.duration||14}s`,"--shine-border-width":`${t.launcherShineBorder.borderWidth||1}px`,backgroundImage:`radial-gradient(transparent, transparent, ${Array.isArray(t.launcherShineBorder.color)?t.launcherShineBorder.color.join(","):t.launcherShineBorder.color||"rgba(255,255,255,0.5)"}, transparent, transparent)`}}),d("button",{class:"btn-dismiss launcher-dismiss","aria-label":"Dismiss",onClick:f=>{f.stopPropagation(),M(!0),t.onDismiss?.()},children:d(Zt,{})}),t.showLauncherLogo!==!1&&d("div",{class:"launcher-logo",children:d(fr,{})}),d("div",{class:"launcher-label",children:[d("span",{children:(()=>{let f=ht.match(/^(For\s+)(.+)$/i);return f?d(oe,{children:[f[1],d("span",{class:"launcher-domain",children:f[2]})]}):ht})()}),ee&&bt("launcher")]}),d("div",{class:"launcher-actions",children:[t.enableUndoToggle&&T&&d("button",{class:"btn-toggle-personalization","aria-label":t.isPersonalized?"Show original":"Show personalized",onClick:f=>{f.stopPropagation(),t.onTogglePersonalization?.()},children:[d(mr,{}),d("span",{class:"toggle-tooltip",children:t.isPersonalized?"Show original":"Show personalized"})]}),t.launcherAction&&t.launcherAction.status!=="idle"&&T&&d("button",{class:`btn-toggle-personalization${t.launcherAction.status==="loading"?" loading":""}`,"aria-label":t.launcherAction.tooltip||"Action",onClick:f=>{f.stopPropagation(),t.launcherAction?.onClick?.()},disabled:t.launcherAction.status==="loading",children:[t.launcherAction.status==="loading"?d(Oe,{}):d(ot,{}),t.launcherAction.tooltip&&d("span",{class:"toggle-tooltip",children:t.launcherAction.tooltip})]})]}),Pn&&d("div",{class:"kbd-hint visible launcher-hint","aria-hidden":"true",children:[Ke.keys.length>0&&d("div",{class:"kbd-group",children:Ke.keys.map((f,y)=>d("div",{class:"kbd",children:f},y))}),d("span",{class:"kbd-text",children:Ke.label})]})]})]})},we=class{constructor(e){m(this,"host");m(this,"shadow");m(this,"config");m(this,"isOpen",!1);m(this,"skipFocus",!1);m(this,"mountTarget",null);m(this,"deanonymizedCompany",null);m(this,"deanonymizationStatus","idle");m(this,"deanonymizationCleanup",null);m(this,"hasStartedDeanonymization",!1);m(this,"clearDeanonymizedCompany",()=>{let e=this.deanonymizedCompany,n=this.config.status==="success"||this.config.isPersonalized;this.config.isPersonalized&&this.config.onTogglePersonalization?.(),this.deanonymizedCompany=null,this.deanonymizationStatus="failed",e&&at("deanonymization:not-you",{company:e}),n&&(this.config={...this.config,status:"resting",progressPct:0,isPersonalized:!1}),this.render()});this.config={position:"top-center",direction:"top-to-bottom",theme:"glass",entranceDelayMs:0,exitDelayMs:75,hasPersonalization:!1,isVisible:!1,progressPct:0,status:"resting",enableTimer:!0,timerDurationMs:2e4,enableLauncher:!0,enableFocusMode:!1,focusBlurIntensity:"10px",focusDelayMs:500,showKeyboardHints:!1,showWatermark:!0,mountMode:"overlay",...e},this.mountTarget=e.mountNode??null,this.isDeanonymizationEnabled()&&(this.deanonymizationStatus="pending"),this.host=document.createElement("div"),this.host.id="kenobi-cue-card-root",this.applyHostStyles(),this.shadow=this.host.attachShadow({mode:"open"});let n=document.createElement("style");n.textContent=yr,this.shadow.appendChild(n);let r=document.createElement("div");this.shadow.appendChild(r)}applyHostStyles(){let e=this.config.mountMode==="inline";this.host.classList.toggle("kb-inline",e);let n=this.config.focusBlurIntensity??"10px";if(e){this.host.style.cssText=`
|
|
251
252
|
position: relative !important;
|
|
252
253
|
z-index: auto !important;
|
|
253
254
|
top: auto !important;
|
|
@@ -268,5 +269,5 @@
|
|
|
268
269
|
pointer-events: none !important;
|
|
269
270
|
isolation: isolate !important;
|
|
270
271
|
--kb-focus-blur: ${n};
|
|
271
|
-
`}mount(e){let n=e||this.config.mountNode||this.mountTarget||document.body;this.mountTarget=n,n.contains(this.host)||n.appendChild(this.host),this.applyHostStyles(),this.startDeanonymization(),this.render()}unmount(){
|
|
272
|
-
`);break;default:d=l.split("")}let h=document.createDocumentFragment(),E=c;return d.forEach(M=>{if(M.length===0)return;if(M.trim().length===0){h.appendChild(document.createTextNode(M));return}let g=document.createElement("span");g.textContent=M,g.style.display="inline-block",g.style.opacity="0",m&&(g.style.setProperty("background","inherit"),g.style.setProperty("-webkit-background-clip","text"),g.style.setProperty("background-clip","text"),g.style.setProperty("color","transparent"),g.style.setProperty("will-change","opacity, transform"));let x=this.resolveKeyframes(n.keyframes),P=n.durationMs??r.durationMs??300,O=r.easing??"ease",D=g.animate(x,{duration:P,easing:O,delay:E,fill:"forwards"});D.addEventListener("finish",()=>{D.commitStyles(),D.cancel()}),h.appendChild(g),E+=n.staggerMs??50}),u.parentNode?.replaceChild(h,u),E}if(u.nodeType===Node.ELEMENT_NODE){let l=c,d=Array.from(u.childNodes);for(let h of d)l=s(h,l,m);return l}return c};s(e,i,a)})}},an="kenobi:identity-resolved",xr=1600,Cr=t=>typeof t!="object"||t===null?!1:typeof t.enabled=="boolean",cn=new Set(["Replace","InsertBefore","InsertAfter","Delete","SetFormField"]),un=t=>typeof t=="string",Tr=t=>Array.isArray(t)&&t.every(e=>un(e)),Sr=t=>typeof t=="string"&&cn.has(t),Er=t=>{if(typeof t!="object"||t===null)return!1;let e=t;return un(e.identifier)&&typeof e.markup=="string"&&Tr(e.selectorGuesses)&&Sr(e.action)&&(e.transition===void 0||wr(e.transition))},zr=t=>{if(typeof t!="object"||t===null)throw new Error("Invalid response: expected object with data array");let e=t.data;if(!Array.isArray(e))throw new Error("Invalid response: data must be an array");return e.forEach((n,r)=>{if(!Er(n))throw new Error(`Invalid transformation at index ${r}`)}),e},ot=class{constructor(e){f(this,"config");f(this,"changeStack",new Map);f(this,"visitorKey",null);f(this,"orchestrator");f(this,"cueCardInstance",null);f(this,"preparedPersonalization",null);f(this,"isPreparingPersonalization",!1);f(this,"preparePersonalizationPromise",null);f(this,"deanonymizationPrefetchCleanup",null);f(this,"currentPath");f(this,"currentUrl");f(this,"navTicking",!1);f(this,"transitionDefaults");f(this,"lastAppliedTransformations",[]);f(this,"isPersonalized",!1);f(this,"startAutoTransform",async()=>{try{this.syncChangeStack(),await this.waitForLoaded(),this.isFramer()&&(await this.waitForFrames(),await this.waitForIdle(),await this.waitForQuietDom(100,1e3)),await this.transform()}catch(e){this.log("error","Auto-transformation flow failed with error:",e)}});f(this,"transform",async()=>{try{let e=new Date;if(this.log("debug","Starting transform"),this.visitorKey===null){this.log("debug",`Couldn't find a visitor copy external ID with query param key "${nn}"`,"Exiting...");return}let n=[];try{n=await this.getTransformations(this.currentPath,this.visitorKey)}catch(o){this.log("error_detailed","An error occurred _getting_ transformations",o)}try{await this.applyTransformations(n)}catch(o){this.log("error_detailed","An error occurred _applying_ transformations",o)}let r=new Date,i=this.getDurationInMilliseconds(e,r);this.log("debug",`Transformation complete, took ${this.formatThousands(i)} ms`)}catch(e){this.log("error","An unexpected, top-level error occurred during transformation",e)}});f(this,"log",(e,n,...r)=>{let a=`${`[Kenobi \u25D4] (v${typeof window.__KENOBI_VERSION__<"u"?window.__KENOBI_VERSION__:"dev"})`} [${e.toLocaleUpperCase()}] :: ${n}`;switch(e){case"debug":this.config.debug&&console.log(a,...r);break;case"info":console.log(a,...r);break;case"warn":console.warn(a,...r);break;case"error_detailed":console.trace(...r);case"error":console.error(a,...r);break}});f(this,"resolveTransitionConfig",e=>gr(this.transitionDefaults,e));f(this,"retrieveElement",e=>{if(!Array.isArray(e)||e.some(n=>typeof n!="string"))throw new Error(`Invalid selectorGuesses payload received: expected array of strings but got ${JSON.stringify(e)}`);for(let n of e){let r=document.querySelectorAll(n);if(r.length===0)continue;if(r.length===1)return r[0];let i=Array.from(r).filter(a=>{let s=a.getBoundingClientRect(),u=getComputedStyle(a);return u.display!=="none"&&u.visibility!=="hidden"&&s.width>0&&s.height>0});if(i.length===0)continue;let o=i.sort((a,s)=>a.getBoundingClientRect().top-s.getBoundingClientRect().top);return this.log("debug",`Selector "${n}" matched ${r.length} elements, selected topmost visible one at y=${o[0].getBoundingClientRect().top}`),o[0]}throw new Error(`Could not find an element in the document with any of these selector patterns: ${e.join(", ")}`)});f(this,"getQueryParam",e=>new URLSearchParams(window.location.search).get(e));f(this,"getCurrentPath",()=>window.location.pathname);f(this,"getCurrentUrl",()=>window.location.pathname+window.location.search+window.location.hash);f(this,"getDurationInMilliseconds",(e,n)=>+n-+e);f(this,"formatThousands",e=>new Intl.NumberFormat("en-US").format(e));f(this,"setDebug",e=>this.config.debug=e);f(this,"isInputElement",e=>!(!(e instanceof HTMLInputElement)&&!(e instanceof HTMLTextAreaElement)&&!(e instanceof HTMLSelectElement)));f(this,"waitForFrames",()=>new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))));f(this,"waitForIdle",(e=1e3)=>new Promise(n=>"requestIdleCallback"in window?window.requestIdleCallback(()=>n(),{timeout:e}):setTimeout(n,50)));f(this,"waitForLoaded",()=>document.readyState==="complete"?Promise.resolve():new Promise(e=>window.addEventListener("load",()=>e(),{once:!0})));f(this,"waitForQuietDom",(e,n)=>new Promise(r=>{let i=performance.now(),o=new MutationObserver(()=>{i=performance.now()});o.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let a=performance.now()+e;(function s(){let u=performance.now();if(u-i>=n){o.disconnect(),r();return}if(u>=a){o.disconnect(),r();return}requestAnimationFrame(s)})()}));f(this,"isFramer",()=>{let e=Array.from(document.scripts).map(r=>r.src||"");return["__framer_events"in window,document.querySelector("[data-framer-root],[data-framer-component],[data-framer-page]"),e.some(r=>/framerusercontent\.com\/sites/i.test(r))].some(r=>!!r)});f(this,"syncVisitorKey",()=>{try{let e=this.getQueryParam(nn);e?(this.log("debug",`Query param value found (${e}), pushing into session storage`),sessionStorage.setItem(rn,e),this.visitorKey=e):this.visitorKey=sessionStorage.getItem(rn)}catch(e){this.log("error","Failed to sync visitor key with error:",e)}});f(this,"initNavigationListener",()=>{if("__KENOBI_NAV_HOOKED__"in window)return;window.__KENOBI_NAV_HOOKED__=!0;let e=i=>{this.navTicking||(this.navTicking=!0,queueMicrotask(()=>{this.navTicking=!1;let o=this.getCurrentUrl();o!==this.currentUrl&&(this.currentUrl=o,this.currentPath=this.getCurrentPath(),this.log("debug",`URL changed (${i}) \u2192 ${location.href}`),this.config.autoTransform&&(this.undoAll(),this.startAutoTransform()),this.syncCueCardVisibility())}))};if("navigation"in window){let i=window.navigation;i&&"addEventListener"in i&&typeof i.addEventListener=="function"&&(i.addEventListener("navigate",()=>e("navigation:navigate")),i.addEventListener("currententrychange",()=>e("navigation:entrychange")),i.addEventListener?.("navigatesuccess",()=>e("navigation:success")))}let n=history.pushState.bind(history),r=history.replaceState.bind(history);history.pushState=((...i)=>{let o=n(...i);return e("pushState"),o}),history.replaceState=((...i)=>{let o=r(...i);return e("replaceState"),o}),window.addEventListener("popstate",()=>e("popstate")),window.addEventListener("hashchange",()=>e("hashchange")),document.addEventListener("click",i=>{let o=i.target,a=o&&o.closest?.("a[href]");!a||a.target&&a.target!=="_self"||new URL(a.href,location.href).origin!==location.origin||setTimeout(()=>e("click"),0)},!0),setInterval(()=>{this.getCurrentUrl()!==this.currentUrl&&e("poll")},1e3)});f(this,"getTransformations",async(e,n)=>{let r=new URLSearchParams({path:e}),i=await fetch(`${this.config.apiHost}/v1/visitor-copy-transformations/${n}?${r.toString()}`),o=await i.json();if(!i.ok)throw new Error(`Network error (status ${i.status}) with json body: ${JSON.stringify(o,null,2)}`);return zr(o)});f(this,"validateTransitionPreconditions",(e,n,r)=>{if(r.enabled){let i=document.createElement("div");i.innerHTML=n;let o=i.firstElementChild;if(!o||!xe(o))return this.log("warn",`Transformation "${e}" was skipped: A transition was requested, but the element is not animatable.`),!1}return!0});f(this,"applyTransformations",async(e,n)=>{this.log("debug",`Starting ${e.length} transformations`),n?.shouldConsolidate&&this.changeStack.forEach((r,i)=>{e.find(a=>a.identifier===i)&&this.undo(i)});for(let{identifier:r,...i}of e)try{if(this.changeStack.get(r))throw new Error("Transformation already exists in stack");let o=this.retrieveElement(i.selectorGuesses);switch(i.action){case"Replace":{let a=o.outerHTML,s=this.resolveTransitionConfig(i.transition);if(s.enabled&&xe(o)&&"animate"in o){let u=await this.orchestrator.replaceWithTransition(o,i.markup,s);this.setOrUpdateReplaceChangeRef(r,a,u)}else Pe(o,i.markup,{}),this.setOrUpdateReplaceChangeRef(r,a,o);o.nodeName==="VIDEO"&&o.play();break}case"InsertBefore":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(r,i.markup,a))break;o.insertAdjacentHTML("beforebegin",i.markup);let s=o.previousElementSibling;if(s===null)throw new Error("Element wasn't created");if(s.setAttribute(oe,r),a.enabled&&xe(s)){let u=s.style.cssText;s.style.opacity="0",this.orchestrator.enter(s,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{s.style.cssText=u},{once:!0})}this.changeStack.set(r,{undoOpts:{type:"Remove",ref:s}});break}case"InsertAfter":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(r,i.markup,a))break;o.insertAdjacentHTML("afterend",i.markup);let s=o.nextElementSibling;if(s===null)throw new Error("Element wasn't created");if(s.setAttribute(oe,r),a.enabled&&xe(s)){let u=s.style.cssText;s.style.opacity="0",this.orchestrator.enter(s,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{s.style.cssText=u},{once:!0})}this.changeStack.set(r,{undoOpts:{type:"Remove",ref:s}});break}case"Delete":{let a=o.outerHTML;Pe(o,'<div style="display: none;" data-kenobi-delete-marker="true"></div>',{}),o.setAttribute(oe,r),this.changeStack.set(r,{undoOpts:{type:"Replace",ref:o,content:a}});break}case"SetFormField":{if(!this.isInputElement(o))throw new Error("Element targeted is not of a supported type");let a=o.value;this.setInputValue(o,i.markup),o.setAttribute(oe,r),this.changeStack.set(r,{undoOpts:{type:"SetInput",ref:o,content:a}})}}}catch(o){this.log("warn",`Unable to apply transformation with identifier "${r}"`,o)}this.lastAppliedTransformations=e,this.isPersonalized=!0,this.updateCueCardPersonalizationState()});f(this,"setOrUpdateReplaceChangeRef",(e,n,r)=>{let i=this.changeStack.get(e);if(!i){r.setAttribute(oe,e),this.changeStack.set(e,{undoOpts:{type:"Replace",ref:r,content:n}});return}let o=i.undoOpts.ref;o&&o!==r&&o.isConnected&&o.removeAttribute(oe),r.setAttribute(oe,e),i.undoOpts.ref=r});f(this,"syncChangeStack",()=>{let e=0;for(let[n,r]of this.changeStack){let i=r.undoOpts.ref;if(!(!!i&&(i.isConnected||document.contains(i)))){this.changeStack.delete(n),e++;continue}i.getAttribute(oe)!==n&&(this.changeStack.delete(n),e++)}this.log("debug",`syncChangeStack pruned ${this.formatThousands(e)} stale entries`)});f(this,"undo",e=>{let n=this.changeStack.get(e);if(n===void 0)throw new Error(`Cannot undo stack item with identifier ${e} as it does not exist.`);let{undoOpts:r}=n;switch(r.type){case"Remove":{r.ref.remove();break}case"Replace":{Pe(r.ref,r.content),r.ref.removeAttribute(oe);break}case"SetInput":{if(!this.isInputElement(r.ref))throw new Error("Element targeted is not of a supported type");this.setInputValue(r.ref,r.content),r.ref.removeAttribute(oe);break}}this.changeStack.delete(e)});f(this,"undoAll",()=>{this.changeStack.forEach((e,n)=>this.undo(n))});f(this,"toggleTransformations",async()=>{this.isPersonalized?(this.undoAll(),this.isPersonalized=!1,this.log("debug","Toggled to original content")):(this.lastAppliedTransformations.length>0&&await this.applyTransformations(this.lastAppliedTransformations,{shouldConsolidate:!0}),this.isPersonalized=!0,this.log("debug","Toggled to personalized content")),this.updateCueCardPersonalizationState()});f(this,"updateCueCardPersonalizationState",()=>{this.cueCardInstance&&this.cueCardInstance.update({isPersonalized:this.isPersonalized})});f(this,"setInputValue",(e,n)=>{let r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:e instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLSelectElement.prototype,i=Object.getOwnPropertyDescriptor(r,"value");if(!i?.set)throw new Error("No value setter found");i.set.call(e,n),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))});f(this,"fetchCueCardConfig",async e=>{if(!this.config.publicKey)return null;try{let n=new URLSearchParams({publicKey:this.config.publicKey,pagePath:e}),r=await fetch(`${this.config.apiHost}/v1/cue-card-config?${n.toString()}`);if(!r.ok)return this.log("warn",`CueCard config request failed with status ${r.status}`),null;let i=await r.json();return Cr(i)?i:(this.log("warn","Invalid CueCard config response format"),null)}catch(n){return this.log("error","Failed to fetch CueCard config:",n),null}});f(this,"initCueCard",async()=>{if(this.cueCardInstance){this.log("warn","CueCard already initialized, skipping...");return}let e=await this.fetchCueCardConfig(this.currentPath);if(!e||!e.enabled){this.log("debug",`CueCard not mounted: no active template for path "${this.currentPath}"`);return}this.log("debug","Active template found, mounting CueCard...");let n=e.config,r=n?.deanonymization,i=!!r?.provider;this.cueCardInstance=new we({theme:n?.theme??"light",position:n?.position??"top-center",direction:n?.direction??"top-to-bottom",fields:n?.fields??[{name:"companyDomain",label:"Company Name or Domain",placeholder:"example.com",required:!0,minLength:3,errorMessage:"Company name or domain is required"}],isVisible:!i,enableFocusMode:n?.enableFocusMode??!1,showWatermark:n?.showWatermark??!1,showKeyboardHints:n?.showKeyboardHints??!0,enableLauncher:n?.enableLauncher??!0,customTheme:n?.customTheme,textOverrides:n?.textOverrides,enableUndoToggle:n?.enableUndoToggle??!1,deanonymization:r,isPersonalized:this.isPersonalized,onDismiss:()=>{this.log("debug","CueCard dismissed by user"),this.dispatchKenobiEvent("cuecard:dismiss",{pagePath:this.currentPath})},onSubmitPersonalization:o=>{this.log("debug","CueCard submitted:",o),this.personalize(o)},onOpenChange:o=>{this.log("debug","CueCard open state changed:",o),this.dispatchKenobiEvent("cuecard:openchange",{isOpen:o,pagePath:this.currentPath})},onTogglePersonalization:()=>{this.log("debug","CueCard toggle personalization"),this.toggleTransformations(),this.dispatchKenobiEvent("cuecard:toggle",{isPersonalized:this.isPersonalized,pagePath:this.currentPath})}}),this.cueCardInstance.mount(),i&&this.setupDeanonymizationPrefetch(r,n?.fields),this.log("debug","CueCard mounted successfully")});f(this,"isSameInput",(e,n)=>{let r=Object.keys(e).sort(),i=Object.keys(n).sort();if(r.length!==i.length)return!1;for(let o=0;o<r.length;o+=1){let a=r[o];if(a!==i[o]||(e[a]??"")!==(n[a]??""))return!1}return!0});f(this,"buildInputFromFields",(e,n,r)=>{let i=r||n;if(!i)return null;let o={};return e.forEach(a=>{let s=a.name,u=s.toLowerCase();if(u.includes("domain")){o[s]=r||i;return}if(u.includes("company")){o[s]=n||i;return}o[s]=i}),o});f(this,"buildDeanonymizedInput",(e,n)=>{let r=e.company?.name||e.domain||"",i=e.company?.domain||e.domain||"";return!n||n.length===0?!r&&!i?null:{companyName:r||i,companyDomain:i||r}:this.buildInputFromFields(n,r,i)});f(this,"requestPersonalization",async(e,n)=>{let r={publicKey:this.config.publicKey,input:e,pagePath:this.currentPath};n?.notifySlack===!1&&(r.notifySlack=!1),n?.notifyOnly&&(r.notifyOnly=!0),n?.predictionSource&&(r.predictionSource=n.predictionSource),n?.prefetchedTransformations&&(r.prefetchedTransformations=n.prefetchedTransformations),n?.prefetchedMetadata&&(r.prefetchedMetadata=n.prefetchedMetadata);let i=await fetch(`${this.config.apiHost}/v1/personalize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok){let a=await i.json().catch(()=>({}));throw new Error(a.error||`API error: ${i.status}`)}let o=await i.json();return this.log("debug","Personalization API response:",o),o});f(this,"preparePersonalization",async(e,n)=>this.config.publicKey?this.preparedPersonalization?.input&&this.isSameInput(this.preparedPersonalization.input,e)?(n?.source&&!this.preparedPersonalization.source&&(this.preparedPersonalization={...this.preparedPersonalization,source:n.source}),this.preparedPersonalization.result):this.preparePersonalizationPromise?this.preparePersonalizationPromise:(this.isPreparingPersonalization=!0,this.preparePersonalizationPromise=(async()=>{try{let r=await this.requestPersonalization(e,{notifySlack:!1,predictionSource:n?.source});return this.preparedPersonalization={input:e,result:r,source:n?.source},this.dispatchKenobiEvent("personalization:ready",{input:e,pagePath:this.currentPath,transformationsCount:r.transformations?.length??0,metadata:r.metadata,source:n?.source}),r}catch(r){return this.log("error","Personalization prefetch failed:",r),null}finally{this.isPreparingPersonalization=!1,this.preparePersonalizationPromise=null}})(),this.preparePersonalizationPromise):(this.log("error","Cannot prepare personalization: publicKey not configured"),null));f(this,"notifyPreparedPersonalization",async e=>{if(!e.result.transformations||!e.result.metadata){this.log("warn","Prepared personalization missing transformations or metadata for notify");return}try{await this.requestPersonalization(e.input,{notifySlack:!0,notifyOnly:!0,predictionSource:e.source,prefetchedTransformations:e.result.transformations,prefetchedMetadata:e.result.metadata})}catch(n){this.log("warn","Failed to send Slack notification for prepared personalization:",n)}});f(this,"setupDeanonymizationPrefetch",(e,n)=>{if(!this.cueCardInstance)return;if(typeof window>"u"){this.cueCardInstance.update({isVisible:!0});return}if(this.deanonymizationPrefetchCleanup)return;let r=!1,i=!1,o=!1,a=()=>{r||(r=!0,o?this.cueCardInstance?.update({deanonymization:void 0,isVisible:!0}):this.cueCardInstance?.update({isVisible:!0}),this.deanonymizationPrefetchCleanup?.(),this.deanonymizationPrefetchCleanup=null)},s=async l=>{if(r)return;let d=l.detail;if(i=!0,d?.type!=="business"){a();return}let h=this.buildDeanonymizedInput(d,n);if(!h){a();return}await this.preparePersonalization(h,{source:"deanonymized"})||(o=!0),a()},u=window.__kenobiIdentityResolution;u&&s({detail:u}),window.addEventListener(an,s);let c=e?.timeoutMs??xr,m=window.setTimeout(()=>{i||a()},c+50);this.deanonymizationPrefetchCleanup=()=>{window.removeEventListener(an,s),window.clearTimeout(m)}});f(this,"syncCueCardVisibility",async()=>{this.config.publicKey&&(this.cueCardInstance&&(this.log("debug","Navigation detected, unmounting CueCard"),this.cueCardInstance.unmount(),this.cueCardInstance=null),this.initCueCard())});f(this,"dispatchKenobiEvent",(e,n)=>{let r=new CustomEvent(`kenobi:${e}`,{detail:n,bubbles:!0});window.dispatchEvent(r),this.log("debug",`Dispatched event: kenobi:${e}`,n)});f(this,"personalize",async e=>{if(!this.config.publicKey){this.log("error","Cannot personalize: publicKey not configured");return}let n=new Date;this.log("debug","Starting personalization with input:",e);let r=this.preparedPersonalization?.input&&this.isSameInput(this.preparedPersonalization.input,e)?this.preparedPersonalization:null,i=r?.source==="deanonymized";this.dispatchKenobiEvent("personalization:start",{input:e,pagePath:this.currentPath,deanonymized:i});try{this.cueCardInstance&&this.cueCardInstance.update({status:"starting",progressPct:r?80:10}),r&&this.notifyPreparedPersonalization(r);let o=r?r.result:await this.requestPersonalization(e);o.transformations&&Array.isArray(o.transformations)&&await this.applyTransformations(o.transformations,{shouldConsolidate:!0}),r&&(this.preparedPersonalization=null),this.cueCardInstance&&this.cueCardInstance.update({status:"success",progressPct:100});let a=new Date,s=this.getDurationInMilliseconds(n,a);this.log("debug",`Personalization complete, took ${this.formatThousands(s)} ms`),this.dispatchKenobiEvent("personalization:complete",{input:e,pagePath:this.currentPath,durationMs:s,transformationsCount:o.transformations?.length??0,metadata:o.metadata,source:r?"prefetch":"api",deanonymized:i})}catch(o){this.log("error","Personalization failed:",o),this.cueCardInstance&&this.cueCardInstance.update({status:"error",progressPct:0}),this.dispatchKenobiEvent("personalization:error",{input:e,pagePath:this.currentPath,error:o instanceof Error?o.message:String(o),deanonymized:i})}});f(this,"getCueCard",()=>this.cueCardInstance);this.config={apiHost:"https://kenobi.ai/api",debug:!1,autoTransform:!0,...e},this.transitionDefaults=br(this.config.transitionDefaults),this.orchestrator=new it,this.syncVisitorKey(),this.currentPath=this.getCurrentPath(),this.currentUrl=this.getCurrentUrl();try{this.initNavigationListener()}catch(n){this.log("error","Failed to initialize navigation listener with error:",n)}this.log("debug","Kenobi initialized"),this.config.autoTransform&&(this.log("debug","Auto-transform is requested... Starting..."),this.startAutoTransform()),this.config.publicKey&&!this.config.skipCueCardAutoMount&&(this.log("debug","Public key provided, checking for active template..."),this.initCueCard())}};return Nn(Pr);})();
|
|
272
|
+
`}mount(e){let n=e||this.config.mountNode||this.mountTarget||document.body;this.mountTarget=n,n.contains(this.host)||n.appendChild(this.host),this.applyHostStyles(),this.startDeanonymization(),this.render()}unmount(){tt(null,this.shadow.lastElementChild),this.host.remove(),this.deanonymizationCleanup?.(),this.deanonymizationCleanup=null}update(e){e.status==="starting"&&this.config.status!=="starting"&&(this.isOpen=!1);let n=this.isDeanonymizationEnabled();this.config={...this.config,...e};let r=this.isDeanonymizationEnabled();r&&!n&&(this.deanonymizationStatus="pending",this.startDeanonymization()),!r&&n&&(this.deanonymizedCompany=null,this.deanonymizationStatus="idle",this.deanonymizationCleanup?.(),this.deanonymizationCleanup=null,this.hasStartedDeanonymization=!1),this.applyHostStyles(),this.render()}isDeanonymizationEnabled(){return this.config.deanonymization?.provider==="Kenobi"}startDeanonymization(){if(!this.isDeanonymizationEnabled()||this.hasStartedDeanonymization||this.deanonymizationStatus!=="pending")return;if(this.hasStartedDeanonymization=!0,typeof window>"u"){this.deanonymizationStatus="failed",this.render();return}let e=window.__kenobiIdentityResolution;if(e){this.handleDeanonymizationResult(e);return}let n=o=>{let a=o.detail;this.handleDeanonymizationResult(a)};window.addEventListener(He,n),gr(this.config.deanonymization);let r=this.config.deanonymization?.timeoutMs??hr,i=window.setTimeout(()=>{window.removeEventListener(He,n),this.handleDeanonymizationResult(null)},r);this.deanonymizationCleanup=()=>{window.removeEventListener(He,n),window.clearTimeout(i)}}handleDeanonymizationResult(e){if(this.deanonymizationStatus!=="pending")return;this.deanonymizationCleanup?.(),this.deanonymizationCleanup=null;let n=br(e);this.deanonymizedCompany=n,this.deanonymizationStatus=n?"resolved":"failed",n?at("deanonymization:success",{company:n,detail:e}):at("deanonymization:fail",{detail:e}),this.render()}getRenderConfig(){return this.deanonymizationStatus==="pending"?{...this.config,isVisible:!1}:this.config}setTheme(e){this.update({theme:e})}openForm(e){this.isOpen=!0,this.skipFocus=e??!1,this.render()}render(){let e=this.shadow.lastElementChild,n=this.skipFocus;this.skipFocus=!1,tt(d(_r,{config:this.getRenderConfig(),isOpen:this.isOpen,skipFocus:n,deanonymizedCompany:this.deanonymizedCompany,onClearDeanonymizedCompany:this.clearDeanonymizedCompany,setIsOpen:r=>{this.isOpen=r,this.config.onOpenChange?.(r),this.render()}}),e)}};var on="kfor",an="kenobi_visitor_key",ae="data-kenobi-transformation-identifier",be={enabled:!1,durationMs:300,delayMs:0,easing:"ease",animateSize:!0,overflow:"hidden"},vr=t=>({enabled:t?.enabled??be.enabled,durationMs:t?.durationMs??be.durationMs,delayMs:t?.delayMs??be.delayMs,easing:t?.easing??be.easing,animateSize:t?.animateSize??be.animateSize,overflow:t?.overflow??be.overflow,textAnimation:t?.textAnimation,enter:t?.enter,exit:t?.exit}),kr=(t,e)=>({enabled:e?.enabled??t.enabled,durationMs:e?.durationMs??t.durationMs,delayMs:e?.delayMs??t.delayMs,easing:e?.easing??t.easing,animateSize:e?.animateSize??t.animateSize,overflow:e?.overflow??t.overflow,textAnimation:e?.textAnimation??t.textAnimation,enter:e?.enter??t.enter,exit:e?.exit??t.exit}),cn=t=>typeof t=="string",xe=t=>t instanceof HTMLElement||typeof SVGElement<"u"&&t instanceof SVGElement,wr=t=>typeof t=="string",xr=t=>t==="hidden"||t==="visible"||t==="clip",Cr=t=>t==="line"||t==="word"||t==="character",un=t=>typeof t!="object"||t===null?!1:Array.isArray(t)?t.every(e=>typeof e=="object"&&e!==null):!0,sn=t=>{if(typeof t!="object"||t===null)return!1;let e=t,{animationName:n,keyframes:r,durationMs:i,delayMs:o}=e;return(n===void 0||cn(n))&&(r===void 0||un(r))&&(i===void 0||typeof i=="number")&&(o===void 0||typeof o=="number")},Tr=t=>{if(typeof t!="object"||t===null)return!1;let e=t,{by:n,staggerMs:r,animationName:i,keyframes:o,delayMs:a,durationMs:s}=e;return Cr(n)&&(a===void 0||typeof a=="number")&&(r===void 0||typeof r=="number")&&(s===void 0||typeof s=="number")&&(cn(i)||o!==void 0)&&(o===void 0||un(o))},Sr=t=>{if(typeof t!="object"||t===null)return!1;let e=t,{enabled:n,durationMs:r,delayMs:i,easing:o,animateSize:a,overflow:s,textAnimation:u,enter:c,exit:h}=e;return(n===void 0||typeof n=="boolean")&&(r===void 0||typeof r=="number")&&(i===void 0||typeof i=="number")&&(o===void 0||wr(o))&&(a===void 0||typeof a=="boolean")&&(s===void 0||xr(s))&&(u===void 0||Tr(u))&&(c===void 0||sn(c))&&(h===void 0||sn(h))},st=class{constructor(){m(this,"replaceWithTransition",async(e,n,r)=>{let i=document.createElement("div");i.style.position="relative",i.style.overflow=r.overflow;let o=e.getBoundingClientRect(),a=window.getComputedStyle(e);i.style.display=a.display,i.style.verticalAlign=a.verticalAlign,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`,i.style.margin=a.margin;let s=e.cloneNode(!0);if(!(s instanceof Element)||!xe(s))throw new Error("oldElClone is not an AnimatableElement");s.style.position="absolute",s.style.top="0",s.style.left="0",s.style.width="100%",s.style.height="100%",s.style.margin="0",s.style.pointerEvents="none",i.appendChild(s);let u=document.createElement("div");u.innerHTML=n;let c=u.firstElementChild;if(!c||!(c instanceof HTMLElement||c instanceof SVGElement))return await this.exit(e,r).finished,e;let h=c.style.cssText,l=e.parentNode,p;if(l instanceof HTMLElement){let v=l.cloneNode(!1),V=window.getComputedStyle(l),J=V.cssText?V.cssText:Array.from(V).reduce((j,H)=>`${j}${H}:${V.getPropertyValue(H)};`,"");v.style.cssText=J,v.style.position="absolute",v.style.top="-9999px",v.style.left="-9999px",v.style.visibility="hidden",v.style.pointerEvents="none",v.appendChild(c),document.body.appendChild(v),r.textAnimation&&this.applyTextAnimationToNode(c,r.textAnimation,r),p=c.getBoundingClientRect(),document.body.removeChild(v)}else{let v=document.createElement("div");v.style.position="absolute",v.style.top="-9999px",v.style.left="-9999px",v.style.visibility="hidden",v.appendChild(c),document.body.appendChild(v),r.textAnimation&&this.applyTextAnimationToNode(c,r.textAnimation,r),p=c.getBoundingClientRect(),document.body.removeChild(v)}c.style.cssText=h,c.style.visibility="",c.style.position="absolute",c.style.top="0",c.style.left="0",c.style.width=`${p.width}px`,c.style.height=`${p.height}px`,c.style.margin="0",c.style.opacity="0",i.appendChild(c),e.replaceWith(i);let b=r.exit?.delayMs??r.delayMs,E=r.exit?.durationMs??r.durationMs,M=r.enter?.delayMs??r.delayMs,T=r.enter?.durationMs??r.durationMs,g=[],x=this.resolveKeyframes(r.exit?.keyframes),P=s.animate(x,{duration:E,delay:b,easing:r.easing,fill:"forwards"});g.push(P);let O=this.resolveKeyframes(r.enter?.keyframes),L=c.animate(O,{duration:T,delay:M,easing:r.easing,fill:"forwards"});if(g.push(L),r.animateSize){let v=i.animate([{width:`${o.width}px`,height:`${o.height}px`},{width:`${p.width}px`,height:`${p.height}px`}],{duration:T,delay:M,easing:r.easing,fill:"forwards"});g.push(v)}return await Promise.all(g.map(v=>v.finished)),i.parentNode&&i.replaceWith(c),c.style.cssText=h,s.remove(),c});m(this,"enter",(e,n)=>{let r=n.enter?.delayMs??n.delayMs,i=n.enter?.durationMs??n.durationMs,o=this.resolveKeyframes(n.enter?.keyframes);return e.animate(o,{duration:i,delay:r,easing:n.easing,fill:"forwards"})});m(this,"exit",(e,n)=>{let r=n.exit?.delayMs??n.delayMs,i=n.exit?.durationMs??n.durationMs,o=this.resolveKeyframes(n.exit?.keyframes);return e.animate(o,{duration:i,delay:r,easing:n.easing,fill:"forwards"})});m(this,"resolveKeyframes",e=>e?Array.isArray(e)?e:[e]:[]);m(this,"applyTextAnimationToNode",(e,n,r)=>{let i=n.delayMs??0,o=window.getComputedStyle(e),a=o.getPropertyValue("background-clip")==="text"||o.getPropertyValue("-webkit-background-clip")==="text",s=(u,c,h)=>{if(u.nodeType===Node.TEXT_NODE){let l=u.textContent??"";if(l.trim().length===0)return c;if(n.by==="character"){let M=l.split(/(\s+)/),T=document.createDocumentFragment(),g=c;return M.forEach(x=>{if(x.length===0)return;if(x.trim().length===0){T.appendChild(document.createTextNode(x));return}let P=document.createElement("span");P.style.display="inline-block",P.style.whiteSpace="nowrap",h&&(P.style.setProperty("background","inherit"),P.style.setProperty("-webkit-background-clip","text"),P.style.setProperty("background-clip","text"),P.style.setProperty("color","transparent")),x.split("").forEach(L=>{let v=document.createElement("span");v.textContent=L,v.style.display="inline-block",v.style.opacity="0",h&&(v.style.setProperty("background","inherit"),v.style.setProperty("-webkit-background-clip","text"),v.style.setProperty("background-clip","text"),v.style.setProperty("color","transparent"),v.style.paddingBottom="0.1em",v.style.marginBottom="-0.1em");let V=this.resolveKeyframes(n.keyframes),J=n.durationMs??r.durationMs??300,j=r.easing??"ease",H=v.animate(V,{duration:J,easing:j,delay:g,fill:"forwards"});H.addEventListener("finish",()=>{H.commitStyles(),H.cancel()}),P.appendChild(v),g+=n.staggerMs??50}),T.appendChild(P)}),u.parentNode?.replaceChild(T,u),g}let p;switch(n.by){case"word":p=l.split(/(\s+)/);break;case"line":p=l.split(`
|
|
273
|
+
`);break;default:p=l.split("")}let b=document.createDocumentFragment(),E=c;return p.forEach(M=>{if(M.length===0)return;if(M.trim().length===0){b.appendChild(document.createTextNode(M));return}let g=document.createElement("span");g.textContent=M,g.style.display="inline-block",g.style.opacity="0",h&&(g.style.setProperty("background","inherit"),g.style.setProperty("-webkit-background-clip","text"),g.style.setProperty("background-clip","text"),g.style.setProperty("color","transparent"),g.style.setProperty("will-change","opacity, transform"));let x=this.resolveKeyframes(n.keyframes),P=n.durationMs??r.durationMs??300,O=r.easing??"ease",L=g.animate(x,{duration:P,easing:O,delay:E,fill:"forwards"});L.addEventListener("finish",()=>{L.commitStyles(),L.cancel()}),b.appendChild(g),E+=n.staggerMs??50}),u.parentNode?.replaceChild(b,u),E}if(u.nodeType===Node.ELEMENT_NODE){let l=c,p=Array.from(u.childNodes);for(let b of p)l=s(b,l,h);return l}return c};s(e,i,a)})}},ln="kenobi:identity-resolved",Er=1600,zr=t=>typeof t!="object"||t===null?!1:typeof t.enabled=="boolean",dn=new Set(["Replace","InsertBefore","InsertAfter","Delete","SetFormField"]),pn=t=>typeof t=="string",Pr=t=>Array.isArray(t)&&t.every(e=>pn(e)),Ar=t=>typeof t=="string"&&dn.has(t),Mr=t=>{if(typeof t!="object"||t===null)return!1;let e=t;return pn(e.identifier)&&typeof e.markup=="string"&&Pr(e.selectorGuesses)&&Ar(e.action)&&(e.transition===void 0||Sr(e.transition))},Lr=t=>{if(typeof t!="object"||t===null)throw new Error("Invalid response: expected object with data array");let e=t.data;if(!Array.isArray(e))throw new Error("Invalid response: data must be an array");return e.forEach((n,r)=>{if(!Mr(n))throw new Error(`Invalid transformation at index ${r}`)}),e},lt=class{constructor(e){m(this,"config");m(this,"changeStack",new Map);m(this,"visitorKey",null);m(this,"orchestrator");m(this,"cueCardInstance",null);m(this,"preparedPersonalization",null);m(this,"isPreparingPersonalization",!1);m(this,"preparePersonalizationPromise",null);m(this,"deanonymizationPrefetchCleanup",null);m(this,"currentPath");m(this,"currentUrl");m(this,"navTicking",!1);m(this,"transitionDefaults");m(this,"lastAppliedTransformations",[]);m(this,"isPersonalized",!1);m(this,"startAutoTransform",async()=>{try{this.syncChangeStack(),await this.waitForLoaded(),this.isFramer()&&(await this.waitForFrames(),await this.waitForIdle(),await this.waitForQuietDom(100,1e3)),await this.transform()}catch(e){this.log("error","Auto-transformation flow failed with error:",e)}});m(this,"transform",async()=>{try{let e=new Date;if(this.log("debug","Starting transform"),this.visitorKey===null){this.log("debug",`Couldn't find a visitor copy external ID with query param key "${on}"`,"Exiting...");return}let n=[];try{n=await this.getTransformations(this.currentPath,this.visitorKey)}catch(o){this.log("error_detailed","An error occurred _getting_ transformations",o)}try{await this.applyTransformations(n)}catch(o){this.log("error_detailed","An error occurred _applying_ transformations",o)}let r=new Date,i=this.getDurationInMilliseconds(e,r);this.log("debug",`Transformation complete, took ${this.formatThousands(i)} ms`)}catch(e){this.log("error","An unexpected, top-level error occurred during transformation",e)}});m(this,"log",(e,n,...r)=>{let a=`${`[Kenobi \u25D4] (v${typeof window.__KENOBI_VERSION__<"u"?window.__KENOBI_VERSION__:"dev"})`} [${e.toLocaleUpperCase()}] :: ${n}`;switch(e){case"debug":this.config.debug&&console.log(a,...r);break;case"info":console.log(a,...r);break;case"warn":console.warn(a,...r);break;case"error_detailed":console.trace(...r);case"error":console.error(a,...r);break}});m(this,"resolveTransitionConfig",e=>kr(this.transitionDefaults,e));m(this,"retrieveElement",e=>{if(!Array.isArray(e)||e.some(n=>typeof n!="string"))throw new Error(`Invalid selectorGuesses payload received: expected array of strings but got ${JSON.stringify(e)}`);for(let n of e){let r=document.querySelectorAll(n);if(r.length===0)continue;if(r.length===1)return r[0];let i=Array.from(r).filter(a=>{let s=a.getBoundingClientRect(),u=getComputedStyle(a);return u.display!=="none"&&u.visibility!=="hidden"&&s.width>0&&s.height>0});if(i.length===0)continue;let o=i.sort((a,s)=>a.getBoundingClientRect().top-s.getBoundingClientRect().top);return this.log("debug",`Selector "${n}" matched ${r.length} elements, selected topmost visible one at y=${o[0].getBoundingClientRect().top}`),o[0]}throw new Error(`Could not find an element in the document with any of these selector patterns: ${e.join(", ")}`)});m(this,"getQueryParam",e=>new URLSearchParams(window.location.search).get(e));m(this,"getCurrentPath",()=>window.location.pathname);m(this,"getCurrentUrl",()=>window.location.pathname+window.location.search+window.location.hash);m(this,"getDurationInMilliseconds",(e,n)=>+n-+e);m(this,"formatThousands",e=>new Intl.NumberFormat("en-US").format(e));m(this,"setDebug",e=>this.config.debug=e);m(this,"isInputElement",e=>!(!(e instanceof HTMLInputElement)&&!(e instanceof HTMLTextAreaElement)&&!(e instanceof HTMLSelectElement)));m(this,"waitForFrames",()=>new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))));m(this,"waitForIdle",(e=1e3)=>new Promise(n=>"requestIdleCallback"in window?window.requestIdleCallback(()=>n(),{timeout:e}):setTimeout(n,50)));m(this,"waitForLoaded",()=>document.readyState==="complete"?Promise.resolve():new Promise(e=>window.addEventListener("load",()=>e(),{once:!0})));m(this,"waitForQuietDom",(e,n)=>new Promise(r=>{let i=performance.now(),o=new MutationObserver(()=>{i=performance.now()});o.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let a=performance.now()+e;(function s(){let u=performance.now();if(u-i>=n){o.disconnect(),r();return}if(u>=a){o.disconnect(),r();return}requestAnimationFrame(s)})()}));m(this,"isFramer",()=>{let e=Array.from(document.scripts).map(r=>r.src||"");return["__framer_events"in window,document.querySelector("[data-framer-root],[data-framer-component],[data-framer-page]"),e.some(r=>/framerusercontent\.com\/sites/i.test(r))].some(r=>!!r)});m(this,"syncVisitorKey",()=>{try{let e=this.getQueryParam(on);e?(this.log("debug",`Query param value found (${e}), pushing into session storage`),sessionStorage.setItem(an,e),this.visitorKey=e):this.visitorKey=sessionStorage.getItem(an)}catch(e){this.log("error","Failed to sync visitor key with error:",e)}});m(this,"initNavigationListener",()=>{if("__KENOBI_NAV_HOOKED__"in window)return;window.__KENOBI_NAV_HOOKED__=!0;let e=i=>{this.navTicking||(this.navTicking=!0,queueMicrotask(()=>{this.navTicking=!1;let o=this.getCurrentUrl();o!==this.currentUrl&&(this.currentUrl=o,this.currentPath=this.getCurrentPath(),this.log("debug",`URL changed (${i}) \u2192 ${location.href}`),this.config.autoTransform&&(this.undoAll(),this.startAutoTransform()),this.syncCueCardVisibility())}))};if("navigation"in window){let i=window.navigation;i&&"addEventListener"in i&&typeof i.addEventListener=="function"&&(i.addEventListener("navigate",()=>e("navigation:navigate")),i.addEventListener("currententrychange",()=>e("navigation:entrychange")),i.addEventListener?.("navigatesuccess",()=>e("navigation:success")))}let n=history.pushState.bind(history),r=history.replaceState.bind(history);history.pushState=((...i)=>{let o=n(...i);return e("pushState"),o}),history.replaceState=((...i)=>{let o=r(...i);return e("replaceState"),o}),window.addEventListener("popstate",()=>e("popstate")),window.addEventListener("hashchange",()=>e("hashchange")),document.addEventListener("click",i=>{let o=i.target,a=o&&o.closest?.("a[href]");!a||a.target&&a.target!=="_self"||new URL(a.href,location.href).origin!==location.origin||setTimeout(()=>e("click"),0)},!0),setInterval(()=>{this.getCurrentUrl()!==this.currentUrl&&e("poll")},1e3)});m(this,"getTransformations",async(e,n)=>{let r=new URLSearchParams({path:e}),i=await fetch(`${this.config.apiHost}/v1/visitor-copy-transformations/${n}?${r.toString()}`),o=await i.json();if(!i.ok)throw new Error(`Network error (status ${i.status}) with json body: ${JSON.stringify(o,null,2)}`);return Lr(o)});m(this,"validateTransitionPreconditions",(e,n,r)=>{if(r.enabled){let i=document.createElement("div");i.innerHTML=n;let o=i.firstElementChild;if(!o||!xe(o))return this.log("warn",`Transformation "${e}" was skipped: A transition was requested, but the element is not animatable.`),!1}return!0});m(this,"applyTransformations",async(e,n)=>{this.log("debug",`Starting ${e.length} transformations`),n?.shouldConsolidate&&this.changeStack.forEach((r,i)=>{e.find(a=>a.identifier===i)&&this.undo(i)});for(let{identifier:r,...i}of e)try{if(this.changeStack.get(r))throw new Error("Transformation already exists in stack");let o=this.retrieveElement(i.selectorGuesses);switch(i.action){case"Replace":{let a=o.outerHTML,s=this.resolveTransitionConfig(i.transition);if(s.enabled&&xe(o)&&"animate"in o){let u=await this.orchestrator.replaceWithTransition(o,i.markup,s);this.setOrUpdateReplaceChangeRef(r,a,u)}else Pe(o,i.markup,{}),this.setOrUpdateReplaceChangeRef(r,a,o);o.nodeName==="VIDEO"&&o.play();break}case"InsertBefore":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(r,i.markup,a))break;o.insertAdjacentHTML("beforebegin",i.markup);let s=o.previousElementSibling;if(s===null)throw new Error("Element wasn't created");if(s.setAttribute(ae,r),a.enabled&&xe(s)){let u=s.style.cssText;s.style.opacity="0",this.orchestrator.enter(s,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{s.style.cssText=u},{once:!0})}this.changeStack.set(r,{undoOpts:{type:"Remove",ref:s}});break}case"InsertAfter":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(r,i.markup,a))break;o.insertAdjacentHTML("afterend",i.markup);let s=o.nextElementSibling;if(s===null)throw new Error("Element wasn't created");if(s.setAttribute(ae,r),a.enabled&&xe(s)){let u=s.style.cssText;s.style.opacity="0",this.orchestrator.enter(s,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{s.style.cssText=u},{once:!0})}this.changeStack.set(r,{undoOpts:{type:"Remove",ref:s}});break}case"Delete":{let a=o.outerHTML;Pe(o,'<div style="display: none;" data-kenobi-delete-marker="true"></div>',{}),o.setAttribute(ae,r),this.changeStack.set(r,{undoOpts:{type:"Replace",ref:o,content:a}});break}case"SetFormField":{if(!this.isInputElement(o))throw new Error("Element targeted is not of a supported type");let a=o.value;this.setInputValue(o,i.markup),o.setAttribute(ae,r),this.changeStack.set(r,{undoOpts:{type:"SetInput",ref:o,content:a}})}}}catch(o){this.log("warn",`Unable to apply transformation with identifier "${r}"`,o)}this.lastAppliedTransformations=e,this.isPersonalized=!0,this.updateCueCardPersonalizationState()});m(this,"setOrUpdateReplaceChangeRef",(e,n,r)=>{let i=this.changeStack.get(e);if(!i){r.setAttribute(ae,e),this.changeStack.set(e,{undoOpts:{type:"Replace",ref:r,content:n}});return}let o=i.undoOpts.ref;o&&o!==r&&o.isConnected&&o.removeAttribute(ae),r.setAttribute(ae,e),i.undoOpts.ref=r});m(this,"syncChangeStack",()=>{let e=0;for(let[n,r]of this.changeStack){let i=r.undoOpts.ref;if(!(!!i&&(i.isConnected||document.contains(i)))){this.changeStack.delete(n),e++;continue}i.getAttribute(ae)!==n&&(this.changeStack.delete(n),e++)}this.log("debug",`syncChangeStack pruned ${this.formatThousands(e)} stale entries`)});m(this,"undo",e=>{let n=this.changeStack.get(e);if(n===void 0)throw new Error(`Cannot undo stack item with identifier ${e} as it does not exist.`);let{undoOpts:r}=n;switch(r.type){case"Remove":{r.ref.remove();break}case"Replace":{Pe(r.ref,r.content),r.ref.removeAttribute(ae);break}case"SetInput":{if(!this.isInputElement(r.ref))throw new Error("Element targeted is not of a supported type");this.setInputValue(r.ref,r.content),r.ref.removeAttribute(ae);break}}this.changeStack.delete(e)});m(this,"undoAll",()=>{this.changeStack.forEach((e,n)=>this.undo(n))});m(this,"toggleTransformations",async()=>{this.isPersonalized?(this.undoAll(),this.isPersonalized=!1,this.log("debug","Toggled to original content")):(this.lastAppliedTransformations.length>0&&await this.applyTransformations(this.lastAppliedTransformations,{shouldConsolidate:!0}),this.isPersonalized=!0,this.log("debug","Toggled to personalized content")),this.updateCueCardPersonalizationState()});m(this,"updateCueCardPersonalizationState",()=>{this.cueCardInstance&&this.cueCardInstance.update({isPersonalized:this.isPersonalized})});m(this,"setInputValue",(e,n)=>{let r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:e instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLSelectElement.prototype,i=Object.getOwnPropertyDescriptor(r,"value");if(!i?.set)throw new Error("No value setter found");i.set.call(e,n),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))});m(this,"fetchCueCardConfig",async e=>{if(!this.config.publicKey)return null;try{let n=new URLSearchParams({publicKey:this.config.publicKey,pagePath:e}),r=await fetch(`${this.config.apiHost}/v1/cue-card-config?${n.toString()}`);if(!r.ok)return this.log("warn",`CueCard config request failed with status ${r.status}`),null;let i=await r.json();return zr(i)?i:(this.log("warn","Invalid CueCard config response format"),null)}catch(n){return this.log("error","Failed to fetch CueCard config:",n),null}});m(this,"initCueCard",async()=>{if(this.cueCardInstance){this.log("warn","CueCard already initialized, skipping...");return}let e=await this.fetchCueCardConfig(this.currentPath);if(!e||!e.enabled){this.log("debug",`CueCard not mounted: no active template for path "${this.currentPath}"`);return}this.log("debug","Active template found, mounting CueCard...");let n=e.config,r=n?.deanonymization,i=!!r?.provider;this.cueCardInstance=new we({theme:n?.theme??"light",position:n?.position??"top-center",direction:n?.direction??"top-to-bottom",fields:n?.fields??[{name:"companyDomain",label:"Company Name or Domain",placeholder:"example.com",required:!0,minLength:3,errorMessage:"Company name or domain is required"}],isVisible:!i,enableFocusMode:n?.enableFocusMode??!1,showWatermark:n?.showWatermark??!1,showKeyboardHints:n?.showKeyboardHints??!0,enableLauncher:n?.enableLauncher??!0,customTheme:n?.customTheme,textOverrides:n?.textOverrides,enableUndoToggle:n?.enableUndoToggle??!1,deanonymization:r,isPersonalized:this.isPersonalized,onDismiss:()=>{this.log("debug","CueCard dismissed by user"),this.dispatchKenobiEvent("cuecard:dismiss",{pagePath:this.currentPath})},onSubmitPersonalization:o=>{this.log("debug","CueCard submitted:",o),this.personalize(o)},onOpenChange:o=>{this.log("debug","CueCard open state changed:",o),this.dispatchKenobiEvent("cuecard:openchange",{isOpen:o,pagePath:this.currentPath})},onTogglePersonalization:()=>{this.log("debug","CueCard toggle personalization"),this.toggleTransformations(),this.dispatchKenobiEvent("cuecard:toggle",{isPersonalized:this.isPersonalized,pagePath:this.currentPath})}}),this.cueCardInstance.mount(),i&&this.setupDeanonymizationPrefetch(r,n?.fields),this.log("debug","CueCard mounted successfully")});m(this,"isSameInput",(e,n)=>{let r=Object.keys(e).sort(),i=Object.keys(n).sort();if(r.length!==i.length)return!1;for(let o=0;o<r.length;o+=1){let a=r[o];if(a!==i[o]||(e[a]??"")!==(n[a]??""))return!1}return!0});m(this,"buildInputFromFields",(e,n,r)=>{let i=r||n;if(!i)return null;let o={};return e.forEach(a=>{let s=a.name,u=s.toLowerCase();if(u.includes("domain")){o[s]=r||i;return}if(u.includes("company")){o[s]=n||i;return}o[s]=i}),o});m(this,"buildDeanonymizedInput",(e,n)=>{let r=e.company?.name||e.domain||"",i=e.company?.domain||e.domain||"";return!n||n.length===0?!r&&!i?null:{companyName:r||i,companyDomain:i||r}:this.buildInputFromFields(n,r,i)});m(this,"requestPersonalization",async(e,n)=>{let r={publicKey:this.config.publicKey,input:e,pagePath:this.currentPath};n?.notifySlack===!1&&(r.notifySlack=!1),n?.notifyOnly&&(r.notifyOnly=!0),n?.predictionSource&&(r.predictionSource=n.predictionSource),n?.prefetchedTransformations&&(r.prefetchedTransformations=n.prefetchedTransformations),n?.prefetchedMetadata&&(r.prefetchedMetadata=n.prefetchedMetadata);let i=await fetch(`${this.config.apiHost}/v1/personalize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok){let a=await i.json().catch(()=>({}));throw new Error(a.error||`API error: ${i.status}`)}let o=await i.json();return this.log("debug","Personalization API response:",o),o});m(this,"preparePersonalization",async(e,n)=>this.config.publicKey?this.preparedPersonalization?.input&&this.isSameInput(this.preparedPersonalization.input,e)?(n?.source&&!this.preparedPersonalization.source&&(this.preparedPersonalization={...this.preparedPersonalization,source:n.source}),this.preparedPersonalization.result):this.preparePersonalizationPromise?this.preparePersonalizationPromise:(this.isPreparingPersonalization=!0,this.preparePersonalizationPromise=(async()=>{try{let r=await this.requestPersonalization(e,{notifySlack:!1,predictionSource:n?.source});return this.preparedPersonalization={input:e,result:r,source:n?.source},this.dispatchKenobiEvent("personalization:ready",{input:e,pagePath:this.currentPath,transformationsCount:r.transformations?.length??0,metadata:r.metadata,source:n?.source}),r}catch(r){return this.log("error","Personalization prefetch failed:",r),null}finally{this.isPreparingPersonalization=!1,this.preparePersonalizationPromise=null}})(),this.preparePersonalizationPromise):(this.log("error","Cannot prepare personalization: publicKey not configured"),null));m(this,"notifyPreparedPersonalization",async e=>{if(!e.result.transformations||!e.result.metadata){this.log("warn","Prepared personalization missing transformations or metadata for notify");return}try{await this.requestPersonalization(e.input,{notifySlack:!0,notifyOnly:!0,predictionSource:e.source,prefetchedTransformations:e.result.transformations,prefetchedMetadata:e.result.metadata})}catch(n){this.log("warn","Failed to send Slack notification for prepared personalization:",n)}});m(this,"setupDeanonymizationPrefetch",(e,n)=>{if(!this.cueCardInstance)return;if(typeof window>"u"){this.cueCardInstance.update({isVisible:!0});return}if(this.deanonymizationPrefetchCleanup)return;let r=!1,i=!1,o=!1,a=()=>{r||(r=!0,o?this.cueCardInstance?.update({deanonymization:void 0,isVisible:!0}):this.cueCardInstance?.update({isVisible:!0}),this.deanonymizationPrefetchCleanup?.(),this.deanonymizationPrefetchCleanup=null)},s=async l=>{if(r)return;let p=l.detail;if(i=!0,p?.type!=="business"){a();return}let b=this.buildDeanonymizedInput(p,n);if(!b){a();return}await this.preparePersonalization(b,{source:"deanonymized"})||(o=!0),a()},u=window.__kenobiIdentityResolution;u&&s({detail:u}),window.addEventListener(ln,s);let c=e?.timeoutMs??Er,h=window.setTimeout(()=>{i||a()},c+50);this.deanonymizationPrefetchCleanup=()=>{window.removeEventListener(ln,s),window.clearTimeout(h)}});m(this,"syncCueCardVisibility",async()=>{this.config.publicKey&&(this.cueCardInstance&&(this.log("debug","Navigation detected, unmounting CueCard"),this.cueCardInstance.unmount(),this.cueCardInstance=null),this.initCueCard())});m(this,"dispatchKenobiEvent",(e,n)=>{let r=new CustomEvent(`kenobi:${e}`,{detail:n,bubbles:!0});window.dispatchEvent(r),this.log("debug",`Dispatched event: kenobi:${e}`,n)});m(this,"personalize",async e=>{if(!this.config.publicKey)return this.log("error","Cannot personalize: publicKey not configured"),null;let n=new Date;this.log("debug","Starting personalization with input:",e);let r=this.preparedPersonalization?.input&&this.isSameInput(this.preparedPersonalization.input,e)?this.preparedPersonalization:null,i=r?.source==="deanonymized";this.dispatchKenobiEvent("personalization:start",{input:e,pagePath:this.currentPath,deanonymized:i});try{this.cueCardInstance&&this.cueCardInstance.update({status:"starting",progressPct:r?80:10}),r&&this.notifyPreparedPersonalization(r);let o=r?r.result:await this.requestPersonalization(e);o.transformations&&Array.isArray(o.transformations)&&await this.applyTransformations(o.transformations,{shouldConsolidate:!0}),r&&(this.preparedPersonalization=null),this.cueCardInstance&&this.cueCardInstance.update({status:"success",progressPct:100});let a=new Date,s=this.getDurationInMilliseconds(n,a);return this.log("debug",`Personalization complete, took ${this.formatThousands(s)} ms`),this.dispatchKenobiEvent("personalization:complete",{input:e,pagePath:this.currentPath,durationMs:s,transformationsCount:o.transformations?.length??0,metadata:o.metadata,source:r?"prefetch":"api",deanonymized:i}),o}catch(o){this.log("error","Personalization failed:",o),this.cueCardInstance&&this.cueCardInstance.update({status:"error",progressPct:0}),this.dispatchKenobiEvent("personalization:error",{input:e,pagePath:this.currentPath,error:o instanceof Error?o.message:String(o),deanonymized:i})}return null});m(this,"getCueCard",()=>this.cueCardInstance);this.config={apiHost:"https://kenobi.ai/api",debug:!1,autoTransform:!0,...e},this.transitionDefaults=vr(this.config.transitionDefaults),this.orchestrator=new st,this.syncVisitorKey(),this.currentPath=this.getCurrentPath(),this.currentUrl=this.getCurrentUrl();try{this.initNavigationListener()}catch(n){this.log("error","Failed to initialize navigation listener with error:",n)}this.log("debug","Kenobi initialized"),this.config.autoTransform&&(this.log("debug","Auto-transform is requested... Starting..."),this.startAutoTransform()),this.config.publicKey&&!this.config.skipCueCardAutoMount&&(this.log("debug","Public key provided, checking for active template..."),this.initCueCard())}};return Un(Dr);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kenobi-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44",
|
|
4
4
|
"description": "Kenobi JavaScript SDK",
|
|
5
5
|
"main": "browser/dist.min.js",
|
|
6
6
|
"exports": {
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"browser"
|
|
12
12
|
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"bump": "pnpm version patch",
|
|
15
|
+
"build": "tsx src/build.ts --prod",
|
|
16
|
+
"dev": "tsx src/build.ts --watch",
|
|
17
|
+
"tsc": "tsc --noEmit"
|
|
18
|
+
},
|
|
13
19
|
"publishConfig": {
|
|
14
20
|
"access": "public"
|
|
15
21
|
},
|
|
@@ -19,12 +25,6 @@
|
|
|
19
25
|
},
|
|
20
26
|
"devDependencies": {
|
|
21
27
|
"esbuild": "^0.25.9",
|
|
22
|
-
"typescript": "
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"bump": "pnpm version patch",
|
|
26
|
-
"build": "tsx src/build.ts --prod",
|
|
27
|
-
"dev": "tsx src/build.ts --watch",
|
|
28
|
-
"tsc": "tsc --noEmit"
|
|
28
|
+
"typescript": "catalog:"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|