@meltingspot/core 1.2.0 → 1.3.0

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/CHANGELOG.md CHANGED
@@ -15,6 +15,16 @@ Date: YYYY-MM-DD
15
15
 
16
16
  -->
17
17
 
18
+ ## v1.3.0
19
+
20
+ Date: 2026-07-15
21
+
22
+ ### Minor Changes
23
+
24
+ - Release alignment with the other MeltingSpot SDKs (`@meltingspot/embed`,
25
+ `@meltingspot/widget`, `@meltingspot/coach`). No functional changes to
26
+ `@meltingspot/core`.
27
+
18
28
  ## v1.2.0
19
29
 
20
30
  Date: 2026-07-07
package/index.mjs CHANGED
@@ -4929,7 +4929,7 @@ class r0 {
4929
4929
  this.listener !== null && typeof document < "u" && document.removeEventListener(xa, this.listener), this.listener = null, this.lastOptions = null;
4930
4930
  }
4931
4931
  }
4932
- const Zm = "1.2.0";
4932
+ const Zm = "1.3.0";
4933
4933
  class Jm {
4934
4934
  constructor(s) {
4935
4935
  this.debug = !1, this.debug = s?.debug ?? !1, this.appName = s?.appName, this.appVersion = s?.appVersion;
package/index.umd.js CHANGED
@@ -30,4 +30,4 @@ __p += '`),tn&&(A+=`' +
30
30
  function print() { __p += __j.call(arguments, '') }
31
31
  `:`;
32
32
  `)+A+`return __p
33
- }`;var J=Cf(function(){return sn(f,U+"return "+A).apply(i,l)});if(J.source=A,Du(J))throw J;return J}function Fv(n){return fn(n).toLowerCase()}function Hv(n){return fn(n).toUpperCase()}function Bv(n,e,t){if(n=fn(n),n&&(t||e===i))return zs(n);if(!n||!(e=ne(e)))return n;var u=Te(n),s=Te(e),f=qs(u,s),l=Ks(u,s)+1;return Ze(u,f,l).join("")}function Wv(n,e,t){if(n=fn(n),n&&(t||e===i))return n.slice(0,Zs(n)+1);if(!n||!(e=ne(e)))return n;var u=Te(n),s=Ks(u,Te(e))+1;return Ze(u,0,s).join("")}function kv(n,e,t){if(n=fn(n),n&&(t||e===i))return n.replace(Di,"");if(!n||!(e=ne(e)))return n;var u=Te(n),s=qs(u,Te(e));return Ze(u,s).join("")}function Gv(n,e){var t=ln,u=rn;if(Tn(e)){var s="separator"in e?e.separator:s;t="length"in e?Q(e.length):t,u="omission"in e?ne(e.omission):u}n=fn(n);var f=n.length;if(It(n)){var l=Te(n);f=l.length}if(t>=f)return n;var h=t-Lt(u);if(h<1)return u;var _=l?Ze(l,0,h).join(""):n.slice(0,h);if(s===i)return _+u;if(l&&(h+=_.length-h),Su(s)){if(n.slice(h).search(s)){var T,w=_;for(s.global||(s=qi(s.source,fn(ds.exec(s))+"g")),s.lastIndex=0;T=s.exec(w);)var A=T.index;_=_.slice(0,A===i?h:A)}}else if(n.indexOf(ne(s),h)!=h){var R=_.lastIndexOf(s);R>-1&&(_=_.slice(0,R))}return _+u}function zv(n){return n=fn(n),n&&th.test(n)?n.replace(cs,Td):n}var qv=xt(function(n,e,t){return n+(t?" ":"")+e.toUpperCase()}),Uu=Ca("toUpperCase");function Pf(n,e,t){return n=fn(n),e=t?i:e,e===i?_d(n)?yd(n):od(n):n.match(e)||[]}var Cf=V(function(n,e){try{return Xn(n,i,e)}catch(t){return Du(t)?t:new W(t)}}),Kv=Ce(function(n,e){return ae(e,function(t){t=Oe(t),$e(n,t,Mu(n[t],n))}),n});function Qv(n){var e=n==null?0:n.length,t=N();return n=e?gn(n,function(u){if(typeof u[1]!="function")throw new fe(g);return[t(u[0]),u[1]]}):[],V(function(u){for(var s=-1;++s<e;){var f=n[s];if(Xn(f[0],this,u))return Xn(f[1],this,u)}})}function Zv(n){return Tp(le(n,H))}function Nu(n){return function(){return n}}function Jv(n,e){return n==null||n!==n?e:n}var Vv=Fa(),Xv=Fa(!0);function Qn(n){return n}function $u(n){return _a(typeof n=="function"?n:le(n,H))}function jv(n){return ma(le(n,H))}function n0(n,e){return va(n,le(e,H))}var e0=V(function(n,e){return function(t){return Vt(t,n,e)}}),t0=V(function(n,e){return function(t){return Vt(n,t,e)}});function Pu(n,e,t){var u=Un(e),s=qr(e,u);t==null&&!(Tn(e)&&(s.length||!u.length))&&(t=e,e=n,n=this,s=qr(e,Un(e)));var f=!(Tn(t)&&"chain"in t)||!!t.chain,l=Fe(n);return ae(s,function(h){var _=e[h];n[h]=_,l&&(n.prototype[h]=function(){var T=this.__chain__;if(f||T){var w=n(this.__wrapped__),A=w.__actions__=zn(this.__actions__);return A.push({func:_,args:arguments,thisArg:n}),w.__chain__=T,w}return _.apply(n,ke([this.value()],arguments))})}),n}function r0(){return Pn._===this&&(Pn._=Dd),this}function Cu(){}function i0(n){return n=Q(n),V(function(e){return Ea(e,n)})}var u0=pu(gn),o0=pu(Hs),s0=pu(Fi);function Yf(n){return wu(n)?Hi(Oe(n)):Cp(n)}function a0(n){return function(e){return n==null?i:ct(n,e)}}var f0=Ba(),c0=Ba(!0);function Yu(){return[]}function Fu(){return!1}function l0(){return{}}function h0(){return""}function d0(){return!0}function p0(n,e){if(n=Q(n),n<1||n>L)return[];var t=X,u=Fn(n,X);e=N(e),n-=X;for(var s=ki(u,e);++t<n;)e(t);return s}function _0(n){return G(n)?gn(n,Oe):ee(n)?[n]:zn(rf(fn(n)))}function g0(n){var e=++Md;return fn(n)+e}var m0=Xr(function(n,e){return n+e},0),v0=_u("ceil"),E0=Xr(function(n,e){return n/e},1),T0=_u("floor");function w0(n){return n&&n.length?zr(n,Qn,nu):i}function A0(n,e){return n&&n.length?zr(n,N(e,2),nu):i}function y0(n){return ks(n,Qn)}function I0(n,e){return ks(n,N(e,2))}function L0(n){return n&&n.length?zr(n,Qn,iu):i}function R0(n,e){return n&&n.length?zr(n,N(e,2),iu):i}var M0=Xr(function(n,e){return n*e},1),O0=_u("round"),D0=Xr(function(n,e){return n-e},0);function S0(n){return n&&n.length?Wi(n,Qn):0}function b0(n,e){return n&&n.length?Wi(n,N(e,2)):0}return a.after=jg,a.ary=_f,a.assign=Hm,a.assignIn=Df,a.assignInWith=li,a.assignWith=Bm,a.at=Wm,a.before=gf,a.bind=Mu,a.bindAll=Kv,a.bindKey=mf,a.castArray=lm,a.chain=hf,a.chunk=T_,a.compact=w_,a.concat=A_,a.cond=Qv,a.conforms=Zv,a.constant=Nu,a.countBy=Sg,a.create=km,a.curry=vf,a.curryRight=Ef,a.debounce=Tf,a.defaults=Gm,a.defaultsDeep=zm,a.defer=nm,a.delay=em,a.difference=y_,a.differenceBy=I_,a.differenceWith=L_,a.drop=R_,a.dropRight=M_,a.dropRightWhile=O_,a.dropWhile=D_,a.fill=S_,a.filter=xg,a.flatMap=$g,a.flatMapDeep=Pg,a.flatMapDepth=Cg,a.flatten=af,a.flattenDeep=b_,a.flattenDepth=x_,a.flip=tm,a.flow=Vv,a.flowRight=Xv,a.fromPairs=U_,a.functions=Xm,a.functionsIn=jm,a.groupBy=Yg,a.initial=$_,a.intersection=P_,a.intersectionBy=C_,a.intersectionWith=Y_,a.invert=ev,a.invertBy=tv,a.invokeMap=Hg,a.iteratee=$u,a.keyBy=Bg,a.keys=Un,a.keysIn=Kn,a.map=ui,a.mapKeys=iv,a.mapValues=uv,a.matches=jv,a.matchesProperty=n0,a.memoize=si,a.merge=ov,a.mergeWith=Sf,a.method=e0,a.methodOf=t0,a.mixin=Pu,a.negate=ai,a.nthArg=i0,a.omit=sv,a.omitBy=av,a.once=rm,a.orderBy=Wg,a.over=u0,a.overArgs=im,a.overEvery=o0,a.overSome=s0,a.partial=Ou,a.partialRight=wf,a.partition=kg,a.pick=fv,a.pickBy=bf,a.property=Yf,a.propertyOf=a0,a.pull=W_,a.pullAll=cf,a.pullAllBy=k_,a.pullAllWith=G_,a.pullAt=z_,a.range=f0,a.rangeRight=c0,a.rearg=um,a.reject=qg,a.remove=q_,a.rest=om,a.reverse=Lu,a.sampleSize=Qg,a.set=lv,a.setWith=hv,a.shuffle=Zg,a.slice=K_,a.sortBy=Xg,a.sortedUniq=ng,a.sortedUniqBy=eg,a.split=$v,a.spread=sm,a.tail=tg,a.take=rg,a.takeRight=ig,a.takeRightWhile=ug,a.takeWhile=og,a.tap=wg,a.throttle=am,a.thru=ii,a.toArray=Rf,a.toPairs=xf,a.toPairsIn=Uf,a.toPath=_0,a.toPlainObject=Of,a.transform=dv,a.unary=fm,a.union=sg,a.unionBy=ag,a.unionWith=fg,a.uniq=cg,a.uniqBy=lg,a.uniqWith=hg,a.unset=pv,a.unzip=Ru,a.unzipWith=lf,a.update=_v,a.updateWith=gv,a.values=$t,a.valuesIn=mv,a.without=dg,a.words=Pf,a.wrap=cm,a.xor=pg,a.xorBy=_g,a.xorWith=gg,a.zip=mg,a.zipObject=vg,a.zipObjectDeep=Eg,a.zipWith=Tg,a.entries=xf,a.entriesIn=Uf,a.extend=Df,a.extendWith=li,Pu(a,a),a.add=m0,a.attempt=Cf,a.camelCase=wv,a.capitalize=Nf,a.ceil=v0,a.clamp=vv,a.clone=hm,a.cloneDeep=pm,a.cloneDeepWith=_m,a.cloneWith=dm,a.conformsTo=gm,a.deburr=$f,a.defaultTo=Jv,a.divide=E0,a.endsWith=Av,a.eq=Ae,a.escape=yv,a.escapeRegExp=Iv,a.every=bg,a.find=Ug,a.findIndex=of,a.findKey=qm,a.findLast=Ng,a.findLastIndex=sf,a.findLastKey=Km,a.floor=T0,a.forEach=df,a.forEachRight=pf,a.forIn=Qm,a.forInRight=Zm,a.forOwn=Jm,a.forOwnRight=Vm,a.get=bu,a.gt=mm,a.gte=vm,a.has=nv,a.hasIn=xu,a.head=ff,a.identity=Qn,a.includes=Fg,a.indexOf=N_,a.inRange=Ev,a.invoke=rv,a.isArguments=dt,a.isArray=G,a.isArrayBuffer=Em,a.isArrayLike=qn,a.isArrayLikeObject=yn,a.isBoolean=Tm,a.isBuffer=Je,a.isDate=wm,a.isElement=Am,a.isEmpty=ym,a.isEqual=Im,a.isEqualWith=Lm,a.isError=Du,a.isFinite=Rm,a.isFunction=Fe,a.isInteger=Af,a.isLength=fi,a.isMap=yf,a.isMatch=Mm,a.isMatchWith=Om,a.isNaN=Dm,a.isNative=Sm,a.isNil=xm,a.isNull=bm,a.isNumber=If,a.isObject=Tn,a.isObjectLike=wn,a.isPlainObject=rr,a.isRegExp=Su,a.isSafeInteger=Um,a.isSet=Lf,a.isString=ci,a.isSymbol=ee,a.isTypedArray=Nt,a.isUndefined=Nm,a.isWeakMap=$m,a.isWeakSet=Pm,a.join=F_,a.kebabCase=Lv,a.last=de,a.lastIndexOf=H_,a.lowerCase=Rv,a.lowerFirst=Mv,a.lt=Cm,a.lte=Ym,a.max=w0,a.maxBy=A0,a.mean=y0,a.meanBy=I0,a.min=L0,a.minBy=R0,a.stubArray=Yu,a.stubFalse=Fu,a.stubObject=l0,a.stubString=h0,a.stubTrue=d0,a.multiply=M0,a.nth=B_,a.noConflict=r0,a.noop=Cu,a.now=oi,a.pad=Ov,a.padEnd=Dv,a.padStart=Sv,a.parseInt=bv,a.random=Tv,a.reduce=Gg,a.reduceRight=zg,a.repeat=xv,a.replace=Uv,a.result=cv,a.round=O0,a.runInContext=p,a.sample=Kg,a.size=Jg,a.snakeCase=Nv,a.some=Vg,a.sortedIndex=Q_,a.sortedIndexBy=Z_,a.sortedIndexOf=J_,a.sortedLastIndex=V_,a.sortedLastIndexBy=X_,a.sortedLastIndexOf=j_,a.startCase=Pv,a.startsWith=Cv,a.subtract=D0,a.sum=S0,a.sumBy=b0,a.template=Yv,a.times=p0,a.toFinite=He,a.toInteger=Q,a.toLength=Mf,a.toLower=Fv,a.toNumber=pe,a.toSafeInteger=Fm,a.toString=fn,a.toUpper=Hv,a.trim=Bv,a.trimEnd=Wv,a.trimStart=kv,a.truncate=Gv,a.unescape=zv,a.uniqueId=g0,a.upperCase=qv,a.upperFirst=Uu,a.each=df,a.eachRight=pf,a.first=ff,Pu(a,(function(){var n={};return Re(a,function(e,t){cn.call(a.prototype,t)||(n[t]=e)}),n})(),{chain:!1}),a.VERSION=c,ae(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){a[n].placeholder=a}),ae(["drop","take"],function(n,e){nn.prototype[n]=function(t){t=t===i?1:bn(Q(t),0);var u=this.__filtered__&&!e?new nn(this):this.clone();return u.__filtered__?u.__takeCount__=Fn(t,u.__takeCount__):u.__views__.push({size:Fn(t,X),type:n+(u.__dir__<0?"Right":"")}),u},nn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),ae(["filter","map","takeWhile"],function(n,e){var t=e+1,u=t==Y||t==O;nn.prototype[n]=function(s){var f=this.clone();return f.__iteratees__.push({iteratee:N(s,3),type:t}),f.__filtered__=f.__filtered__||u,f}}),ae(["head","last"],function(n,e){var t="take"+(e?"Right":"");nn.prototype[n]=function(){return this[t](1).value()[0]}}),ae(["initial","tail"],function(n,e){var t="drop"+(e?"":"Right");nn.prototype[n]=function(){return this.__filtered__?new nn(this):this[t](1)}}),nn.prototype.compact=function(){return this.filter(Qn)},nn.prototype.find=function(n){return this.filter(n).head()},nn.prototype.findLast=function(n){return this.reverse().find(n)},nn.prototype.invokeMap=V(function(n,e){return typeof n=="function"?new nn(this):this.map(function(t){return Vt(t,n,e)})}),nn.prototype.reject=function(n){return this.filter(ai(N(n)))},nn.prototype.slice=function(n,e){n=Q(n);var t=this;return t.__filtered__&&(n>0||e<0)?new nn(t):(n<0?t=t.takeRight(-n):n&&(t=t.drop(n)),e!==i&&(e=Q(e),t=e<0?t.dropRight(-e):t.take(e-n)),t)},nn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},nn.prototype.toArray=function(){return this.take(X)},Re(nn.prototype,function(n,e){var t=/^(?:filter|find|map|reject)|While$/.test(e),u=/^(?:head|last)$/.test(e),s=a[u?"take"+(e=="last"?"Right":""):e],f=u||/^find/.test(e);s&&(a.prototype[e]=function(){var l=this.__wrapped__,h=u?[1]:arguments,_=l instanceof nn,T=h[0],w=_||G(l),A=function(j){var tn=s.apply(a,ke([j],h));return u&&R?tn[0]:tn};w&&t&&typeof T=="function"&&T.length!=1&&(_=w=!1);var R=this.__chain__,U=!!this.__actions__.length,$=f&&!R,J=_&&!U;if(!f&&w){l=J?l:new nn(this);var P=n.apply(l,h);return P.__actions__.push({func:ii,args:[A],thisArg:i}),new ce(P,R)}return $&&J?n.apply(this,h):(P=this.thru(A),$?u?P.value()[0]:P.value():P)})}),ae(["pop","push","shift","sort","splice","unshift"],function(n){var e=Sr[n],t=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",u=/^(?:pop|shift)$/.test(n);a.prototype[n]=function(){var s=arguments;if(u&&!this.__chain__){var f=this.value();return e.apply(G(f)?f:[],s)}return this[t](function(l){return e.apply(G(l)?l:[],s)})}}),Re(nn.prototype,function(n,e){var t=a[e];if(t){var u=t.name+"";cn.call(Dt,u)||(Dt[u]=[]),Dt[u].push({name:e,func:t})}}),Dt[Vr(i,dn).name]=[{name:"wrapper",func:i}],nn.prototype.clone=zd,nn.prototype.reverse=qd,nn.prototype.value=Kd,a.prototype.at=Ag,a.prototype.chain=yg,a.prototype.commit=Ig,a.prototype.next=Lg,a.prototype.plant=Mg,a.prototype.reverse=Og,a.prototype.toJSON=a.prototype.valueOf=a.prototype.value=Dg,a.prototype.first=a.prototype.head,Gt&&(a.prototype[Gt]=Rg),a}),Rt=Id();ut?((ut.exports=Rt)._=Rt,$i._=Rt):Pn._=Rt}).call($c)})(Ct,Ct.exports)),Ct.exports}var Cc=Pc();const so=pt(Cc),ao=(r,o)=>{switch(o){case"fr":case"it":return so.capitalize(r.format("dddd D MMMM"));case"es":return so.capitalize(r.format("dddd D [de] MMMM"));case"de":return r.format("dddd, D. MMMM");default:return r.format("dddd, MMMM Do")}},fo=r=>r.format("LT"),Yc=(r,o)=>{const i=ao(r,o),c=fo(r);switch(o){case"fr":return`${i} à ${c}`;case"it":return`${i} alle ${c}`;case"es":return`${i} a las ${c}`;case"de":return`${i} um ${c}`;default:return`${i} at ${c}`}},Fc=r=>r.format("ll"),Hc=(r,o)=>{switch(o){case"fr":case"de":case"it":return r.format("HH:mm");case"es":return r.format("H:mm");default:return r.format("h:mm")}},Bc=r=>r.format("L"),Wc=r=>r.format("L LT");var co=(r=>(r.SimpleDate="SimpleDate",r.SimpleDateTime="SimpleDateTime",r.ExtraShortDate="ExtraShortDate",r.InlineExtraShortDate="InlineExtraShortDate",r.ShortDate="ShortDate",r.InlineShortDate="InlineShortDate",r.Date="Date",r.LongDate="LongDate",r.LongDateTime="LongDateTime",r.ShortTime="ShortTime",r.Time="Time",r.DateTime="DateTime",r))(co||{});const kc=(r,o,i,c)=>{let d=_t(r);c&&(d=d.tz(c)),i&&(d=d.locale(i));const v=d.locale();switch(o){case"SimpleDate":return Bc(d);case"SimpleDateTime":return Wc(d);case"ExtraShortDate":return xc(d,v);case"InlineExtraShortDate":return Uc(d,v);case"ShortDate":return Fc(d);case"InlineShortDate":return Nc(d,v);case"Date":return Sc(d);case"LongDate":return ao(d,v);case"LongDateTime":return Yc(d,v);case"ShortTime":return Hc(d,v);case"Time":return fo(d);case"DateTime":return bc(d)}};var _e=(r=>(r.Contains="Contains",r.DoesntContain="DoesntContain",r.DoesntEndWith="DoesntEndWith",r.DoesntEqual="DoesntEqual",r.DoesntStartWith="DoesntStartWith",r.EndsWith="EndsWith",r.Equals="Equals",r.MatchesRegex="MatchesRegex",r.StartsWith="StartsWith",r))(_e||{});const Gc="http://_meltingspot.local",zc=200,qc=/(\([^()]*[+*][^()]*\))[+*]/,Kc=r=>r.length<=zc&&!qc.test(r),Qc=r=>{try{const o=new URL(r,Gc);return`${o.pathname}${o.search}${o.hash}`}catch{return r}},Er=r=>r.startsWith("/")?r:`/${r}`,Zc=(r,o)=>{switch(o.operator){case _e.MatchesRegex:if(!Kc(o.value))return!1;try{return new RegExp(o.value).test(r)}catch{return!1}case _e.StartsWith:return r.startsWith(Er(o.value));case _e.DoesntStartWith:return!r.startsWith(Er(o.value));case _e.EndsWith:return r.endsWith(o.value);case _e.DoesntEndWith:return!r.endsWith(o.value);case _e.Contains:return r.includes(o.value);case _e.DoesntContain:return!r.includes(o.value);case _e.Equals:return r===Er(o.value);case _e.DoesntEqual:return r!==Er(o.value)}},Jc=(r,o)=>{const i=o.rules.map(c=>Zc(r,c));return o.ruleOperator==="AND"?i.every(Boolean):i.some(Boolean)},Vc=(r,o)=>{const i=Qc(r),c=o.blocks.map(d=>Jc(i,d));return o.blockOperator==="AND"?c.every(Boolean):c.some(Boolean)},Xc=r=>r.replace(/^https?:\/\//,""),jc=(r,o)=>{const i=Xc(o);try{const c=new URL(r);return c.hostname===i||c.hostname.endsWith(`.${i}`)}catch{return!1}},nl="data-meltingspot-playbook-editor-active",di="meltingspot:playbook-editor:active-changed",el=()=>typeof document<"u"&&typeof document.dispatchEvent=="function",lo=()=>el()?document.documentElement.getAttribute(nl)==="true":!1;class tl{constructor(){this.listener=null,this.lastOptions=null,this.chain=Promise.resolve()}enqueue(o){const i=this.chain.then(o);return this.chain=i.catch(()=>{}),i}get isBound(){return this.listener!==null}bind(o){if(this.listener!==null||typeof document>"u")return;const i=()=>{if(lo()){Promise.resolve().then(()=>o.onEditorActive()).catch(d=>{console.warn("[playbook-editor] onEditorActive callback failed",d)});return}const c=this.lastOptions;c!==null&&Promise.resolve().then(()=>o.onEditorInactive(c)).catch(d=>{console.warn("[playbook-editor] onEditorInactive callback failed",d)})};document.addEventListener(di,i),this.listener=i}cacheOptions(o){this.lastOptions=o}clearOptions(){this.lastOptions=null}unbind(){this.listener!==null&&typeof document<"u"&&document.removeEventListener(di,this.listener),this.listener=null,this.lastOptions=null}}const rl="1.2.0";class ho{constructor(o){this.debug=!1,this.debug=o?.debug??!1,this.appName=o?.appName,this.appVersion=o?.appVersion}log(o,...i){this.debug&&this.print(o,"info",i)}warn(o,...i){this.print(o,"warn",i)}error(o,...i){this.print(o,"error",i)}print(o,i,c){const g=[`[${["MeltingSpot",this.appName,this.appVersion].filter(Boolean).join(" - ")}] ${o}`];c.length&&g.push(...c),console[i](...g)}}const po=new ho({appName:"Core SDK",appVersion:rl}),il=r=>{po.debug=r},ul=r=>r.toLowerCase().replace(/[^a-z0-9-]/g,""),ol=["/user"],sl=({deeplink:r,spotId:o})=>{try{const i=new URL(r,"https://unused.com");let c=i.pathname;return i.search&&(c+=i.search),i.hash&&(c+=i.hash),ol.some(d=>c.startsWith(d))||(c=`/spot/${o}/${zu(c)}`),c}catch(i){return po.warn("Failed to parse deeplink URL",i),null}},al=[/(^|\.)meltingspot\.io$/i],fl=r=>{let o;try{const v=qu(r);o=new URL(v)}catch{throw new Error(`Invalid baseURL: ${r}`)}const i=o.hostname==="localhost"||o.hostname==="127.0.0.1",c=o.protocol==="https:",d=al.some(v=>v.test(o.hostname));if(!i&&(!c||!d))throw new Error(`Untrusted baseURL origin: ${o.origin}`);return o.origin},cl={msApiBaseUrl:"https://openapi.meltingspot.io/",msCommunityWebBaseUrl:"https://go.meltingspot.io/",ssoToken:void 0,spotId:"",autoJoin:!1,rootDocument:globalThis.document};class ue{constructor(){this.configuration=cl}static getInstance(){return ue.instance||(ue.instance=new ue),ue.instance}setConfiguration(o){this.configuration={...this.configuration,...o}}static getConfiguration(o={}){return{...ue.getInstance().configuration,...o}}}const _o="%[a-f0-9]{2}",go=new RegExp("("+_o+")|([^%]+?)","gi"),mo=new RegExp("("+_o+")+","gi");function pi(r,o){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;o=o||1;const i=r.slice(0,o),c=r.slice(o);return Array.prototype.concat.call([],pi(i),pi(c))}function ll(r){try{return decodeURIComponent(r)}catch{let o=r.match(go)||[];for(let i=1;i<o.length;i++)r=pi(o,i).join(""),o=r.match(go)||[];return r}}function hl(r){const o={"%FE%FF":"��","%FF%FE":"��"};let i=mo.exec(r);for(;i;){try{o[i[0]]=decodeURIComponent(i[0])}catch{const d=ll(i[0]);d!==i[0]&&(o[i[0]]=d)}i=mo.exec(r)}o["%C2"]="�";const c=Object.keys(o);for(const d of c)r=r.replace(new RegExp(d,"g"),o[d]);return r}function dl(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return hl(r)}}function pl(r,o){const i={};if(Array.isArray(o))for(const c of o){const d=Object.getOwnPropertyDescriptor(r,c);d?.enumerable&&Object.defineProperty(i,c,d)}else for(const c of Reflect.ownKeys(r)){const d=Object.getOwnPropertyDescriptor(r,c);if(d.enumerable){const v=r[c];o(c,v,r)&&Object.defineProperty(i,c,d)}}return i}function vo(r,o){if(!(typeof r=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r===""||o==="")return[];const i=r.indexOf(o);return i===-1?[]:[r.slice(0,i),r.slice(i+o.length)]}const _l=r=>r==null,gl=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),_i=Symbol("encodeFragmentIdentifier");function ml(r){switch(r.arrayFormat){case"index":return o=>(i,c)=>{const d=i.length;return c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),"[",d,"]"].join("")]:[...i,[Ln(o,r),"[",Ln(d,r),"]=",Ln(c,r)].join("")]};case"bracket":return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),"[]"].join("")]:[...i,[Ln(o,r),"[]=",Ln(c,r)].join("")];case"colon-list-separator":return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),":list="].join("")]:[...i,[Ln(o,r),":list=",Ln(c,r)].join("")];case"comma":case"separator":case"bracket-separator":{const o=r.arrayFormat==="bracket-separator"?"[]=":"=";return i=>(c,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?c:(d=d===null?"":d,c.length===0?[[Ln(i,r),o,Ln(d,r)].join("")]:[[c,Ln(d,r)].join(r.arrayFormatSeparator)])}default:return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,Ln(o,r)]:[...i,[Ln(o,r),"=",Ln(c,r)].join("")]}}function vl(r){let o;switch(r.arrayFormat){case"index":return(i,c,d)=>{if(o=/\[(\d*)]$/.exec(i),i=i.replace(/\[\d*]$/,""),!o){d[i]=c;return}d[i]===void 0&&(d[i]={}),d[i][o[1]]=c};case"bracket":return(i,c,d)=>{if(o=/(\[])$/.exec(i),i=i.replace(/\[]$/,""),!o){d[i]=c;return}if(d[i]===void 0){d[i]=[c];return}d[i]=[...d[i],c]};case"colon-list-separator":return(i,c,d)=>{if(o=/(:list)$/.exec(i),i=i.replace(/:list$/,""),!o){d[i]=c;return}if(d[i]===void 0){d[i]=[c];return}d[i]=[...d[i],c]};case"comma":case"separator":return(i,c,d)=>{const v=typeof c=="string"&&c.includes(r.arrayFormatSeparator),g=typeof c=="string"&&!v&&De(c,r).includes(r.arrayFormatSeparator);c=g?De(c,r):c;const I=v||g?c.split(r.arrayFormatSeparator).map(M=>De(M,r)):c===null?c:De(c,r);d[i]=I};case"bracket-separator":return(i,c,d)=>{const v=/(\[])$/.test(i);if(i=i.replace(/\[]$/,""),!v){d[i]=c&&De(c,r);return}const g=c===null?[]:De(c,r).split(r.arrayFormatSeparator);if(d[i]===void 0){d[i]=g;return}d[i]=[...d[i],...g]};default:return(i,c,d)=>{if(d[i]===void 0){d[i]=c;return}d[i]=[...[d[i]].flat(),c]}}}function Eo(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Ln(r,o){return o.encode?o.strict?gl(r):encodeURIComponent(r):r}function De(r,o){return o.decode?dl(r):r}function To(r){return Array.isArray(r)?r.sort():typeof r=="object"?To(Object.keys(r)).sort((o,i)=>Number(o)-Number(i)).map(o=>r[o]):r}function wo(r){const o=r.indexOf("#");return o!==-1&&(r=r.slice(0,o)),r}function El(r){let o="";const i=r.indexOf("#");return i!==-1&&(o=r.slice(i)),o}function Ao(r,o,i){return i==="string"&&typeof r=="string"?r:typeof i=="function"&&typeof r=="string"?i(r):i==="boolean"&&r===null?!0:i==="boolean"&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":i==="boolean"&&r!==null&&(r.toLowerCase()==="1"||r.toLowerCase()==="0")?r.toLowerCase()==="1":i==="string[]"&&o.arrayFormat!=="none"&&typeof r=="string"?[r]:i==="number[]"&&o.arrayFormat!=="none"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?[Number(r)]:i==="number"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):o.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":o.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):r}function gi(r){r=wo(r);const o=r.indexOf("?");return o===-1?"":r.slice(o+1)}function mi(r,o){o={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...o},Eo(o.arrayFormatSeparator);const i=vl(o),c=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return c;for(const d of r.split("&")){if(d==="")continue;const v=o.decode?d.replaceAll("+"," "):d;let[g,I]=vo(v,"=");g===void 0&&(g=v),I=I===void 0?null:["comma","separator","bracket-separator"].includes(o.arrayFormat)?I:De(I,o),i(De(g,o),I,c)}for(const[d,v]of Object.entries(c))if(typeof v=="object"&&v!==null&&o.types[d]!=="string")for(const[g,I]of Object.entries(v)){const M=o.types[d]?o.types[d].replace("[]",""):void 0;v[g]=Ao(I,o,M)}else typeof v=="object"&&v!==null&&o.types[d]==="string"?c[d]=Object.values(v).join(o.arrayFormatSeparator):c[d]=Ao(v,o,o.types[d]);return o.sort===!1?c:(o.sort===!0?Object.keys(c).sort():Object.keys(c).sort(o.sort)).reduce((d,v)=>{const g=c[v];return d[v]=g&&typeof g=="object"&&!Array.isArray(g)?To(g):g,d},Object.create(null))}function yo(r,o){if(!r)return"";o={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...o},Eo(o.arrayFormatSeparator);const i=g=>o.skipNull&&_l(r[g])||o.skipEmptyString&&r[g]==="",c=ml(o),d={};for(const[g,I]of Object.entries(r))i(g)||(d[g]=I);const v=Object.keys(d);return o.sort!==!1&&v.sort(o.sort),v.map(g=>{const I=r[g];return I===void 0?"":I===null?Ln(g,o):Array.isArray(I)?I.length===0&&o.arrayFormat==="bracket-separator"?Ln(g,o)+"[]":I.reduce(c(g),[]).join("&"):Ln(g,o)+"="+Ln(I,o)}).filter(g=>g.length>0).join("&")}function Io(r,o){o={decode:!0,...o};let[i,c]=vo(r,"#");return i===void 0&&(i=r),{url:i?.split("?")?.[0]??"",query:mi(gi(r),o),...o&&o.parseFragmentIdentifier&&c?{fragmentIdentifier:De(c,o)}:{}}}function Lo(r,o){o={encode:!0,strict:!0,[_i]:!0,...o};const i=wo(r.url).split("?")[0]||"",c=gi(r.url),d={...mi(c,{sort:!1,...o}),...r.query};let v=yo(d,o);v&&=`?${v}`;let g=El(r.url);if(typeof r.fragmentIdentifier=="string"){const I=new URL(i);I.hash=r.fragmentIdentifier,g=o[_i]?I.hash:`#${r.fragmentIdentifier}`}return`${i}${v}${g}`}function Ro(r,o,i){i={parseFragmentIdentifier:!0,[_i]:!1,...i};const{url:c,query:d,fragmentIdentifier:v}=Io(r,i);return Lo({url:c,query:pl(d,o),fragmentIdentifier:v},i)}function Tl(r,o,i){const c=Array.isArray(o)?d=>!o.includes(d):(d,v)=>!o(d,v);return Ro(r,c,i)}const wl=Object.freeze(Object.defineProperty({__proto__:null,exclude:Tl,extract:gi,parse:mi,parseUrl:Io,pick:Ro,stringify:yo,stringifyUrl:Lo},Symbol.toStringTag,{value:"Module"}));class Gn extends Error{constructor(o,i){super(`HTTP Error ${o}${i?`: ${i}`:""}`),this.code=o,this.name="HttpError",Object.setPrototypeOf(this,Gn.prototype)}}var Rn=(r=>(r.GET="GET",r.PATCH="PATCH",r.POST="POST",r))(Rn||{});class Mo{constructor(){this.headers={}}setHeaders(o){this.headers=o}async get(o){try{const i=o.query?`${o.url}?${this.serializeQuery(o.query)}`:o.url,c=await fetch(i,{headers:{...this.headers,...o.headers,"Content-Type":"application/json"},...o.signal?{signal:o.signal}:{}});return c.ok?on(await c.json()):z(new Gn(c.status,await c.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}async post(o){try{const i=await fetch(o.url,{method:"POST",headers:{...this.headers,...o.headers,"Content-Type":"application/json"},body:JSON.stringify(o.payload),...o.signal?{signal:o.signal}:{}});return i.ok?on(await i.json()):z(new Gn(i.status,await i.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}async patch(o){try{const i=await fetch(o.url,{method:"PATCH",headers:{...this.headers,...o.headers,"Content-Type":"application/json"},body:JSON.stringify(o.payload),...o.signal?{signal:o.signal}:{}});return i.ok?on(await i.json()):z(new Gn(i.status,await i.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}serializeQuery(o){if(typeof o=="string")return o;if(typeof o=="object")for(const i in o)o[i]===void 0&&delete o[i];return o=wl.stringify(o,{arrayFormat:"none"}),o}}const Tr={accessToken:{email:"/v1/auth/accessToken/email",sso:{jwt:"/v1/auth/accessToken/sso/jwt"}},refreshAccessToken:"/v1/auth/accessToken~refresh",password:{reset:"/v1/auth/password~reset"}};var Oo=(r=>(r.TokensUpdated="auth:tokens-updated",r))(Oo||{});class Se extends EventTarget{constructor(){super(),this.accessToken=null,this.refreshToken=null}static getInstance(){return Se.instance||(Se.instance=new Se),Se.instance}async loginWithPassword(o,i){const c=await this.callApi({endpoint:Tr.accessToken.email,method:"POST",body:{email:o,password:i},withSpotId:!0});if(c.isErr())return z(c.error);const{accessToken:d,refreshToken:v}=c.value;return this.setTokens(d.token,v.token),on({accessToken:d.token,refreshToken:v.token})}async loginWithSsoToken(o){const i=await this.callApi({endpoint:Tr.accessToken.sso.jwt,method:"POST",body:{token:o},withSpotId:!0});if(i.isErr())return z(i.error);const{accessToken:c,refreshToken:d}=i.value;return this.setTokens(c.token,d.token),on({accessToken:c.token,refreshToken:d.token})}loginWithAuthTokens(o,i){return this.setTokens(o,i),{accessToken:o,refreshToken:i}}resetPassword(o){return this.callApi({endpoint:Tr.password.reset,method:"POST",body:{email:o}})}async refresh(){const o=await this.callApi({endpoint:Tr.refreshAccessToken,method:"POST",body:{refreshToken:this.refreshToken}});if(o.isErr())return z(o.error);const{accessToken:i,refreshToken:c}=o.value;return this.setTokens(i.token,c.token),on({accessToken:i.token,refreshToken:c.token})}async logout(){this.setTokens(null,null)}getAccessToken(){return this.accessToken}getRefreshToken(){return this.refreshToken}setTokens(o,i){if(this.accessToken!==o||this.refreshToken!==i){this.accessToken=o,this.refreshToken=i;const c=new CustomEvent("auth:tokens-updated",{detail:{accessToken:o,refreshToken:i}});this.dispatchEvent(c)}}async callApi(o){try{const{spotId:i,msApiBaseUrl:c}=ue.getConfiguration(),d=ur(o.endpoint,c),v={"Content-Type":"application/json",...o.headers};o.withSpotId&&i&&(v[Do.SpotId]=i);const g=await fetch(d,{method:o.method,body:o.body?JSON.stringify(o.body):void 0,headers:v});if(!g.ok)return z(new Gn(g.status,g.statusText));if(g.status===ie.NO_CONTENT)return on(void 0);const I=await g.json();return on(I)}catch(i){return z(new Gn(ie.INTERNAL_SERVER_ERROR,i instanceof Error?i.message:String(i)))}}}var Do=(r=>(r.Authorization="Authorization",r.SpotId="x-spotid",r))(Do||{});class oe{constructor(){this.queue=[],this.isProcessing=!1,this.isPaused=!1,this.authService=Se.getInstance(),this.httpService=new Mo}static getInstance(){return oe.instance||(oe.instance=new oe),oe.instance}static buildAuthenticatedRequest(o){const{msApiBaseUrl:i,spotId:c}=ue.getConfiguration(),d=ur(o,i),v=Se.getInstance().getAccessToken();if(!v)return z(new Error("Not authenticated"));const g={"Content-Type":"application/json",Authorization:`Bearer ${v}`};return c&&(g["x-spotid"]=c),on({url:d,headers:g})}static async stream(o,i,c){const{streamTransport:d}=ue.getConfiguration();if(d)return d({endpoint:o,body:i,signal:c});const v=oe.buildAuthenticatedRequest(o);if(v.isErr())return z(v.error);const{url:g,headers:I}=v.value;try{const M=await fetch(g,{method:"POST",headers:I,...i!==void 0?{body:JSON.stringify(i)}:{},...c?{signal:c}:{}});if(!M.ok){const K=await M.text();return z(new Error(`HTTP ${M.status}: ${K}`))}return M.body?on(M.body):z(new Error("Response body is empty"))}catch(M){const K=M instanceof Error?M.message:"Unknown error";return z(M instanceof Error?M:new Error(K))}}get pendingCount(){return this.queue.length}enqueue(o){return new Promise(i=>{const c=async()=>{try{const d=await o();i(d)}catch(d){i(z(new Gn(ie.INTERNAL_SERVER_ERROR,d instanceof Error?d.message:"Unknown error")))}};this.queue.push(c),this.processQueue()})}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;!this.isPaused&&this.queue.length>0;){const o=this.queue.shift();if(!o)break;await o()}}finally{this.isProcessing=!1,!this.isPaused&&this.queue.length>0&&Promise.resolve().then(()=>this.processQueue())}}}pauseQueue(){this.isPaused=!0}resumeQueue(){const o=this.isPaused;this.isPaused=!1,o&&this.processQueue()}async call(o){return this.enqueue(async()=>{const i=async()=>{const{spotId:d,msApiBaseUrl:v}=ue.getConfiguration(),g={...o.options?.headers??{}};d&&(g["x-spotid"]=d);const I=this.authService.getAccessToken(),{requiresAuth:M=!0}=o;if(!I&&M)return z(new Gn(ie.UNAUTHORIZED));I&&(g.Authorization=`Bearer ${I}`);const K=ur(o.endpoint,v);switch(o.method){case Rn.GET:return this.httpService.get({...o.options??{},headers:g,url:K});case Rn.PATCH:return this.httpService.patch({...o.options??{},headers:g,url:K});case Rn.POST:return this.httpService.post({...o.options??{},headers:g,url:K});default:return z(new Gn(ie.METHOD_NOT_ALLOWED,"Method not allowed"))}};let c=await i();if(c.isErr()&&c.error.code===ie.UNAUTHORIZED){const d=await this.authService.refresh();if(d.isErr())return z(new Gn(ie.UNAUTHORIZED,d.error.message));c=await i()}return c})}}const Ie={playbooks:"/v1/playbooks",pages:r=>`/v1/playbooks/${r}/pages`,hotspots:(r,o)=>`/v1/playbooks/${r}/pages/${o}/hotspots`,hotspot:(r,o,i)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}`,accessibleIntents:(r,o)=>`/v1/playbooks/${r}/pages/${o}/accessibleIntents`,intents:(r,o,i)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}/intents`,intent:(r,o,i,c)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}/intents/${c}`},wr=50;class et{static getInstance(){return et.instance||(et.instance=new et),et.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async listPlaybooks(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.playbooks,options:{query:{page:o?.page??1,limit:o?.limit??wr,...o?.domain?{"domain[eq]":o.domain}:{}}}});return i.isErr()?z(i.error):on(i.value)}async listPlaybookPages(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.pages(o.playbookId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.url?{"url[eq]":o.url}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookPage(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.pages(o.playbookId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async listAccessiblePlaybookIntents(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.accessibleIntents(o.playbookId,o.pageId),options:{query:{...o.domain?{domain:o.domain}:{}}}});return i.isErr()?z(i.error):on(i.value)}async listPlaybookHotspots(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.hotspots(o.playbookId,o.pageId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.intentStatus?{"intentStatus[eq]":o.intentStatus}:{},...o.widgetType?{"widgetType[eq]":o.widgetType}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookHotspot(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.hotspots(o.playbookId,o.pageId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async updatePlaybookHotspot(o,i){const c=await this.meltingSpotApi.call({method:Rn.PATCH,endpoint:Ie.hotspot(o.playbookId,o.pageId,o.hotspotId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async listPlaybookIntents(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.intents(o.playbookId,o.pageId,o.hotspotId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.status?{"status[eq]":o.status}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookIntent(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.intents(o.playbookId,o.pageId,o.hotspotId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async updatePlaybookIntent(o,i){const c=await this.meltingSpotApi.call({method:Rn.PATCH,endpoint:Ie.intent(o.playbookId,o.pageId,o.hotspotId,o.intentId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}}const Al={me:"/v1/spots/me"},yl=50;class gt{static getInstance(){return gt.instance||(gt.instance=new gt),gt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async listSpotsForMe(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Al.me,options:{query:{page:1,limit:yl,...o?.spotMemberRole?{"spotMemberRole[eq]":o.spotMemberRole}:{}}}});return i.isErr()?z(i.error):on(i.value)}}const So={spotMember:{me:"/v1/spotMembers/me",joinFromSso:"/v1/spotMembers~joinFromSso"}};class tt{static getInstance(){return tt.instance||(tt.instance=new tt),tt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async getSpotMemberForMe(){const o=await this.meltingSpotApi.call({method:Rn.GET,endpoint:So.spotMember.me});return o.isErr()?z(o.error):on(o.value)}async joinFromSso(o){const i=await this.meltingSpotApi.call({method:Rn.POST,endpoint:So.spotMember.joinFromSso,options:{payload:{token:o}}});return i.isErr()?z(i.error):on(i.value)}}const Il={spotMemberSsoToken:"/v1/spotMembers/auth/sso/jwt"};class mt{static getInstance(){return mt.instance||(mt.instance=new mt),mt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async generateSsoToken(){const o=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Il.spotMemberSsoToken,options:{payload:{}}});return o.isErr()?z(o.error):on(o.value.token)}}class rt{static getInstance(){return rt.instance||(rt.instance=new rt),rt.instance}constructor(){this.spotMemberAuthApiService=mt.getInstance()}async generateSsoToken(){return this.spotMemberAuthApiService.generateSsoToken()}}class Ll{constructor(o){this.active=!1,this.lastObservedUrl=null,this.options={onRouteChange:o.onRouteChange,debounceMs:o.debounceMs??0,enableDeduplication:o.enableDeduplication??!0,enableDomMutationDetection:o.enableDomMutationDetection??!1,enableHistoryChange:o.enableHistoryChange??!0,enablePopState:o.enablePopState??!0,enableHashChange:o.enableHashChange??!0,enableLoad:o.enableLoad??!0,rootDocument:o.rootDocument}}start(){this.active||(this.active=!0,this.lastObservedUrl=null,this.options.enablePopState&&(this.popStateListener=()=>this.handleNavigationEvent("popstate"),window.addEventListener("popstate",this.popStateListener)),this.options.enableHashChange&&(this.hashChangeListener=()=>this.handleNavigationEvent("hashchange"),window.addEventListener("hashchange",this.hashChangeListener)),this.options.enableLoad&&(this.loadListener=()=>this.handleNavigationEvent("load"),window.addEventListener("load",this.loadListener)),this.options.enableDomMutationDetection&&(this.mutationObserver=new MutationObserver(()=>{this.handleNavigationEvent("locationchange")}),this.mutationObserver.observe(this.options.rootDocument??document,{childList:!0,subtree:!0})),this.options.enableHistoryChange&&this.patchHistoryListeners())}stop(){this.active&&(this.active=!1,this.debounceTimer!==void 0&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.popStateListener&&(window.removeEventListener("popstate",this.popStateListener),this.popStateListener=void 0),this.hashChangeListener&&(window.removeEventListener("hashchange",this.hashChangeListener),this.hashChangeListener=void 0),this.loadListener&&(window.removeEventListener("load",this.loadListener),this.loadListener=void 0),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=void 0),(this.originalPushState||this.originalReplaceState)&&this.restoreHistoryListeners(),this.lastObservedUrl=null)}handleNavigationEvent(o){if(!this.active)return;const i=window.location.href;this.options.enableDeduplication&&this.lastObservedUrl===i||(this.lastObservedUrl=i,this.options.debounceMs>0?(this.debounceTimer!==void 0&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=void 0,this.options.onRouteChange(i,o)},this.options.debounceMs)):this.options.onRouteChange(i,o))}patchHistoryListeners(){this.originalPushState=window.history.pushState,this.originalReplaceState=window.history.replaceState,window.history.pushState=(...o)=>{const i=this.originalPushState?.apply(window.history,o);return this.handleNavigationEvent("history.pushState"),i},window.history.replaceState=(...o)=>{const i=this.originalReplaceState?.apply(window.history,o);return this.handleNavigationEvent("history.replaceState"),i}}restoreHistoryListeners(){this.originalPushState&&(window.history.pushState=this.originalPushState,this.originalPushState=void 0),this.originalReplaceState&&(window.history.replaceState=this.originalReplaceState,this.originalReplaceState=void 0)}}const Rl={events:"/v1/analytics/events"};class vt{static getInstance(){return vt.instance||(vt.instance=new vt),vt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async appendEvent(o){const i=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Rl.events,options:{payload:o}});return i.isErr()?z(i.error):on(i.value)}}const Ml=r=>{const o=r.get("utm_source");if(o)return{source:o,medium:r.get("utm_medium")??void 0,campaign:r.get("utm_campaign")??void 0,term:r.get("utm_term")??void 0,content:r.get("utm_content")??void 0}},Ol=r=>r?Object.entries(r).reduce((o,[i,c])=>(c!=null&&(o[`utm_${i}`]=c),o),{}):{};var bo=(r=>(r.Active="Active",r.Closed="Closed",r.Expired="Expired",r))(bo||{}),xo=(r=>(r.User="User",r.Assistant="Assistant",r))(xo||{}),Uo=(r=>(r.Metadata="metadata",r.Token="token",r.Action="action",r.Bubble="bubble",r.Handoff="handoff",r.Done="done",r.Error="error",r))(Uo||{}),No=(r=>(r.NoSource="NoSource",r.LowConfidence="LowConfidence",r.HumanRequest="HumanRequest",r.OutOfScope="OutOfScope",r))(No||{}),$o=(r=>(r.PlaybookIntent="PlaybookIntent",r.UserInitiated="UserInitiated",r.Welcome="Welcome",r.Resume="Resume",r.Discover="Discover",r.Recommend="Recommend",r))($o||{}),Po=(r=>(r.ExtraExtraSmall="ExtraExtraSmall",r.ExtraSmall="ExtraSmall",r.Small="Small",r.Medium="Medium",r.Large="Large",r))(Po||{}),Co=(r=>(r.Dropdown="Dropdown",r.Inline="Inline",r.Overlay="Overlay",r))(Co||{}),Yo=(r=>(r.Left="Left",r.Right="Right",r))(Yo||{}),Fo=(r=>(r.Top="Top",r.Bottom="Bottom",r))(Fo||{}),Ho=(r=>(r.TopLeft="TopLeft",r.TopRight="TopRight",r.BottomLeft="BottomLeft",r.BottomRight="BottomRight",r))(Ho||{}),Bo=(r=>(r.Button="Button",r.Card="Card",r.CardInline="CardInline",r.Carousel="Carousel",r.Helper="Helper",r.ListOfContent="ListOfContent",r.ListOfContentInline="ListOfContentInline",r))(Bo||{}),Wo=(r=>(r.Inline="Inline",r.Modal="Modal",r.Drawer="Drawer",r))(Wo||{}),ko=(r=>(r.Self="Self",r.Parent="Parent",r.Top="Top",r))(ko||{}),Go=(r=>(r.Left="Left",r.Right="Right",r))(Go||{}),zo=(r=>(r.Body="Body",r.DOMSelector="DOMSelector",r))(zo||{}),qo=(r=>(r.After="After",r.AppendChild="AppendChild",r.Before="Before",r.PrependChild="PrependChild",r))(qo||{}),Ko=(r=>(r.CSSSelector="CSSSelector",r.Slot="Slot",r))(Ko||{}),Qo=(r=>(r.Element="Element",r.WebComponent="WebComponent",r))(Qo||{}),Zo=(r=>(r.Inline="Inline",r.Flex="Flex",r))(Zo||{}),Jo=(r=>(r.Horizontal="Horizontal",r.Vertical="Vertical",r))(Jo||{}),Vo=(r=>(r.Start="Start",r.Center="Center",r.End="End",r.Stretch="Stretch",r.Baseline="Baseline",r))(Vo||{}),Xo=(r=>(r.Course="Course",r.Live="Live",r.Link="Link",r.Page="Page",r))(Xo||{}),jo=(r=>(r.Workshop="Workshop",r.Conference="Conference",r))(jo||{}),ns=(r=>(r.Ended="Ended",r.Planned="Planned",r.Live="Live",r))(ns||{}),es=(r=>(r.CloseA="CloseA",r.CloseB="CloseB",r.Later="Later",r))(es||{});const Dl="a",Sl="mention_input",bl="mention",xl="var",Ul="p",Nl="h1",$l="h2",Pl="h3",Cl="blockquote",Yl="layout",Fl="layout-column",Hl="ul",Bl="ol",Wl="lic",kl="li",Gl="img",zl="iframely",ql="code_block",Kl="code_line";var ts=(r=>(r.Element="Element",r.FullPage="FullPage",r))(ts||{}),rs=(r=>(r.Draft="Draft",r.Pending="Pending",r.Published="Published",r))(rs||{}),is=(r=>(r.Beacon="Beacon",r.List="List",r))(is||{}),vi=(r=>(r.Channel="Channel",r.Collection="Collection",r.Course="Course",r.Discussion="Discussion",r.Forum="Forum",r.Link="Link",r.Live="Live",r.LearningPath="LearningPath",r.Page="Page",r.RichText="RichText",r.Topic="Topic",r))(vi||{});function Ql(r){return Object.values(vi).includes(r)}const us=ue.getInstance(),os=Se.getInstance(),ss=rt.getInstance(),as={Playbook:et.getInstance(),Spot:gt.getInstance(),SpotMember:tt.getInstance()},Et=globalThis;Et.MeltingSpot||(Et.MeltingSpot={}),Et.MeltingSpot.Configuration=us,Et.MeltingSpot.Auth=os,Et.MeltingSpot.Sso=ss,Et.MeltingSpot.Api=as,y.ATTRIBUTE_BLOCKQUOTE=Cl,y.ATTRIBUTE_CODE_BLOCK=ql,y.ATTRIBUTE_CODE_LINE=Kl,y.ATTRIBUTE_H1=Nl,y.ATTRIBUTE_H2=$l,y.ATTRIBUTE_H3=Pl,y.ATTRIBUTE_IFRAMELY=zl,y.ATTRIBUTE_IMAGE=Gl,y.ATTRIBUTE_LAYOUT=Yl,y.ATTRIBUTE_LAYOUT_COLUMN=Fl,y.ATTRIBUTE_LI=kl,y.ATTRIBUTE_LIC=Wl,y.ATTRIBUTE_LINK=Dl,y.ATTRIBUTE_MENTION=bl,y.ATTRIBUTE_MENTION_INPUT=Sl,y.ATTRIBUTE_OL=Bl,y.ATTRIBUTE_PARAGRAPH=Ul,y.ATTRIBUTE_UL=Hl,y.ATTRIBUTE_VARIABLE=xl,y.AnalyticsApiService=vt,y.Api=as,y.Auth=os,y.AuthService=Se,y.AuthServiceEvents=Oo,y.BeaconIntegrationType=Co,y.BeaconRenderType=Bo,y.ButtonBeaconSize=Po,y.Configuration=us,y.ConfigurationService=ue,y.ConversationMessageRole=xo,y.ConversationSseEventType=Uo,y.ConversationStatus=bo,y.DEFAULT_PERMISSION_POLICIES=Ku,y.DateFormat=co,y.DrawerWidgetPosition=Go,y.DropdownBeaconHorizontalPosition=Yo,y.DropdownBeaconVerticalPosition=Fo,y.HttpMethods=Rn,y.HttpService=Mo,y.LastActionState=es,y.LearningPathContentType=Xo,y.LiveBuiltInType=jo,y.LiveStatus=ns,y.Logger=ho,y.MeltingSpotApi=oe,y.MeltyHandoffReason=No,y.OverlayBeaconPosition=Ho,y.PLAYBOOK_EDITOR_ACTIVE_EVENT=di,y.PlaybookApiService=et,y.PlaybookEditorAwareLifecycle=tl,y.PlaybookHotspotLocation=ts,y.PlaybookIntentStatus=rs,y.PlaybookIntentWidgetMode=is,y.PlaybookPageMatchingOperator=_e,y.RouteChangeDetector=Ll,y.SpotMemberApiService=tt,y.SpotWidgetContentType=vi,y.Sso=ss,y.SsoService=rt,y.TouchPointAnchorType=zo,y.TouchPointDOMInjectionPosition=qo,y.TouchPointDOMSelectorCssStepMode=Qo,y.TouchPointDOMSelectorPathStepType=Ko,y.TouchPointFlexAlign=Vo,y.TouchPointFlexDirection=Jo,y.TouchPointLayoutType=Zo,y.TriggerType=$o,y.WidgetInjectionTarget=ko,y.WidgetInjectionType=Wo,y.createDialog=Qf,y.createIframe=Zf,y.dayjs=_t,y.flattenUtmParameters=Ol,y.formatBaseUrl=fl,y.formatDate=kc,y.formatDeeplink=sl,y.formatUUID=ul,y.getHTMLElement=Kf,y.getTimeInfoWithStartAndEndDate=Dc,y.isPlaybookEditorActive=lo,y.isSpotWidgetContentType=Ql,y.isTouchDevice=Jf,y.matchesDomain=jc,y.parseUtmParameters=Ml,y.sanitizeUrl=ur,y.setLoggerDebugMode=il,y.testUrlMatching=Vc,y.trimSlashLeft=zu,y.trimSlashRight=qu,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
33
+ }`;var J=Cf(function(){return sn(f,U+"return "+A).apply(i,l)});if(J.source=A,Du(J))throw J;return J}function Fv(n){return fn(n).toLowerCase()}function Hv(n){return fn(n).toUpperCase()}function Bv(n,e,t){if(n=fn(n),n&&(t||e===i))return zs(n);if(!n||!(e=ne(e)))return n;var u=Te(n),s=Te(e),f=qs(u,s),l=Ks(u,s)+1;return Ze(u,f,l).join("")}function Wv(n,e,t){if(n=fn(n),n&&(t||e===i))return n.slice(0,Zs(n)+1);if(!n||!(e=ne(e)))return n;var u=Te(n),s=Ks(u,Te(e))+1;return Ze(u,0,s).join("")}function kv(n,e,t){if(n=fn(n),n&&(t||e===i))return n.replace(Di,"");if(!n||!(e=ne(e)))return n;var u=Te(n),s=qs(u,Te(e));return Ze(u,s).join("")}function Gv(n,e){var t=ln,u=rn;if(Tn(e)){var s="separator"in e?e.separator:s;t="length"in e?Q(e.length):t,u="omission"in e?ne(e.omission):u}n=fn(n);var f=n.length;if(It(n)){var l=Te(n);f=l.length}if(t>=f)return n;var h=t-Lt(u);if(h<1)return u;var _=l?Ze(l,0,h).join(""):n.slice(0,h);if(s===i)return _+u;if(l&&(h+=_.length-h),Su(s)){if(n.slice(h).search(s)){var T,w=_;for(s.global||(s=qi(s.source,fn(ds.exec(s))+"g")),s.lastIndex=0;T=s.exec(w);)var A=T.index;_=_.slice(0,A===i?h:A)}}else if(n.indexOf(ne(s),h)!=h){var R=_.lastIndexOf(s);R>-1&&(_=_.slice(0,R))}return _+u}function zv(n){return n=fn(n),n&&th.test(n)?n.replace(cs,Td):n}var qv=xt(function(n,e,t){return n+(t?" ":"")+e.toUpperCase()}),Uu=Ca("toUpperCase");function Pf(n,e,t){return n=fn(n),e=t?i:e,e===i?_d(n)?yd(n):od(n):n.match(e)||[]}var Cf=V(function(n,e){try{return Xn(n,i,e)}catch(t){return Du(t)?t:new W(t)}}),Kv=Ce(function(n,e){return ae(e,function(t){t=Oe(t),$e(n,t,Mu(n[t],n))}),n});function Qv(n){var e=n==null?0:n.length,t=N();return n=e?gn(n,function(u){if(typeof u[1]!="function")throw new fe(g);return[t(u[0]),u[1]]}):[],V(function(u){for(var s=-1;++s<e;){var f=n[s];if(Xn(f[0],this,u))return Xn(f[1],this,u)}})}function Zv(n){return Tp(le(n,H))}function Nu(n){return function(){return n}}function Jv(n,e){return n==null||n!==n?e:n}var Vv=Fa(),Xv=Fa(!0);function Qn(n){return n}function $u(n){return _a(typeof n=="function"?n:le(n,H))}function jv(n){return ma(le(n,H))}function n0(n,e){return va(n,le(e,H))}var e0=V(function(n,e){return function(t){return Vt(t,n,e)}}),t0=V(function(n,e){return function(t){return Vt(n,t,e)}});function Pu(n,e,t){var u=Un(e),s=qr(e,u);t==null&&!(Tn(e)&&(s.length||!u.length))&&(t=e,e=n,n=this,s=qr(e,Un(e)));var f=!(Tn(t)&&"chain"in t)||!!t.chain,l=Fe(n);return ae(s,function(h){var _=e[h];n[h]=_,l&&(n.prototype[h]=function(){var T=this.__chain__;if(f||T){var w=n(this.__wrapped__),A=w.__actions__=zn(this.__actions__);return A.push({func:_,args:arguments,thisArg:n}),w.__chain__=T,w}return _.apply(n,ke([this.value()],arguments))})}),n}function r0(){return Pn._===this&&(Pn._=Dd),this}function Cu(){}function i0(n){return n=Q(n),V(function(e){return Ea(e,n)})}var u0=pu(gn),o0=pu(Hs),s0=pu(Fi);function Yf(n){return wu(n)?Hi(Oe(n)):Cp(n)}function a0(n){return function(e){return n==null?i:ct(n,e)}}var f0=Ba(),c0=Ba(!0);function Yu(){return[]}function Fu(){return!1}function l0(){return{}}function h0(){return""}function d0(){return!0}function p0(n,e){if(n=Q(n),n<1||n>L)return[];var t=X,u=Fn(n,X);e=N(e),n-=X;for(var s=ki(u,e);++t<n;)e(t);return s}function _0(n){return G(n)?gn(n,Oe):ee(n)?[n]:zn(rf(fn(n)))}function g0(n){var e=++Md;return fn(n)+e}var m0=Xr(function(n,e){return n+e},0),v0=_u("ceil"),E0=Xr(function(n,e){return n/e},1),T0=_u("floor");function w0(n){return n&&n.length?zr(n,Qn,nu):i}function A0(n,e){return n&&n.length?zr(n,N(e,2),nu):i}function y0(n){return ks(n,Qn)}function I0(n,e){return ks(n,N(e,2))}function L0(n){return n&&n.length?zr(n,Qn,iu):i}function R0(n,e){return n&&n.length?zr(n,N(e,2),iu):i}var M0=Xr(function(n,e){return n*e},1),O0=_u("round"),D0=Xr(function(n,e){return n-e},0);function S0(n){return n&&n.length?Wi(n,Qn):0}function b0(n,e){return n&&n.length?Wi(n,N(e,2)):0}return a.after=jg,a.ary=_f,a.assign=Hm,a.assignIn=Df,a.assignInWith=li,a.assignWith=Bm,a.at=Wm,a.before=gf,a.bind=Mu,a.bindAll=Kv,a.bindKey=mf,a.castArray=lm,a.chain=hf,a.chunk=T_,a.compact=w_,a.concat=A_,a.cond=Qv,a.conforms=Zv,a.constant=Nu,a.countBy=Sg,a.create=km,a.curry=vf,a.curryRight=Ef,a.debounce=Tf,a.defaults=Gm,a.defaultsDeep=zm,a.defer=nm,a.delay=em,a.difference=y_,a.differenceBy=I_,a.differenceWith=L_,a.drop=R_,a.dropRight=M_,a.dropRightWhile=O_,a.dropWhile=D_,a.fill=S_,a.filter=xg,a.flatMap=$g,a.flatMapDeep=Pg,a.flatMapDepth=Cg,a.flatten=af,a.flattenDeep=b_,a.flattenDepth=x_,a.flip=tm,a.flow=Vv,a.flowRight=Xv,a.fromPairs=U_,a.functions=Xm,a.functionsIn=jm,a.groupBy=Yg,a.initial=$_,a.intersection=P_,a.intersectionBy=C_,a.intersectionWith=Y_,a.invert=ev,a.invertBy=tv,a.invokeMap=Hg,a.iteratee=$u,a.keyBy=Bg,a.keys=Un,a.keysIn=Kn,a.map=ui,a.mapKeys=iv,a.mapValues=uv,a.matches=jv,a.matchesProperty=n0,a.memoize=si,a.merge=ov,a.mergeWith=Sf,a.method=e0,a.methodOf=t0,a.mixin=Pu,a.negate=ai,a.nthArg=i0,a.omit=sv,a.omitBy=av,a.once=rm,a.orderBy=Wg,a.over=u0,a.overArgs=im,a.overEvery=o0,a.overSome=s0,a.partial=Ou,a.partialRight=wf,a.partition=kg,a.pick=fv,a.pickBy=bf,a.property=Yf,a.propertyOf=a0,a.pull=W_,a.pullAll=cf,a.pullAllBy=k_,a.pullAllWith=G_,a.pullAt=z_,a.range=f0,a.rangeRight=c0,a.rearg=um,a.reject=qg,a.remove=q_,a.rest=om,a.reverse=Lu,a.sampleSize=Qg,a.set=lv,a.setWith=hv,a.shuffle=Zg,a.slice=K_,a.sortBy=Xg,a.sortedUniq=ng,a.sortedUniqBy=eg,a.split=$v,a.spread=sm,a.tail=tg,a.take=rg,a.takeRight=ig,a.takeRightWhile=ug,a.takeWhile=og,a.tap=wg,a.throttle=am,a.thru=ii,a.toArray=Rf,a.toPairs=xf,a.toPairsIn=Uf,a.toPath=_0,a.toPlainObject=Of,a.transform=dv,a.unary=fm,a.union=sg,a.unionBy=ag,a.unionWith=fg,a.uniq=cg,a.uniqBy=lg,a.uniqWith=hg,a.unset=pv,a.unzip=Ru,a.unzipWith=lf,a.update=_v,a.updateWith=gv,a.values=$t,a.valuesIn=mv,a.without=dg,a.words=Pf,a.wrap=cm,a.xor=pg,a.xorBy=_g,a.xorWith=gg,a.zip=mg,a.zipObject=vg,a.zipObjectDeep=Eg,a.zipWith=Tg,a.entries=xf,a.entriesIn=Uf,a.extend=Df,a.extendWith=li,Pu(a,a),a.add=m0,a.attempt=Cf,a.camelCase=wv,a.capitalize=Nf,a.ceil=v0,a.clamp=vv,a.clone=hm,a.cloneDeep=pm,a.cloneDeepWith=_m,a.cloneWith=dm,a.conformsTo=gm,a.deburr=$f,a.defaultTo=Jv,a.divide=E0,a.endsWith=Av,a.eq=Ae,a.escape=yv,a.escapeRegExp=Iv,a.every=bg,a.find=Ug,a.findIndex=of,a.findKey=qm,a.findLast=Ng,a.findLastIndex=sf,a.findLastKey=Km,a.floor=T0,a.forEach=df,a.forEachRight=pf,a.forIn=Qm,a.forInRight=Zm,a.forOwn=Jm,a.forOwnRight=Vm,a.get=bu,a.gt=mm,a.gte=vm,a.has=nv,a.hasIn=xu,a.head=ff,a.identity=Qn,a.includes=Fg,a.indexOf=N_,a.inRange=Ev,a.invoke=rv,a.isArguments=dt,a.isArray=G,a.isArrayBuffer=Em,a.isArrayLike=qn,a.isArrayLikeObject=yn,a.isBoolean=Tm,a.isBuffer=Je,a.isDate=wm,a.isElement=Am,a.isEmpty=ym,a.isEqual=Im,a.isEqualWith=Lm,a.isError=Du,a.isFinite=Rm,a.isFunction=Fe,a.isInteger=Af,a.isLength=fi,a.isMap=yf,a.isMatch=Mm,a.isMatchWith=Om,a.isNaN=Dm,a.isNative=Sm,a.isNil=xm,a.isNull=bm,a.isNumber=If,a.isObject=Tn,a.isObjectLike=wn,a.isPlainObject=rr,a.isRegExp=Su,a.isSafeInteger=Um,a.isSet=Lf,a.isString=ci,a.isSymbol=ee,a.isTypedArray=Nt,a.isUndefined=Nm,a.isWeakMap=$m,a.isWeakSet=Pm,a.join=F_,a.kebabCase=Lv,a.last=de,a.lastIndexOf=H_,a.lowerCase=Rv,a.lowerFirst=Mv,a.lt=Cm,a.lte=Ym,a.max=w0,a.maxBy=A0,a.mean=y0,a.meanBy=I0,a.min=L0,a.minBy=R0,a.stubArray=Yu,a.stubFalse=Fu,a.stubObject=l0,a.stubString=h0,a.stubTrue=d0,a.multiply=M0,a.nth=B_,a.noConflict=r0,a.noop=Cu,a.now=oi,a.pad=Ov,a.padEnd=Dv,a.padStart=Sv,a.parseInt=bv,a.random=Tv,a.reduce=Gg,a.reduceRight=zg,a.repeat=xv,a.replace=Uv,a.result=cv,a.round=O0,a.runInContext=p,a.sample=Kg,a.size=Jg,a.snakeCase=Nv,a.some=Vg,a.sortedIndex=Q_,a.sortedIndexBy=Z_,a.sortedIndexOf=J_,a.sortedLastIndex=V_,a.sortedLastIndexBy=X_,a.sortedLastIndexOf=j_,a.startCase=Pv,a.startsWith=Cv,a.subtract=D0,a.sum=S0,a.sumBy=b0,a.template=Yv,a.times=p0,a.toFinite=He,a.toInteger=Q,a.toLength=Mf,a.toLower=Fv,a.toNumber=pe,a.toSafeInteger=Fm,a.toString=fn,a.toUpper=Hv,a.trim=Bv,a.trimEnd=Wv,a.trimStart=kv,a.truncate=Gv,a.unescape=zv,a.uniqueId=g0,a.upperCase=qv,a.upperFirst=Uu,a.each=df,a.eachRight=pf,a.first=ff,Pu(a,(function(){var n={};return Re(a,function(e,t){cn.call(a.prototype,t)||(n[t]=e)}),n})(),{chain:!1}),a.VERSION=c,ae(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){a[n].placeholder=a}),ae(["drop","take"],function(n,e){nn.prototype[n]=function(t){t=t===i?1:bn(Q(t),0);var u=this.__filtered__&&!e?new nn(this):this.clone();return u.__filtered__?u.__takeCount__=Fn(t,u.__takeCount__):u.__views__.push({size:Fn(t,X),type:n+(u.__dir__<0?"Right":"")}),u},nn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),ae(["filter","map","takeWhile"],function(n,e){var t=e+1,u=t==Y||t==O;nn.prototype[n]=function(s){var f=this.clone();return f.__iteratees__.push({iteratee:N(s,3),type:t}),f.__filtered__=f.__filtered__||u,f}}),ae(["head","last"],function(n,e){var t="take"+(e?"Right":"");nn.prototype[n]=function(){return this[t](1).value()[0]}}),ae(["initial","tail"],function(n,e){var t="drop"+(e?"":"Right");nn.prototype[n]=function(){return this.__filtered__?new nn(this):this[t](1)}}),nn.prototype.compact=function(){return this.filter(Qn)},nn.prototype.find=function(n){return this.filter(n).head()},nn.prototype.findLast=function(n){return this.reverse().find(n)},nn.prototype.invokeMap=V(function(n,e){return typeof n=="function"?new nn(this):this.map(function(t){return Vt(t,n,e)})}),nn.prototype.reject=function(n){return this.filter(ai(N(n)))},nn.prototype.slice=function(n,e){n=Q(n);var t=this;return t.__filtered__&&(n>0||e<0)?new nn(t):(n<0?t=t.takeRight(-n):n&&(t=t.drop(n)),e!==i&&(e=Q(e),t=e<0?t.dropRight(-e):t.take(e-n)),t)},nn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},nn.prototype.toArray=function(){return this.take(X)},Re(nn.prototype,function(n,e){var t=/^(?:filter|find|map|reject)|While$/.test(e),u=/^(?:head|last)$/.test(e),s=a[u?"take"+(e=="last"?"Right":""):e],f=u||/^find/.test(e);s&&(a.prototype[e]=function(){var l=this.__wrapped__,h=u?[1]:arguments,_=l instanceof nn,T=h[0],w=_||G(l),A=function(j){var tn=s.apply(a,ke([j],h));return u&&R?tn[0]:tn};w&&t&&typeof T=="function"&&T.length!=1&&(_=w=!1);var R=this.__chain__,U=!!this.__actions__.length,$=f&&!R,J=_&&!U;if(!f&&w){l=J?l:new nn(this);var P=n.apply(l,h);return P.__actions__.push({func:ii,args:[A],thisArg:i}),new ce(P,R)}return $&&J?n.apply(this,h):(P=this.thru(A),$?u?P.value()[0]:P.value():P)})}),ae(["pop","push","shift","sort","splice","unshift"],function(n){var e=Sr[n],t=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",u=/^(?:pop|shift)$/.test(n);a.prototype[n]=function(){var s=arguments;if(u&&!this.__chain__){var f=this.value();return e.apply(G(f)?f:[],s)}return this[t](function(l){return e.apply(G(l)?l:[],s)})}}),Re(nn.prototype,function(n,e){var t=a[e];if(t){var u=t.name+"";cn.call(Dt,u)||(Dt[u]=[]),Dt[u].push({name:e,func:t})}}),Dt[Vr(i,dn).name]=[{name:"wrapper",func:i}],nn.prototype.clone=zd,nn.prototype.reverse=qd,nn.prototype.value=Kd,a.prototype.at=Ag,a.prototype.chain=yg,a.prototype.commit=Ig,a.prototype.next=Lg,a.prototype.plant=Mg,a.prototype.reverse=Og,a.prototype.toJSON=a.prototype.valueOf=a.prototype.value=Dg,a.prototype.first=a.prototype.head,Gt&&(a.prototype[Gt]=Rg),a}),Rt=Id();ut?((ut.exports=Rt)._=Rt,$i._=Rt):Pn._=Rt}).call($c)})(Ct,Ct.exports)),Ct.exports}var Cc=Pc();const so=pt(Cc),ao=(r,o)=>{switch(o){case"fr":case"it":return so.capitalize(r.format("dddd D MMMM"));case"es":return so.capitalize(r.format("dddd D [de] MMMM"));case"de":return r.format("dddd, D. MMMM");default:return r.format("dddd, MMMM Do")}},fo=r=>r.format("LT"),Yc=(r,o)=>{const i=ao(r,o),c=fo(r);switch(o){case"fr":return`${i} à ${c}`;case"it":return`${i} alle ${c}`;case"es":return`${i} a las ${c}`;case"de":return`${i} um ${c}`;default:return`${i} at ${c}`}},Fc=r=>r.format("ll"),Hc=(r,o)=>{switch(o){case"fr":case"de":case"it":return r.format("HH:mm");case"es":return r.format("H:mm");default:return r.format("h:mm")}},Bc=r=>r.format("L"),Wc=r=>r.format("L LT");var co=(r=>(r.SimpleDate="SimpleDate",r.SimpleDateTime="SimpleDateTime",r.ExtraShortDate="ExtraShortDate",r.InlineExtraShortDate="InlineExtraShortDate",r.ShortDate="ShortDate",r.InlineShortDate="InlineShortDate",r.Date="Date",r.LongDate="LongDate",r.LongDateTime="LongDateTime",r.ShortTime="ShortTime",r.Time="Time",r.DateTime="DateTime",r))(co||{});const kc=(r,o,i,c)=>{let d=_t(r);c&&(d=d.tz(c)),i&&(d=d.locale(i));const v=d.locale();switch(o){case"SimpleDate":return Bc(d);case"SimpleDateTime":return Wc(d);case"ExtraShortDate":return xc(d,v);case"InlineExtraShortDate":return Uc(d,v);case"ShortDate":return Fc(d);case"InlineShortDate":return Nc(d,v);case"Date":return Sc(d);case"LongDate":return ao(d,v);case"LongDateTime":return Yc(d,v);case"ShortTime":return Hc(d,v);case"Time":return fo(d);case"DateTime":return bc(d)}};var _e=(r=>(r.Contains="Contains",r.DoesntContain="DoesntContain",r.DoesntEndWith="DoesntEndWith",r.DoesntEqual="DoesntEqual",r.DoesntStartWith="DoesntStartWith",r.EndsWith="EndsWith",r.Equals="Equals",r.MatchesRegex="MatchesRegex",r.StartsWith="StartsWith",r))(_e||{});const Gc="http://_meltingspot.local",zc=200,qc=/(\([^()]*[+*][^()]*\))[+*]/,Kc=r=>r.length<=zc&&!qc.test(r),Qc=r=>{try{const o=new URL(r,Gc);return`${o.pathname}${o.search}${o.hash}`}catch{return r}},Er=r=>r.startsWith("/")?r:`/${r}`,Zc=(r,o)=>{switch(o.operator){case _e.MatchesRegex:if(!Kc(o.value))return!1;try{return new RegExp(o.value).test(r)}catch{return!1}case _e.StartsWith:return r.startsWith(Er(o.value));case _e.DoesntStartWith:return!r.startsWith(Er(o.value));case _e.EndsWith:return r.endsWith(o.value);case _e.DoesntEndWith:return!r.endsWith(o.value);case _e.Contains:return r.includes(o.value);case _e.DoesntContain:return!r.includes(o.value);case _e.Equals:return r===Er(o.value);case _e.DoesntEqual:return r!==Er(o.value)}},Jc=(r,o)=>{const i=o.rules.map(c=>Zc(r,c));return o.ruleOperator==="AND"?i.every(Boolean):i.some(Boolean)},Vc=(r,o)=>{const i=Qc(r),c=o.blocks.map(d=>Jc(i,d));return o.blockOperator==="AND"?c.every(Boolean):c.some(Boolean)},Xc=r=>r.replace(/^https?:\/\//,""),jc=(r,o)=>{const i=Xc(o);try{const c=new URL(r);return c.hostname===i||c.hostname.endsWith(`.${i}`)}catch{return!1}},nl="data-meltingspot-playbook-editor-active",di="meltingspot:playbook-editor:active-changed",el=()=>typeof document<"u"&&typeof document.dispatchEvent=="function",lo=()=>el()?document.documentElement.getAttribute(nl)==="true":!1;class tl{constructor(){this.listener=null,this.lastOptions=null,this.chain=Promise.resolve()}enqueue(o){const i=this.chain.then(o);return this.chain=i.catch(()=>{}),i}get isBound(){return this.listener!==null}bind(o){if(this.listener!==null||typeof document>"u")return;const i=()=>{if(lo()){Promise.resolve().then(()=>o.onEditorActive()).catch(d=>{console.warn("[playbook-editor] onEditorActive callback failed",d)});return}const c=this.lastOptions;c!==null&&Promise.resolve().then(()=>o.onEditorInactive(c)).catch(d=>{console.warn("[playbook-editor] onEditorInactive callback failed",d)})};document.addEventListener(di,i),this.listener=i}cacheOptions(o){this.lastOptions=o}clearOptions(){this.lastOptions=null}unbind(){this.listener!==null&&typeof document<"u"&&document.removeEventListener(di,this.listener),this.listener=null,this.lastOptions=null}}const rl="1.3.0";class ho{constructor(o){this.debug=!1,this.debug=o?.debug??!1,this.appName=o?.appName,this.appVersion=o?.appVersion}log(o,...i){this.debug&&this.print(o,"info",i)}warn(o,...i){this.print(o,"warn",i)}error(o,...i){this.print(o,"error",i)}print(o,i,c){const g=[`[${["MeltingSpot",this.appName,this.appVersion].filter(Boolean).join(" - ")}] ${o}`];c.length&&g.push(...c),console[i](...g)}}const po=new ho({appName:"Core SDK",appVersion:rl}),il=r=>{po.debug=r},ul=r=>r.toLowerCase().replace(/[^a-z0-9-]/g,""),ol=["/user"],sl=({deeplink:r,spotId:o})=>{try{const i=new URL(r,"https://unused.com");let c=i.pathname;return i.search&&(c+=i.search),i.hash&&(c+=i.hash),ol.some(d=>c.startsWith(d))||(c=`/spot/${o}/${zu(c)}`),c}catch(i){return po.warn("Failed to parse deeplink URL",i),null}},al=[/(^|\.)meltingspot\.io$/i],fl=r=>{let o;try{const v=qu(r);o=new URL(v)}catch{throw new Error(`Invalid baseURL: ${r}`)}const i=o.hostname==="localhost"||o.hostname==="127.0.0.1",c=o.protocol==="https:",d=al.some(v=>v.test(o.hostname));if(!i&&(!c||!d))throw new Error(`Untrusted baseURL origin: ${o.origin}`);return o.origin},cl={msApiBaseUrl:"https://openapi.meltingspot.io/",msCommunityWebBaseUrl:"https://go.meltingspot.io/",ssoToken:void 0,spotId:"",autoJoin:!1,rootDocument:globalThis.document};class ue{constructor(){this.configuration=cl}static getInstance(){return ue.instance||(ue.instance=new ue),ue.instance}setConfiguration(o){this.configuration={...this.configuration,...o}}static getConfiguration(o={}){return{...ue.getInstance().configuration,...o}}}const _o="%[a-f0-9]{2}",go=new RegExp("("+_o+")|([^%]+?)","gi"),mo=new RegExp("("+_o+")+","gi");function pi(r,o){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;o=o||1;const i=r.slice(0,o),c=r.slice(o);return Array.prototype.concat.call([],pi(i),pi(c))}function ll(r){try{return decodeURIComponent(r)}catch{let o=r.match(go)||[];for(let i=1;i<o.length;i++)r=pi(o,i).join(""),o=r.match(go)||[];return r}}function hl(r){const o={"%FE%FF":"��","%FF%FE":"��"};let i=mo.exec(r);for(;i;){try{o[i[0]]=decodeURIComponent(i[0])}catch{const d=ll(i[0]);d!==i[0]&&(o[i[0]]=d)}i=mo.exec(r)}o["%C2"]="�";const c=Object.keys(o);for(const d of c)r=r.replace(new RegExp(d,"g"),o[d]);return r}function dl(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return decodeURIComponent(r)}catch{return hl(r)}}function pl(r,o){const i={};if(Array.isArray(o))for(const c of o){const d=Object.getOwnPropertyDescriptor(r,c);d?.enumerable&&Object.defineProperty(i,c,d)}else for(const c of Reflect.ownKeys(r)){const d=Object.getOwnPropertyDescriptor(r,c);if(d.enumerable){const v=r[c];o(c,v,r)&&Object.defineProperty(i,c,d)}}return i}function vo(r,o){if(!(typeof r=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r===""||o==="")return[];const i=r.indexOf(o);return i===-1?[]:[r.slice(0,i),r.slice(i+o.length)]}const _l=r=>r==null,gl=r=>encodeURIComponent(r).replaceAll(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),_i=Symbol("encodeFragmentIdentifier");function ml(r){switch(r.arrayFormat){case"index":return o=>(i,c)=>{const d=i.length;return c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),"[",d,"]"].join("")]:[...i,[Ln(o,r),"[",Ln(d,r),"]=",Ln(c,r)].join("")]};case"bracket":return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),"[]"].join("")]:[...i,[Ln(o,r),"[]=",Ln(c,r)].join("")];case"colon-list-separator":return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,[Ln(o,r),":list="].join("")]:[...i,[Ln(o,r),":list=",Ln(c,r)].join("")];case"comma":case"separator":case"bracket-separator":{const o=r.arrayFormat==="bracket-separator"?"[]=":"=";return i=>(c,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?c:(d=d===null?"":d,c.length===0?[[Ln(i,r),o,Ln(d,r)].join("")]:[[c,Ln(d,r)].join(r.arrayFormatSeparator)])}default:return o=>(i,c)=>c===void 0||r.skipNull&&c===null||r.skipEmptyString&&c===""?i:c===null?[...i,Ln(o,r)]:[...i,[Ln(o,r),"=",Ln(c,r)].join("")]}}function vl(r){let o;switch(r.arrayFormat){case"index":return(i,c,d)=>{if(o=/\[(\d*)]$/.exec(i),i=i.replace(/\[\d*]$/,""),!o){d[i]=c;return}d[i]===void 0&&(d[i]={}),d[i][o[1]]=c};case"bracket":return(i,c,d)=>{if(o=/(\[])$/.exec(i),i=i.replace(/\[]$/,""),!o){d[i]=c;return}if(d[i]===void 0){d[i]=[c];return}d[i]=[...d[i],c]};case"colon-list-separator":return(i,c,d)=>{if(o=/(:list)$/.exec(i),i=i.replace(/:list$/,""),!o){d[i]=c;return}if(d[i]===void 0){d[i]=[c];return}d[i]=[...d[i],c]};case"comma":case"separator":return(i,c,d)=>{const v=typeof c=="string"&&c.includes(r.arrayFormatSeparator),g=typeof c=="string"&&!v&&De(c,r).includes(r.arrayFormatSeparator);c=g?De(c,r):c;const I=v||g?c.split(r.arrayFormatSeparator).map(M=>De(M,r)):c===null?c:De(c,r);d[i]=I};case"bracket-separator":return(i,c,d)=>{const v=/(\[])$/.test(i);if(i=i.replace(/\[]$/,""),!v){d[i]=c&&De(c,r);return}const g=c===null?[]:De(c,r).split(r.arrayFormatSeparator);if(d[i]===void 0){d[i]=g;return}d[i]=[...d[i],...g]};default:return(i,c,d)=>{if(d[i]===void 0){d[i]=c;return}d[i]=[...[d[i]].flat(),c]}}}function Eo(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Ln(r,o){return o.encode?o.strict?gl(r):encodeURIComponent(r):r}function De(r,o){return o.decode?dl(r):r}function To(r){return Array.isArray(r)?r.sort():typeof r=="object"?To(Object.keys(r)).sort((o,i)=>Number(o)-Number(i)).map(o=>r[o]):r}function wo(r){const o=r.indexOf("#");return o!==-1&&(r=r.slice(0,o)),r}function El(r){let o="";const i=r.indexOf("#");return i!==-1&&(o=r.slice(i)),o}function Ao(r,o,i){return i==="string"&&typeof r=="string"?r:typeof i=="function"&&typeof r=="string"?i(r):i==="boolean"&&r===null?!0:i==="boolean"&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":i==="boolean"&&r!==null&&(r.toLowerCase()==="1"||r.toLowerCase()==="0")?r.toLowerCase()==="1":i==="string[]"&&o.arrayFormat!=="none"&&typeof r=="string"?[r]:i==="number[]"&&o.arrayFormat!=="none"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?[Number(r)]:i==="number"&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):o.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")?r.toLowerCase()==="true":o.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?Number(r):r}function gi(r){r=wo(r);const o=r.indexOf("?");return o===-1?"":r.slice(o+1)}function mi(r,o){o={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...o},Eo(o.arrayFormatSeparator);const i=vl(o),c=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return c;for(const d of r.split("&")){if(d==="")continue;const v=o.decode?d.replaceAll("+"," "):d;let[g,I]=vo(v,"=");g===void 0&&(g=v),I=I===void 0?null:["comma","separator","bracket-separator"].includes(o.arrayFormat)?I:De(I,o),i(De(g,o),I,c)}for(const[d,v]of Object.entries(c))if(typeof v=="object"&&v!==null&&o.types[d]!=="string")for(const[g,I]of Object.entries(v)){const M=o.types[d]?o.types[d].replace("[]",""):void 0;v[g]=Ao(I,o,M)}else typeof v=="object"&&v!==null&&o.types[d]==="string"?c[d]=Object.values(v).join(o.arrayFormatSeparator):c[d]=Ao(v,o,o.types[d]);return o.sort===!1?c:(o.sort===!0?Object.keys(c).sort():Object.keys(c).sort(o.sort)).reduce((d,v)=>{const g=c[v];return d[v]=g&&typeof g=="object"&&!Array.isArray(g)?To(g):g,d},Object.create(null))}function yo(r,o){if(!r)return"";o={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...o},Eo(o.arrayFormatSeparator);const i=g=>o.skipNull&&_l(r[g])||o.skipEmptyString&&r[g]==="",c=ml(o),d={};for(const[g,I]of Object.entries(r))i(g)||(d[g]=I);const v=Object.keys(d);return o.sort!==!1&&v.sort(o.sort),v.map(g=>{const I=r[g];return I===void 0?"":I===null?Ln(g,o):Array.isArray(I)?I.length===0&&o.arrayFormat==="bracket-separator"?Ln(g,o)+"[]":I.reduce(c(g),[]).join("&"):Ln(g,o)+"="+Ln(I,o)}).filter(g=>g.length>0).join("&")}function Io(r,o){o={decode:!0,...o};let[i,c]=vo(r,"#");return i===void 0&&(i=r),{url:i?.split("?")?.[0]??"",query:mi(gi(r),o),...o&&o.parseFragmentIdentifier&&c?{fragmentIdentifier:De(c,o)}:{}}}function Lo(r,o){o={encode:!0,strict:!0,[_i]:!0,...o};const i=wo(r.url).split("?")[0]||"",c=gi(r.url),d={...mi(c,{sort:!1,...o}),...r.query};let v=yo(d,o);v&&=`?${v}`;let g=El(r.url);if(typeof r.fragmentIdentifier=="string"){const I=new URL(i);I.hash=r.fragmentIdentifier,g=o[_i]?I.hash:`#${r.fragmentIdentifier}`}return`${i}${v}${g}`}function Ro(r,o,i){i={parseFragmentIdentifier:!0,[_i]:!1,...i};const{url:c,query:d,fragmentIdentifier:v}=Io(r,i);return Lo({url:c,query:pl(d,o),fragmentIdentifier:v},i)}function Tl(r,o,i){const c=Array.isArray(o)?d=>!o.includes(d):(d,v)=>!o(d,v);return Ro(r,c,i)}const wl=Object.freeze(Object.defineProperty({__proto__:null,exclude:Tl,extract:gi,parse:mi,parseUrl:Io,pick:Ro,stringify:yo,stringifyUrl:Lo},Symbol.toStringTag,{value:"Module"}));class Gn extends Error{constructor(o,i){super(`HTTP Error ${o}${i?`: ${i}`:""}`),this.code=o,this.name="HttpError",Object.setPrototypeOf(this,Gn.prototype)}}var Rn=(r=>(r.GET="GET",r.PATCH="PATCH",r.POST="POST",r))(Rn||{});class Mo{constructor(){this.headers={}}setHeaders(o){this.headers=o}async get(o){try{const i=o.query?`${o.url}?${this.serializeQuery(o.query)}`:o.url,c=await fetch(i,{headers:{...this.headers,...o.headers,"Content-Type":"application/json"},...o.signal?{signal:o.signal}:{}});return c.ok?on(await c.json()):z(new Gn(c.status,await c.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}async post(o){try{const i=await fetch(o.url,{method:"POST",headers:{...this.headers,...o.headers,"Content-Type":"application/json"},body:JSON.stringify(o.payload),...o.signal?{signal:o.signal}:{}});return i.ok?on(await i.json()):z(new Gn(i.status,await i.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}async patch(o){try{const i=await fetch(o.url,{method:"PATCH",headers:{...this.headers,...o.headers,"Content-Type":"application/json"},body:JSON.stringify(o.payload),...o.signal?{signal:o.signal}:{}});return i.ok?on(await i.json()):z(new Gn(i.status,await i.text()))}catch(i){const c=i instanceof Error?i.message:"Unknown error";return z(new Gn(ie.INTERNAL_SERVER_ERROR,c))}}serializeQuery(o){if(typeof o=="string")return o;if(typeof o=="object")for(const i in o)o[i]===void 0&&delete o[i];return o=wl.stringify(o,{arrayFormat:"none"}),o}}const Tr={accessToken:{email:"/v1/auth/accessToken/email",sso:{jwt:"/v1/auth/accessToken/sso/jwt"}},refreshAccessToken:"/v1/auth/accessToken~refresh",password:{reset:"/v1/auth/password~reset"}};var Oo=(r=>(r.TokensUpdated="auth:tokens-updated",r))(Oo||{});class Se extends EventTarget{constructor(){super(),this.accessToken=null,this.refreshToken=null}static getInstance(){return Se.instance||(Se.instance=new Se),Se.instance}async loginWithPassword(o,i){const c=await this.callApi({endpoint:Tr.accessToken.email,method:"POST",body:{email:o,password:i},withSpotId:!0});if(c.isErr())return z(c.error);const{accessToken:d,refreshToken:v}=c.value;return this.setTokens(d.token,v.token),on({accessToken:d.token,refreshToken:v.token})}async loginWithSsoToken(o){const i=await this.callApi({endpoint:Tr.accessToken.sso.jwt,method:"POST",body:{token:o},withSpotId:!0});if(i.isErr())return z(i.error);const{accessToken:c,refreshToken:d}=i.value;return this.setTokens(c.token,d.token),on({accessToken:c.token,refreshToken:d.token})}loginWithAuthTokens(o,i){return this.setTokens(o,i),{accessToken:o,refreshToken:i}}resetPassword(o){return this.callApi({endpoint:Tr.password.reset,method:"POST",body:{email:o}})}async refresh(){const o=await this.callApi({endpoint:Tr.refreshAccessToken,method:"POST",body:{refreshToken:this.refreshToken}});if(o.isErr())return z(o.error);const{accessToken:i,refreshToken:c}=o.value;return this.setTokens(i.token,c.token),on({accessToken:i.token,refreshToken:c.token})}async logout(){this.setTokens(null,null)}getAccessToken(){return this.accessToken}getRefreshToken(){return this.refreshToken}setTokens(o,i){if(this.accessToken!==o||this.refreshToken!==i){this.accessToken=o,this.refreshToken=i;const c=new CustomEvent("auth:tokens-updated",{detail:{accessToken:o,refreshToken:i}});this.dispatchEvent(c)}}async callApi(o){try{const{spotId:i,msApiBaseUrl:c}=ue.getConfiguration(),d=ur(o.endpoint,c),v={"Content-Type":"application/json",...o.headers};o.withSpotId&&i&&(v[Do.SpotId]=i);const g=await fetch(d,{method:o.method,body:o.body?JSON.stringify(o.body):void 0,headers:v});if(!g.ok)return z(new Gn(g.status,g.statusText));if(g.status===ie.NO_CONTENT)return on(void 0);const I=await g.json();return on(I)}catch(i){return z(new Gn(ie.INTERNAL_SERVER_ERROR,i instanceof Error?i.message:String(i)))}}}var Do=(r=>(r.Authorization="Authorization",r.SpotId="x-spotid",r))(Do||{});class oe{constructor(){this.queue=[],this.isProcessing=!1,this.isPaused=!1,this.authService=Se.getInstance(),this.httpService=new Mo}static getInstance(){return oe.instance||(oe.instance=new oe),oe.instance}static buildAuthenticatedRequest(o){const{msApiBaseUrl:i,spotId:c}=ue.getConfiguration(),d=ur(o,i),v=Se.getInstance().getAccessToken();if(!v)return z(new Error("Not authenticated"));const g={"Content-Type":"application/json",Authorization:`Bearer ${v}`};return c&&(g["x-spotid"]=c),on({url:d,headers:g})}static async stream(o,i,c){const{streamTransport:d}=ue.getConfiguration();if(d)return d({endpoint:o,body:i,signal:c});const v=oe.buildAuthenticatedRequest(o);if(v.isErr())return z(v.error);const{url:g,headers:I}=v.value;try{const M=await fetch(g,{method:"POST",headers:I,...i!==void 0?{body:JSON.stringify(i)}:{},...c?{signal:c}:{}});if(!M.ok){const K=await M.text();return z(new Error(`HTTP ${M.status}: ${K}`))}return M.body?on(M.body):z(new Error("Response body is empty"))}catch(M){const K=M instanceof Error?M.message:"Unknown error";return z(M instanceof Error?M:new Error(K))}}get pendingCount(){return this.queue.length}enqueue(o){return new Promise(i=>{const c=async()=>{try{const d=await o();i(d)}catch(d){i(z(new Gn(ie.INTERNAL_SERVER_ERROR,d instanceof Error?d.message:"Unknown error")))}};this.queue.push(c),this.processQueue()})}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;!this.isPaused&&this.queue.length>0;){const o=this.queue.shift();if(!o)break;await o()}}finally{this.isProcessing=!1,!this.isPaused&&this.queue.length>0&&Promise.resolve().then(()=>this.processQueue())}}}pauseQueue(){this.isPaused=!0}resumeQueue(){const o=this.isPaused;this.isPaused=!1,o&&this.processQueue()}async call(o){return this.enqueue(async()=>{const i=async()=>{const{spotId:d,msApiBaseUrl:v}=ue.getConfiguration(),g={...o.options?.headers??{}};d&&(g["x-spotid"]=d);const I=this.authService.getAccessToken(),{requiresAuth:M=!0}=o;if(!I&&M)return z(new Gn(ie.UNAUTHORIZED));I&&(g.Authorization=`Bearer ${I}`);const K=ur(o.endpoint,v);switch(o.method){case Rn.GET:return this.httpService.get({...o.options??{},headers:g,url:K});case Rn.PATCH:return this.httpService.patch({...o.options??{},headers:g,url:K});case Rn.POST:return this.httpService.post({...o.options??{},headers:g,url:K});default:return z(new Gn(ie.METHOD_NOT_ALLOWED,"Method not allowed"))}};let c=await i();if(c.isErr()&&c.error.code===ie.UNAUTHORIZED){const d=await this.authService.refresh();if(d.isErr())return z(new Gn(ie.UNAUTHORIZED,d.error.message));c=await i()}return c})}}const Ie={playbooks:"/v1/playbooks",pages:r=>`/v1/playbooks/${r}/pages`,hotspots:(r,o)=>`/v1/playbooks/${r}/pages/${o}/hotspots`,hotspot:(r,o,i)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}`,accessibleIntents:(r,o)=>`/v1/playbooks/${r}/pages/${o}/accessibleIntents`,intents:(r,o,i)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}/intents`,intent:(r,o,i,c)=>`/v1/playbooks/${r}/pages/${o}/hotspots/${i}/intents/${c}`},wr=50;class et{static getInstance(){return et.instance||(et.instance=new et),et.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async listPlaybooks(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.playbooks,options:{query:{page:o?.page??1,limit:o?.limit??wr,...o?.domain?{"domain[eq]":o.domain}:{}}}});return i.isErr()?z(i.error):on(i.value)}async listPlaybookPages(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.pages(o.playbookId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.url?{"url[eq]":o.url}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookPage(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.pages(o.playbookId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async listAccessiblePlaybookIntents(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.accessibleIntents(o.playbookId,o.pageId),options:{query:{...o.domain?{domain:o.domain}:{}}}});return i.isErr()?z(i.error):on(i.value)}async listPlaybookHotspots(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.hotspots(o.playbookId,o.pageId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.intentStatus?{"intentStatus[eq]":o.intentStatus}:{},...o.widgetType?{"widgetType[eq]":o.widgetType}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookHotspot(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.hotspots(o.playbookId,o.pageId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async updatePlaybookHotspot(o,i){const c=await this.meltingSpotApi.call({method:Rn.PATCH,endpoint:Ie.hotspot(o.playbookId,o.pageId,o.hotspotId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async listPlaybookIntents(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Ie.intents(o.playbookId,o.pageId,o.hotspotId),options:{query:{page:o.page??1,limit:o.limit??wr,...o.status?{"status[eq]":o.status}:{}}}});return i.isErr()?z(i.error):on(i.value)}async createPlaybookIntent(o,i){const c=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Ie.intents(o.playbookId,o.pageId,o.hotspotId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}async updatePlaybookIntent(o,i){const c=await this.meltingSpotApi.call({method:Rn.PATCH,endpoint:Ie.intent(o.playbookId,o.pageId,o.hotspotId,o.intentId),options:{payload:i}});return c.isErr()?z(c.error):on(c.value)}}const Al={me:"/v1/spots/me"},yl=50;class gt{static getInstance(){return gt.instance||(gt.instance=new gt),gt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async listSpotsForMe(o){const i=await this.meltingSpotApi.call({method:Rn.GET,endpoint:Al.me,options:{query:{page:1,limit:yl,...o?.spotMemberRole?{"spotMemberRole[eq]":o.spotMemberRole}:{}}}});return i.isErr()?z(i.error):on(i.value)}}const So={spotMember:{me:"/v1/spotMembers/me",joinFromSso:"/v1/spotMembers~joinFromSso"}};class tt{static getInstance(){return tt.instance||(tt.instance=new tt),tt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async getSpotMemberForMe(){const o=await this.meltingSpotApi.call({method:Rn.GET,endpoint:So.spotMember.me});return o.isErr()?z(o.error):on(o.value)}async joinFromSso(o){const i=await this.meltingSpotApi.call({method:Rn.POST,endpoint:So.spotMember.joinFromSso,options:{payload:{token:o}}});return i.isErr()?z(i.error):on(i.value)}}const Il={spotMemberSsoToken:"/v1/spotMembers/auth/sso/jwt"};class mt{static getInstance(){return mt.instance||(mt.instance=new mt),mt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async generateSsoToken(){const o=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Il.spotMemberSsoToken,options:{payload:{}}});return o.isErr()?z(o.error):on(o.value.token)}}class rt{static getInstance(){return rt.instance||(rt.instance=new rt),rt.instance}constructor(){this.spotMemberAuthApiService=mt.getInstance()}async generateSsoToken(){return this.spotMemberAuthApiService.generateSsoToken()}}class Ll{constructor(o){this.active=!1,this.lastObservedUrl=null,this.options={onRouteChange:o.onRouteChange,debounceMs:o.debounceMs??0,enableDeduplication:o.enableDeduplication??!0,enableDomMutationDetection:o.enableDomMutationDetection??!1,enableHistoryChange:o.enableHistoryChange??!0,enablePopState:o.enablePopState??!0,enableHashChange:o.enableHashChange??!0,enableLoad:o.enableLoad??!0,rootDocument:o.rootDocument}}start(){this.active||(this.active=!0,this.lastObservedUrl=null,this.options.enablePopState&&(this.popStateListener=()=>this.handleNavigationEvent("popstate"),window.addEventListener("popstate",this.popStateListener)),this.options.enableHashChange&&(this.hashChangeListener=()=>this.handleNavigationEvent("hashchange"),window.addEventListener("hashchange",this.hashChangeListener)),this.options.enableLoad&&(this.loadListener=()=>this.handleNavigationEvent("load"),window.addEventListener("load",this.loadListener)),this.options.enableDomMutationDetection&&(this.mutationObserver=new MutationObserver(()=>{this.handleNavigationEvent("locationchange")}),this.mutationObserver.observe(this.options.rootDocument??document,{childList:!0,subtree:!0})),this.options.enableHistoryChange&&this.patchHistoryListeners())}stop(){this.active&&(this.active=!1,this.debounceTimer!==void 0&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.popStateListener&&(window.removeEventListener("popstate",this.popStateListener),this.popStateListener=void 0),this.hashChangeListener&&(window.removeEventListener("hashchange",this.hashChangeListener),this.hashChangeListener=void 0),this.loadListener&&(window.removeEventListener("load",this.loadListener),this.loadListener=void 0),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=void 0),(this.originalPushState||this.originalReplaceState)&&this.restoreHistoryListeners(),this.lastObservedUrl=null)}handleNavigationEvent(o){if(!this.active)return;const i=window.location.href;this.options.enableDeduplication&&this.lastObservedUrl===i||(this.lastObservedUrl=i,this.options.debounceMs>0?(this.debounceTimer!==void 0&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=void 0,this.options.onRouteChange(i,o)},this.options.debounceMs)):this.options.onRouteChange(i,o))}patchHistoryListeners(){this.originalPushState=window.history.pushState,this.originalReplaceState=window.history.replaceState,window.history.pushState=(...o)=>{const i=this.originalPushState?.apply(window.history,o);return this.handleNavigationEvent("history.pushState"),i},window.history.replaceState=(...o)=>{const i=this.originalReplaceState?.apply(window.history,o);return this.handleNavigationEvent("history.replaceState"),i}}restoreHistoryListeners(){this.originalPushState&&(window.history.pushState=this.originalPushState,this.originalPushState=void 0),this.originalReplaceState&&(window.history.replaceState=this.originalReplaceState,this.originalReplaceState=void 0)}}const Rl={events:"/v1/analytics/events"};class vt{static getInstance(){return vt.instance||(vt.instance=new vt),vt.instance}constructor(){this.meltingSpotApi=oe.getInstance()}async appendEvent(o){const i=await this.meltingSpotApi.call({method:Rn.POST,endpoint:Rl.events,options:{payload:o}});return i.isErr()?z(i.error):on(i.value)}}const Ml=r=>{const o=r.get("utm_source");if(o)return{source:o,medium:r.get("utm_medium")??void 0,campaign:r.get("utm_campaign")??void 0,term:r.get("utm_term")??void 0,content:r.get("utm_content")??void 0}},Ol=r=>r?Object.entries(r).reduce((o,[i,c])=>(c!=null&&(o[`utm_${i}`]=c),o),{}):{};var bo=(r=>(r.Active="Active",r.Closed="Closed",r.Expired="Expired",r))(bo||{}),xo=(r=>(r.User="User",r.Assistant="Assistant",r))(xo||{}),Uo=(r=>(r.Metadata="metadata",r.Token="token",r.Action="action",r.Bubble="bubble",r.Handoff="handoff",r.Done="done",r.Error="error",r))(Uo||{}),No=(r=>(r.NoSource="NoSource",r.LowConfidence="LowConfidence",r.HumanRequest="HumanRequest",r.OutOfScope="OutOfScope",r))(No||{}),$o=(r=>(r.PlaybookIntent="PlaybookIntent",r.UserInitiated="UserInitiated",r.Welcome="Welcome",r.Resume="Resume",r.Discover="Discover",r.Recommend="Recommend",r))($o||{}),Po=(r=>(r.ExtraExtraSmall="ExtraExtraSmall",r.ExtraSmall="ExtraSmall",r.Small="Small",r.Medium="Medium",r.Large="Large",r))(Po||{}),Co=(r=>(r.Dropdown="Dropdown",r.Inline="Inline",r.Overlay="Overlay",r))(Co||{}),Yo=(r=>(r.Left="Left",r.Right="Right",r))(Yo||{}),Fo=(r=>(r.Top="Top",r.Bottom="Bottom",r))(Fo||{}),Ho=(r=>(r.TopLeft="TopLeft",r.TopRight="TopRight",r.BottomLeft="BottomLeft",r.BottomRight="BottomRight",r))(Ho||{}),Bo=(r=>(r.Button="Button",r.Card="Card",r.CardInline="CardInline",r.Carousel="Carousel",r.Helper="Helper",r.ListOfContent="ListOfContent",r.ListOfContentInline="ListOfContentInline",r))(Bo||{}),Wo=(r=>(r.Inline="Inline",r.Modal="Modal",r.Drawer="Drawer",r))(Wo||{}),ko=(r=>(r.Self="Self",r.Parent="Parent",r.Top="Top",r))(ko||{}),Go=(r=>(r.Left="Left",r.Right="Right",r))(Go||{}),zo=(r=>(r.Body="Body",r.DOMSelector="DOMSelector",r))(zo||{}),qo=(r=>(r.After="After",r.AppendChild="AppendChild",r.Before="Before",r.PrependChild="PrependChild",r))(qo||{}),Ko=(r=>(r.CSSSelector="CSSSelector",r.Slot="Slot",r))(Ko||{}),Qo=(r=>(r.Element="Element",r.WebComponent="WebComponent",r))(Qo||{}),Zo=(r=>(r.Inline="Inline",r.Flex="Flex",r))(Zo||{}),Jo=(r=>(r.Horizontal="Horizontal",r.Vertical="Vertical",r))(Jo||{}),Vo=(r=>(r.Start="Start",r.Center="Center",r.End="End",r.Stretch="Stretch",r.Baseline="Baseline",r))(Vo||{}),Xo=(r=>(r.Course="Course",r.Live="Live",r.Link="Link",r.Page="Page",r))(Xo||{}),jo=(r=>(r.Workshop="Workshop",r.Conference="Conference",r))(jo||{}),ns=(r=>(r.Ended="Ended",r.Planned="Planned",r.Live="Live",r))(ns||{}),es=(r=>(r.CloseA="CloseA",r.CloseB="CloseB",r.Later="Later",r))(es||{});const Dl="a",Sl="mention_input",bl="mention",xl="var",Ul="p",Nl="h1",$l="h2",Pl="h3",Cl="blockquote",Yl="layout",Fl="layout-column",Hl="ul",Bl="ol",Wl="lic",kl="li",Gl="img",zl="iframely",ql="code_block",Kl="code_line";var ts=(r=>(r.Element="Element",r.FullPage="FullPage",r))(ts||{}),rs=(r=>(r.Draft="Draft",r.Pending="Pending",r.Published="Published",r))(rs||{}),is=(r=>(r.Beacon="Beacon",r.List="List",r))(is||{}),vi=(r=>(r.Channel="Channel",r.Collection="Collection",r.Course="Course",r.Discussion="Discussion",r.Forum="Forum",r.Link="Link",r.Live="Live",r.LearningPath="LearningPath",r.Page="Page",r.RichText="RichText",r.Topic="Topic",r))(vi||{});function Ql(r){return Object.values(vi).includes(r)}const us=ue.getInstance(),os=Se.getInstance(),ss=rt.getInstance(),as={Playbook:et.getInstance(),Spot:gt.getInstance(),SpotMember:tt.getInstance()},Et=globalThis;Et.MeltingSpot||(Et.MeltingSpot={}),Et.MeltingSpot.Configuration=us,Et.MeltingSpot.Auth=os,Et.MeltingSpot.Sso=ss,Et.MeltingSpot.Api=as,y.ATTRIBUTE_BLOCKQUOTE=Cl,y.ATTRIBUTE_CODE_BLOCK=ql,y.ATTRIBUTE_CODE_LINE=Kl,y.ATTRIBUTE_H1=Nl,y.ATTRIBUTE_H2=$l,y.ATTRIBUTE_H3=Pl,y.ATTRIBUTE_IFRAMELY=zl,y.ATTRIBUTE_IMAGE=Gl,y.ATTRIBUTE_LAYOUT=Yl,y.ATTRIBUTE_LAYOUT_COLUMN=Fl,y.ATTRIBUTE_LI=kl,y.ATTRIBUTE_LIC=Wl,y.ATTRIBUTE_LINK=Dl,y.ATTRIBUTE_MENTION=bl,y.ATTRIBUTE_MENTION_INPUT=Sl,y.ATTRIBUTE_OL=Bl,y.ATTRIBUTE_PARAGRAPH=Ul,y.ATTRIBUTE_UL=Hl,y.ATTRIBUTE_VARIABLE=xl,y.AnalyticsApiService=vt,y.Api=as,y.Auth=os,y.AuthService=Se,y.AuthServiceEvents=Oo,y.BeaconIntegrationType=Co,y.BeaconRenderType=Bo,y.ButtonBeaconSize=Po,y.Configuration=us,y.ConfigurationService=ue,y.ConversationMessageRole=xo,y.ConversationSseEventType=Uo,y.ConversationStatus=bo,y.DEFAULT_PERMISSION_POLICIES=Ku,y.DateFormat=co,y.DrawerWidgetPosition=Go,y.DropdownBeaconHorizontalPosition=Yo,y.DropdownBeaconVerticalPosition=Fo,y.HttpMethods=Rn,y.HttpService=Mo,y.LastActionState=es,y.LearningPathContentType=Xo,y.LiveBuiltInType=jo,y.LiveStatus=ns,y.Logger=ho,y.MeltingSpotApi=oe,y.MeltyHandoffReason=No,y.OverlayBeaconPosition=Ho,y.PLAYBOOK_EDITOR_ACTIVE_EVENT=di,y.PlaybookApiService=et,y.PlaybookEditorAwareLifecycle=tl,y.PlaybookHotspotLocation=ts,y.PlaybookIntentStatus=rs,y.PlaybookIntentWidgetMode=is,y.PlaybookPageMatchingOperator=_e,y.RouteChangeDetector=Ll,y.SpotMemberApiService=tt,y.SpotWidgetContentType=vi,y.Sso=ss,y.SsoService=rt,y.TouchPointAnchorType=zo,y.TouchPointDOMInjectionPosition=qo,y.TouchPointDOMSelectorCssStepMode=Qo,y.TouchPointDOMSelectorPathStepType=Ko,y.TouchPointFlexAlign=Vo,y.TouchPointFlexDirection=Jo,y.TouchPointLayoutType=Zo,y.TriggerType=$o,y.WidgetInjectionTarget=ko,y.WidgetInjectionType=Wo,y.createDialog=Qf,y.createIframe=Zf,y.dayjs=_t,y.flattenUtmParameters=Ol,y.formatBaseUrl=fl,y.formatDate=kc,y.formatDeeplink=sl,y.formatUUID=ul,y.getHTMLElement=Kf,y.getTimeInfoWithStartAndEndDate=Dc,y.isPlaybookEditorActive=lo,y.isSpotWidgetContentType=Ql,y.isTouchDevice=Jf,y.matchesDomain=jc,y.parseUtmParameters=Ml,y.sanitizeUrl=ur,y.setLoggerDebugMode=il,y.testUrlMatching=Vc,y.trimSlashLeft=zu,y.trimSlashRight=qu,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "MeltingSpot Core SDK",
4
4
  "homepage": "https://meltingspot.io",
5
5
  "license": "BSD-3-Clause",
6
- "version": "1.2.0",
6
+ "version": "1.3.0",
7
7
  "main": "./index.umd.js",
8
8
  "module": "./index.mjs",
9
9
  "typings": "./index.d.ts",