obi-sdk 0.19.44-beta.0 → 0.19.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/dist/index.js +1 -1
- package/dist/obi-sdk.standalone.iife.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,4 +53,4 @@ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
|
|
|
53
53
|
}
|
|
54
54
|
`}),g("article",{style:n.skeletonContainer,role:"status","aria-label":"Loading content",children:[g("section",{style:n.headerSection,children:[g("div",{style:n.avatar,role:"img","aria-label":"Loading avatar",children:g("div",{style:n.shimmer})}),g("div",{style:n.textLines,children:[g("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 1",children:g("div",{style:n.shimmer})}),g("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 2",children:g("div",{style:n.shimmer})})]})]}),g("section",{style:n.contentSection,children:g("div",{style:n.contentBlock,role:"presentation","aria-label":"Loading card content",children:g("div",{style:n.shimmer})})})]})]})}function Gw({}){const n={host:{display:"block",height:"161px"},shareContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"grid",placeItems:"center",overflow:"hidden",position:"relative",backgroundColor:"var(--obi-color-tint)"},controlsRow:{zIndex:10,gridRowStart:1,gridColumnStart:1,display:"flex",alignSelf:"flex-start",marginTop:"36px",alignItems:"center",gap:"8px"},monitorIconContainer:{display:"flex",height:"40px",width:"40px",aspectRatio:"1",alignItems:"center",justifyContent:"center",gap:"8px",borderRadius:"2px",border:"1px solid #E4E4E7",background:"#F8FAFC",padding:"8px"},monitorIcon:{width:"24px",height:"24px",color:"#111827"},tabSelector:{display:"flex",width:"260px",height:"40px",padding:"4px",alignItems:"center",borderRadius:"2px",background:"#E4E4E7"},tabButton:e=>({display:"flex",flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",gap:"10px",borderRadius:"2px",padding:"6px 12px",border:"none",cursor:"pointer",fontFamily:"'Inter', sans-serif",fontSize:"14px",fontWeight:500,opacity:e?1:.4,background:e?"white":"#F8FAFC",boxShadow:e?"0 1px 2px 0 rgba(0, 0, 0, 0.05)":"none"}),skeletonContainer:{marginTop:"104px",gridColumnStart:1,gridRowStart:1,alignSelf:"center"}};return g("div",{style:n.host,children:g("div",{style:n.shareContainer,children:[g("div",{style:n.controlsRow,children:[g("div",{style:n.monitorIconContainer,children:g("svg",{style:n.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[g("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),g("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),g("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),g("div",{style:n.tabSelector,children:[g("button",{style:n.tabButton(!1),children:"Tab"}),g("button",{style:n.tabButton(!0),children:"Window"})]})]}),g("div",{style:n.skeletonContainer,children:g(Vw,{})})]})})}function zw({session:n,speakingState:e,onAction:t}){return g(Di,{title:"Connect your screen",subtitle:"Watch for the prompt in your browser",agentName:n.agentName||"Obi",buttonText:"Share screen",speakingState:e,description:`${n.agentName||"Obi"} will guide you through ${n.appName||"the app"} by watching your screen.`,centerVisual:g(Gw,{}),actionDisabled:!0,onAction:t})}function Hw({session:n,speakingState:e,spectrum:t,onAction:i}){return g(Di,{title:"Overview",subtitle:`${n.agentName||"Obi"} will start your tutorial in a moment`,agentName:n.agentName||"Obi",speakingState:e,description:`Get ready to explore ${n.appName||"the app"} with ${n.agentName||"Obi"}.`,centerVisual:g(om,{spectrum:t}),actionDisabled:!0,onAction:i})}function Ww({id:n,name:e,description:t,duration:i=10,order:r=0,selected:s=!1,completed:a=!1,onClick:o}){return g("div",{className:`course-container ${s?"selected":""}`,onClick:()=>{o==null||o({id:n,name:e,description:t,duration:i,order:r})},children:[g("div",{className:"header-row",children:[g("h2",{className:"course-title",children:e}),a&&g("span",{className:"duration",children:"Completed"})]}),t&&g("p",{className:"course-description",children:t})]})}function qw({courses:n=[],selectedCourseId:e=null,loading:t=!1,error:i="",onCourseSelect:r}){const[s,a]=Y(""),o=u=>{const d=u.currentTarget;a(d.value)},c=u=>{r==null||r(u)};if(t)return g("div",{className:"loading",children:"Loading..."});if(i)return g("div",{className:"error",children:i});if(!n||n.length===0)return g("div",{className:"empty",children:"No courses available"});const l=n.filter(u=>u.name.toLowerCase().includes(s.toLowerCase())||(u.description||"").toLowerCase().includes(s.toLowerCase()));return g("div",{className:"tour-select",children:[g("div",{className:"controls",children:[g("div",{className:"tabs",children:g("button",{className:"tab active",children:"All"})}),g("div",{className:"filter",children:[g("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g("path",{d:"M10.0417 8.75002H9.42087L9.20004 8.53502C9.96921 7.63585 10.4417 6.47502 10.4417 5.20835C10.4417 2.56085 8.32254 0.441681 5.67504 0.441681C3.02754 0.441681 0.908374 2.56085 0.908374 5.20835C0.908374 7.85585 3.02754 9.97502 5.67504 9.97502C6.94171 9.97502 8.10254 9.50252 9.00171 8.73335L9.22671 8.95418V9.57502L13.2167 13.5592L14.375 12.4008L10.0417 8.75002ZM5.67504 8.75002C3.72754 8.75002 2.15837 7.18085 2.15837 5.20835C2.15837 3.23585 3.72754 1.66668 5.67504 1.66668C7.62254 1.66668 9.19171 3.23585 9.19171 5.20835C9.19171 7.18085 7.62254 8.75002 5.67504 8.75002Z",fill:"#6B7280"})}),g("input",{type:"text",placeholder:"Search...",value:s,onInput:o})]})]}),g("div",{className:"course-grid",children:l.sort((u,d)=>(u.order||0)-(d.order||0)).map(u=>{const d=u.id===e;return g(Ww,{id:u.id,name:u.name,description:u.description||"",duration:u.duration,order:u.order||0,completed:u.completed,selected:d,onClick:c},u.id)})})]})}function Kw({open:n,courses:e=[],loading:t=!1,error:i="",title:r="AI Coach",productName:s,onClose:a,onCourseSelect:o,onCourseHighlight:c}){const[l,u]=Y(null),d=f=>{u(f),c==null||c(f)},h=()=>{l&&o&&o(l)};return g(Pp,{open:n,onClose:a,size:"large",preventOutsideClick:!0,children:g("div",{className:"tour-select-modal-container",children:[g("div",{className:"header",children:[g("div",{className:"icon",style:{color:"white"},children:g(Wp,{})}),g("div",{className:"title-section",children:t?g(nt,{children:[g("div",{className:"skeleton skeleton-title"}),g("div",{className:"skeleton skeleton-subtitle"})]}):g(nt,{children:[g("h1",{children:r}),g("p",{className:"subtitle",children:["Start a tutorial and learn how to use ",s," through an interactive conversation."]})]})})]}),g("div",{className:"course-list-wrapper",children:g(qw,{courses:e,selectedCourseId:(l==null?void 0:l.id)||"",loading:t,error:i,onCourseSelect:d})}),g("div",{className:"footer",children:[g("button",{className:"obi-button footer-button",onClick:h,disabled:!l,children:[g("span",{children:"Get started"}),g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:g("path",{d:"M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673",stroke:l?"#FAFAFA":"#999","stroke-width":"1.33","stroke-linecap":"round","stroke-linejoin":"round"})})]}),g("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function $w({session:n,sessionState:e,speakingState:t,spectrum:i,onStart:r,onContinue:s,onShareMicrophone:a,onShareScreen:o,onModalChange:c}){const[l,u]=Y(null);function d(f){l!==f&&(c==null||c(f),u(f))}function h(){e==="connecting"||e==="connected"||!e?r==null||r():e==="volume-check"||e==="mic-check"?s==null||s():e==="mic-share"?a==null||a():e==="screen-share"&&(o==null||o())}return fa(()=>{switch(e){case null:case"connecting":case"connected":return d("session-start"),g(Uw,{session:n,speakingState:t,onAction:h});case"volume-check":return d("voice-guidance"),g(jw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-check":return d("overview"),g(Hw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-share":return d("share-mic"),g(Fw,{session:n,speakingState:t,onAction:h});case"screen-share":return d("share-screen"),g(zw,{session:n,speakingState:t,onAction:h});case"navigate":return d("navigate"),g(fw,{session:n,speakingState:t,onAction:h});default:return null}},[e,t,r,s,a,o])}function Yw(n){const{session:e,sessionState:t,speakingState:i,spectrum:r,onClose:s,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:u}=n,[d,h]=Y(null);function f(v){u==null||u(v),h(v)}function m(v){s(v,d),h(null)}const p=(n.open??!0)&&(!t||t==="connecting"||t==="connected"||t==="volume-check"||t==="mic-check"||t==="mic-share"||t==="screen-share"||t==="navigate");return g(cw,{open:p,onClose:m,preventOutsideClick:!0,children:()=>g($w,{session:e,sessionState:t,speakingState:i,spectrum:r,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:f})})}const Xw={identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}};function ii(){return Xw}const Jw=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,cm="9.23.0",Ui=globalThis;function Qw(n,e,t=Ui){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[cm]=i[cm]||{};return r[n]||(r[n]=e())}const Zw="Sentry Logger ",lm=["debug","info","warn","error","log","assert","trace"],um={};function ex(n){if(!("console"in Ui))return n();const e=Ui.console,t={},i=Object.keys(um);i.forEach(r=>{const s=um[r];t[r]=e[r],e[r]=s});try{return n()}finally{i.forEach(r=>{e[r]=t[r]})}}function tx(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return Jw?lm.forEach(t=>{e[t]=(...i)=>{n&&ex(()=>{Ui.console[t](`${Zw}[${t}]:`,...i)})}}):lm.forEach(t=>{e[t]=()=>{}}),e}Qw("logger",tx);const dm=1e3;function nx(){return Date.now()/dm}function ix(){const{performance:n}=Ui;if(!(n!=null&&n.now))return nx;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/dm}ix();const hm=50,Bi="?",fm=/\(error: (.*)\)/,pm=/captureMessage|captureException/;function rx(...n){const e=n.sort((t,i)=>t[0]-i[0]).map(t=>t[1]);return(t,i=0,r=0)=>{const s=[],a=t.split(`
|
|
55
55
|
`);for(let o=i;o<a.length;o++){const c=a[o];if(c.length>1024)continue;const l=fm.test(c)?c.replace(fm,"$1"):c;if(!l.match(/\S*Error: /)){for(const u of e){const d=u(l);if(d){s.push(d);break}}if(s.length>=hm+r)break}}return sx(s.slice(r))}}function sx(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(Ta(e).function||"")&&e.pop(),e.reverse(),pm.test(Ta(e).function||"")&&(e.pop(),pm.test(Ta(e).function||"")&&e.pop()),e.slice(0,hm).map(t=>({...t,filename:t.filename||Ta(e).filename,function:t.function||Bi}))}function Ta(n){return n[n.length-1]||{}}var mm;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(mm||(mm={})),Ui._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const ax=30,ox=50;function Zc(n,e,t,i){const r={filename:n,function:e==="<anonymous>"?Bi:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const cx=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,lx=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ux=/\((\S*)(?::(\d+))(?::(\d+))\)/,dx=n=>{const e=cx.exec(n);if(e){const[,i,r,s]=e;return Zc(i,Bi,+r,+s)}const t=lx.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const s=ux.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}const[i,r]=gm(t[1]||Bi,t[2]);return Zc(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},hx=[ax,dx],fx=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,px=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;rx(...[hx,[ox,n=>{const e=fx.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=px.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let t=e[3],i=e[1]||Bi;return[i,t]=gm(i,t),Zc(t,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const gm=(n,e)=>{const t=n.indexOf("safari-extension")!==-1,i=n.indexOf("safari-web-extension")!==-1;return t||i?[n.indexOf("@")!==-1?n.split("@")[0]:Bi,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function mx(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function gx(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(i=>{try{const r=mx(i);return r.test(t)||r.test(n)}catch(r){return console.warn(`Invalid URL pattern: ${i}`,r),!1}})}function ka(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return gx(e,n)}function vx(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(d){a(d)}}function c(u){try{l(i.throw(u))}catch(d){a(d)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(n,e||[])).next())})}function bx(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1],s=l;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(l);break}s[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(n,t)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var vm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Sa=0;Sa<vm.length;Sa++)xr[vm.charCodeAt(Sa)]=Sa;for(var yx=function(n){var e=n.length*.75,t=n.length,i,r=0,s,a,o,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(l)?l:new Uint8Array(l);for(i=0;i<t;i+=4)s=xr[n.charCodeAt(i)],a=xr[n.charCodeAt(i+1)],o=xr[n.charCodeAt(i+2)],c=xr[n.charCodeAt(i+3)],u[r++]=s<<2|a>>4,u[r++]=(a&15)<<4|o>>2,u[r++]=(o&3)<<6|c&63;return l},Tx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},kx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},ri=5,el=6+5,tl=2,Sx=el-ri,bm=65536>>ri,Cx=1<<ri,nl=Cx-1,wx=1024>>ri,xx=bm+wx,_x=xx,Ex=32,Rx=_x+Ex,Px=65536>>el,Ix=1<<Sx,Ox=Ix-1,ym=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Ax=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},Nx=function(n,e){var t=yx(n),i=Array.isArray(t)?kx(t):new Uint32Array(t),r=Array.isArray(t)?Tx(t):new Uint16Array(t),s=24,a=ym(r,s/2,i[4]/2),o=i[5]===2?ym(r,(s+i[4])/2):Ax(i,Math.ceil((s+i[4])/4));return new Mx(i[0],i[1],i[2],i[3],a,o)},Mx=function(){function n(e,t,i,r,s,a){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=s,this.data=a}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>ri],t=(t<<tl)+(e&nl),this.data[t];if(e<=65535)return t=this.index[bm+(e-55296>>ri)],t=(t<<tl)+(e&nl),this.data[t];if(e<this.highStart)return t=Rx-Px+(e>>el),t=this.index[t],t+=e>>ri&Ox,t=this.index[t],t=(t<<tl)+(e&nl),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),Tm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lx=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ca=0;Ca<Tm.length;Ca++)Lx[Tm.charCodeAt(Ca)]=Ca;var km=null;function Dx(n){return vx(this,void 0,void 0,function(){var e;return bx(this,function(t){switch(t.label){case 0:return km!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw new Error("Invalid graphemes response");km=Nx(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}for(var Sm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ux=typeof Uint8Array>"u"?[]:new Uint8Array(256),wa=0;wa<Sm.length;wa++)Ux[Sm.charCodeAt(wa)]=wa;function Bx(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(d){a(d)}}function c(u){try{l(i.throw(u))}catch(d){a(d)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(n,e||[])).next())})}function Fx(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1],s=l;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(l);break}s[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(n,t)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var Cm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_r=typeof Uint8Array>"u"?[]:new Uint8Array(256),xa=0;xa<Cm.length;xa++)_r[Cm.charCodeAt(xa)]=xa;for(var jx=function(n){var e=n.length*.75,t=n.length,i,r=0,s,a,o,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(l)?l:new Uint8Array(l);for(i=0;i<t;i+=4)s=_r[n.charCodeAt(i)],a=_r[n.charCodeAt(i+1)],o=_r[n.charCodeAt(i+2)],c=_r[n.charCodeAt(i+3)],u[r++]=s<<2|a>>4,u[r++]=(a&15)<<4|o>>2,u[r++]=(o&3)<<6|c&63;return l},Vx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},Gx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},si=5,il=6+5,rl=2,zx=il-si,wm=65536>>si,Hx=1<<si,sl=Hx-1,Wx=1024>>si,qx=wm+Wx,Kx=qx,$x=32,Yx=Kx+$x,Xx=65536>>il,Jx=1<<zx,Qx=Jx-1,xm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Zx=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},e_=function(n,e){var t=jx(n),i=Array.isArray(t)?Gx(t):new Uint32Array(t),r=Array.isArray(t)?Vx(t):new Uint16Array(t),s=24,a=xm(r,s/2,i[4]/2),o=i[5]===2?xm(r,(s+i[4])/2):Zx(i,Math.ceil((s+i[4])/4));return new t_(i[0],i[1],i[2],i[3],a,o)},t_=function(){function n(e,t,i,r,s,a){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=s,this.data=a}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>si],t=(t<<rl)+(e&sl),this.data[t];if(e<=65535)return t=this.index[wm+(e-55296>>si)],t=(t<<rl)+(e&sl),this.data[t];if(e<this.highStart)return t=Yx-Xx+(e>>il),t=this.index[t],t+=e>>si&Qx,t=this.index[t],t=(t<<rl)+(e&sl),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),_m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n_=typeof Uint8Array>"u"?[]:new Uint8Array(256),_a=0;_a<_m.length;_a++)n_[_m.charCodeAt(_a)]=_a;var Em=null;function i_(n){return Bx(this,void 0,void 0,function(){var e;return Fx(this,function(t){switch(t.label){case 0:return Em!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw console.error("invalid graphemes response",e),new Error("Invalid graphemes response");Em=e_(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}const r_=`:root,:host{--obi-modal-padding: 32px 48px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 24px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 372px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:block;flex-grow:1;flex-direction:column;align-items:center;padding:0;width:100%;margin-bottom:16px}.tour-content .title{width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:700;font-size:24px;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0 0 12px}.tour-content .subtitle{width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{flex-grow:0;flex-shrink:0;display:flex;align-items:center;justify-content:center;position:relative;margin-bottom:24px}.tour-content .visual.glow{width:390px;border-radius:15px;background-color:var(--obi-color-tint)}.tour-content .description{height:45px;width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:400;font-size:16px;color:#757575!important;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.tour-content .button-container{flex-grow:0;display:flex;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Inter,sans-serif;font-style:normal;font-weight:500;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{height:100%;flex:1;display:flex;flex-direction:column}.tour-footer{width:100%!important;text-align:center;display:flex;align-items:flex-end;justify-content:center;font-family:Inter,sans-serif;font-size:8px;font-weight:200;margin-top:20px}.session-start-content .description{height:48px}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);transform:translateY(0);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill2.container:not(.active) .pill .text{opacity:0;animation:none}.obi-pill-up.container{display:flex;align-items:flex-end;justify-content:center}.obi-pill-up.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container .pill.button{cursor:pointer}.obi-pill-up.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill-up.container:not(.active) .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container.active{transition:none;height:30px}.obi-pill-up.container.active .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill-up.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill-up.container:not(.active) .pill .text{opacity:0;animation:none}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-message{display:inline-flex;align-items:center;justify-content:center;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:14px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:6px 0;height:100%;flex:1;min-width:0;cursor:pointer}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0;cursor:pointer}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-course-progress .obi-widget-popout,.obi-course-progress .obi-widget-popout .content{z-index:800}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-widget-course-progress{display:block;width:100%;max-width:220px;max-height:40px;opacity:1;transform:translateY(0);overflow:visible;position:relative;z-index:800;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel .obi-widget-course-progress.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:0}.obi-widget-out-of-plan .text{font-size:16px;color:#fff;display:inline-flex;align-items:center;gap:8px;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active{gap:0}.obi-widget-out-of-plan.active:hover,.obi-widget-out-of-plan.active.hover{gap:4px}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.obi-widget-draggable .obi-widget-panel{cursor:grab}.obi-widget-draggable.dragging .obi-widget-panel{cursor:grabbing;-webkit-user-select:none;user-select:none}.obi-static-voice{height:96px;display:flex;flex-direction:column;align-items:center;justify-content:center}.obi-static-voice-visual-title{font-family:Inter,sans-serif;font-style:normal;font-weight:600;font-size:14px;color:var(--obi-color-primary);background-color:var(--obi-color-tint);padding:8px 12px;border-radius:20px;margin-bottom:24px}.obi-static-voice-visual{display:flex;align-items:center;gap:2px;height:32px}.obi-static-voice-visual .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-static-voice-visual .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;background-color:#fff;border-radius:2px;z-index:1}.obi-static-voice-visual .bar-1{height:2px}.obi-static-voice-visual .bar-2{height:6px}.obi-static-voice-visual .bar-3{height:10px}.obi-static-voice-visual .bar-4,.obi-static-voice-visual .bar-5{height:16px}.obi-static-voice-visual .bar-6{height:10px}.obi-static-voice-visual .bar-7{height:6px}.obi-static-voice-visual .bar-8{height:2px}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
|
|
56
|
-
`;function s_(n){var Et,Qt,oi,Er,Rr,Ea,ji,jn,pn,mn,Pr;const[e,t]=Y(!1),[i,r]=Y(!1),[s,a]=Y(!1),[o,c]=Y(!1),[l,u]=Y(null),[d,h]=Y(!1),[f,m]=Y(null),[p,v]=Y(null),[b,C]=Y(null),[x,T]=Y(!1),k=Ie(null),w=Ie(0),_=Ie(0),R=Ie(0),O=Ie(0),B=Ie({width:0,height:0}),N=Ie(null),W=Ie(!1),K=6,M=a_(n.sdk,Q,n.shadowHost,v,A=>{var z,$;a(A),A&&(($=(z=M.client.session)==null?void 0:z.muteMicrophone)==null||$.call(z))},A=>{if(!A){u(null);return}if(ge&&(u(A),!re&&me==="minimized")){h(!0);const z=Math.max(0,A.autoCloseMs??3e3);f&&window.clearTimeout(f);const $=window.setTimeout(()=>h(!1),z);m($)}});function Q(A){var z;(z=M.client)!=null&&z.session||(A?fn():t(!1))}if(!M.client)return null;const X=M.client.planIsCompleted.filter(Boolean).length===M.client.plans.length,Te=o_((Et=M.client.product)==null?void 0:Et.widget_url_blacklist),me=X?M.completedWidgetDisplay||((Qt=M.client.product)==null?void 0:Qt.completed_widget_display):M.widgetDisplay||((oi=M.client.product)==null?void 0:oi.widget_display),we=M.widgetPosition||((Er=M.client.product)==null?void 0:Er.widget_position);let ze=M.isActive;((Ea=(Rr=M.client)==null?void 0:Rr.product)==null?void 0:Ea.name)==="Canibuild"&&(ze=!0);const G=M.client.session,re=!!G;Je(()=>{c(!1)},[G]);const oe=re&&!e;let xe;switch(G==null?void 0:G.speakingState){case"listening":xe="user-speaking";break;case"speaking":xe="agent-speaking";break;case"thinking":xe="thinking";break;case"busy":xe="busy";break}const J=G==null?void 0:G.isPaused,ge=re||M.client.state==="ready"&&ze&&!Te&&(me!=="invisible"||M.client.selectedPlan),De=()=>{var A,z,$,ve,Be,ct,vt;return{name:(A=M.client.selectedPlan)==null?void 0:A.name,description:(z=M.client.selectedPlan)==null?void 0:z.description,appName:($=M.client.product)==null?void 0:$.name,appLogoUrl:((ve=M.client.product)==null?void 0:ve.logo_url)||"",url:(Be=M.client.product)==null?void 0:Be.url,agentName:((ct=M.client.product)==null?void 0:ct.agent_name)||"Obi",legalFooter:((vt=M.client.product)==null?void 0:vt.legal_footer_text)||void 0}};function yt(){const A=we==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return oe?A.top="calc(100vh - 100px)":A.bottom="20px",A}const Tt=(()=>{if(re&&b)return{position:"fixed",left:`${Math.round(b.left)}px`,top:`${Math.round(b.top)}px`,width:"max-content",right:void 0,bottom:void 0,transform:void 0,touchAction:"none"};const A=yt();return re&&(A.touchAction="none"),A})();Je(()=>{re||(C(null),T(!1),k.current=null,W.current=!1,N.current&&(cancelAnimationFrame(N.current),N.current=null))},[re]);function ai(A,z,$){return Math.max(z,Math.min($,A))}function Fi(A){var ct;if(!re)return;const z=A.currentTarget;if(!z)return;const $=A.target;if((ct=$==null?void 0:$.closest)==null?void 0:ct.call($,'button, a[href], input, textarea, select, [role="button"], [contenteditable="true"], [data-no-drag]'))return;k.current=A.pointerId;const Be=z.getBoundingClientRect();w.current=A.clientX,_.current=A.clientY,R.current=Be.left,O.current=Be.top,B.current={width:Be.width,height:Be.height},W.current=!1,C({left:Be.left,top:Be.top})}function te(A){var Gi;if(!re||k.current!==A.pointerId)return;const z=A.clientX-w.current,$=A.clientY-_.current;if(!x){if(Math.hypot(z,$)<K)return;const Zt=A.currentTarget;try{(Gi=Zt==null?void 0:Zt.setPointerCapture)==null||Gi.call(Zt,A.pointerId)}catch{}T(!0),W.current=!0,b||C({left:R.current,top:O.current})}const ve=8,Be=ve,ct=ve,vt=Math.max(ve,window.innerWidth-B.current.width-ve),Vn=Math.max(ve,window.innerHeight-B.current.height-ve),Vi={left:ai(R.current+z,Be,vt),top:ai(O.current+$,ct,Vn)};if(N.current==null){const Ra=Vi;N.current=requestAnimationFrame(()=>{C(Ra),N.current=null})}else C(Vi)}function Ue(A){var z,$;if(k.current!==null)try{($=(z=A.currentTarget)==null?void 0:z.releasePointerCapture)==null||$.call(z,k.current)}catch{}k.current=null,T(!1)}function Qe(A){re&&k.current===A.pointerId&&Ue(A)}function Vt(A){re&&k.current===A.pointerId&&Ue(A)}const fn=()=>{const A=M.client;if(!A)return;const z=A.plans||[];if(z.length===1){const[$]=z;A.selectedPlanUuid!==$.uuid&&(A.selectPlan($),ii().track("course-get-started",{courseName:$.name,courseUuid:$.uuid})),t(!1),r(!0);return}t(!0)};return g("div",{children:[e&&g(Kw,{open:e,courses:M.client.plans.map((A,z)=>{var $,ve;return{id:A.uuid,name:A.name,description:A.description||"",duration:A.duration||0,completed:((ve=($=M.client)==null?void 0:$.planIsCompleted)==null?void 0:ve[z])||!1}}),loading:!1,title:((ji=M.client.product)==null?void 0:ji.assistant_subtitle)||void 0,productName:((jn=M.client.product)==null?void 0:jn.name)||"",onCourseHighlight:A=>{A&&ii().track("course-selected",{courseName:A.name,courseUuid:A.id})},onCourseSelect:A=>{const z=M.client.plans.find($=>$.uuid===A.id)||null;z&&(z==null?void 0:z.uuid)!==M.client.selectedPlanUuid&&(M.client.selectPlan(z),t(!1),r(!0),ii().track("course-get-started",{courseName:A.name,courseUuid:A.id}))},onClose:A=>{A==="user-initiated"&&M.client.selectPlan(null),t(!1)}}),ge&&g(nt,{children:[g("div",{className:re?`obi-widget-draggable${x?" dragging":""}`:void 0,style:Tt,onPointerDown:Fi,onPointerMove:te,onPointerUp:Qe,onPointerCancel:Vt,onClickCapture:A=>{var z,$;W.current&&((z=A.preventDefault)==null||z.call(A),($=A.stopPropagation)==null||$.call(A),W.current=!1)},children:g(sw,{inPlan:re,isActive:i?!1:d?!0:void 0,defaultIsActive:me!=="minimized",isPaused:J,toastMessage:l,messaging:(G==null?void 0:G.isMicShared)===!1||s?!0:void 0,speakingStatus:xe,spectrum:()=>(G==null?void 0:G.audioSpectrum())||null,courseProgress:p,onOpen:fn,onCancelClick:()=>{var A,z,$;o&&(c(!1),(A=M.client.session)!=null&&A.isPaused||($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z))},onCancelAbort:()=>{},onCancel:()=>{var A;(A=M.client.session)==null||A.stop()},onCancelReason:(A,z)=>{},onPause:()=>{var A,z;(z=(A=M.client.session)==null?void 0:A.pause)==null||z.call(A)},onUnpause:()=>{var A,z,$,ve;(z=(A=M.client.session)==null?void 0:A.unpause)==null||z.call(A),(o||s)&&((ve=($=M.client.session)==null?void 0:$.muteMicrophone)==null||ve.call($))},onMessagingChange:A=>{var z,$,ve,Be,ct;a(!1),c(A),A?($=(z=M.client.session)==null?void 0:z.muteMicrophone)==null||$.call(z):(ve=M.client.session)!=null&&ve.isPaused||(ct=(Be=M.client.session)==null?void 0:Be.unmuteMicrophone)==null||ct.call(Be)},onMessageChange:A=>{ii().track("chat-input-provided",{message:A,length:A.length})},onMessage:A=>{var z,$;M.say(A),a(!1),!o&&!(G!=null&&G.isPaused)&&(G==null?void 0:G.isMicShared)!==!1&&(($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z)),ii().track("chat-message-sent",{message:A,length:A.length})},onHover:A=>{},onOneClickAction:A=>{a(!1)},onMinimize:()=>{var A,z,$;o&&(c(!1),(A=M.client.session)!=null&&A.isPaused||($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z))},agentName:((pn=M.client.product)==null?void 0:pn.agent_name)||"Obi",completedTutorials:((mn=M.client.product)==null?void 0:mn.widget_show_progress)===!1?void 0:M.client.planIsCompleted.filter(Boolean).length,totalTutorials:((Pr=M.client.product)==null?void 0:Pr.widget_show_progress)===!1?void 0:M.client.plans.length})}),!!M.client.selectedPlan&&g(Yw,{open:!0,session:De(),sessionState:(G==null?void 0:G.state)||null,speakingState:(G==null?void 0:G.speakingState)||null,spectrum:()=>(G==null?void 0:G.audioSpectrum())||null,onModalChange:A=>{},onClose:(A,z)=>{var $,ve;A==="user-initiated"&&((($=M.client.session)==null?void 0:$.state)==="mic-share"?(ve=M.client.session)==null||ve.shareMicrophoneFailed():M.client.stopSession()),r(!1)},onStart:()=>{M.client.selectedPlanUuid&&M.startSession()},onContinue:()=>{G==null||G.continue()},onShareMicrophone:()=>{G==null||G.shareMicrophone()}})]})]})}function a_(n,e,t,i,r,s){const[a,o]=Y(0),[c,l]=Y(()=>{var p;return((p=n.client)==null?void 0:p.session)||null}),u=Ie(s),d=Ie(null),h=Ie(null);Je(()=>{u.current=s},[s]);const f=p=>{var v;(v=u.current)==null||v.call(u,p)},m=p=>{if(!p||d.current===p)return;h.current&&(h.current(),h.current=null);const v=()=>{o(R=>R+1)},b=()=>{o(R=>R+1)},C=()=>{o(R=>R+1)},x=()=>{o(R=>R+1)},T=R=>{},k=(R,O)=>{},w=()=>{r==null||r(!0),o(R=>R+1)},_=R=>{i(R)};p.on("stateChanged",v),p.on("speakingStateChanged",b),p.on("paused",C),p.on("unpaused",x),p.on("micCheckComplete",T),p.on("transcript",k),p.on&&p.on("textInputRequested",w),p.on&&p.on("courseProgress",_),d.current=p,h.current=()=>{p.off&&p.off("stateChanged",v),p.off&&p.off("speakingStateChanged",b),p.off&&p.off("paused",C),p.off&&p.off("unpaused",x),p.off&&p.off("micCheckComplete",T),p.off&&p.off("transcript",k),p.off&&p.off("courseProgress",_),p.off&&p.off("textInputRequested",w)}};return Je(()=>{const p=b=>{e(b)};n.on("showMenu",p);const v=()=>{o(b=>b+1)};return n.on("configUpdated",v),n.on("showMessage",f),()=>{var b,C,x;(b=n.off)==null||b.call(n,"showMenu",p),(C=n.off)==null||C.call(n,"configUpdated",v),(x=n.off)==null||x.call(n,"showMessage",f)}},[n]),Je(()=>{var p;n.client&&(n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((p=n.client.product)==null?void 0:p.primary_color)||"#9500FF"),n.client.session&&(l(n.client.session),m(n.client.session)),n.client.on("sessionStarted",v=>{l(v),r==null||r(!1),o(b=>b+1),m(v)}),n.client.on("sessionStopped",()=>{h.current&&(h.current(),h.current=null),d.current=null,l(null),r==null||r(!1),o(v=>v+1)}),n.client.on("sessionShutdown",()=>{o(v=>v+1)}),n.client.on("sessionResumed",()=>{o(v=>v+1)}),n.client.on("stateChanged",()=>{var v;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((v=n.client.product)==null?void 0:v.primary_color)||"#9500FF"),o(b=>b+1)}),n.client.on("planSelected",()=>{o(v=>v+1)}))},[n,n.client]),yr(()=>{if(c)return m(c),()=>{d.current===c&&h.current&&(h.current(),h.current=null,d.current=null)}},[c]),n}function o_(n){const[e,t]=Y(()=>ka(n));return Je(()=>{t(ka(n))},[n]),Je(()=>{c_();const i=()=>{t(ka(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function c_(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...s){const a=r.apply(this,s);return window.dispatchEvent(new Event("locationchange")),a};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function l_(n){if(document.querySelector("obi-widget"))return;u_();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(r_),t.adoptedStyleSheets=[r],S1(g(s_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function u_(){Rm("https://fonts.cdnfonts.com/css/satoshi"),Rm("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function Rm(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Pm="49206C6F7665204F6269_session",Im="obi-url-params";class d_ extends Ia{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,i)=>{var r,s,a,o,c;switch(this.commandLog.push({commandType:t,args:i}),t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const l=(((r=this.client)==null?void 0:r.plans)||[]).find(u=>u.uuid===i.planUuid)||null;if(!l){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(a=(s=this.client)==null?void 0:s.selectPlan)==null||a.call(s,l);break;case"stopSession":(c=(o=this.client)==null?void 0:o.stopSession)==null||c.call(o);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=oa.deserialise(i,e,"sdk",{apiBaseUrl:"https://staging.coragents.ai",captureScreen:this.captureScreen.bind(this)}),t?this._resumed=!0:localStorage.removeItem("obi-client")}catch(r){console.error("[obi] error loading cached client",r),localStorage.removeItem("obi-client")}t||(t=new oa(e,"sdk",{apiBaseUrl:"https://staging.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var s,a,o,c,l,u,d,h,f,m;r==="ready"&&this.updateConfig({isActive:((s=window==null?void 0:window.obiWidgetConfig)==null?void 0:s.isActive)??((a=this.client)==null?void 0:a.showWidget),primaryColour:((c=(o=this.client)==null?void 0:o.product)==null?void 0:c.primary_color)||"#9500FF",widgetDisplay:((l=window==null?void 0:window.obiWidgetConfig)==null?void 0:l.widgetDisplay)||((d=(u=this.client)==null?void 0:u.product)==null?void 0:d.widget_display)||"regular",completedWidgetDisplay:((h=window==null?void 0:window.obiWidgetConfig)==null?void 0:h.completedWidgetDisplay)||((m=(f=this.client)==null?void 0:f.product)==null?void 0:m.completed_widget_display)||"regular"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",()=>{localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,s)=>{}),this.client.session&&(this.client.session.isPaused,this.client.resumeSession(r=>{r.on("stateChanged",s=>{s!=="disconnecting"&&s!=="disconnected"&&s!=="error"&&s!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})}))}_maybeActOnServerEngagement(){var o;const e=this.client;if(!e||e.state!=="ready")return;const t=e.product,i=(o=e.engagement)==null?void 0:o.style;if(!i||t&&ka(t.widget_url_blacklist||[])||!e.showWidget)return;const r=e.plans||[],s=e.planIsCompleted||[],a=r.length>0&&s.filter(Boolean).length===r.length;if(!(r.length===0||a)){if(i==="modal"){const c=s.findIndex(u=>!u),l=c>=0?r[c]:null;l&&e.selectPlan(l)}else i==="popover"&&setTimeout(()=>{this.showMessage("Don't forget to complete your onboarding",{autoCloseMs:1e4})},1e3);try{ii().track("engagement-prompt-shown",{style:i})}catch{}}}async initialise(e={}){var t;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0,identity:((t=window==null?void 0:window.obiWidgetConfig)==null?void 0:t.user)||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}this.dispatchCommandQueue()}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i,r;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;(r=this.client)==null||r.identity;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&ii().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlanUuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()}),e.on("paused",()=>{this.save()}),e.on("unpaused",()=>{this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(Im)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[Pm];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Pm),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Im),this.passivePlanUuid=t}mountWidget(){l_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Dx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await i_(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await RT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var t;const e=((t=this.client)==null?void 0:t.serialise())||"";localStorage.setItem("obi-client",e)}load(){return localStorage.getItem("obi-client")}}async function Om(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return h_({appToken:n,window:t,init:e})}async function h_({appToken:n,window:e,init:t}){var s,a;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t&&t(),n||(n=(s=e==null?void 0:e.obiWidgetConfig)==null?void 0:s.apiKey);let i;try{i=((a=e.ObiSDK)==null?void 0:a.q)||[]}catch{i=[]}const r=new d_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Am(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Om(void 0,Am)}):Om(void 0,Am)})();
|
|
56
|
+
`;function s_(n){var Et,Qt,oi,Er,Rr,Ea,ji,jn,pn,mn,Pr;const[e,t]=Y(!1),[i,r]=Y(!1),[s,a]=Y(!1),[o,c]=Y(!1),[l,u]=Y(null),[d,h]=Y(!1),[f,m]=Y(null),[p,v]=Y(null),[b,C]=Y(null),[x,T]=Y(!1),k=Ie(null),w=Ie(0),_=Ie(0),R=Ie(0),O=Ie(0),B=Ie({width:0,height:0}),N=Ie(null),W=Ie(!1),K=6,M=a_(n.sdk,Q,n.shadowHost,v,A=>{var z,$;a(A),A&&(($=(z=M.client.session)==null?void 0:z.muteMicrophone)==null||$.call(z))},A=>{if(!A){u(null);return}if(ge&&(u(A),!re&&me==="minimized")){h(!0);const z=Math.max(0,A.autoCloseMs??3e3);f&&window.clearTimeout(f);const $=window.setTimeout(()=>h(!1),z);m($)}});function Q(A){var z;(z=M.client)!=null&&z.session||(A?fn():t(!1))}if(!M.client)return null;const X=M.client.planIsCompleted.filter(Boolean).length===M.client.plans.length,Te=o_((Et=M.client.product)==null?void 0:Et.widget_url_blacklist),me=X?M.completedWidgetDisplay||((Qt=M.client.product)==null?void 0:Qt.completed_widget_display):M.widgetDisplay||((oi=M.client.product)==null?void 0:oi.widget_display),we=M.widgetPosition||((Er=M.client.product)==null?void 0:Er.widget_position);let ze=M.isActive;((Ea=(Rr=M.client)==null?void 0:Rr.product)==null?void 0:Ea.name)==="Canibuild"&&(ze=!0);const G=M.client.session,re=!!G;Je(()=>{c(!1)},[G]);const oe=re&&!e;let xe;switch(G==null?void 0:G.speakingState){case"listening":xe="user-speaking";break;case"speaking":xe="agent-speaking";break;case"thinking":xe="thinking";break;case"busy":xe="busy";break}const J=G==null?void 0:G.isPaused,ge=re||M.client.state==="ready"&&ze&&!Te&&(me!=="invisible"||M.client.selectedPlan),De=()=>{var A,z,$,ve,Be,ct,vt;return{name:(A=M.client.selectedPlan)==null?void 0:A.name,description:(z=M.client.selectedPlan)==null?void 0:z.description,appName:($=M.client.product)==null?void 0:$.name,appLogoUrl:((ve=M.client.product)==null?void 0:ve.logo_url)||"",url:(Be=M.client.product)==null?void 0:Be.url,agentName:((ct=M.client.product)==null?void 0:ct.agent_name)||"Obi",legalFooter:((vt=M.client.product)==null?void 0:vt.legal_footer_text)||void 0}};function yt(){const A=we==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return oe?A.top="calc(100vh - 100px)":A.bottom="20px",A}const Tt=(()=>{if(re&&b)return{position:"fixed",left:`${Math.round(b.left)}px`,top:`${Math.round(b.top)}px`,width:"max-content",right:void 0,bottom:void 0,transform:void 0,touchAction:"none"};const A=yt();return re&&(A.touchAction="none"),A})();Je(()=>{re||(C(null),T(!1),k.current=null,W.current=!1,N.current&&(cancelAnimationFrame(N.current),N.current=null))},[re]);function ai(A,z,$){return Math.max(z,Math.min($,A))}function Fi(A){var ct;if(!re)return;const z=A.currentTarget;if(!z)return;const $=A.target;if((ct=$==null?void 0:$.closest)==null?void 0:ct.call($,'button, a[href], input, textarea, select, [role="button"], [contenteditable="true"], [data-no-drag]'))return;k.current=A.pointerId;const Be=z.getBoundingClientRect();w.current=A.clientX,_.current=A.clientY,R.current=Be.left,O.current=Be.top,B.current={width:Be.width,height:Be.height},W.current=!1,C({left:Be.left,top:Be.top})}function te(A){var Gi;if(!re||k.current!==A.pointerId)return;const z=A.clientX-w.current,$=A.clientY-_.current;if(!x){if(Math.hypot(z,$)<K)return;const Zt=A.currentTarget;try{(Gi=Zt==null?void 0:Zt.setPointerCapture)==null||Gi.call(Zt,A.pointerId)}catch{}T(!0),W.current=!0,b||C({left:R.current,top:O.current})}const ve=8,Be=ve,ct=ve,vt=Math.max(ve,window.innerWidth-B.current.width-ve),Vn=Math.max(ve,window.innerHeight-B.current.height-ve),Vi={left:ai(R.current+z,Be,vt),top:ai(O.current+$,ct,Vn)};if(N.current==null){const Ra=Vi;N.current=requestAnimationFrame(()=>{C(Ra),N.current=null})}else C(Vi)}function Ue(A){var z,$;if(k.current!==null)try{($=(z=A.currentTarget)==null?void 0:z.releasePointerCapture)==null||$.call(z,k.current)}catch{}k.current=null,T(!1)}function Qe(A){re&&k.current===A.pointerId&&Ue(A)}function Vt(A){re&&k.current===A.pointerId&&Ue(A)}const fn=()=>{const A=M.client;if(!A)return;const z=A.plans||[];if(z.length===1){const[$]=z;A.selectedPlanUuid!==$.uuid&&(A.selectPlan($),ii().track("course-get-started",{courseName:$.name,courseUuid:$.uuid})),t(!1),r(!0);return}t(!0)};return g("div",{children:[e&&g(Kw,{open:e,courses:M.client.plans.map((A,z)=>{var $,ve;return{id:A.uuid,name:A.name,description:A.description||"",duration:A.duration||0,completed:((ve=($=M.client)==null?void 0:$.planIsCompleted)==null?void 0:ve[z])||!1}}),loading:!1,title:((ji=M.client.product)==null?void 0:ji.assistant_subtitle)||void 0,productName:((jn=M.client.product)==null?void 0:jn.name)||"",onCourseHighlight:A=>{A&&ii().track("course-selected",{courseName:A.name,courseUuid:A.id})},onCourseSelect:A=>{const z=M.client.plans.find($=>$.uuid===A.id)||null;z&&(z==null?void 0:z.uuid)!==M.client.selectedPlanUuid&&(M.client.selectPlan(z),t(!1),r(!0),ii().track("course-get-started",{courseName:A.name,courseUuid:A.id}))},onClose:A=>{A==="user-initiated"&&M.client.selectPlan(null),t(!1)}}),ge&&g(nt,{children:[g("div",{className:re?`obi-widget-draggable${x?" dragging":""}`:void 0,style:Tt,onPointerDown:Fi,onPointerMove:te,onPointerUp:Qe,onPointerCancel:Vt,onClickCapture:A=>{var z,$;W.current&&((z=A.preventDefault)==null||z.call(A),($=A.stopPropagation)==null||$.call(A),W.current=!1)},children:g(sw,{inPlan:re,isActive:i?!1:d?!0:void 0,defaultIsActive:me!=="minimized",isPaused:J,toastMessage:l,messaging:(G==null?void 0:G.isMicShared)===!1||s?!0:void 0,speakingStatus:xe,spectrum:()=>(G==null?void 0:G.audioSpectrum())||null,courseProgress:p,onOpen:fn,onCancelClick:()=>{var A,z,$;o&&(c(!1),(A=M.client.session)!=null&&A.isPaused||($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z))},onCancelAbort:()=>{},onCancel:()=>{var A;(A=M.client.session)==null||A.stop()},onCancelReason:(A,z)=>{},onPause:()=>{var A,z;(z=(A=M.client.session)==null?void 0:A.pause)==null||z.call(A)},onUnpause:()=>{var A,z,$,ve;(z=(A=M.client.session)==null?void 0:A.unpause)==null||z.call(A),(o||s)&&((ve=($=M.client.session)==null?void 0:$.muteMicrophone)==null||ve.call($))},onMessagingChange:A=>{var z,$,ve,Be,ct;a(!1),c(A),A?($=(z=M.client.session)==null?void 0:z.muteMicrophone)==null||$.call(z):(ve=M.client.session)!=null&&ve.isPaused||(ct=(Be=M.client.session)==null?void 0:Be.unmuteMicrophone)==null||ct.call(Be)},onMessageChange:A=>{ii().track("chat-input-provided",{message:A,length:A.length})},onMessage:A=>{var z,$;M.say(A),a(!1),!o&&!(G!=null&&G.isPaused)&&(G==null?void 0:G.isMicShared)!==!1&&(($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z)),ii().track("chat-message-sent",{message:A,length:A.length})},onHover:A=>{},onOneClickAction:A=>{a(!1)},onMinimize:()=>{var A,z,$;o&&(c(!1),(A=M.client.session)!=null&&A.isPaused||($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z))},agentName:((pn=M.client.product)==null?void 0:pn.agent_name)||"Obi",completedTutorials:((mn=M.client.product)==null?void 0:mn.widget_show_progress)===!1?void 0:M.client.planIsCompleted.filter(Boolean).length,totalTutorials:((Pr=M.client.product)==null?void 0:Pr.widget_show_progress)===!1?void 0:M.client.plans.length})}),!!M.client.selectedPlan&&g(Yw,{open:!0,session:De(),sessionState:(G==null?void 0:G.state)||null,speakingState:(G==null?void 0:G.speakingState)||null,spectrum:()=>(G==null?void 0:G.audioSpectrum())||null,onModalChange:A=>{},onClose:(A,z)=>{var $,ve;A==="user-initiated"&&((($=M.client.session)==null?void 0:$.state)==="mic-share"?(ve=M.client.session)==null||ve.shareMicrophoneFailed():M.client.stopSession()),r(!1)},onStart:()=>{M.client.selectedPlanUuid&&M.startSession()},onContinue:()=>{G==null||G.continue()},onShareMicrophone:()=>{G==null||G.shareMicrophone()}})]})]})}function a_(n,e,t,i,r,s){const[a,o]=Y(0),[c,l]=Y(()=>{var p;return((p=n.client)==null?void 0:p.session)||null}),u=Ie(s),d=Ie(null),h=Ie(null);Je(()=>{u.current=s},[s]);const f=p=>{var v;(v=u.current)==null||v.call(u,p)},m=p=>{if(!p||d.current===p)return;h.current&&(h.current(),h.current=null);const v=()=>{o(R=>R+1)},b=()=>{o(R=>R+1)},C=()=>{o(R=>R+1)},x=()=>{o(R=>R+1)},T=R=>{},k=(R,O)=>{},w=()=>{r==null||r(!0),o(R=>R+1)},_=R=>{i(R)};p.on("stateChanged",v),p.on("speakingStateChanged",b),p.on("paused",C),p.on("unpaused",x),p.on("micCheckComplete",T),p.on("transcript",k),p.on&&p.on("textInputRequested",w),p.on&&p.on("courseProgress",_),d.current=p,h.current=()=>{p.off&&p.off("stateChanged",v),p.off&&p.off("speakingStateChanged",b),p.off&&p.off("paused",C),p.off&&p.off("unpaused",x),p.off&&p.off("micCheckComplete",T),p.off&&p.off("transcript",k),p.off&&p.off("courseProgress",_),p.off&&p.off("textInputRequested",w)}};return Je(()=>{const p=b=>{e(b)};n.on("showMenu",p);const v=()=>{o(b=>b+1)};return n.on("configUpdated",v),n.on("showMessage",f),()=>{var b,C,x;(b=n.off)==null||b.call(n,"showMenu",p),(C=n.off)==null||C.call(n,"configUpdated",v),(x=n.off)==null||x.call(n,"showMessage",f)}},[n]),Je(()=>{var p;n.client&&(n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((p=n.client.product)==null?void 0:p.primary_color)||"#9500FF"),n.client.session&&(l(n.client.session),m(n.client.session)),n.client.on("sessionStarted",v=>{l(v),r==null||r(!1),o(b=>b+1),m(v)}),n.client.on("sessionStopped",()=>{h.current&&(h.current(),h.current=null),d.current=null,l(null),r==null||r(!1),o(v=>v+1)}),n.client.on("sessionShutdown",()=>{o(v=>v+1)}),n.client.on("sessionResumed",()=>{o(v=>v+1)}),n.client.on("stateChanged",()=>{var v;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((v=n.client.product)==null?void 0:v.primary_color)||"#9500FF"),o(b=>b+1)}),n.client.on("planSelected",()=>{o(v=>v+1)}))},[n,n.client]),yr(()=>{if(c)return m(c),()=>{d.current===c&&h.current&&(h.current(),h.current=null,d.current=null)}},[c]),n}function o_(n){const[e,t]=Y(()=>ka(n));return Je(()=>{t(ka(n))},[n]),Je(()=>{c_();const i=()=>{t(ka(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function c_(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...s){const a=r.apply(this,s);return window.dispatchEvent(new Event("locationchange")),a};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function l_(n){if(document.querySelector("obi-widget"))return;u_();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(r_),t.adoptedStyleSheets=[r],S1(g(s_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function u_(){Rm("https://fonts.cdnfonts.com/css/satoshi"),Rm("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function Rm(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Pm="49206C6F7665204F6269_session",Im="obi-url-params";class d_ extends Ia{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,i)=>{var r,s,a,o,c;switch(this.commandLog.push({commandType:t,args:i}),t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const l=(((r=this.client)==null?void 0:r.plans)||[]).find(u=>u.uuid===i.planUuid)||null;if(!l){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(a=(s=this.client)==null?void 0:s.selectPlan)==null||a.call(s,l);break;case"stopSession":(c=(o=this.client)==null?void 0:o.stopSession)==null||c.call(o);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=oa.deserialise(i,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),t?this._resumed=!0:localStorage.removeItem("obi-client")}catch(r){console.error("[obi] error loading cached client",r),localStorage.removeItem("obi-client")}t||(t=new oa(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var s,a,o,c,l,u,d,h,f,m;r==="ready"&&this.updateConfig({isActive:((s=window==null?void 0:window.obiWidgetConfig)==null?void 0:s.isActive)??((a=this.client)==null?void 0:a.showWidget),primaryColour:((c=(o=this.client)==null?void 0:o.product)==null?void 0:c.primary_color)||"#9500FF",widgetDisplay:((l=window==null?void 0:window.obiWidgetConfig)==null?void 0:l.widgetDisplay)||((d=(u=this.client)==null?void 0:u.product)==null?void 0:d.widget_display)||"regular",completedWidgetDisplay:((h=window==null?void 0:window.obiWidgetConfig)==null?void 0:h.completedWidgetDisplay)||((m=(f=this.client)==null?void 0:f.product)==null?void 0:m.completed_widget_display)||"regular"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",()=>{localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,s)=>{}),this.client.session&&(this.client.session.isPaused,this.client.resumeSession(r=>{r.on("stateChanged",s=>{s!=="disconnecting"&&s!=="disconnected"&&s!=="error"&&s!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})}))}_maybeActOnServerEngagement(){var o;const e=this.client;if(!e||e.state!=="ready")return;const t=e.product,i=(o=e.engagement)==null?void 0:o.style;if(!i||t&&ka(t.widget_url_blacklist||[])||!e.showWidget)return;const r=e.plans||[],s=e.planIsCompleted||[],a=r.length>0&&s.filter(Boolean).length===r.length;if(!(r.length===0||a)){if(i==="modal"){const c=s.findIndex(u=>!u),l=c>=0?r[c]:null;l&&e.selectPlan(l)}else i==="popover"&&setTimeout(()=>{this.showMessage("Don't forget to complete your onboarding",{autoCloseMs:1e4})},1e3);try{ii().track("engagement-prompt-shown",{style:i})}catch{}}}async initialise(e={}){var t;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0,identity:((t=window==null?void 0:window.obiWidgetConfig)==null?void 0:t.user)||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}this.dispatchCommandQueue()}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i,r;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;(r=this.client)==null||r.identity;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&ii().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlanUuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()}),e.on("paused",()=>{this.save()}),e.on("unpaused",()=>{this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(Im)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[Pm];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Pm),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Im),this.passivePlanUuid=t}mountWidget(){l_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Dx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await i_(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await RT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var t;const e=((t=this.client)==null?void 0:t.serialise())||"";localStorage.setItem("obi-client",e)}load(){return localStorage.getItem("obi-client")}}async function Om(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return h_({appToken:n,window:t,init:e})}async function h_({appToken:n,window:e,init:t}){var s,a;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t&&t(),n||(n=(s=e==null?void 0:e.obiWidgetConfig)==null?void 0:s.apiKey);let i;try{i=((a=e.ObiSDK)==null?void 0:a.q)||[]}catch{i=[]}const r=new d_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Am(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Om(void 0,Am)}):Om(void 0,Am)})();
|
|
@@ -53,4 +53,4 @@ a=extmap-allow-mixed`)!==-1){const s=r.sdp.split(`
|
|
|
53
53
|
}
|
|
54
54
|
`}),g("article",{style:n.skeletonContainer,role:"status","aria-label":"Loading content",children:[g("section",{style:n.headerSection,children:[g("div",{style:n.avatar,role:"img","aria-label":"Loading avatar",children:g("div",{style:n.shimmer})}),g("div",{style:n.textLines,children:[g("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 1",children:g("div",{style:n.shimmer})}),g("div",{style:n.textLine,role:"presentation","aria-label":"Loading text line 2",children:g("div",{style:n.shimmer})})]})]}),g("section",{style:n.contentSection,children:g("div",{style:n.contentBlock,role:"presentation","aria-label":"Loading card content",children:g("div",{style:n.shimmer})})})]})]})}function Gw({}){const n={host:{display:"block",height:"161px"},shareContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"grid",placeItems:"center",overflow:"hidden",position:"relative",backgroundColor:"var(--obi-color-tint)"},controlsRow:{zIndex:10,gridRowStart:1,gridColumnStart:1,display:"flex",alignSelf:"flex-start",marginTop:"36px",alignItems:"center",gap:"8px"},monitorIconContainer:{display:"flex",height:"40px",width:"40px",aspectRatio:"1",alignItems:"center",justifyContent:"center",gap:"8px",borderRadius:"2px",border:"1px solid #E4E4E7",background:"#F8FAFC",padding:"8px"},monitorIcon:{width:"24px",height:"24px",color:"#111827"},tabSelector:{display:"flex",width:"260px",height:"40px",padding:"4px",alignItems:"center",borderRadius:"2px",background:"#E4E4E7"},tabButton:e=>({display:"flex",flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",gap:"10px",borderRadius:"2px",padding:"6px 12px",border:"none",cursor:"pointer",fontFamily:"'Inter', sans-serif",fontSize:"14px",fontWeight:500,opacity:e?1:.4,background:e?"white":"#F8FAFC",boxShadow:e?"0 1px 2px 0 rgba(0, 0, 0, 0.05)":"none"}),skeletonContainer:{marginTop:"104px",gridColumnStart:1,gridRowStart:1,alignSelf:"center"}};return g("div",{style:n.host,children:g("div",{style:n.shareContainer,children:[g("div",{style:n.controlsRow,children:[g("div",{style:n.monitorIconContainer,children:g("svg",{style:n.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[g("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),g("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),g("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),g("div",{style:n.tabSelector,children:[g("button",{style:n.tabButton(!1),children:"Tab"}),g("button",{style:n.tabButton(!0),children:"Window"})]})]}),g("div",{style:n.skeletonContainer,children:g(Vw,{})})]})})}function zw({session:n,speakingState:e,onAction:t}){return g(Di,{title:"Connect your screen",subtitle:"Watch for the prompt in your browser",agentName:n.agentName||"Obi",buttonText:"Share screen",speakingState:e,description:`${n.agentName||"Obi"} will guide you through ${n.appName||"the app"} by watching your screen.`,centerVisual:g(Gw,{}),actionDisabled:!0,onAction:t})}function Hw({session:n,speakingState:e,spectrum:t,onAction:i}){return g(Di,{title:"Overview",subtitle:`${n.agentName||"Obi"} will start your tutorial in a moment`,agentName:n.agentName||"Obi",speakingState:e,description:`Get ready to explore ${n.appName||"the app"} with ${n.agentName||"Obi"}.`,centerVisual:g(om,{spectrum:t}),actionDisabled:!0,onAction:i})}function Ww({id:n,name:e,description:t,duration:i=10,order:r=0,selected:s=!1,completed:a=!1,onClick:o}){return g("div",{className:`course-container ${s?"selected":""}`,onClick:()=>{o==null||o({id:n,name:e,description:t,duration:i,order:r})},children:[g("div",{className:"header-row",children:[g("h2",{className:"course-title",children:e}),a&&g("span",{className:"duration",children:"Completed"})]}),t&&g("p",{className:"course-description",children:t})]})}function qw({courses:n=[],selectedCourseId:e=null,loading:t=!1,error:i="",onCourseSelect:r}){const[s,a]=Y(""),o=u=>{const d=u.currentTarget;a(d.value)},c=u=>{r==null||r(u)};if(t)return g("div",{className:"loading",children:"Loading..."});if(i)return g("div",{className:"error",children:i});if(!n||n.length===0)return g("div",{className:"empty",children:"No courses available"});const l=n.filter(u=>u.name.toLowerCase().includes(s.toLowerCase())||(u.description||"").toLowerCase().includes(s.toLowerCase()));return g("div",{className:"tour-select",children:[g("div",{className:"controls",children:[g("div",{className:"tabs",children:g("button",{className:"tab active",children:"All"})}),g("div",{className:"filter",children:[g("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g("path",{d:"M10.0417 8.75002H9.42087L9.20004 8.53502C9.96921 7.63585 10.4417 6.47502 10.4417 5.20835C10.4417 2.56085 8.32254 0.441681 5.67504 0.441681C3.02754 0.441681 0.908374 2.56085 0.908374 5.20835C0.908374 7.85585 3.02754 9.97502 5.67504 9.97502C6.94171 9.97502 8.10254 9.50252 9.00171 8.73335L9.22671 8.95418V9.57502L13.2167 13.5592L14.375 12.4008L10.0417 8.75002ZM5.67504 8.75002C3.72754 8.75002 2.15837 7.18085 2.15837 5.20835C2.15837 3.23585 3.72754 1.66668 5.67504 1.66668C7.62254 1.66668 9.19171 3.23585 9.19171 5.20835C9.19171 7.18085 7.62254 8.75002 5.67504 8.75002Z",fill:"#6B7280"})}),g("input",{type:"text",placeholder:"Search...",value:s,onInput:o})]})]}),g("div",{className:"course-grid",children:l.sort((u,d)=>(u.order||0)-(d.order||0)).map(u=>{const d=u.id===e;return g(Ww,{id:u.id,name:u.name,description:u.description||"",duration:u.duration,order:u.order||0,completed:u.completed,selected:d,onClick:c},u.id)})})]})}function Kw({open:n,courses:e=[],loading:t=!1,error:i="",title:r="AI Coach",productName:s,onClose:a,onCourseSelect:o,onCourseHighlight:c}){const[l,u]=Y(null),d=f=>{u(f),c==null||c(f)},h=()=>{l&&o&&o(l)};return g(Pp,{open:n,onClose:a,size:"large",preventOutsideClick:!0,children:g("div",{className:"tour-select-modal-container",children:[g("div",{className:"header",children:[g("div",{className:"icon",style:{color:"white"},children:g(Wp,{})}),g("div",{className:"title-section",children:t?g(nt,{children:[g("div",{className:"skeleton skeleton-title"}),g("div",{className:"skeleton skeleton-subtitle"})]}):g(nt,{children:[g("h1",{children:r}),g("p",{className:"subtitle",children:["Start a tutorial and learn how to use ",s," through an interactive conversation."]})]})})]}),g("div",{className:"course-list-wrapper",children:g(qw,{courses:e,selectedCourseId:(l==null?void 0:l.id)||"",loading:t,error:i,onCourseSelect:d})}),g("div",{className:"footer",children:[g("button",{className:"obi-button footer-button",onClick:h,disabled:!l,children:[g("span",{children:"Get started"}),g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:g("path",{d:"M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673",stroke:l?"#FAFAFA":"#999","stroke-width":"1.33","stroke-linecap":"round","stroke-linejoin":"round"})})]}),g("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function $w({session:n,sessionState:e,speakingState:t,spectrum:i,onStart:r,onContinue:s,onShareMicrophone:a,onShareScreen:o,onModalChange:c}){const[l,u]=Y(null);function d(f){l!==f&&(c==null||c(f),u(f))}function h(){e==="connecting"||e==="connected"||!e?r==null||r():e==="volume-check"||e==="mic-check"?s==null||s():e==="mic-share"?a==null||a():e==="screen-share"&&(o==null||o())}return fa(()=>{switch(e){case null:case"connecting":case"connected":return d("session-start"),g(Uw,{session:n,speakingState:t,onAction:h});case"volume-check":return d("voice-guidance"),g(jw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-check":return d("overview"),g(Hw,{session:n,speakingState:t,spectrum:i,onAction:h});case"mic-share":return d("share-mic"),g(Fw,{session:n,speakingState:t,onAction:h});case"screen-share":return d("share-screen"),g(zw,{session:n,speakingState:t,onAction:h});case"navigate":return d("navigate"),g(fw,{session:n,speakingState:t,onAction:h});default:return null}},[e,t,r,s,a,o])}function Yw(n){const{session:e,sessionState:t,speakingState:i,spectrum:r,onClose:s,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:u}=n,[d,h]=Y(null);function f(v){u==null||u(v),h(v)}function m(v){s(v,d),h(null)}const p=(n.open??!0)&&(!t||t==="connecting"||t==="connected"||t==="volume-check"||t==="mic-check"||t==="mic-share"||t==="screen-share"||t==="navigate");return g(cw,{open:p,onClose:m,preventOutsideClick:!0,children:()=>g($w,{session:e,sessionState:t,speakingState:i,spectrum:r,onStart:a,onContinue:o,onShareMicrophone:c,onShareScreen:l,onModalChange:f})})}const Xw={identify:()=>{},track:()=>{},page:()=>{},reset:()=>{}};function ii(){return Xw}const Jw=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,cm="9.23.0",Ui=globalThis;function Qw(n,e,t=Ui){const i=t.__SENTRY__=t.__SENTRY__||{},r=i[cm]=i[cm]||{};return r[n]||(r[n]=e())}const Zw="Sentry Logger ",lm=["debug","info","warn","error","log","assert","trace"],um={};function ex(n){if(!("console"in Ui))return n();const e=Ui.console,t={},i=Object.keys(um);i.forEach(r=>{const s=um[r];t[r]=e[r],e[r]=s});try{return n()}finally{i.forEach(r=>{e[r]=t[r]})}}function tx(){let n=!1;const e={enable:()=>{n=!0},disable:()=>{n=!1},isEnabled:()=>n};return Jw?lm.forEach(t=>{e[t]=(...i)=>{n&&ex(()=>{Ui.console[t](`${Zw}[${t}]:`,...i)})}}):lm.forEach(t=>{e[t]=()=>{}}),e}Qw("logger",tx);const dm=1e3;function nx(){return Date.now()/dm}function ix(){const{performance:n}=Ui;if(!(n!=null&&n.now))return nx;const e=Date.now()-n.now(),t=n.timeOrigin==null?e:n.timeOrigin;return()=>(t+n.now())/dm}ix();const hm=50,Bi="?",fm=/\(error: (.*)\)/,pm=/captureMessage|captureException/;function rx(...n){const e=n.sort((t,i)=>t[0]-i[0]).map(t=>t[1]);return(t,i=0,r=0)=>{const s=[],a=t.split(`
|
|
55
55
|
`);for(let o=i;o<a.length;o++){const c=a[o];if(c.length>1024)continue;const l=fm.test(c)?c.replace(fm,"$1"):c;if(!l.match(/\S*Error: /)){for(const u of e){const d=u(l);if(d){s.push(d);break}}if(s.length>=hm+r)break}}return sx(s.slice(r))}}function sx(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(Ta(e).function||"")&&e.pop(),e.reverse(),pm.test(Ta(e).function||"")&&(e.pop(),pm.test(Ta(e).function||"")&&e.pop()),e.slice(0,hm).map(t=>({...t,filename:t.filename||Ta(e).filename,function:t.function||Bi}))}function Ta(n){return n[n.length-1]||{}}var mm;(function(n){n[n.PENDING=0]="PENDING";const e=1;n[n.RESOLVED=e]="RESOLVED";const t=2;n[n.REJECTED=t]="REJECTED"})(mm||(mm={})),Ui._sentryClientToLogBufferMap=new WeakMap,typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;const ax=30,ox=50;function Zc(n,e,t,i){const r={filename:n,function:e==="<anonymous>"?Bi:e,in_app:!0};return t!==void 0&&(r.lineno=t),i!==void 0&&(r.colno=i),r}const cx=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,lx=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ux=/\((\S*)(?::(\d+))(?::(\d+))\)/,dx=n=>{const e=cx.exec(n);if(e){const[,i,r,s]=e;return Zc(i,Bi,+r,+s)}const t=lx.exec(n);if(t){if(t[2]&&t[2].indexOf("eval")===0){const s=ux.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}const[i,r]=gm(t[1]||Bi,t[2]);return Zc(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},hx=[ax,dx],fx=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,px=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;rx(...[hx,[ox,n=>{const e=fx.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=px.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let t=e[3],i=e[1]||Bi;return[i,t]=gm(i,t),Zc(t,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]);const gm=(n,e)=>{const t=n.indexOf("safari-extension")!==-1,i=n.indexOf("safari-web-extension")!==-1;return t||i?[n.indexOf("@")!==-1?n.split("@")[0]:Bi,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]};typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function mx(n){let e=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function gx(n,e){if(!e||e.length===0)return!1;const t=n.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(i=>{try{const r=mx(i);return r.test(t)||r.test(n)}catch(r){return console.warn(`Invalid URL pattern: ${i}`,r),!1}})}function ka(n){if(!n||n.length===0)return!1;const e=window.location.origin+window.location.pathname;return gx(e,n)}function vx(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(d){a(d)}}function c(u){try{l(i.throw(u))}catch(d){a(d)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(n,e||[])).next())})}function bx(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1],s=l;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(l);break}s[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(n,t)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var vm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Sa=0;Sa<vm.length;Sa++)xr[vm.charCodeAt(Sa)]=Sa;for(var yx=function(n){var e=n.length*.75,t=n.length,i,r=0,s,a,o,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(l)?l:new Uint8Array(l);for(i=0;i<t;i+=4)s=xr[n.charCodeAt(i)],a=xr[n.charCodeAt(i+1)],o=xr[n.charCodeAt(i+2)],c=xr[n.charCodeAt(i+3)],u[r++]=s<<2|a>>4,u[r++]=(a&15)<<4|o>>2,u[r++]=(o&3)<<6|c&63;return l},Tx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},kx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},ri=5,el=6+5,tl=2,Sx=el-ri,bm=65536>>ri,Cx=1<<ri,nl=Cx-1,wx=1024>>ri,xx=bm+wx,_x=xx,Ex=32,Rx=_x+Ex,Px=65536>>el,Ix=1<<Sx,Ox=Ix-1,ym=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Ax=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},Nx=function(n,e){var t=yx(n),i=Array.isArray(t)?kx(t):new Uint32Array(t),r=Array.isArray(t)?Tx(t):new Uint16Array(t),s=24,a=ym(r,s/2,i[4]/2),o=i[5]===2?ym(r,(s+i[4])/2):Ax(i,Math.ceil((s+i[4])/4));return new Mx(i[0],i[1],i[2],i[3],a,o)},Mx=function(){function n(e,t,i,r,s,a){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=s,this.data=a}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>ri],t=(t<<tl)+(e&nl),this.data[t];if(e<=65535)return t=this.index[bm+(e-55296>>ri)],t=(t<<tl)+(e&nl),this.data[t];if(e<this.highStart)return t=Rx-Px+(e>>el),t=this.index[t],t+=e>>ri&Ox,t=this.index[t],t=(t<<tl)+(e&nl),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),Tm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lx=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ca=0;Ca<Tm.length;Ca++)Lx[Tm.charCodeAt(Ca)]=Ca;var km=null;function Dx(n){return vx(this,void 0,void 0,function(){var e;return bx(this,function(t){switch(t.label){case 0:return km!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw new Error("Invalid graphemes response");km=Nx(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}for(var Sm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ux=typeof Uint8Array>"u"?[]:new Uint8Array(256),wa=0;wa<Sm.length;wa++)Ux[Sm.charCodeAt(wa)]=wa;function Bx(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(d){a(d)}}function c(u){try{l(i.throw(u))}catch(d){a(d)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(n,e||[])).next())})}function Fx(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,r=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1],s=l;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(l);break}s[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(n,t)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;for(var Cm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_r=typeof Uint8Array>"u"?[]:new Uint8Array(256),xa=0;xa<Cm.length;xa++)_r[Cm.charCodeAt(xa)]=xa;for(var jx=function(n){var e=n.length*.75,t=n.length,i,r=0,s,a,o,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(l)?l:new Uint8Array(l);for(i=0;i<t;i+=4)s=_r[n.charCodeAt(i)],a=_r[n.charCodeAt(i+1)],o=_r[n.charCodeAt(i+2)],c=_r[n.charCodeAt(i+3)],u[r++]=s<<2|a>>4,u[r++]=(a&15)<<4|o>>2,u[r++]=(o&3)<<6|c&63;return l},Vx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=2)t.push(n[i+1]<<8|n[i]);return t},Gx=function(n){for(var e=n.length,t=[],i=0;i<e;i+=4)t.push(n[i+3]<<24|n[i+2]<<16|n[i+1]<<8|n[i]);return t},si=5,il=6+5,rl=2,zx=il-si,wm=65536>>si,Hx=1<<si,sl=Hx-1,Wx=1024>>si,qx=wm+Wx,Kx=qx,$x=32,Yx=Kx+$x,Xx=65536>>il,Jx=1<<zx,Qx=Jx-1,xm=function(n,e,t){return n.slice?n.slice(e,t):new Uint16Array(Array.prototype.slice.call(n,e,t))},Zx=function(n,e,t){return n.slice?n.slice(e,t):new Uint32Array(Array.prototype.slice.call(n,e,t))},e_=function(n,e){var t=jx(n),i=Array.isArray(t)?Gx(t):new Uint32Array(t),r=Array.isArray(t)?Vx(t):new Uint16Array(t),s=24,a=xm(r,s/2,i[4]/2),o=i[5]===2?xm(r,(s+i[4])/2):Zx(i,Math.ceil((s+i[4])/4));return new t_(i[0],i[1],i[2],i[3],a,o)},t_=function(){function n(e,t,i,r,s,a){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=s,this.data=a}return n.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>si],t=(t<<rl)+(e&sl),this.data[t];if(e<=65535)return t=this.index[wm+(e-55296>>si)],t=(t<<rl)+(e&sl),this.data[t];if(e<this.highStart)return t=Yx-Xx+(e>>il),t=this.index[t],t+=e>>si&Qx,t=this.index[t],t=(t<<rl)+(e&sl),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},n}(),_m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n_=typeof Uint8Array>"u"?[]:new Uint8Array(256),_a=0;_a<_m.length;_a++)n_[_m.charCodeAt(_a)]=_a;var Em=null;function i_(n){return Bx(this,void 0,void 0,function(){var e;return Fx(this,function(t){switch(t.label){case 0:return Em!==null?[3,2]:[4,n()];case 1:if(e=t.sent(),!e.base64||!e.byte_length)throw console.error("invalid graphemes response",e),new Error("Invalid graphemes response");Em=e_(e.base64,e.byte_length),t.label=2;case 2:return[2]}})})}const r_=`:root,:host{--obi-modal-padding: 32px 48px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 24px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 372px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:block;flex-grow:1;flex-direction:column;align-items:center;padding:0;width:100%;margin-bottom:16px}.tour-content .title{width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:700;font-size:24px;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0 0 12px}.tour-content .subtitle{width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{flex-grow:0;flex-shrink:0;display:flex;align-items:center;justify-content:center;position:relative;margin-bottom:24px}.tour-content .visual.glow{width:390px;border-radius:15px;background-color:var(--obi-color-tint)}.tour-content .description{height:45px;width:100%;font-family:Inter,sans-serif;font-style:normal;font-weight:400;font-size:16px;color:#757575!important;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.tour-content .button-container{flex-grow:0;display:flex;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Inter,sans-serif;font-style:normal;font-weight:500;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{height:100%;flex:1;display:flex;flex-direction:column}.tour-footer{width:100%!important;text-align:center;display:flex;align-items:flex-end;justify-content:center;font-family:Inter,sans-serif;font-size:8px;font-weight:200;margin-top:20px}.session-start-content .description{height:48px}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);transform:translateY(0);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill2.container:not(.active) .pill .text{opacity:0;animation:none}.obi-pill-up.container{display:flex;align-items:flex-end;justify-content:center}.obi-pill-up.container .pill{display:flex;align-items:center;justify-content:center;min-width:48px;max-width:48px;height:6px;opacity:.7;border-radius:3px;border:1px solid #FFFFFF1F;background-color:var(--obi-color-primary);overflow:hidden;white-space:nowrap;flex:0 0 auto;box-sizing:border-box;padding-left:0;padding-right:0;transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container .pill.button{cursor:pointer}.obi-pill-up.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill-up.container:not(.active) .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out}.obi-pill-up.container.active{transition:none;height:30px}.obi-pill-up.container.active .pill{transition:max-width .15s ease-in-out,min-width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out,padding-left .15s ease-in-out,padding-right .15s ease-in-out;max-width:1000px;height:30px;border-radius:15px;opacity:1;padding-left:14px;padding-right:14px}.obi-pill-up.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill-up.container:not(.active) .pill .text{opacity:0;animation:none}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-message{display:inline-flex;align-items:center;justify-content:center;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:14px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:6px 0;height:100%;flex:1;min-width:0;cursor:pointer}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0;cursor:pointer}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-course-progress .obi-widget-popout,.obi-course-progress .obi-widget-popout .content{z-index:800}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-widget-course-progress{display:block;width:100%;max-width:220px;max-height:40px;opacity:1;transform:translateY(0);overflow:visible;position:relative;z-index:800;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel .obi-widget-course-progress.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:0}.obi-widget-out-of-plan .text{font-size:16px;color:#fff;display:inline-flex;align-items:center;gap:8px;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active{gap:0}.obi-widget-out-of-plan.active:hover,.obi-widget-out-of-plan.active.hover{gap:4px}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.obi-widget-draggable .obi-widget-panel{cursor:grab}.obi-widget-draggable.dragging .obi-widget-panel{cursor:grabbing;-webkit-user-select:none;user-select:none}.obi-static-voice{height:96px;display:flex;flex-direction:column;align-items:center;justify-content:center}.obi-static-voice-visual-title{font-family:Inter,sans-serif;font-style:normal;font-weight:600;font-size:14px;color:var(--obi-color-primary);background-color:var(--obi-color-tint);padding:8px 12px;border-radius:20px;margin-bottom:24px}.obi-static-voice-visual{display:flex;align-items:center;gap:2px;height:32px}.obi-static-voice-visual .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-static-voice-visual .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;background-color:#fff;border-radius:2px;z-index:1}.obi-static-voice-visual .bar-1{height:2px}.obi-static-voice-visual .bar-2{height:6px}.obi-static-voice-visual .bar-3{height:10px}.obi-static-voice-visual .bar-4,.obi-static-voice-visual .bar-5{height:16px}.obi-static-voice-visual .bar-6{height:10px}.obi-static-voice-visual .bar-7{height:6px}.obi-static-voice-visual .bar-8{height:2px}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
|
|
56
|
-
`;function s_(n){var Et,Qt,oi,Er,Rr,Ea,ji,jn,pn,mn,Pr;const[e,t]=Y(!1),[i,r]=Y(!1),[s,a]=Y(!1),[o,c]=Y(!1),[l,u]=Y(null),[d,h]=Y(!1),[f,m]=Y(null),[p,v]=Y(null),[b,C]=Y(null),[x,T]=Y(!1),k=Ie(null),w=Ie(0),_=Ie(0),R=Ie(0),O=Ie(0),B=Ie({width:0,height:0}),N=Ie(null),W=Ie(!1),K=6,M=a_(n.sdk,Q,n.shadowHost,v,A=>{var z,$;a(A),A&&(($=(z=M.client.session)==null?void 0:z.muteMicrophone)==null||$.call(z))},A=>{if(!A){u(null);return}if(ge&&(u(A),!re&&me==="minimized")){h(!0);const z=Math.max(0,A.autoCloseMs??3e3);f&&window.clearTimeout(f);const $=window.setTimeout(()=>h(!1),z);m($)}});function Q(A){var z;(z=M.client)!=null&&z.session||(A?fn():t(!1))}if(!M.client)return null;const X=M.client.planIsCompleted.filter(Boolean).length===M.client.plans.length,Te=o_((Et=M.client.product)==null?void 0:Et.widget_url_blacklist),me=X?M.completedWidgetDisplay||((Qt=M.client.product)==null?void 0:Qt.completed_widget_display):M.widgetDisplay||((oi=M.client.product)==null?void 0:oi.widget_display),we=M.widgetPosition||((Er=M.client.product)==null?void 0:Er.widget_position);let ze=M.isActive;((Ea=(Rr=M.client)==null?void 0:Rr.product)==null?void 0:Ea.name)==="Canibuild"&&(ze=!0);const G=M.client.session,re=!!G;Je(()=>{c(!1)},[G]);const oe=re&&!e;let xe;switch(G==null?void 0:G.speakingState){case"listening":xe="user-speaking";break;case"speaking":xe="agent-speaking";break;case"thinking":xe="thinking";break;case"busy":xe="busy";break}const J=G==null?void 0:G.isPaused,ge=re||M.client.state==="ready"&&ze&&!Te&&(me!=="invisible"||M.client.selectedPlan),De=()=>{var A,z,$,ve,Be,ct,vt;return{name:(A=M.client.selectedPlan)==null?void 0:A.name,description:(z=M.client.selectedPlan)==null?void 0:z.description,appName:($=M.client.product)==null?void 0:$.name,appLogoUrl:((ve=M.client.product)==null?void 0:ve.logo_url)||"",url:(Be=M.client.product)==null?void 0:Be.url,agentName:((ct=M.client.product)==null?void 0:ct.agent_name)||"Obi",legalFooter:((vt=M.client.product)==null?void 0:vt.legal_footer_text)||void 0}};function yt(){const A=we==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return oe?A.top="calc(100vh - 100px)":A.bottom="20px",A}const Tt=(()=>{if(re&&b)return{position:"fixed",left:`${Math.round(b.left)}px`,top:`${Math.round(b.top)}px`,width:"max-content",right:void 0,bottom:void 0,transform:void 0,touchAction:"none"};const A=yt();return re&&(A.touchAction="none"),A})();Je(()=>{re||(C(null),T(!1),k.current=null,W.current=!1,N.current&&(cancelAnimationFrame(N.current),N.current=null))},[re]);function ai(A,z,$){return Math.max(z,Math.min($,A))}function Fi(A){var ct;if(!re)return;const z=A.currentTarget;if(!z)return;const $=A.target;if((ct=$==null?void 0:$.closest)==null?void 0:ct.call($,'button, a[href], input, textarea, select, [role="button"], [contenteditable="true"], [data-no-drag]'))return;k.current=A.pointerId;const Be=z.getBoundingClientRect();w.current=A.clientX,_.current=A.clientY,R.current=Be.left,O.current=Be.top,B.current={width:Be.width,height:Be.height},W.current=!1,C({left:Be.left,top:Be.top})}function te(A){var Gi;if(!re||k.current!==A.pointerId)return;const z=A.clientX-w.current,$=A.clientY-_.current;if(!x){if(Math.hypot(z,$)<K)return;const Zt=A.currentTarget;try{(Gi=Zt==null?void 0:Zt.setPointerCapture)==null||Gi.call(Zt,A.pointerId)}catch{}T(!0),W.current=!0,b||C({left:R.current,top:O.current})}const ve=8,Be=ve,ct=ve,vt=Math.max(ve,window.innerWidth-B.current.width-ve),Vn=Math.max(ve,window.innerHeight-B.current.height-ve),Vi={left:ai(R.current+z,Be,vt),top:ai(O.current+$,ct,Vn)};if(N.current==null){const Ra=Vi;N.current=requestAnimationFrame(()=>{C(Ra),N.current=null})}else C(Vi)}function Ue(A){var z,$;if(k.current!==null)try{($=(z=A.currentTarget)==null?void 0:z.releasePointerCapture)==null||$.call(z,k.current)}catch{}k.current=null,T(!1)}function Qe(A){re&&k.current===A.pointerId&&Ue(A)}function Vt(A){re&&k.current===A.pointerId&&Ue(A)}const fn=()=>{const A=M.client;if(!A)return;const z=A.plans||[];if(z.length===1){const[$]=z;A.selectedPlanUuid!==$.uuid&&(A.selectPlan($),ii().track("course-get-started",{courseName:$.name,courseUuid:$.uuid})),t(!1),r(!0);return}t(!0)};return g("div",{children:[e&&g(Kw,{open:e,courses:M.client.plans.map((A,z)=>{var $,ve;return{id:A.uuid,name:A.name,description:A.description||"",duration:A.duration||0,completed:((ve=($=M.client)==null?void 0:$.planIsCompleted)==null?void 0:ve[z])||!1}}),loading:!1,title:((ji=M.client.product)==null?void 0:ji.assistant_subtitle)||void 0,productName:((jn=M.client.product)==null?void 0:jn.name)||"",onCourseHighlight:A=>{A&&ii().track("course-selected",{courseName:A.name,courseUuid:A.id})},onCourseSelect:A=>{const z=M.client.plans.find($=>$.uuid===A.id)||null;z&&(z==null?void 0:z.uuid)!==M.client.selectedPlanUuid&&(M.client.selectPlan(z),t(!1),r(!0),ii().track("course-get-started",{courseName:A.name,courseUuid:A.id}))},onClose:A=>{A==="user-initiated"&&M.client.selectPlan(null),t(!1)}}),ge&&g(nt,{children:[g("div",{className:re?`obi-widget-draggable${x?" dragging":""}`:void 0,style:Tt,onPointerDown:Fi,onPointerMove:te,onPointerUp:Qe,onPointerCancel:Vt,onClickCapture:A=>{var z,$;W.current&&((z=A.preventDefault)==null||z.call(A),($=A.stopPropagation)==null||$.call(A),W.current=!1)},children:g(sw,{inPlan:re,isActive:i?!1:d?!0:void 0,defaultIsActive:me!=="minimized",isPaused:J,toastMessage:l,messaging:(G==null?void 0:G.isMicShared)===!1||s?!0:void 0,speakingStatus:xe,spectrum:()=>(G==null?void 0:G.audioSpectrum())||null,courseProgress:p,onOpen:fn,onCancelClick:()=>{var A,z,$;o&&(c(!1),(A=M.client.session)!=null&&A.isPaused||($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z))},onCancelAbort:()=>{},onCancel:()=>{var A;(A=M.client.session)==null||A.stop()},onCancelReason:(A,z)=>{},onPause:()=>{var A,z;(z=(A=M.client.session)==null?void 0:A.pause)==null||z.call(A)},onUnpause:()=>{var A,z,$,ve;(z=(A=M.client.session)==null?void 0:A.unpause)==null||z.call(A),(o||s)&&((ve=($=M.client.session)==null?void 0:$.muteMicrophone)==null||ve.call($))},onMessagingChange:A=>{var z,$,ve,Be,ct;a(!1),c(A),A?($=(z=M.client.session)==null?void 0:z.muteMicrophone)==null||$.call(z):(ve=M.client.session)!=null&&ve.isPaused||(ct=(Be=M.client.session)==null?void 0:Be.unmuteMicrophone)==null||ct.call(Be)},onMessageChange:A=>{ii().track("chat-input-provided",{message:A,length:A.length})},onMessage:A=>{var z,$;M.say(A),a(!1),!o&&!(G!=null&&G.isPaused)&&(G==null?void 0:G.isMicShared)!==!1&&(($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z)),ii().track("chat-message-sent",{message:A,length:A.length})},onHover:A=>{},onOneClickAction:A=>{a(!1)},onMinimize:()=>{var A,z,$;o&&(c(!1),(A=M.client.session)!=null&&A.isPaused||($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z))},agentName:((pn=M.client.product)==null?void 0:pn.agent_name)||"Obi",completedTutorials:((mn=M.client.product)==null?void 0:mn.widget_show_progress)===!1?void 0:M.client.planIsCompleted.filter(Boolean).length,totalTutorials:((Pr=M.client.product)==null?void 0:Pr.widget_show_progress)===!1?void 0:M.client.plans.length})}),!!M.client.selectedPlan&&g(Yw,{open:!0,session:De(),sessionState:(G==null?void 0:G.state)||null,speakingState:(G==null?void 0:G.speakingState)||null,spectrum:()=>(G==null?void 0:G.audioSpectrum())||null,onModalChange:A=>{},onClose:(A,z)=>{var $,ve;A==="user-initiated"&&((($=M.client.session)==null?void 0:$.state)==="mic-share"?(ve=M.client.session)==null||ve.shareMicrophoneFailed():M.client.stopSession()),r(!1)},onStart:()=>{M.client.selectedPlanUuid&&M.startSession()},onContinue:()=>{G==null||G.continue()},onShareMicrophone:()=>{G==null||G.shareMicrophone()}})]})]})}function a_(n,e,t,i,r,s){const[a,o]=Y(0),[c,l]=Y(()=>{var p;return((p=n.client)==null?void 0:p.session)||null}),u=Ie(s),d=Ie(null),h=Ie(null);Je(()=>{u.current=s},[s]);const f=p=>{var v;(v=u.current)==null||v.call(u,p)},m=p=>{if(!p||d.current===p)return;h.current&&(h.current(),h.current=null);const v=()=>{o(R=>R+1)},b=()=>{o(R=>R+1)},C=()=>{o(R=>R+1)},x=()=>{o(R=>R+1)},T=R=>{},k=(R,O)=>{},w=()=>{r==null||r(!0),o(R=>R+1)},_=R=>{i(R)};p.on("stateChanged",v),p.on("speakingStateChanged",b),p.on("paused",C),p.on("unpaused",x),p.on("micCheckComplete",T),p.on("transcript",k),p.on&&p.on("textInputRequested",w),p.on&&p.on("courseProgress",_),d.current=p,h.current=()=>{p.off&&p.off("stateChanged",v),p.off&&p.off("speakingStateChanged",b),p.off&&p.off("paused",C),p.off&&p.off("unpaused",x),p.off&&p.off("micCheckComplete",T),p.off&&p.off("transcript",k),p.off&&p.off("courseProgress",_),p.off&&p.off("textInputRequested",w)}};return Je(()=>{const p=b=>{e(b)};n.on("showMenu",p);const v=()=>{o(b=>b+1)};return n.on("configUpdated",v),n.on("showMessage",f),()=>{var b,C,x;(b=n.off)==null||b.call(n,"showMenu",p),(C=n.off)==null||C.call(n,"configUpdated",v),(x=n.off)==null||x.call(n,"showMessage",f)}},[n]),Je(()=>{var p;n.client&&(n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((p=n.client.product)==null?void 0:p.primary_color)||"#9500FF"),n.client.session&&(l(n.client.session),m(n.client.session)),n.client.on("sessionStarted",v=>{l(v),r==null||r(!1),o(b=>b+1),m(v)}),n.client.on("sessionStopped",()=>{h.current&&(h.current(),h.current=null),d.current=null,l(null),r==null||r(!1),o(v=>v+1)}),n.client.on("sessionShutdown",()=>{o(v=>v+1)}),n.client.on("sessionResumed",()=>{o(v=>v+1)}),n.client.on("stateChanged",()=>{var v;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((v=n.client.product)==null?void 0:v.primary_color)||"#9500FF"),o(b=>b+1)}),n.client.on("planSelected",()=>{o(v=>v+1)}))},[n,n.client]),yr(()=>{if(c)return m(c),()=>{d.current===c&&h.current&&(h.current(),h.current=null,d.current=null)}},[c]),n}function o_(n){const[e,t]=Y(()=>ka(n));return Je(()=>{t(ka(n))},[n]),Je(()=>{c_();const i=()=>{t(ka(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function c_(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...s){const a=r.apply(this,s);return window.dispatchEvent(new Event("locationchange")),a};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function l_(n){if(document.querySelector("obi-widget"))return;u_();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(r_),t.adoptedStyleSheets=[r],S1(g(s_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function u_(){Rm("https://fonts.cdnfonts.com/css/satoshi"),Rm("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function Rm(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Pm="49206C6F7665204F6269_session",Im="obi-url-params";class d_ extends Ia{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,i)=>{var r,s,a,o,c;switch(this.commandLog.push({commandType:t,args:i}),t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const l=(((r=this.client)==null?void 0:r.plans)||[]).find(u=>u.uuid===i.planUuid)||null;if(!l){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(a=(s=this.client)==null?void 0:s.selectPlan)==null||a.call(s,l);break;case"stopSession":(c=(o=this.client)==null?void 0:o.stopSession)==null||c.call(o);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=oa.deserialise(i,e,"sdk",{apiBaseUrl:"https://staging.coragents.ai",captureScreen:this.captureScreen.bind(this)}),t?this._resumed=!0:localStorage.removeItem("obi-client")}catch(r){console.error("[obi] error loading cached client",r),localStorage.removeItem("obi-client")}t||(t=new oa(e,"sdk",{apiBaseUrl:"https://staging.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var s,a,o,c,l,u,d,h,f,m;r==="ready"&&this.updateConfig({isActive:((s=window==null?void 0:window.obiWidgetConfig)==null?void 0:s.isActive)??((a=this.client)==null?void 0:a.showWidget),primaryColour:((c=(o=this.client)==null?void 0:o.product)==null?void 0:c.primary_color)||"#9500FF",widgetDisplay:((l=window==null?void 0:window.obiWidgetConfig)==null?void 0:l.widgetDisplay)||((d=(u=this.client)==null?void 0:u.product)==null?void 0:d.widget_display)||"regular",completedWidgetDisplay:((h=window==null?void 0:window.obiWidgetConfig)==null?void 0:h.completedWidgetDisplay)||((m=(f=this.client)==null?void 0:f.product)==null?void 0:m.completed_widget_display)||"regular"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",()=>{localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,s)=>{}),this.client.session&&(this.client.session.isPaused,this.client.resumeSession(r=>{r.on("stateChanged",s=>{s!=="disconnecting"&&s!=="disconnected"&&s!=="error"&&s!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})}))}_maybeActOnServerEngagement(){var o;const e=this.client;if(!e||e.state!=="ready")return;const t=e.product,i=(o=e.engagement)==null?void 0:o.style;if(!i||t&&ka(t.widget_url_blacklist||[])||!e.showWidget)return;const r=e.plans||[],s=e.planIsCompleted||[],a=r.length>0&&s.filter(Boolean).length===r.length;if(!(r.length===0||a)){if(i==="modal"){const c=s.findIndex(u=>!u),l=c>=0?r[c]:null;l&&e.selectPlan(l)}else i==="popover"&&setTimeout(()=>{this.showMessage("Don't forget to complete your onboarding",{autoCloseMs:1e4})},1e3);try{ii().track("engagement-prompt-shown",{style:i})}catch{}}}async initialise(e={}){var t;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0,identity:((t=window==null?void 0:window.obiWidgetConfig)==null?void 0:t.user)||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}this.dispatchCommandQueue()}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i,r;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;(r=this.client)==null||r.identity;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&ii().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlanUuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()}),e.on("paused",()=>{this.save()}),e.on("unpaused",()=>{this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(Im)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[Pm];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Pm),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Im),this.passivePlanUuid=t}mountWidget(){l_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Dx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await i_(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await RT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var t;const e=((t=this.client)==null?void 0:t.serialise())||"";localStorage.setItem("obi-client",e)}load(){return localStorage.getItem("obi-client")}}async function Om(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return h_({appToken:n,window:t,init:e})}async function h_({appToken:n,window:e,init:t}){var s,a;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t&&t(),n||(n=(s=e==null?void 0:e.obiWidgetConfig)==null?void 0:s.apiKey);let i;try{i=((a=e.ObiSDK)==null?void 0:a.q)||[]}catch{i=[]}const r=new d_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Am(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Om(void 0,Am)}):Om(void 0,Am)})();
|
|
56
|
+
`;function s_(n){var Et,Qt,oi,Er,Rr,Ea,ji,jn,pn,mn,Pr;const[e,t]=Y(!1),[i,r]=Y(!1),[s,a]=Y(!1),[o,c]=Y(!1),[l,u]=Y(null),[d,h]=Y(!1),[f,m]=Y(null),[p,v]=Y(null),[b,C]=Y(null),[x,T]=Y(!1),k=Ie(null),w=Ie(0),_=Ie(0),R=Ie(0),O=Ie(0),B=Ie({width:0,height:0}),N=Ie(null),W=Ie(!1),K=6,M=a_(n.sdk,Q,n.shadowHost,v,A=>{var z,$;a(A),A&&(($=(z=M.client.session)==null?void 0:z.muteMicrophone)==null||$.call(z))},A=>{if(!A){u(null);return}if(ge&&(u(A),!re&&me==="minimized")){h(!0);const z=Math.max(0,A.autoCloseMs??3e3);f&&window.clearTimeout(f);const $=window.setTimeout(()=>h(!1),z);m($)}});function Q(A){var z;(z=M.client)!=null&&z.session||(A?fn():t(!1))}if(!M.client)return null;const X=M.client.planIsCompleted.filter(Boolean).length===M.client.plans.length,Te=o_((Et=M.client.product)==null?void 0:Et.widget_url_blacklist),me=X?M.completedWidgetDisplay||((Qt=M.client.product)==null?void 0:Qt.completed_widget_display):M.widgetDisplay||((oi=M.client.product)==null?void 0:oi.widget_display),we=M.widgetPosition||((Er=M.client.product)==null?void 0:Er.widget_position);let ze=M.isActive;((Ea=(Rr=M.client)==null?void 0:Rr.product)==null?void 0:Ea.name)==="Canibuild"&&(ze=!0);const G=M.client.session,re=!!G;Je(()=>{c(!1)},[G]);const oe=re&&!e;let xe;switch(G==null?void 0:G.speakingState){case"listening":xe="user-speaking";break;case"speaking":xe="agent-speaking";break;case"thinking":xe="thinking";break;case"busy":xe="busy";break}const J=G==null?void 0:G.isPaused,ge=re||M.client.state==="ready"&&ze&&!Te&&(me!=="invisible"||M.client.selectedPlan),De=()=>{var A,z,$,ve,Be,ct,vt;return{name:(A=M.client.selectedPlan)==null?void 0:A.name,description:(z=M.client.selectedPlan)==null?void 0:z.description,appName:($=M.client.product)==null?void 0:$.name,appLogoUrl:((ve=M.client.product)==null?void 0:ve.logo_url)||"",url:(Be=M.client.product)==null?void 0:Be.url,agentName:((ct=M.client.product)==null?void 0:ct.agent_name)||"Obi",legalFooter:((vt=M.client.product)==null?void 0:vt.legal_footer_text)||void 0}};function yt(){const A=we==="bottom-right"?{position:"fixed",right:"250px",width:"max-content",transform:"translateX(50%)"}:{position:"fixed",left:"50%",transform:"translateX(-50%)",width:"max-content"};return oe?A.top="calc(100vh - 100px)":A.bottom="20px",A}const Tt=(()=>{if(re&&b)return{position:"fixed",left:`${Math.round(b.left)}px`,top:`${Math.round(b.top)}px`,width:"max-content",right:void 0,bottom:void 0,transform:void 0,touchAction:"none"};const A=yt();return re&&(A.touchAction="none"),A})();Je(()=>{re||(C(null),T(!1),k.current=null,W.current=!1,N.current&&(cancelAnimationFrame(N.current),N.current=null))},[re]);function ai(A,z,$){return Math.max(z,Math.min($,A))}function Fi(A){var ct;if(!re)return;const z=A.currentTarget;if(!z)return;const $=A.target;if((ct=$==null?void 0:$.closest)==null?void 0:ct.call($,'button, a[href], input, textarea, select, [role="button"], [contenteditable="true"], [data-no-drag]'))return;k.current=A.pointerId;const Be=z.getBoundingClientRect();w.current=A.clientX,_.current=A.clientY,R.current=Be.left,O.current=Be.top,B.current={width:Be.width,height:Be.height},W.current=!1,C({left:Be.left,top:Be.top})}function te(A){var Gi;if(!re||k.current!==A.pointerId)return;const z=A.clientX-w.current,$=A.clientY-_.current;if(!x){if(Math.hypot(z,$)<K)return;const Zt=A.currentTarget;try{(Gi=Zt==null?void 0:Zt.setPointerCapture)==null||Gi.call(Zt,A.pointerId)}catch{}T(!0),W.current=!0,b||C({left:R.current,top:O.current})}const ve=8,Be=ve,ct=ve,vt=Math.max(ve,window.innerWidth-B.current.width-ve),Vn=Math.max(ve,window.innerHeight-B.current.height-ve),Vi={left:ai(R.current+z,Be,vt),top:ai(O.current+$,ct,Vn)};if(N.current==null){const Ra=Vi;N.current=requestAnimationFrame(()=>{C(Ra),N.current=null})}else C(Vi)}function Ue(A){var z,$;if(k.current!==null)try{($=(z=A.currentTarget)==null?void 0:z.releasePointerCapture)==null||$.call(z,k.current)}catch{}k.current=null,T(!1)}function Qe(A){re&&k.current===A.pointerId&&Ue(A)}function Vt(A){re&&k.current===A.pointerId&&Ue(A)}const fn=()=>{const A=M.client;if(!A)return;const z=A.plans||[];if(z.length===1){const[$]=z;A.selectedPlanUuid!==$.uuid&&(A.selectPlan($),ii().track("course-get-started",{courseName:$.name,courseUuid:$.uuid})),t(!1),r(!0);return}t(!0)};return g("div",{children:[e&&g(Kw,{open:e,courses:M.client.plans.map((A,z)=>{var $,ve;return{id:A.uuid,name:A.name,description:A.description||"",duration:A.duration||0,completed:((ve=($=M.client)==null?void 0:$.planIsCompleted)==null?void 0:ve[z])||!1}}),loading:!1,title:((ji=M.client.product)==null?void 0:ji.assistant_subtitle)||void 0,productName:((jn=M.client.product)==null?void 0:jn.name)||"",onCourseHighlight:A=>{A&&ii().track("course-selected",{courseName:A.name,courseUuid:A.id})},onCourseSelect:A=>{const z=M.client.plans.find($=>$.uuid===A.id)||null;z&&(z==null?void 0:z.uuid)!==M.client.selectedPlanUuid&&(M.client.selectPlan(z),t(!1),r(!0),ii().track("course-get-started",{courseName:A.name,courseUuid:A.id}))},onClose:A=>{A==="user-initiated"&&M.client.selectPlan(null),t(!1)}}),ge&&g(nt,{children:[g("div",{className:re?`obi-widget-draggable${x?" dragging":""}`:void 0,style:Tt,onPointerDown:Fi,onPointerMove:te,onPointerUp:Qe,onPointerCancel:Vt,onClickCapture:A=>{var z,$;W.current&&((z=A.preventDefault)==null||z.call(A),($=A.stopPropagation)==null||$.call(A),W.current=!1)},children:g(sw,{inPlan:re,isActive:i?!1:d?!0:void 0,defaultIsActive:me!=="minimized",isPaused:J,toastMessage:l,messaging:(G==null?void 0:G.isMicShared)===!1||s?!0:void 0,speakingStatus:xe,spectrum:()=>(G==null?void 0:G.audioSpectrum())||null,courseProgress:p,onOpen:fn,onCancelClick:()=>{var A,z,$;o&&(c(!1),(A=M.client.session)!=null&&A.isPaused||($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z))},onCancelAbort:()=>{},onCancel:()=>{var A;(A=M.client.session)==null||A.stop()},onCancelReason:(A,z)=>{},onPause:()=>{var A,z;(z=(A=M.client.session)==null?void 0:A.pause)==null||z.call(A)},onUnpause:()=>{var A,z,$,ve;(z=(A=M.client.session)==null?void 0:A.unpause)==null||z.call(A),(o||s)&&((ve=($=M.client.session)==null?void 0:$.muteMicrophone)==null||ve.call($))},onMessagingChange:A=>{var z,$,ve,Be,ct;a(!1),c(A),A?($=(z=M.client.session)==null?void 0:z.muteMicrophone)==null||$.call(z):(ve=M.client.session)!=null&&ve.isPaused||(ct=(Be=M.client.session)==null?void 0:Be.unmuteMicrophone)==null||ct.call(Be)},onMessageChange:A=>{ii().track("chat-input-provided",{message:A,length:A.length})},onMessage:A=>{var z,$;M.say(A),a(!1),!o&&!(G!=null&&G.isPaused)&&(G==null?void 0:G.isMicShared)!==!1&&(($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z)),ii().track("chat-message-sent",{message:A,length:A.length})},onHover:A=>{},onOneClickAction:A=>{a(!1)},onMinimize:()=>{var A,z,$;o&&(c(!1),(A=M.client.session)!=null&&A.isPaused||($=(z=M.client.session)==null?void 0:z.unmuteMicrophone)==null||$.call(z))},agentName:((pn=M.client.product)==null?void 0:pn.agent_name)||"Obi",completedTutorials:((mn=M.client.product)==null?void 0:mn.widget_show_progress)===!1?void 0:M.client.planIsCompleted.filter(Boolean).length,totalTutorials:((Pr=M.client.product)==null?void 0:Pr.widget_show_progress)===!1?void 0:M.client.plans.length})}),!!M.client.selectedPlan&&g(Yw,{open:!0,session:De(),sessionState:(G==null?void 0:G.state)||null,speakingState:(G==null?void 0:G.speakingState)||null,spectrum:()=>(G==null?void 0:G.audioSpectrum())||null,onModalChange:A=>{},onClose:(A,z)=>{var $,ve;A==="user-initiated"&&((($=M.client.session)==null?void 0:$.state)==="mic-share"?(ve=M.client.session)==null||ve.shareMicrophoneFailed():M.client.stopSession()),r(!1)},onStart:()=>{M.client.selectedPlanUuid&&M.startSession()},onContinue:()=>{G==null||G.continue()},onShareMicrophone:()=>{G==null||G.shareMicrophone()}})]})]})}function a_(n,e,t,i,r,s){const[a,o]=Y(0),[c,l]=Y(()=>{var p;return((p=n.client)==null?void 0:p.session)||null}),u=Ie(s),d=Ie(null),h=Ie(null);Je(()=>{u.current=s},[s]);const f=p=>{var v;(v=u.current)==null||v.call(u,p)},m=p=>{if(!p||d.current===p)return;h.current&&(h.current(),h.current=null);const v=()=>{o(R=>R+1)},b=()=>{o(R=>R+1)},C=()=>{o(R=>R+1)},x=()=>{o(R=>R+1)},T=R=>{},k=(R,O)=>{},w=()=>{r==null||r(!0),o(R=>R+1)},_=R=>{i(R)};p.on("stateChanged",v),p.on("speakingStateChanged",b),p.on("paused",C),p.on("unpaused",x),p.on("micCheckComplete",T),p.on("transcript",k),p.on&&p.on("textInputRequested",w),p.on&&p.on("courseProgress",_),d.current=p,h.current=()=>{p.off&&p.off("stateChanged",v),p.off&&p.off("speakingStateChanged",b),p.off&&p.off("paused",C),p.off&&p.off("unpaused",x),p.off&&p.off("micCheckComplete",T),p.off&&p.off("transcript",k),p.off&&p.off("courseProgress",_),p.off&&p.off("textInputRequested",w)}};return Je(()=>{const p=b=>{e(b)};n.on("showMenu",p);const v=()=>{o(b=>b+1)};return n.on("configUpdated",v),n.on("showMessage",f),()=>{var b,C,x;(b=n.off)==null||b.call(n,"showMenu",p),(C=n.off)==null||C.call(n,"configUpdated",v),(x=n.off)==null||x.call(n,"showMessage",f)}},[n]),Je(()=>{var p;n.client&&(n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((p=n.client.product)==null?void 0:p.primary_color)||"#9500FF"),n.client.session&&(l(n.client.session),m(n.client.session)),n.client.on("sessionStarted",v=>{l(v),r==null||r(!1),o(b=>b+1),m(v)}),n.client.on("sessionStopped",()=>{h.current&&(h.current(),h.current=null),d.current=null,l(null),r==null||r(!1),o(v=>v+1)}),n.client.on("sessionShutdown",()=>{o(v=>v+1)}),n.client.on("sessionResumed",()=>{o(v=>v+1)}),n.client.on("stateChanged",()=>{var v;n.client.state==="ready"&&t.style.setProperty("--obi-color-primary",((v=n.client.product)==null?void 0:v.primary_color)||"#9500FF"),o(b=>b+1)}),n.client.on("planSelected",()=>{o(v=>v+1)}))},[n,n.client]),yr(()=>{if(c)return m(c),()=>{d.current===c&&h.current&&(h.current(),h.current=null,d.current=null)}},[c]),n}function o_(n){const[e,t]=Y(()=>ka(n));return Je(()=>{t(ka(n))},[n]),Je(()=>{c_();const i=()=>{t(ka(n))};return window.addEventListener("locationchange",i),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),()=>{window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i)}},[n]),e}function c_(){const n=window;if(n.__obi_history_patched)return;const{pushState:e,replaceState:t}=window.history,i=r=>function(...s){const a=r.apply(this,s);return window.dispatchEvent(new Event("locationchange")),a};window.history.pushState=i(e),window.history.replaceState=i(t),n.__obi_history_patched=!0}function l_(n){if(document.querySelector("obi-widget"))return;u_();const e=document.createElement("div");e.id="obi-host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const t=e.attachShadow({mode:"open"}),i=document.createElement("div");i.id="obi-container",t.appendChild(i);const r=new CSSStyleSheet;r.replaceSync(r_),t.adoptedStyleSheets=[r],S1(g(s_,{sdk:n,shadowHost:e}),i),console.log("[obi-sdk] widget mounted")}function u_(){Rm("https://fonts.cdnfonts.com/css/satoshi"),Rm("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function Rm(n){const e=document.createElement("link");e.href=n,e.rel="stylesheet",document.head.appendChild(e)}const Pm="49206C6F7665204F6269_session",Im="obi-url-params";class d_ extends Ia{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandLog=[],this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(t,i)=>{var r,s,a,o,c;switch(this.commandLog.push({commandType:t,args:i}),t){case"update":this.updateConfig(i);break;case"startSession":if(!(i!=null&&i.planUuid)){console.warn("[obi] startSession command requires a planUuid",i);return}const l=(((r=this.client)==null?void 0:r.plans)||[]).find(u=>u.uuid===i.planUuid)||null;if(!l){console.warn("[obi] startSession command requires a valid planUuid",i);return}this.updateActive(!0),(a=(s=this.client)==null?void 0:s.selectPlan)==null||a.call(s,l);break;case"stopSession":(c=(o=this.client)==null?void 0:o.stopSession)==null||c.call(o);break;case"say":this.say(i);break;default:console.warn("[obi] unknown command",{commandType:t,args:i})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let t=null;const i=this.load();if(i)try{t=oa.deserialise(i,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),t?this._resumed=!0:localStorage.removeItem("obi-client")}catch(r){console.error("[obi] error loading cached client",r),localStorage.removeItem("obi-client")}t||(t=new oa(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=t,this.client.on("stateChanged",r=>{var s,a,o,c,l,u,d,h,f,m;r==="ready"&&this.updateConfig({isActive:((s=window==null?void 0:window.obiWidgetConfig)==null?void 0:s.isActive)??((a=this.client)==null?void 0:a.showWidget),primaryColour:((c=(o=this.client)==null?void 0:o.product)==null?void 0:c.primary_color)||"#9500FF",widgetDisplay:((l=window==null?void 0:window.obiWidgetConfig)==null?void 0:l.widgetDisplay)||((d=(u=this.client)==null?void 0:u.product)==null?void 0:d.widget_display)||"regular",completedWidgetDisplay:((h=window==null?void 0:window.obiWidgetConfig)==null?void 0:h.completedWidgetDisplay)||((m=(f=this.client)==null?void 0:f.product)==null?void 0:m.completed_widget_display)||"regular"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",()=>{localStorage.removeItem("obi-client")}),this.client.on("trackEvent",(r,s)=>{}),this.client.session&&(this.client.session.isPaused,this.client.resumeSession(r=>{r.on("stateChanged",s=>{s!=="disconnecting"&&s!=="disconnected"&&s!=="error"&&s!=="connecting"&&this.save()}),r.on("paused",()=>{this.save()}),r.on("unpaused",()=>{this.save()})}))}_maybeActOnServerEngagement(){var o;const e=this.client;if(!e||e.state!=="ready")return;const t=e.product,i=(o=e.engagement)==null?void 0:o.style;if(!i||t&&ka(t.widget_url_blacklist||[])||!e.showWidget)return;const r=e.plans||[],s=e.planIsCompleted||[],a=r.length>0&&s.filter(Boolean).length===r.length;if(!(r.length===0||a)){if(i==="modal"){const c=s.findIndex(u=>!u),l=c>=0?r[c]:null;l&&e.selectPlan(l)}else i==="popover"&&setTimeout(()=>{this.showMessage("Don't forget to complete your onboarding",{autoCloseMs:1e4})},1e3);try{ii().track("engagement-prompt-shown",{style:i})}catch{}}}async initialise(e={}){var t;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0,identity:((t=window==null?void 0:window.obiWidgetConfig)==null?void 0:t.user)||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}this.dispatchCommandQueue()}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),this.updateWidgetDisplay(e.widgetDisplay),this.updateCompletedWidgetDisplay(e.completedWidgetDisplay),this.updateWidgetPosition(e.widgetPosition),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var t;e===void 0||e==((t=this.client)==null?void 0:t.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}updateWidgetDisplay(e){e===void 0||e==this.widgetDisplay||(this.widgetDisplay=e)}updateCompletedWidgetDisplay(e){e===void 0||e==this.completedWidgetDisplay||(this.completedWidgetDisplay=e)}updateWidgetPosition(e){e===void 0||e==this.widgetPosition||(this.widgetPosition=e)}async updateIdentity(e){var i,r;if(e===void 0||e==((i=this.client)==null?void 0:i.identity))return;(r=this.client)==null||r.identity;let t=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:t,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised");try{this._maybeActOnServerEngagement()}catch{}}).catch(s=>{console.error("[obi] error initialising client",s),this.emit("error",s)}),e!=null&&e.email&&ii().identify((e==null?void 0:e.email)||"",t)}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var t,i,r;await((r=(i=(t=this.client)==null?void 0:t.session)==null?void 0:i.say)==null?void 0:r.call(i,e))}async startSession(){await this.client.startSession(this.client.selectedPlanUuid,e=>{e.on("stateChanged",t=>{t!=="disconnecting"&&t!=="disconnected"&&t!=="error"&&t!=="connecting"&&this.save()}),e.on("paused",()=>{this.save()}),e.on("unpaused",()=>{this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(t=>{try{this.dispatchCommand(t[0],t[1]||[])}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(Im)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((s,a)=>{e[a]=s});const t=e[Pm];if(!t)return null;const i=new URL(window.location.href);i.searchParams.delete(Pm),window.history.replaceState({},"",i.toString()),i.toString(),localStorage.removeItem(Im),this.passivePlanUuid=t}mountWidget(){l_(this)}showMessage(e,t){try{this.emit("showMessage",{text:e,autoCloseMs:t==null?void 0:t.autoCloseMs})}catch{}}async captureScreen(){try{await Dx(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.text_segmentation)),await i_(async()=>(this.graphemes||(this.graphemes=await this.client.api.getGraphemes()),this.graphemes.data.css_line_breaks))}catch(e){throw console.error("[obi] error initialising unicode trie",e),e}try{return(await RT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}catch(e){throw console.error("[obi] error capturing screen",e),e}}save(){var t;const e=((t=this.client)==null?void 0:t.serialise())||"";localStorage.setItem("obi-client",e)}load(){return localStorage.getItem("obi-client")}}async function Om(n,e){let t;try{t=window}catch{console.warn("[obi] no window object found"),t={}}return h_({appToken:n,window:t,init:e})}async function h_({appToken:n,window:e,init:t}){var s,a;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t&&t(),n||(n=(s=e==null?void 0:e.obiWidgetConfig)==null?void 0:s.apiKey);let i;try{i=((a=e.ObiSDK)==null?void 0:a.q)||[]}catch{i=[]}const r=new d_(n);return e.ObiSDK=r.dispatchCommand,await r.initialise({queuedCommands:i}),e.obi=r,r.mountWidget(),r}function Am(){}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Om(void 0,Am)}):Om(void 0,Am)})();
|