kenobi-js 0.1.28 → 0.1.30

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.
@@ -0,0 +1,91 @@
1
+ /*!
2
+ * Kenobi SDK v0.1.30
3
+ * (c) 2025 Kenobi.ai
4
+ */
5
+ "use strict";var KenobiLib=(()=>{var xe=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var qt=(e,t,r)=>t in e?xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Wt=(e,t)=>{for(var r in t)xe(e,r,{get:t[r],enumerable:!0})},Gt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jt(t))!Bt.call(e,i)&&i!==r&&xe(e,i,{get:()=>t[i],enumerable:!(n=$t(t,i))||n.enumerable});return e};var Xt=e=>Gt(xe({},"__esModule",{value:!0}),e);var _=(e,t,r)=>qt(e,typeof t!="symbol"?t+"":t,r);var Ir={};Wt(Ir,{CueCard:()=>ye,Kenobi:()=>Qe,TRANSFORMATION_ACTIONS:()=>Ut});var Je=11;function Yt(e,t){var r=t.attributes,n,i,o,a,c;if(!(t.nodeType===Je||e.nodeType===Je)){for(var u=r.length-1;u>=0;u--)n=r[u],i=n.name,o=n.namespaceURI,a=n.value,o?(i=n.localName||i,c=e.getAttributeNS(o,i),c!==a&&(n.prefix==="xmlns"&&(i=n.name),e.setAttributeNS(o,i,a))):(c=e.getAttribute(i),c!==a&&e.setAttribute(i,a));for(var s=e.attributes,p=s.length-1;p>=0;p--)n=s[p],i=n.name,o=n.namespaceURI,o?(i=n.localName||i,t.hasAttributeNS(o,i)||e.removeAttributeNS(o,i)):t.hasAttribute(i)||e.removeAttribute(i)}}var Ce,Qt="http://www.w3.org/1999/xhtml",j=typeof document>"u"?void 0:document,Jt=!!j&&"content"in j.createElement("template"),Zt=!!j&&j.createRange&&"createContextualFragment"in j.createRange();function er(e){var t=j.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function tr(e){Ce||(Ce=j.createRange(),Ce.selectNode(j.body));var t=Ce.createContextualFragment(e);return t.childNodes[0]}function rr(e){var t=j.createElement("body");return t.innerHTML=e,t.childNodes[0]}function nr(e){return e=e.trim(),Jt?er(e):Zt?tr(e):rr(e)}function Te(e,t){var r=e.nodeName,n=t.nodeName,i,o;return r===n?!0:(i=r.charCodeAt(0),o=n.charCodeAt(0),i<=90&&o>=97?r===n.toUpperCase():o<=90&&i>=97?n===r.toUpperCase():!1)}function ir(e,t){return!t||t===Qt?j.createElement(e):j.createElementNS(t,e)}function or(e,t){for(var r=e.firstChild;r;){var n=r.nextSibling;t.appendChild(r),r=n}return t}function Oe(e,t,r){e[r]!==t[r]&&(e[r]=t[r],e[r]?e.setAttribute(r,""):e.removeAttribute(r))}var Ze={OPTION:function(e,t){var r=e.parentNode;if(r){var n=r.nodeName.toUpperCase();n==="OPTGROUP"&&(r=r.parentNode,n=r&&r.nodeName.toUpperCase()),n==="SELECT"&&!r.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),r.selectedIndex=-1)}Oe(e,t,"selected")},INPUT:function(e,t){Oe(e,t,"checked"),Oe(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var r=t.value;e.value!==r&&(e.value=r);var n=e.firstChild;if(n){var i=n.nodeValue;if(i==r||!r&&i==e.placeholder)return;n.nodeValue=r}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var r=-1,n=0,i=e.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")){r=n;break}n++}i=i.nextSibling,!i&&o&&(i=o.nextSibling,o=null)}e.selectedIndex=r}}},me=1,et=11,tt=3,rt=8;function ie(){}function ar(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function sr(e){return function(r,n,i){if(i||(i={}),typeof n=="string")if(r.nodeName==="#document"||r.nodeName==="HTML"||r.nodeName==="BODY"){var o=n;n=j.createElement("html"),n.innerHTML=o}else n=nr(n);else n.nodeType===et&&(n=n.firstElementChild);var a=i.getNodeKey||ar,c=i.onBeforeNodeAdded||ie,u=i.onNodeAdded||ie,s=i.onBeforeElUpdated||ie,p=i.onElUpdated||ie,l=i.onBeforeNodeDiscarded||ie,m=i.onNodeDiscarded||ie,f=i.onBeforeElChildrenUpdated||ie,M=i.skipFromChildren||ie,L=i.addChild||function(h,g){return h.appendChild(g)},E=i.childrenOnly===!0,b=Object.create(null),v=[];function x(h){v.push(h)}function D(h,g){if(h.nodeType===me)for(var R=h.firstChild;R;){var C=void 0;g&&(C=a(R))?x(C):(m(R),R.firstChild&&D(R,g)),R=R.nextSibling}}function H(h,g,R){l(h)!==!1&&(g&&g.removeChild(h),m(h),D(h,R))}function k(h){if(h.nodeType===me||h.nodeType===et)for(var g=h.firstChild;g;){var R=a(g);R&&(b[R]=g),k(g),g=g.nextSibling}}k(r);function O(h){u(h);for(var g=h.firstChild;g;){var R=g.nextSibling,C=a(g);if(C){var w=b[C];w&&Te(g,w)?(g.parentNode.replaceChild(w,g),U(w,g)):O(g)}else O(g);g=R}}function V(h,g,R){for(;g;){var C=g.nextSibling;(R=a(g))?x(R):H(g,h,!0),g=C}}function U(h,g,R){var C=a(g);if(C&&delete b[C],!R){var w=s(h,g);if(w===!1||(w instanceof HTMLElement&&(h=w,k(h)),e(h,g),p(h),f(h,g)===!1))return}h.nodeName!=="TEXTAREA"?$(h,g):Ze.TEXTAREA(h,g)}function $(h,g){var R=M(h,g),C=g.firstChild,w=h.firstChild,ne,W,Y,oe,Q;e:for(;C;){for(oe=C.nextSibling,ne=a(C);!R&&w;){if(Y=w.nextSibling,C.isSameNode&&C.isSameNode(w)){C=oe,w=Y;continue e}W=a(w);var le=w.nodeType,J=void 0;if(le===C.nodeType&&(le===me?(ne?ne!==W&&((Q=b[ne])?Y===Q?J=!1:(h.insertBefore(Q,w),W?x(W):H(w,h,!0),w=Q,W=a(w)):J=!1):W&&(J=!1),J=J!==!1&&Te(w,C),J&&U(w,C)):(le===tt||le==rt)&&(J=!0,w.nodeValue!==C.nodeValue&&(w.nodeValue=C.nodeValue))),J){C=oe,w=Y;continue e}W?x(W):H(w,h,!0),w=Y}if(ne&&(Q=b[ne])&&Te(Q,C))R||L(h,Q),U(Q,C);else{var fe=c(C);fe!==!1&&(fe&&(C=fe),C.actualize&&(C=C.actualize(h.ownerDocument||j)),L(h,C),O(C))}C=oe,w=Y}V(h,w,W);var ke=Ze[h.nodeName];ke&&ke(h,g)}var A=r,F=A.nodeType,se=n.nodeType;if(!E){if(F===me)se===me?Te(r,n)||(m(r),A=or(r,ir(n.nodeName,n.namespaceURI))):A=n;else if(F===tt||F===rt){if(se===F)return A.nodeValue!==n.nodeValue&&(A.nodeValue=n.nodeValue),A;A=n}}if(A===n)m(r);else{if(n.isSameNode&&n.isSameNode(A))return;if(U(A,n,E),v)for(var X=0,de=v.length;X<de;X++){var pe=b[v[X]];pe&&H(pe,pe.parentNode,!1)}}return!E&&A!==r&&r.parentNode&&(A.actualize&&(A=A.actualize(r.ownerDocument||j)),r.parentNode.replaceChild(A,r)),A}}var lr=sr(Yt),Se=lr;var Le,P,st,cr,ae,nt,lt,ct,ut,Ke,Fe,ze,ur,be={},dt=[],dr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Re=Array.isArray;function re(e,t){for(var r in t)e[r]=t[r];return e}function Ve(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function pr(e,t,r){var n,i,o,a={};for(o in t)o=="key"?n=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Le.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return Ae(e,a,n,i,null)}function Ae(e,t,r,n,i){var o={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++st,__i:-1,__u:0};return i==null&&P.vnode!=null&&P.vnode(o),o}function ee(e){return e.children}function Me(e,t){this.props=e,this.context=t}function ce(e,t){if(t==null)return e.__?ce(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?ce(e):null}function pt(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return pt(e)}}function it(e){(!e.__d&&(e.__d=!0)&&ae.push(e)&&!Pe.__r++||nt!=P.debounceRendering)&&((nt=P.debounceRendering)||lt)(Pe)}function Pe(){for(var e,t,r,n,i,o,a,c=1;ae.length;)ae.length>c&&ae.sort(ct),e=ae.shift(),c=ae.length,e.__d&&(r=void 0,n=void 0,i=(n=(t=e).__v).__e,o=[],a=[],t.__P&&((r=re({},n)).__v=n.__v+1,P.vnode&&P.vnode(r),$e(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,o,i??ce(n),!!(32&n.__u),a),r.__v=n.__v,r.__.__k[r.__i]=r,bt(o,r,a),n.__e=n.__=null,r.__e!=i&&pt(r)));Pe.__r=0}function ft(e,t,r,n,i,o,a,c,u,s,p){var l,m,f,M,L,E,b,v=n&&n.__k||dt,x=t.length;for(u=fr(r,t,v,u,x),l=0;l<x;l++)(f=r.__k[l])!=null&&(m=f.__i==-1?be:v[f.__i]||be,f.__i=l,E=$e(e,f,m,i,o,a,c,u,s,p),M=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&je(m.ref,null,f),p.push(f.ref,f.__c||M,f)),L==null&&M!=null&&(L=M),(b=!!(4&f.__u))||m.__k===f.__k?u=mt(f,u,e,b):typeof f.type=="function"&&E!==void 0?u=E:M&&(u=M.nextSibling),f.__u&=-7);return r.__e=L,u}function fr(e,t,r,n,i){var o,a,c,u,s,p=r.length,l=p,m=0;for(e.__k=new Array(i),o=0;o<i;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(u=o+m,(a=e.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?Ae(null,a,null,null,null):Re(a)?Ae(ee,{children:a},null,null,null):a.constructor==null&&a.__b>0?Ae(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,c=null,(s=a.__i=mr(a,r,u,l))!=-1&&(l--,(c=r[s])&&(c.__u|=2)),c==null||c.__v==null?(s==-1&&(i>p?m--:i<p&&m++),typeof a.type!="function"&&(a.__u|=4)):s!=u&&(s==u-1?m--:s==u+1?m++:(s>u?m--:m++,a.__u|=4))):e.__k[o]=null;if(l)for(o=0;o<p;o++)(c=r[o])!=null&&(2&c.__u)==0&&(c.__e==n&&(n=ce(c)),_t(c,c));return n}function mt(e,t,r,n){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=mt(i[o],t,r,n));return t}e.__e!=t&&(n&&(t&&e.type&&!t.parentNode&&(t=ce(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function mr(e,t,r,n){var i,o,a,c=e.key,u=e.type,s=t[r],p=s!=null&&(2&s.__u)==0;if(s===null&&e.key==null||p&&c==s.key&&u==s.type)return r;if(n>(p?1:0)){for(i=r-1,o=r+1;i>=0||o<t.length;)if((s=t[a=i>=0?i--:o++])!=null&&(2&s.__u)==0&&c==s.key&&u==s.type)return a}return-1}function ot(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||dr.test(t)?r:r+"px"}function Ee(e,t,r,n,i){var o,a;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||ot(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||ot(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(ut,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n?r.u=n.u:(r.u=Ke,e.addEventListener(t,o?ze:Fe,o)):e.removeEventListener(t,o?ze:Fe,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function at(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=Ke++;else if(t.t<r.u)return;return r(P.event?P.event(t):t)}}}function $e(e,t,r,n,i,o,a,c,u,s){var p,l,m,f,M,L,E,b,v,x,D,H,k,O,V,U,$,A=t.type;if(t.constructor!=null)return null;128&r.__u&&(u=!!(32&r.__u),o=[c=t.__e=r.__e]),(p=P.__b)&&p(t);e:if(typeof A=="function")try{if(b=t.props,v="prototype"in A&&A.prototype.render,x=(p=A.contextType)&&n[p.__c],D=p?x?x.props.value:p.__:n,r.__c?E=(l=t.__c=r.__c).__=l.__E:(v?t.__c=l=new A(b,D):(t.__c=l=new Me(b,D),l.constructor=A,l.render=hr),x&&x.sub(l),l.props=b,l.state||(l.state={}),l.context=D,l.__n=n,m=l.__d=!0,l.__h=[],l._sb=[]),v&&l.__s==null&&(l.__s=l.state),v&&A.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=re({},l.__s)),re(l.__s,A.getDerivedStateFromProps(b,l.__s))),f=l.props,M=l.state,l.__v=t,m)v&&A.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),v&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(v&&A.getDerivedStateFromProps==null&&b!==f&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(b,D),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(b,l.__s,D)===!1||t.__v==r.__v){for(t.__v!=r.__v&&(l.props=b,l.state=l.__s,l.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(F){F&&(F.__=t)}),H=0;H<l._sb.length;H++)l.__h.push(l._sb[H]);l._sb=[],l.__h.length&&a.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(b,l.__s,D),v&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(f,M,L)})}if(l.context=D,l.props=b,l.__P=e,l.__e=!1,k=P.__r,O=0,v){for(l.state=l.__s,l.__d=!1,k&&k(t),p=l.render(l.props,l.state,l.context),V=0;V<l._sb.length;V++)l.__h.push(l._sb[V]);l._sb=[]}else do l.__d=!1,k&&k(t),p=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++O<25);l.state=l.__s,l.getChildContext!=null&&(n=re(re({},n),l.getChildContext())),v&&!m&&l.getSnapshotBeforeUpdate!=null&&(L=l.getSnapshotBeforeUpdate(f,M)),U=p,p!=null&&p.type===ee&&p.key==null&&(U=ht(p.props.children)),c=ft(e,Re(U)?U:[U],t,r,n,i,o,a,c,u,s),l.base=t.__e,t.__u&=-161,l.__h.length&&a.push(l),E&&(l.__E=l.__=null)}catch(F){if(t.__v=null,u||o!=null)if(F.then){for(t.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for($=o.length;$--;)Ve(o[$]);Ue(t)}else t.__e=r.__e,t.__k=r.__k,F.then||Ue(t);P.__e(F,t,r)}else o==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):c=t.__e=br(r.__e,t,r,n,i,o,a,u,s);return(p=P.diffed)&&p(t),128&t.__u?void 0:c}function Ue(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Ue)}function bt(e,t,r){for(var n=0;n<r.length;n++)je(r[n],r[++n],r[++n]);P.__c&&P.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){P.__e(o,i.__v)}})}function ht(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Re(e)?e.map(ht):re({},e)}function br(e,t,r,n,i,o,a,c,u){var s,p,l,m,f,M,L,E=r.props,b=t.props,v=t.type;if(v=="svg"?i="http://www.w3.org/2000/svg":v=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(s=0;s<o.length;s++)if((f=o[s])&&"setAttribute"in f==!!v&&(v?f.localName==v:f.nodeType==3)){e=f,o[s]=null;break}}if(e==null){if(v==null)return document.createTextNode(b);e=document.createElementNS(i,v,b.is&&b),c&&(P.__m&&P.__m(t,o),c=!1),o=null}if(v==null)E===b||c&&e.data==b||(e.data=b);else{if(o=o&&Le.call(e.childNodes),E=r.props||be,!c&&o!=null)for(E={},s=0;s<e.attributes.length;s++)E[(f=e.attributes[s]).name]=f.value;for(s in E)if(f=E[s],s!="children"){if(s=="dangerouslySetInnerHTML")l=f;else if(!(s in b)){if(s=="value"&&"defaultValue"in b||s=="checked"&&"defaultChecked"in b)continue;Ee(e,s,null,f,i)}}for(s in b)f=b[s],s=="children"?m=f:s=="dangerouslySetInnerHTML"?p=f:s=="value"?M=f:s=="checked"?L=f:c&&typeof f!="function"||E[s]===f||Ee(e,s,f,E[s],i);if(p)c||l&&(p.__html==l.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(l&&(e.innerHTML=""),ft(t.type=="template"?e.content:e,Re(m)?m:[m],t,r,n,v=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:r.__k&&ce(r,0),c,u),o!=null)for(s=o.length;s--;)Ve(o[s]);c||(s="value",v=="progress"&&M==null?e.removeAttribute("value"):M!=null&&(M!==e[s]||v=="progress"&&!M||v=="option"&&M!=E[s])&&Ee(e,s,M,E[s],i),s="checked",L!=null&&L!=e[s]&&Ee(e,s,L,E[s],i))}return e}function je(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){P.__e(i,r)}}function _t(e,t,r){var n,i;if(P.unmount&&P.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||je(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){P.__e(o,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&_t(n[i],t,r||typeof e.type!="function");r||Ve(e.__e),e.__c=e.__=e.__e=void 0}function hr(e,t,r){return this.constructor(e,r)}function Be(e,t,r){var n,i,o,a;t==document&&(t=document.documentElement),P.__&&P.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,o=[],a=[],$e(t,e=(!n&&r||t).__k=pr(ee,null,[e]),i||be,be,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?Le.call(t.childNodes):null,o,!n&&r?r:i?i.__e:t.firstChild,n,a),bt(o,e,a)}Le=dt.slice,P={__e:function(e,t,r,n){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(c){e=c}throw e}},st=0,cr=function(e){return e!=null&&e.constructor==null},Me.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=re({},this.state),typeof e=="function"&&(e=e(re({},r),this.props)),e&&re(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),it(this))},Me.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),it(this))},Me.prototype.render=ee,ae=[],lt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ct=function(e,t){return e.__v.__b-t.__v.__b},Pe.__r=0,ut=/(PointerCapture)$|Capture$/i,Ke=0,Fe=at(!1),ze=at(!0),ur=0;var he,N,qe,gt,_e=0,St=[],I=P,yt=I.__b,vt=I.__r,kt=I.diffed,wt=I.__c,xt=I.unmount,Ct=I.__;function Ge(e,t){I.__h&&I.__h(N,e,_e||t),_e=0;var r=N.__H||(N.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function ge(e){return _e=1,_r(Pt,e)}function _r(e,t,r){var n=Ge(he++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Pt(void 0,t),function(c){var u=n.__N?n.__N[0]:n.__[0],s=n.t(u,c);u!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=N,!N.__f)){var i=function(c,u,s){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(m){return!!m.__c});if(p.every(function(m){return!m.__N}))return!o||o.call(this,c,u,s);var l=n.__c.props!==c;return p.forEach(function(m){if(m.__N){var f=m.__[0];m.__=m.__N,m.__N=void 0,f!==m.__[0]&&(l=!0)}}),o&&o.call(this,c,u,s)||l};N.__f=!0;var o=N.shouldComponentUpdate,a=N.componentWillUpdate;N.componentWillUpdate=function(c,u,s){if(this.__e){var p=o;o=void 0,i(c,u,s),o=p}a&&a.call(this,c,u,s)},N.shouldComponentUpdate=i}return n.__N||n.__}function q(e,t){var r=Ge(he++,3);!I.__s&&Mt(r.__H,t)&&(r.__=e,r.u=t,N.__H.__h.push(r))}function z(e){return _e=5,Et(function(){return{current:e}},[])}function Et(e,t){var r=Ge(he++,7);return Mt(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function At(e,t){return _e=8,Et(function(){return e},t)}function gr(){for(var e;e=St.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(De),e.__H.__h.forEach(We),e.__H.__h=[]}catch(t){e.__H.__h=[],I.__e(t,e.__v)}}I.__b=function(e){N=null,yt&&yt(e)},I.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ct&&Ct(e,t)},I.__r=function(e){vt&&vt(e),he=0;var t=(N=e.__c).__H;t&&(qe===N?(t.__h=[],N.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(De),t.__h.forEach(We),t.__h=[],he=0)),qe=N},I.diffed=function(e){kt&&kt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(St.push(t)!==1&&gt===I.requestAnimationFrame||((gt=I.requestAnimationFrame)||yr)(gr)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),qe=N=null},I.__c=function(e,t){t.some(function(r){try{r.__h.forEach(De),r.__h=r.__h.filter(function(n){return!n.__||We(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],I.__e(n,r.__v)}}),wt&&wt(e,t)},I.unmount=function(e){xt&&xt(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{De(n)}catch(i){t=i}}),r.__H=void 0,t&&I.__e(t,r.__v))};var Tt=typeof requestAnimationFrame=="function";function yr(e){var t,r=function(){clearTimeout(n),Tt&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);Tt&&(t=requestAnimationFrame(r))}function De(e){var t=N,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),N=t}function We(e){var t=N;e.__c=e.__(),N=t}function Mt(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Pt(e,t){return typeof t=="function"?t(e):t}var vr=0;function d(e,t,r,n,i,o){t||(t={});var a,c,u=t;if("ref"in u)for(c in u={},t)c=="ref"?a=t[c]:u[c]=t[c];var s={type:e,props:u,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--vr,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(c in a)u[c]===void 0&&(u[c]=a[c]);return P.vnode&&P.vnode(s),s}var Lt=()=>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:"M16.72 7.72a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1 0 1.06l-3.75 3.75a.75.75 0 1 1-1.06-1.06l2.47-2.47H3a.75.75 0 0 1 0-1.5h16.19l-2.47-2.47a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),kr=()=>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"})}),wr=()=>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"})}),Xe=()=>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"})}),Rt=()=>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:"url(#paint0_linear_1_41)"}),d("ellipse",{cx:"579.85",cy:"294.451",rx:"79.778",ry:"108.483",transform:"rotate(-46.2324 579.85 294.451)",fill:"black"}),d("defs",{children:d("linearGradient",{id:"paint0_linear_1_41",x1:"807",y1:"93",x2:"93",y2:"807",gradientUnits:"userSpaceOnUse",children:[d("stop",{"stop-color":"#FAFAFA"}),d("stop",{offset:"1","stop-color":"#CACACA"})]})})]}),xr=`
6
+ :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.1); --kb-kbd-border: rgba(255, 255, 255, 0.2); --kb-kbd-text: rgba(255, 255, 255, 0.6); --kb-watermark-text: rgba(255, 255, 255, 0.4); font-family: var(--kb-font-family); }
7
+ .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; }
8
+ .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; }
9
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
10
+ #cue-card-root { position: fixed; z-index: 2147483647; pointer-events: none; width: 100%; height: 0; top: 0; left: 0; isolation: isolate; }
11
+ .container { 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: 0.25rem; border-bottom-left-radius: 0.25rem; border-bottom-right-radius: 0.25rem; padding: 1rem; width: auto; min-width: 320px; max-width: 90vw; opacity: 0; z-index: 1; font-family: var(--kb-font-family); }
12
+ .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; }
13
+ .backdrop.active { background: rgba(0,0,0,0.1); backdrop-filter: blur(var(--kb-focus-blur)); -webkit-backdrop-filter: blur(var(--kb-focus-blur)); }
14
+ .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); }
15
+ .launcher .kbd-hint .kbd { background: var(--kb-kbd-bg); border: 1px solid var(--kb-kbd-border); color: var(--kb-kbd-text); }
16
+ .launcher .kbd-hint .kbd-text { color: var(--kb-kbd-text); }
17
+ .launcher:hover { transform: scale(1.02); background-color: var(--kb-bg-container); }
18
+ .pos-top-center { left: 50%; translate: -50% 0; top: 1rem; }
19
+ .pos-top-right { right: 1rem; top: 1rem; left: auto; }
20
+ @media (max-width: 768px) { .pos-top-center, .pos-top-right { left: 0.5rem; right: 0.5rem; top: 0.5rem; translate: none; width: auto; max-width: none; } }
21
+ :host(.kb-inline) { position: relative !important; z-index: auto !important; top: auto !important; left: auto !important; width: 100% !important; height: auto !important; pointer-events: auto !important; isolation: auto !important; display: block; }
22
+ :host(.kb-inline) .container, :host(.kb-inline) .launcher { position: relative !important; left: auto !important; right: auto !important; top: auto !important; translate: none !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; box-shadow: none !important; }
23
+ :host(.kb-inline) .container { opacity: 1 !important; transform: none !important; }
24
+ :host(.kb-inline) .popover { position: static !important; transform: none !important; opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; margin-top: 0.75rem !important; }
25
+ :host(.kb-inline) .backdrop, :host(.kb-inline) .launcher, :host(.kb-inline) .btn-dismiss { display: none !important; }
26
+ .content-wrapper { display: flex; align-items: center; gap: 1rem; }
27
+ .logo { width: 2.5rem; height: 2.5rem; display: none; }
28
+ @media (min-width: 1024px) { .logo { display: block; } }
29
+ .text-content { flex: 1; user-select: none; }
30
+ .text-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
31
+ .title { color: var(--kb-text-title); font-size: 1rem; font-weight: 600; line-height: 1.5; }
32
+ .subtitle { color: var(--kb-text-title); font-size: 0.875rem; line-height: 1.25; opacity: 0.8; }
33
+ .btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 0.375rem; font-weight: 500; font-size: 0.875rem; line-height: 1.25rem; padding: 0.5rem 1rem; transition: all 0.2s; cursor: pointer; border: none; outline: none; }
34
+ .btn-trigger { background-color: var(--kb-btn-trigger-bg); color: var(--kb-btn-trigger-text); min-width: 8rem; gap: 0.5rem; }
35
+ .btn-trigger:not(:disabled):hover { background-color: var(--kb-btn-trigger-hover-bg); }
36
+ .btn-trigger:disabled { opacity: 0.8; cursor: not-allowed; }
37
+ .btn-trigger.success { background-color: transparent; color: var(--kb-success-color); padding-right: 0.75rem; cursor: default; }
38
+ .btn-trigger.success:hover { background-color: transparent; }
39
+ .animate-spin { animation: spin 1s linear infinite; }
40
+ @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
41
+ .btn-dismiss { position: absolute; top: -0.5rem; left: -0.5rem; width: 1.5rem; height: 1.5rem; padding: 0; border-radius: 9999px; display: flex; align-items: center; justify-content: center; background-color: var(--kb-btn-dismiss-bg); border: 1px solid var(--kb-btn-dismiss-border); color: var(--kb-btn-dismiss-text); cursor: pointer; transition: all 0.3s ease-out; z-index: 10; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
42
+ .btn-dismiss:hover { background-color: var(--kb-btn-dismiss-hover-bg); color: var(--kb-btn-dismiss-hover-text); }
43
+ .progress-clip { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
44
+ .progress-container { position: absolute; bottom: 0; left: 0; right: 0; height: 0.25rem; background-color: var(--kb-progress-track); overflow: hidden; pointer-events: none; }
45
+ .progress-bar { height: 100%; background-color: var(--kb-progress-indicator); width: 0%; transition: width 0.3s ease; }
46
+ .popover { position: absolute; top: 100%; left: 0; right: 0; margin-top: 0.375rem; background-color: var(--kb-popover-bg); border: 1px solid var(--kb-popover-border); border-radius: 0.25rem; border-top-left-radius: 0; border-top-right-radius: 0; padding: 1rem; color: var(--kb-popover-text); box-shadow: var(--kb-shadow-container); backdrop-filter: blur(var(--kb-backdrop-blur)); -webkit-backdrop-filter: blur(var(--kb-backdrop-blur)); opacity: 0; transform: translateY(-10px); pointer-events: none; visibility: hidden; transition: all 0.2s ease-out; }
47
+ .popover.open { opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible; }
48
+ .form-group { margin-bottom: 1rem; }
49
+ .form-label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--kb-form-label); font-weight: 500; }
50
+ .input-row { display: flex; gap: 0.5rem; }
51
+ .form-input { flex: 1; background-color: var(--kb-input-bg); border: 1px solid var(--kb-input-border); color: var(--kb-input-text); border-radius: 0.375rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; outline: none; transition: border-color 0.2s; min-height: 44px; }
52
+ .form-input::placeholder { color: var(--kb-input-placeholder); }
53
+ .form-input:focus { border-color: var(--kb-progress-indicator); }
54
+ .form-input.error { border-color: var(--kb-error-text); }
55
+ .form-label.error { color: var(--kb-error-text); }
56
+ .form-message { color: var(--kb-error-text); font-size: 0.75rem; margin-top: 0.25rem; font-weight: 500; }
57
+ .btn-submit { background-color: var(--kb-btn-trigger-bg); color: var(--kb-btn-trigger-text); padding: 0.5rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
58
+ .btn-submit:disabled { opacity: 0.7; cursor: not-allowed; }
59
+ .kbd-hint { display: flex; align-items: center; gap: 0.5rem; position: absolute; top: calc(100% + 0.5rem); left: 50%; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; white-space: nowrap; }
60
+ .kbd-hint.visible { opacity: 1; }
61
+ .kbd-group { display: flex; align-items: center; gap: 0.25rem; }
62
+ .kbd { font-family: inherit; font-size: 0.75rem; line-height: 1; padding: 0.25rem 0.375rem; border-radius: 0.25rem; background: var(--kb-kbd-bg); border: 1px solid var(--kb-kbd-border); color: var(--kb-kbd-text); font-weight: 500; min-width: 1.25rem; text-align: center; }
63
+ .kbd-text { font-size: 0.75rem; color: var(--kb-kbd-text); }
64
+ .watermark { text-align: center; font-size: 0.625rem; color: var(--kb-watermark-text); opacity: 0.8; font-weight: 500; letter-spacing: 0.025em; }
65
+ .watermark a { color: inherit; text-decoration: none; cursor: pointer; }
66
+ .watermark a:hover { text-decoration: underline; text-decoration-color: var(--kb-watermark-text); }
67
+ /* Launcher hint positioning */
68
+ .launcher .kbd-hint { position: static; transform: none; opacity: 0.6; transition: opacity 0.2s; }
69
+ .launcher:hover .kbd-hint { opacity: 1; }
70
+ .pos-top-right.launcher .kbd-hint { left: auto; right: auto; }
71
+ `,Dt=(e,t,r)=>{let n=z(!1);q(()=>{let i=e.current;if(!i)return;let o=r.direction==="top-to-bottom",a=o?"translateY(-60px)":"translateX(60px)",c=o?"translateY(-20px)":"translateX(20px)",u="translate(0, 0)";if(t){n.current=!0;let s=i.animate([{opacity:0,transform:a},{opacity:1,transform:u}],{duration:500,delay:r.entranceDelayMs,easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fill:"forwards"});s.onfinish=()=>r.onEntranceComplete?.()}else if(n.current){let s=i.animate([{opacity:1,transform:u},{opacity:0,transform:c}],{duration:350,delay:r.exitDelayMs,easing:"ease-in-out",fill:"forwards"});s.onfinish=()=>r.onExitComplete?.()}else i.style.opacity="0",i.style.transform=c},[t,r.direction])},Nt=e=>{if(!e)return{};let t={};return e.fontFamily&&(t["--kb-font-family"]=e.fontFamily),e.backgroundColor&&(t["--kb-bg-container"]=e.backgroundColor,t["--kb-popover-bg"]=e.backgroundColor),e.borderColor&&(t["--kb-border-container"]=e.borderColor,t["--kb-popover-border"]=e.borderColor),e.textColor&&(t["--kb-text-title"]=e.textColor,t["--kb-popover-text"]=e.textColor),e.subtitleColor&&(t["--kb-text-subtitle"]=e.subtitleColor),e.borderRadius&&(t["border-radius"]=e.borderRadius,t["border-bottom-left-radius"]=e.borderRadius,t["border-bottom-right-radius"]=e.borderRadius),e.primaryColor&&(t["--kb-btn-trigger-bg"]=e.primaryColor,t["--kb-progress-indicator"]=e.primaryColor,t["--kb-success-color"]=e.primaryColor),e.primaryTextColor&&(t["--kb-btn-trigger-text"]=e.primaryTextColor),t},Cr=({config:e,isOpen:t,setIsOpen:r})=>{let n=e.mountMode==="inline",i=z(null),o=z(null),a=z(null),c=z(null),u=z(null),[s,p]=ge("card"),l=z(!1),m=z(!1),f=z(!1),M=z(!1),L=z("card"),E=z(e.status),b=z(!!e.isVisible),v=z(null),x=z(null),D=z(!1),[H,k]=ge(!1),[O,V]=ge({}),[U,$]=ge(0),A=z(0),F=e.enableTimer!==!1,se=Math.max(500,e.timerDurationMs??2e4),X=At(y=>{A.current=y,$(y)},[]);q(()=>{e.isVisible&&(p("card"),l.current=!1)},[e.isVisible]),s==="card"&&L.current==="launcher"&&(f.current=!1),e.status==="success"&&E.current!=="success"?s==="card"&&(f.current=!0):e.status!=="success"&&(f.current=!1),E.current=e.status,q(()=>{let y=L.current==="launcher",T=s==="card";y&&T&&m.current&&(M.current=!0,setTimeout(()=>{M.current=!1},100)),s==="launcher"&&k(!1),y&&T&&F&&(X(0),v.current=null,D.current=!1)},[s,X,F]),q(()=>{if(e.status==="success"&&(m.current=!0,e.enableLauncher&&s==="card"&&f.current)){let y=setTimeout(()=>{p("launcher")},2e3);return()=>clearTimeout(y)}},[e.status,e.enableLauncher,s]),q(()=>{e.isVisible&&!b.current&&F&&(X(0),v.current=null,D.current=!1),b.current=!!e.isVisible},[e.isVisible,X,F]),q(()=>{L.current=s},[s]),q(()=>{if(t){m.current&&u.current&&u.current.reset();let y=setTimeout(()=>{c.current&&c.current.focus()},100);return()=>clearTimeout(y)}},[t]),n||(Dt(i,!!e.isVisible&&s==="card",{direction:e.direction||"top-to-bottom",position:e.position||"top-center",entranceDelayMs:l.current?0:e.entranceDelayMs||0,exitDelayMs:75,onEntranceComplete:()=>{e.onEntranceComplete?.(),l.current=!0},onExitComplete:()=>{e.isVisible||e.onExitComplete?.()}}),Dt(o,!!e.isVisible&&s==="launcher",{direction:e.direction||"top-to-bottom",position:e.position||"top-center",entranceDelayMs:0,exitDelayMs:75})),q(()=>{let y=a.current;if(!y)return;let T=e.status==="success";if(e.enableFocusMode&&s==="card"&&e.isVisible&&!T){let S=setTimeout(()=>{y.classList.add("active")},e.focusDelayMs||500);return()=>clearTimeout(S)}else y.classList.remove("active")},[e.enableFocusMode,s,e.isVisible,e.focusDelayMs,e.status]),q(()=>{if(!e.isVisible)return;let y=T=>{if(T.key==="Escape"){if(t){r(!1);return}s==="card"&&(e.enableLauncher?p("launcher"):e.onDismiss?.());return}((K,G)=>{let Z=G||{key:"p",modifiers:["meta","ctrl"]};if(K.key.toLowerCase()!==Z.key.toLowerCase())return!1;let B=Z.modifiers||[];if(G){let He=B.includes("meta")===K.metaKey,we=B.includes("ctrl")===K.ctrlKey,Ie=B.includes("alt")===K.altKey,Vt=B.includes("shift")===K.shiftKey;return He&&we&&Ie&&Vt}return K.metaKey||K.ctrlKey})(T,e.keyboardShortcut)&&(T.preventDefault(),s==="launcher"?(p("card"),r(!0)):s==="card"&&(e.enableLauncher?p("launcher"):e.onDismiss?.()))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[e.isVisible,t,s,e.enableLauncher,r,e.onDismiss]);let de=typeof navigator<"u"&&/Mac/.test(navigator.userAgent),pe=(()=>{if(e.keyboardShortcut){let y=e.keyboardShortcut.modifiers||[],T=[];return y.includes("meta")&&T.push(de?"\u2318":"Win"),y.includes("ctrl")&&T.push("Ctrl"),y.includes("alt")&&T.push(de?"Opt":"Alt"),y.includes("shift")&&T.push("Shift"),T.push(e.keyboardShortcut.key.toUpperCase()),T}return[de?"\u2318":"Ctrl","P"]})(),h=e.status==="starting",g=e.status==="success",R=e.status==="error",C=g&&f.current,w=e.textOverrides||{},ne=g?w.titleSuccess||"Personalization complete":h?"Starting personalization":R?w.titleError||"Let's try that again":e.hasPersonalization?"Personalization ready":w.titleResting||"Personalization available",W=g?w.subtitleSuccess||"Take a look":h?"Hang tight...":R?w.subtitleError||"Something went wrong. Tap to retry.":w.subtitleResting||"This page can adapt to you",Y=h?w.btnLoading||"Starting...":R?w.btnError||"Try again":g&&f.current?w.btnSuccess||"Personalised":m.current?"Show me again":w.btnResting||"Show me",oe=(y,T,S)=>{if(!S)return null;if(S.required&&!T.trim())return S.errorMessage||`${S.label} is required`;if(!T)return null;if(S.type==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(T))return S.errorMessage||"Please enter a valid email address";if(S.type==="url")try{new URL(T)}catch{return S.errorMessage||"Please enter a valid URL (e.g., https://example.com)"}return S.minLength&&T.length<S.minLength?S.errorMessage||`Must be at least ${S.minLength} characters`:S.maxLength&&T.length>S.maxLength?S.errorMessage||`Must be at most ${S.maxLength} characters`:S.pattern&&!new RegExp(S.pattern).test(T)?S.errorMessage||"Invalid format":null},Q=y=>{if(y.preventDefault(),h)return;let T=new FormData(y.target),S={},K={},G=!1;if(T.forEach((Z,B)=>{let Ne=Z.toString();S[B]=Ne;let He=e.fields.find(Ie=>Ie.name===B),we=oe(B,Ne,He);we&&(K[B]=we,G=!0)}),G){V(K);return}V({}),r(!1),e.onSubmitPersonalization?.(S)},le=y=>{let T=y.target,S=T.name;if(O[S]){let K=e.fields.find(Z=>Z.name===S),G=oe(S,T.value,K);V(Z=>{let B={...Z};return G?B[S]=G:delete B[S],B})}},J=y=>{y.stopPropagation(),!(h||g)&&r(!t)};q(()=>{if(!F||D.current)return;if(!(e.isVisible&&s==="card"&&e.status==="resting"&&!t&&!H)){x.current!==null&&(cancelAnimationFrame(x.current),x.current=null),v.current=null;return}let T=S=>{v.current===null&&(v.current=S-A.current/100*se);let K=S-v.current,G=Math.min(1,K/se),Z=G*100;if(X(Z),G>=1){D.current=!0,v.current=null,x.current=null,e.enableLauncher?(p("launcher"),r(!1)):e.onDismiss?.();return}x.current=requestAnimationFrame(T)};return x.current=requestAnimationFrame(T),()=>{x.current!==null&&(cancelAnimationFrame(x.current),x.current=null)}},[e.enableLauncher,e.isVisible,e.onDismiss,e.status,H,t,s,r,se,F,X]),q(()=>()=>{x.current!==null&&cancelAnimationFrame(x.current)},[]);let fe=Math.max(0,Math.min(100,e.progressPct??0)),ke=F?U:fe;return d(ee,{children:[d("div",{ref:a,class:"backdrop"}),d("div",{ref:i,class:`container theme-${e.theme||"glass"} pos-${e.position||"top-center"}`,style:Nt(e.customTheme),onClick:()=>!t&&!h&&!g&&r(!0),onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),children:[d("button",{class:"btn-dismiss","aria-label":"Dismiss",onClick:y=>{y.stopPropagation(),D.current=!0,e.enableLauncher?p("launcher"):e.onDismiss?.()},children:d(wr,{})}),d("div",{class:"content-wrapper",children:[d("div",{class:"logo",children:d(Rt,{})}),d("div",{class:"text-content",children:d("div",{class:"text-row",children:[d("div",{children:[d("div",{class:"title",children:ne}),d("div",{class:"subtitle",children:W})]}),d("button",{class:`btn btn-trigger ${C?"success":""}`,disabled:h||C,onClick:J,children:h?d(ee,{children:[d(Xe,{})," ",Y]}):C?d(ee,{children:[d(kr,{})," ",Y]}):Y})]})})]}),d("div",{class:"progress-clip",children:d("div",{class:"progress-container",children:d("div",{class:"progress-bar",style:{width:`${ke}%`}})})}),d("div",{class:`popover ${t?"open":""}`,onClick:y=>y.stopPropagation(),children:[d("form",{onSubmit:Q,ref:u,children:[e.fields.map((y,T)=>d("div",{class:"form-group",children:[d("label",{class:`form-label ${O[y.name]?"error":""}`,children:y.label}),d("div",{class:"input-row",children:[d("input",{ref:T===0?c:void 0,class:`form-input ${O[y.name]?"error":""}`,name:y.name,type:y.type||"text",placeholder:y.placeholder,required:y.required,onInput:le}),e.fields.length===1&&d("button",{type:"submit",class:"btn btn-submit",disabled:h,children:h?d(Xe,{}):d(Lt,{})})]}),O[y.name]&&d("div",{class:"form-message",children:O[y.name]})]},y.name)),e.fields.length>1&&d("button",{type:"submit",class:"btn btn-submit",style:{width:"100%"},disabled:h,children:h?d(Xe,{}):d(Lt,{})})]}),e.showWatermark&&d("div",{class:"watermark",children:["Powered by"," ",d("a",{href:"https://kenobi.ai",target:"_blank",rel:"noopener noreferrer",children:"Kenobi"})]})]}),e.showKeyboardHints&&e.enableFocusMode&&d("div",{class:`kbd-hint ${!t&&!h&&!g?"visible":""}`,children:[d("div",{class:"kbd-group",children:d("div",{class:"kbd",children:"Esc"})}),d("span",{class:"kbd-text",children:"to dismiss"})]})]}),d("button",{ref:o,class:`launcher theme-${e.theme||"glass"} pos-${e.position||"top-center"}`,style:Nt(e.customTheme),onClick:y=>{y.stopPropagation(),p("card"),r(!0)},children:[d("div",{style:{display:"flex",width:"20px",height:"20px",overflow:"hidden",alignItems:"center",justifyContent:"center"},children:d("div",{style:{transform:"scale(0.6)"},children:d(Rt,{})})}),e.textOverrides?.launcherLabel||(m.current?"Personalize again":"Personalize"),e.showKeyboardHints&&d("div",{class:"kbd-hint visible",children:d("div",{class:"kbd-group",children:pe.map((y,T)=>d("div",{class:"kbd",children:y},T))})})]})]})},ye=class{constructor(t){_(this,"host");_(this,"shadow");_(this,"config");_(this,"isOpen",!1);_(this,"mountTarget",null);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",...t},this.mountTarget=t.mountNode??null,this.host=document.createElement("div"),this.host.id="kenobi-cue-card-root",this.applyHostStyles(),this.shadow=this.host.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=xr,this.shadow.appendChild(r);let n=document.createElement("div");this.shadow.appendChild(n)}applyHostStyles(){let t=this.config.mountMode==="inline";if(this.host.classList.toggle("kb-inline",t),t){this.host.style.cssText=`
72
+ position: relative !important;
73
+ z-index: auto !important;
74
+ top: auto !important;
75
+ left: auto !important;
76
+ width: 100% !important;
77
+ height: auto !important;
78
+ pointer-events: auto !important;
79
+ isolation: auto !important;
80
+ display: block !important;
81
+ `;return}this.host.style.cssText=`
82
+ position: fixed !important;
83
+ z-index: 2147483647 !important;
84
+ top: 0 !important;
85
+ left: 0 !important;
86
+ width: 100% !important;
87
+ height: 0 !important;
88
+ pointer-events: none !important;
89
+ isolation: isolate !important;
90
+ `}mount(t){let r=t||this.config.mountNode||this.mountTarget||document.body;this.mountTarget=r,r.contains(this.host)||r.appendChild(this.host),this.applyHostStyles(),this.render()}unmount(){Be(null,this.shadow.lastElementChild),this.host.remove()}update(t){this.config={...this.config,...t},this.applyHostStyles(),this.render()}setTheme(t){this.update({theme:t})}openForm(){this.isOpen=!0,this.render()}render(){let t=this.shadow.lastElementChild;Be(d(Cr,{config:this.config,isOpen:this.isOpen,setIsOpen:r=>{this.isOpen=r,this.config.onOpenChange?.(r),this.render()}}),t)}};var Ht="kfor",It="kenobi_visitor_key",te="data-kenobi-transformation-identifier",ue={enabled:!1,durationMs:300,delayMs:0,easing:"ease",animateSize:!0,overflow:"hidden"},Tr=e=>({enabled:e?.enabled??ue.enabled,durationMs:e?.durationMs??ue.durationMs,delayMs:e?.delayMs??ue.delayMs,easing:e?.easing??ue.easing,animateSize:e?.animateSize??ue.animateSize,overflow:e?.overflow??ue.overflow,textAnimation:e?.textAnimation,enter:e?.enter,exit:e?.exit}),Sr=(e,t)=>({enabled:t?.enabled??e.enabled,durationMs:t?.durationMs??e.durationMs,delayMs:t?.delayMs??e.delayMs,easing:t?.easing??e.easing,animateSize:t?.animateSize??e.animateSize,overflow:t?.overflow??e.overflow,textAnimation:t?.textAnimation??e.textAnimation,enter:t?.enter??e.enter,exit:t?.exit??e.exit}),Ft=e=>typeof e=="string",ve=e=>e instanceof HTMLElement||typeof SVGElement<"u"&&e instanceof SVGElement,Er=e=>typeof e=="string",Ar=e=>e==="hidden"||e==="visible"||e==="clip",Mr=e=>e==="line"||e==="word"||e==="character",zt=e=>typeof e!="object"||e===null?!1:Array.isArray(e)?e.every(t=>typeof t=="object"&&t!==null):!0,Ot=e=>{if(typeof e!="object"||e===null)return!1;let t=e,{animationName:r,keyframes:n,durationMs:i,delayMs:o}=t;return(r===void 0||Ft(r))&&(n===void 0||zt(n))&&(i===void 0||typeof i=="number")&&(o===void 0||typeof o=="number")},Pr=e=>{if(typeof e!="object"||e===null)return!1;let t=e,{by:r,staggerMs:n,animationName:i,keyframes:o,delayMs:a,durationMs:c}=t;return Mr(r)&&(a===void 0||typeof a=="number")&&(n===void 0||typeof n=="number")&&(c===void 0||typeof c=="number")&&(Ft(i)||o!==void 0)&&(o===void 0||zt(o))},Lr=e=>{if(typeof e!="object"||e===null)return!1;let t=e,{enabled:r,durationMs:n,delayMs:i,easing:o,animateSize:a,overflow:c,textAnimation:u,enter:s,exit:p}=t;return(r===void 0||typeof r=="boolean")&&(n===void 0||typeof n=="number")&&(i===void 0||typeof i=="number")&&(o===void 0||Er(o))&&(a===void 0||typeof a=="boolean")&&(c===void 0||Ar(c))&&(u===void 0||Pr(u))&&(s===void 0||Ot(s))&&(p===void 0||Ot(p))},Ye=class{constructor(){_(this,"replaceWithTransition",async(t,r,n)=>{let i=document.createElement("div");i.style.position="relative",i.style.overflow=n.overflow;let o=t.getBoundingClientRect(),a=window.getComputedStyle(t);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 c=t.cloneNode(!0);if(!(c instanceof Element)||!ve(c))throw new Error("oldElClone is not an AnimatableElement");c.style.position="absolute",c.style.top="0",c.style.left="0",c.style.width="100%",c.style.height="100%",c.style.margin="0",c.style.pointerEvents="none",i.appendChild(c);let u=document.createElement("div");u.innerHTML=r;let s=u.firstElementChild;if(!s||!(s instanceof HTMLElement||s instanceof SVGElement))return await this.exit(t,n).finished,t;let p=s.style.cssText,l=t.parentNode,m;if(l instanceof HTMLElement){let k=l.cloneNode(!1),O=window.getComputedStyle(l),V=O.cssText?O.cssText:Array.from(O).reduce((U,$)=>`${U}${$}:${O.getPropertyValue($)};`,"");k.style.cssText=V,k.style.position="absolute",k.style.top="-9999px",k.style.left="-9999px",k.style.visibility="hidden",k.style.pointerEvents="none",k.appendChild(s),document.body.appendChild(k),n.textAnimation&&this.applyTextAnimationToNode(s,n.textAnimation,n),m=s.getBoundingClientRect(),document.body.removeChild(k)}else{let k=document.createElement("div");k.style.position="absolute",k.style.top="-9999px",k.style.left="-9999px",k.style.visibility="hidden",k.appendChild(s),document.body.appendChild(k),n.textAnimation&&this.applyTextAnimationToNode(s,n.textAnimation,n),m=s.getBoundingClientRect(),document.body.removeChild(k)}s.style.cssText=p,s.style.visibility="",s.style.position="absolute",s.style.top="0",s.style.left="0",s.style.width=`${m.width}px`,s.style.height=`${m.height}px`,s.style.margin="0",s.style.opacity="0",i.appendChild(s),t.replaceWith(i);let f=n.exit?.delayMs??n.delayMs,M=n.exit?.durationMs??n.durationMs,L=n.enter?.delayMs??n.delayMs,E=n.enter?.durationMs??n.durationMs,b=[],v=this.resolveKeyframes(n.exit?.keyframes),x=c.animate(v,{duration:M,delay:f,easing:n.easing,fill:"forwards"});b.push(x);let D=this.resolveKeyframes(n.enter?.keyframes),H=s.animate(D,{duration:E,delay:L,easing:n.easing,fill:"forwards"});if(b.push(H),n.animateSize){let k=i.animate([{width:`${o.width}px`,height:`${o.height}px`},{width:`${m.width}px`,height:`${m.height}px`}],{duration:E,delay:L,easing:n.easing,fill:"forwards"});b.push(k)}return await Promise.all(b.map(k=>k.finished)),i.parentNode&&i.replaceWith(s),s.style.cssText=p,c.remove(),s});_(this,"enter",(t,r)=>{let n=r.enter?.delayMs??r.delayMs,i=r.enter?.durationMs??r.durationMs,o=this.resolveKeyframes(r.enter?.keyframes);return t.animate(o,{duration:i,delay:n,easing:r.easing,fill:"forwards"})});_(this,"exit",(t,r)=>{let n=r.exit?.delayMs??r.delayMs,i=r.exit?.durationMs??r.durationMs,o=this.resolveKeyframes(r.exit?.keyframes);return t.animate(o,{duration:i,delay:n,easing:r.easing,fill:"forwards"})});_(this,"resolveKeyframes",t=>t?Array.isArray(t)?t:[t]:[]);_(this,"applyTextAnimationToNode",(t,r,n)=>{let i=r.delayMs??0,o=window.getComputedStyle(t),a=o.getPropertyValue("background-clip")==="text"||o.getPropertyValue("-webkit-background-clip")==="text",c=(u,s,p)=>{if(u.nodeType===Node.TEXT_NODE){let l=u.textContent??"";if(l.trim().length===0)return s;if(r.by==="character"){let L=l.split(/(\s+)/),E=document.createDocumentFragment(),b=s;return L.forEach(v=>{if(v.length===0)return;if(v.trim().length===0){E.appendChild(document.createTextNode(v));return}let x=document.createElement("span");x.style.display="inline-block",x.style.whiteSpace="nowrap",p&&(x.style.setProperty("background","inherit"),x.style.setProperty("-webkit-background-clip","text"),x.style.setProperty("background-clip","text"),x.style.setProperty("color","transparent")),v.split("").forEach(H=>{let k=document.createElement("span");k.textContent=H,k.style.display="inline-block",k.style.opacity="0",p&&(k.style.setProperty("background","inherit"),k.style.setProperty("-webkit-background-clip","text"),k.style.setProperty("background-clip","text"),k.style.setProperty("color","transparent"),k.style.paddingBottom="0.1em",k.style.marginBottom="-0.1em");let O=this.resolveKeyframes(r.keyframes),V=r.durationMs??n.durationMs??300,U=n.easing??"ease",$=k.animate(O,{duration:V,easing:U,delay:b,fill:"forwards"});$.addEventListener("finish",()=>{$.commitStyles(),$.cancel()}),x.appendChild(k),b+=r.staggerMs??50}),E.appendChild(x)}),u.parentNode?.replaceChild(E,u),b}let m;switch(r.by){case"word":m=l.split(/(\s+)/);break;case"line":m=l.split(`
91
+ `);break;default:m=l.split("")}let f=document.createDocumentFragment(),M=s;return m.forEach(L=>{if(L.length===0)return;if(L.trim().length===0){f.appendChild(document.createTextNode(L));return}let b=document.createElement("span");b.textContent=L,b.style.display="inline-block",b.style.opacity="0",p&&(b.style.setProperty("background","inherit"),b.style.setProperty("-webkit-background-clip","text"),b.style.setProperty("background-clip","text"),b.style.setProperty("color","transparent"),b.style.setProperty("will-change","opacity, transform"));let v=this.resolveKeyframes(r.keyframes),x=r.durationMs??n.durationMs??300,D=n.easing??"ease",H=b.animate(v,{duration:x,easing:D,delay:M,fill:"forwards"});H.addEventListener("finish",()=>{H.commitStyles(),H.cancel()}),f.appendChild(b),M+=r.staggerMs??50}),u.parentNode?.replaceChild(f,u),M}if(u.nodeType===Node.ELEMENT_NODE){let l=s,m=Array.from(u.childNodes);for(let f of m)l=c(f,l,p);return l}return s};c(t,i,a)})}},Ut=new Set(["Replace","InsertBefore","InsertAfter","Delete","SetFormField"]),Kt=e=>typeof e=="string",Rr=e=>Array.isArray(e)&&e.every(t=>Kt(t)),Dr=e=>typeof e=="string"&&Ut.has(e),Nr=e=>{if(typeof e!="object"||e===null)return!1;let t=e;return Kt(t.identifier)&&typeof t.markup=="string"&&Rr(t.selectorGuesses)&&Dr(t.action)&&(t.transition===void 0||Lr(t.transition))},Hr=e=>{if(typeof e!="object"||e===null)throw new Error("Invalid response: expected object with data array");let t=e.data;if(!Array.isArray(t))throw new Error("Invalid response: data must be an array");return t.forEach((r,n)=>{if(!Nr(r))throw new Error(`Invalid transformation at index ${n}`)}),t},Qe=class{constructor(t){_(this,"config");_(this,"changeStack",new Map);_(this,"visitorKey",null);_(this,"orchestrator");_(this,"cueCardInstance",null);_(this,"currentPath");_(this,"currentUrl");_(this,"navTicking",!1);_(this,"transitionDefaults");_(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(t){this.log("error","Auto-transformation flow failed with error:",t)}});_(this,"transform",async()=>{try{let t=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 "${Ht}"`,"Exiting...");return}let r=[];try{r=await this.getTransformations(this.currentPath,this.visitorKey)}catch(o){this.log("error_detailed","An error occurred _getting_ transformations",o)}try{await this.applyTransformations(r)}catch(o){this.log("error_detailed","An error occurred _applying_ transformations",o)}let n=new Date,i=this.getDurationInMilliseconds(t,n);this.log("debug",`Transformation complete, took ${this.formatThousands(i)} ms`)}catch(t){this.log("error","An unexpected, top-level error occurred during transformation",t)}});_(this,"log",(t,r,...n)=>{let a=`${`[Kenobi \u25D4] (v${typeof window.__KENOBI_VERSION__<"u"?window.__KENOBI_VERSION__:"dev"})`} [${t.toLocaleUpperCase()}] :: ${r}`;switch(t){case"debug":this.config.debug&&console.log(a,...n);break;case"info":console.log(a,...n);break;case"warn":console.warn(a,...n);break;case"error_detailed":console.trace(...n);case"error":console.error(a,...n);break}});_(this,"resolveTransitionConfig",t=>Sr(this.transitionDefaults,t));_(this,"retrieveElement",t=>{if(!Array.isArray(t)||t.some(r=>typeof r!="string"))throw new Error(`Invalid selectorGuesses payload received: expected array of strings but got ${JSON.stringify(t)}`);for(let r of t){let n=document.querySelector(r);if(n!==null)return n}throw new Error(`Could not find an element in the document with any of these selector patterns: ${t.join(", ")}`)});_(this,"getQueryParam",t=>new URLSearchParams(window.location.search).get(t));_(this,"getCurrentPath",()=>window.location.pathname);_(this,"getCurrentUrl",()=>window.location.pathname+window.location.search+window.location.hash);_(this,"getDurationInMilliseconds",(t,r)=>+r-+t);_(this,"formatThousands",t=>new Intl.NumberFormat("en-US").format(t));_(this,"setDebug",t=>this.config.debug=t);_(this,"isInputElement",t=>!(!(t instanceof HTMLInputElement)&&!(t instanceof HTMLTextAreaElement)&&!(t instanceof HTMLSelectElement)));_(this,"waitForFrames",()=>new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t))));_(this,"waitForIdle",(t=1e3)=>new Promise(r=>"requestIdleCallback"in window?window.requestIdleCallback(()=>r(),{timeout:t}):setTimeout(r,50)));_(this,"waitForLoaded",()=>document.readyState==="complete"?Promise.resolve():new Promise(t=>window.addEventListener("load",()=>t(),{once:!0})));_(this,"waitForQuietDom",(t,r)=>new Promise(n=>{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()+t;(function c(){let u=performance.now();if(u-i>=r){o.disconnect(),n();return}if(u>=a){o.disconnect(),n();return}requestAnimationFrame(c)})()}));_(this,"isFramer",()=>{let t=Array.from(document.scripts).map(n=>n.src||"");return["__framer_events"in window,document.querySelector("[data-framer-root],[data-framer-component],[data-framer-page]"),t.some(n=>/framerusercontent\.com\/sites/i.test(n))].some(n=>!!n)});_(this,"syncVisitorKey",()=>{try{let t=this.getQueryParam(Ht);t?(this.log("debug",`Query param value found (${t}), pushing into session storage`),sessionStorage.setItem(It,t),this.visitorKey=t):this.visitorKey=sessionStorage.getItem(It)}catch(t){this.log("error","Failed to sync visitor key with error:",t)}});_(this,"initNavigationListener",()=>{if("__KENOBI_NAV_HOOKED__"in window)return;window.__KENOBI_NAV_HOOKED__=!0;let t=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()))}))};if("navigation"in window){let i=window.navigation;i&&"addEventListener"in i&&typeof i.addEventListener=="function"&&(i.addEventListener("navigate",()=>t("navigation:navigate")),i.addEventListener("currententrychange",()=>t("navigation:entrychange")),i.addEventListener?.("navigatesuccess",()=>t("navigation:success")))}let r=history.pushState.bind(history),n=history.replaceState.bind(history);history.pushState=((...i)=>{let o=r(...i);return t("pushState"),o}),history.replaceState=((...i)=>{let o=n(...i);return t("replaceState"),o}),window.addEventListener("popstate",()=>t("popstate")),window.addEventListener("hashchange",()=>t("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(()=>t("click"),0)},!0),setInterval(()=>{this.getCurrentUrl()!==this.currentUrl&&t("poll")},1e3)});_(this,"getTransformations",async(t,r)=>{let n=new URLSearchParams({path:t}),i=await fetch(`${this.config.apiHost}/v1/visitor-copy-transformations/${r}?${n.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 Hr(o)});_(this,"validateTransitionPreconditions",(t,r,n)=>{if(n.enabled){let i=document.createElement("div");i.innerHTML=r;let o=i.firstElementChild;if(!o||!ve(o))return this.log("warn",`Transformation "${t}" was skipped: A transition was requested, but the element is not animatable.`),!1}return!0});_(this,"applyTransformations",async(t,r)=>{this.log("debug",`Starting ${t.length} transformations`),r?.shouldConsolidate&&this.changeStack.forEach((n,i)=>{t.find(a=>a.identifier===i)&&this.undo(i)});for(let{identifier:n,...i}of t)try{if(this.changeStack.get(n))throw new Error("Transformation already exists in stack");let o=this.retrieveElement(i.selectorGuesses);switch(i.action){case"Replace":{let a=o.outerHTML,c=this.resolveTransitionConfig(i.transition);if(c.enabled&&ve(o)&&"animate"in o){let u=await this.orchestrator.replaceWithTransition(o,i.markup,c);this.setOrUpdateReplaceChangeRef(n,a,u)}else Se(o,i.markup,{}),this.setOrUpdateReplaceChangeRef(n,a,o);o.nodeName==="VIDEO"&&o.play();break}case"InsertBefore":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(n,i.markup,a))break;o.insertAdjacentHTML("beforebegin",i.markup);let c=o.previousElementSibling;if(c===null)throw new Error("Element wasn't created");if(c.setAttribute(te,n),a.enabled&&ve(c)){let u=c.style.cssText;c.style.opacity="0",this.orchestrator.enter(c,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{c.style.cssText=u},{once:!0})}this.changeStack.set(n,{undoOpts:{type:"Remove",ref:c}});break}case"InsertAfter":{let a=this.resolveTransitionConfig(i.transition);if(!this.validateTransitionPreconditions(n,i.markup,a))break;o.insertAdjacentHTML("afterend",i.markup);let c=o.nextElementSibling;if(c===null)throw new Error("Element wasn't created");if(c.setAttribute(te,n),a.enabled&&ve(c)){let u=c.style.cssText;c.style.opacity="0",this.orchestrator.enter(c,{...a,delayMs:a.enter?.delayMs??a.delayMs}).addEventListener("finish",()=>{c.style.cssText=u},{once:!0})}this.changeStack.set(n,{undoOpts:{type:"Remove",ref:c}});break}case"Delete":{let a=o.outerHTML;Se(o,'<div style="display: none;" data-kenobi-delete-marker="true"></div>',{}),o.setAttribute(te,n),this.changeStack.set(n,{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(te,n),this.changeStack.set(n,{undoOpts:{type:"SetInput",ref:o,content:a}})}}}catch(o){this.log("warn",`Unable to apply transformation with identifier "${n}"`,o)}});_(this,"setOrUpdateReplaceChangeRef",(t,r,n)=>{let i=this.changeStack.get(t);if(!i){n.setAttribute(te,t),this.changeStack.set(t,{undoOpts:{type:"Replace",ref:n,content:r}});return}let o=i.undoOpts.ref;o&&o!==n&&o.isConnected&&o.removeAttribute(te),n.setAttribute(te,t),i.undoOpts.ref=n});_(this,"syncChangeStack",()=>{let t=0;for(let[r,n]of this.changeStack){let i=n.undoOpts.ref;if(!(!!i&&(i.isConnected||document.contains(i)))){this.changeStack.delete(r),t++;continue}i.getAttribute(te)!==r&&(this.changeStack.delete(r),t++)}this.log("debug",`syncChangeStack pruned ${this.formatThousands(t)} stale entries`)});_(this,"undo",t=>{let r=this.changeStack.get(t);if(r===void 0)throw new Error(`Cannot undo stack item with identifier ${t} as it does not exist.`);let{undoOpts:n}=r;switch(n.type){case"Remove":{n.ref.remove();break}case"Replace":{Se(n.ref,n.content),n.ref.removeAttribute(te);break}case"SetInput":{if(!this.isInputElement(n.ref))throw new Error("Element targeted is not of a supported type");this.setInputValue(n.ref,n.content),n.ref.removeAttribute(te);break}}this.changeStack.delete(t)});_(this,"undoAll",()=>{this.changeStack.forEach((t,r)=>this.undo(r))});_(this,"setInputValue",(t,r)=>{let n=t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:t instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLSelectElement.prototype,i=Object.getOwnPropertyDescriptor(n,"value");if(!i?.set)throw new Error("No value setter found");i.set.call(t,r),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))});_(this,"initCueCard",()=>{if(this.cueCardInstance){this.log("warn","CueCard already initialized, skipping...");return}this.cueCardInstance=new ye({theme:"light",position:"top-center",fields:[{name:"companyDomain",label:"Company Name or Domain",placeholder:"example.com",required:!0,minLength:3,errorMessage:"Company name or domain is required"}],hasPersonalization:!0,isVisible:!0,enableFocusMode:!0,showKeyboardHints:!0,focusBlurIntensity:"8px",focusDelayMs:2e3,enableLauncher:!0,onSubmitPersonalization:t=>{this.log("debug","CueCard submitted:",t),this.personalize(t)},onOpenChange:t=>{this.log("debug","CueCard open state changed:",t)}}),this.cueCardInstance.mount(),this.log("debug","CueCard mounted successfully")});_(this,"personalize",async t=>{if(!this.config.publicKey){this.log("error","Cannot personalize: publicKey not configured");return}let r=new Date;this.log("debug","Starting personalization with input:",t),this.cueCardInstance&&this.cueCardInstance.update({status:"starting",progressPct:10});try{let n=await fetch(`${this.config.apiHost}/v1/personalize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({publicKey:this.config.publicKey,input:t,pagePath:this.currentPath})});if(this.cueCardInstance&&this.cueCardInstance.update({progressPct:50}),!n.ok){let c=await n.json().catch(()=>({}));throw new Error(c.error||`API error: ${n.status}`)}let i=await n.json();this.log("debug","Personalization API response:",i),this.cueCardInstance&&this.cueCardInstance.update({progressPct:80}),i.transformations&&Array.isArray(i.transformations)&&await this.applyTransformations(i.transformations,{shouldConsolidate:!0}),this.cueCardInstance&&this.cueCardInstance.update({status:"success",progressPct:100});let o=new Date,a=this.getDurationInMilliseconds(r,o);this.log("debug",`Personalization complete, took ${this.formatThousands(a)} ms`)}catch(n){this.log("error","Personalization failed:",n),this.cueCardInstance&&this.cueCardInstance.update({status:"error",progressPct:0})}});_(this,"getCueCard",()=>this.cueCardInstance);this.config={apiHost:"https://kenobi.ai/api",debug:!1,autoTransform:!0,...t},this.transitionDefaults=Tr(this.config.transitionDefaults),this.orchestrator=new Ye,this.syncVisitorKey(),this.currentPath=this.getCurrentPath(),this.currentUrl=this.getCurrentUrl();try{this.initNavigationListener()}catch(r){this.log("error","Failed to initialize navigation listener with error:",r)}this.log("debug","Kenobi initialized"),this.config.autoTransform&&(this.log("debug","Auto-transform is requested... Starting..."),this.startAutoTransform()),this.config.publicKey&&(this.log("debug","Public key provided, auto-mounting CueCard..."),this.initCueCard())}};return Xt(Ir);})();
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "kenobi-js",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Kenobi JavaScript SDK",
5
- "main": "dist/kenobi.min.js",
5
+ "main": "browser/dist.min.js",
6
6
  "exports": {
7
- ".": "./dist/kenobi.min.js",
7
+ ".": "./browser/dist.min.js",
8
8
  "./lib": "./src/index.ts"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "browser"
12
12
  ],
13
13
  "scripts": {
14
14
  "bump": "pnpm version patch",