@telia-ace/widget-conversation-flamingo 1.0.14 → 1.0.37

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.
Files changed (68) hide show
  1. package/{dist/agent.d.ts → agent.d.ts} +3 -4
  2. package/components/conversation/conversation.d.ts +20 -0
  3. package/{dist/components → components}/conversation/plugin.d.ts +0 -1
  4. package/{dist/components → components}/conversation/ui/message-list.d.ts +1 -2
  5. package/{dist/components → components}/conversation/ui/message-types/message-type-html.d.ts +1 -2
  6. package/{dist/components → components}/conversation/ui/message-types/message-type-link-list.d.ts +1 -2
  7. package/{dist/components → components}/conversation/ui/message-types/message-type-separator.d.ts +1 -2
  8. package/{dist/components → components}/conversation/ui/message.d.ts +2 -3
  9. package/{dist/components → components}/conversation/utils.d.ts +0 -1
  10. package/conversation-069e0c28.mjs +1884 -0
  11. package/{dist/conversation-controller.d.ts → conversation-controller.d.ts} +0 -1
  12. package/conversation-da609cdf.js +446 -0
  13. package/{dist/conversation-history.d.ts → conversation-history.d.ts} +0 -1
  14. package/{dist/conversation-platform.d.ts → conversation-platform.d.ts} +1 -2
  15. package/{dist/conversation-provider.d.ts → conversation-provider.d.ts} +0 -1
  16. package/{dist/index-9688347a-02584d39.js → index-17239ac6.mjs} +245 -245
  17. package/index-17fa2121.js +1 -0
  18. package/index-5ce43fbe.mjs +3888 -0
  19. package/index-8e55fd9b.js +160 -0
  20. package/{dist/index.d.ts → index.d.ts} +0 -1
  21. package/index.js +1 -0
  22. package/{dist/index.js → index.mjs} +3 -4
  23. package/package.json +11 -42
  24. package/send-1e9780e5.mjs +5 -0
  25. package/send-df47dcea.js +1 -0
  26. package/{dist/store.d.ts → store.d.ts} +0 -1
  27. package/{dist/types.d.ts → types.d.ts} +2 -3
  28. package/{dist/user.d.ts → user.d.ts} +0 -1
  29. package/{dist/utils → utils}/custom-message.d.ts +0 -1
  30. package/{dist/utils → utils}/index.d.ts +0 -1
  31. package/{dist/utils → utils}/open-chat-widget.d.ts +0 -1
  32. package/{dist/utils → utils}/swap-provider.d.ts +0 -1
  33. package/LICENSE.txt +0 -6
  34. package/README.md +0 -490
  35. package/dist/agent.d.ts.map +0 -1
  36. package/dist/components/conversation/conversation.d.ts +0 -26
  37. package/dist/components/conversation/conversation.d.ts.map +0 -1
  38. package/dist/components/conversation/plugin.d.ts.map +0 -1
  39. package/dist/components/conversation/ui/message-list.d.ts.map +0 -1
  40. package/dist/components/conversation/ui/message-types/message-type-html.d.ts.map +0 -1
  41. package/dist/components/conversation/ui/message-types/message-type-link-list.d.ts.map +0 -1
  42. package/dist/components/conversation/ui/message-types/message-type-separator.d.ts.map +0 -1
  43. package/dist/components/conversation/ui/message.d.ts.map +0 -1
  44. package/dist/components/conversation/utils.d.ts.map +0 -1
  45. package/dist/conversation-309361e4.js +0 -2287
  46. package/dist/conversation-309361e4.js.map +0 -1
  47. package/dist/conversation-controller.d.ts.map +0 -1
  48. package/dist/conversation-form-adapter.d.ts +0 -7
  49. package/dist/conversation-form-adapter.d.ts.map +0 -1
  50. package/dist/conversation-history.d.ts.map +0 -1
  51. package/dist/conversation-platform.d.ts.map +0 -1
  52. package/dist/conversation-provider.d.ts.map +0 -1
  53. package/dist/index-9688347a-02584d39.js.map +0 -1
  54. package/dist/index-c61b2340.js +0 -5175
  55. package/dist/index-c61b2340.js.map +0 -1
  56. package/dist/index.d.ts.map +0 -1
  57. package/dist/index.js.map +0 -1
  58. package/dist/resolve-entity-value.d.ts +0 -11
  59. package/dist/resolve-entity-value.d.ts.map +0 -1
  60. package/dist/store.d.ts.map +0 -1
  61. package/dist/types.d.ts.map +0 -1
  62. package/dist/user.d.ts.map +0 -1
  63. package/dist/utils/custom-message.d.ts.map +0 -1
  64. package/dist/utils/index.d.ts.map +0 -1
  65. package/dist/utils/map-actions.d.ts +0 -2
  66. package/dist/utils/map-actions.d.ts.map +0 -1
  67. package/dist/utils/open-chat-widget.d.ts.map +0 -1
  68. package/dist/utils/swap-provider.d.ts.map +0 -1
@@ -0,0 +1,160 @@
1
+ "use strict";const Nt=(i,t,e,...s)=>{const n=`[${i.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(n,...s);break;case"warning":console.warn(n,...s);break;case"error":console.error(n,...s);break}},Ss=i=>{const t=i.container||i;return{info:(e,...s)=>Nt(t,"info",e,...s),warn:(e,...s)=>Nt(t,"warning",e,...s),error:(e,...s)=>Nt(t,"error",e,...s)}};var tt=(i=>(i.Implementation="implementation",i.Widget="widget",i))(tt||{}),T=(i=>(i.Pre="pre",i.Post="post",i))(T||{});const Os=(i,t,e,s)=>{try{const n=new t(e,s);return{name:i,invoke:(r,o)=>{let a;return n[r]&&(a=n[r].call(n,o)),Promise.resolve(a)},getInstance:()=>n}}catch(n){if(n.message&&n.message.indexOf("is not a constructor")>=0)return{name:i,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw n}};function ye(i,t){return typeof i>"u"?t:i}let Ns=class{constructor(t={}){this.part=t}createCommand(t,e,s){let n;typeof e=="function"?n={scope:tt.Widget,stage:T.Post,defaultArgs:void 0,handlerResolver:e}:n={scope:ye(e.scope,tt.Widget),stage:ye(e.stage,T.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,c)=>{c===o.length-1?r[a]||(r[a]=()=>n):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}};const Ye=i=>{const t=new Ns({});return i(t),t.get()};Ye(i=>{i.createCommand("types.register",{scope:tt.Implementation,stage:T.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:T.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:T.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:T.Pre},t=>(e,s,n)=>{const{container:r}=t;let o=null,a=e,c=s;typeof e=="string"&&(o=e,a=s,c=n);const h=l=>{const{transformPluginSettings:d}=t.container.get("$environmentOptions"),u=d?d(c||{},o,t.container,a):s;try{const p=Os(o,a,r,u);r.get("$plugins").push(p),l&&p.invoke("initialize",null)}catch(p){Ss(t).warn("Error when initializing plugin",p)}};t.container.get("$instance")?h(!0):t.events.subscribeOnce("widget:instance-created",()=>h(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})});const Ts=Ye(i=>{i.createCommand("ready",{scope:tt.Implementation,stage:T.Pre},t=>e=>{const{container:s}=t,n=s.owner;s.get("bootstrapping").ready?e(n):n.events.subscribeOnce("bootstrap:ready",()=>{e(n)})})}),Tt=new WeakMap;function q(){return i=>(Tt.has(i)||Tt.set(i,{}),Tt.get(i))}const It=(i,t,e,...s)=>{const n=`[${i.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(n,...s);break;case"warning":console.warn(n,...s);break;case"error":console.error(n,...s);break}},w=i=>{const t=i.container||i;return{info:(e,...s)=>It(t,"info",e,...s),warn:(e,...s)=>It(t,"warning",e,...s),error:(e,...s)=>It(t,"error",e,...s)}},m=q(),se=(()=>{let i=0;return()=>++i})(),ie=(i,t,e)=>{const s=m(i).touchQueue.get(t);s&&s.forEach(n=>{n(e,i)})};let Is=class{constructor(t,e,s,n){this.key=t,this.factory=e,this.parent=s,this.container=n,this.id=se(),this.resolved=!1,this.constructed=!1,this.async=!0}resolve(){if(!this.constructed){const t=this.factory(this.parent,this.container);return this.constructed=!0,this.value=Promise.resolve(t).then(e=>(this.resolved=!0,ie(this.container,this.key,e),e))}return this.value}},Ms=class{constructor(t,e,s,n){this.key=t,this.value=e,this.parent=s,this.container=n,this.id=se(),this.async=!1,this.resolved=!1,this.constructed=!0,this.resolve=()=>(this.resolved=!0,ie(this.container,this.key,this.value),this.value)}},Ds=class{constructor(t,e,s,n){this.key=t,this.value=e,this.parent=s,this.container=n,this.id=se(),this.async=!1,this.resolved=!1,this.constructed=!1,this.resolve=()=>{this.resolved=!0,this.constructed=!0;const r=this.value(this.parent,this.container);return ie(this.container,this.key,this.value),r}}},js=class Ze{constructor(t,e,s){this.owner=t,this.name=e,this.parent=s,m(this).resolvers=new Map,m(this).touchQueue=new Map,m(this).children=[]}delete(t){const e=m(this).resolvers,s=Array.from(e.values()).find(n=>n.id===t);return s?(m(this).touchQueue.delete(s.key),Promise.resolve(e.delete(s.key))):this.parent?this.parent.delete(t):Promise.resolve(!1)}clear(){const t=m(this).resolvers,e=Array.from(t.values());return Promise.all(e.map(s=>{if(s.constructed)return Promise.resolve(s.resolve()).then(n=>{if(n!==null&&typeof n=="object"&&typeof n.dispose=="function")return n.dispose.call(n,this,s)})})).then(()=>{e.forEach(s=>this.delete(s.id)),m(this).children.forEach(s=>s.clear())})}detach(){if(this.parent){const t=m(this.parent).children,e=t.indexOf(this);e>-1&&(t.splice(e,1),delete this.parent)}}touch(t,e){const s=m(this).resolvers.get(t);if(s&&s.constructed)Promise.resolve(s.resolve()).then(n=>{e(n,this)});else{const n=m(this).touchQueue;let r=n.get(t);r||(r=[],n.set(t,r)),r.push(e)}return this.parent&&!s?this.parent.touch(t,e):Promise.resolve()}registerAsync(t,e){const s=m(this).resolvers.get(t);s&&!s.async&&process.env.NODE_ENV!=="production"&&w(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);const n=new Is(t,e,s,this);return m(this).resolvers.set(t,n),n.id}registerFactory(t,e){const s=m(this).resolvers.get(t);s&&s.async&&process.env.NODE_ENV!=="production"&&w(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);const n=new Ds(t,e,s,this);return m(this).resolvers.set(t,n),n.id}register(t,e){const s=m(this).resolvers.get(t);s&&s.async&&process.env.NODE_ENV!=="production"&&w(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);const n=new Ms(t,e,s,this);return m(this).resolvers.set(t,n),n.id}get(t){const e=m(this).resolvers.get(t);if(e)return e.async&&process.env.NODE_ENV!=="production"&&w(this).warn(`You are retrieving an async value (with key '${t}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`),e.resolve();if(this.parent)return this.parent.get(t)}getAsync(t){const e=m(this).resolvers.get(t);if(e){if(!e.async)throw process.env.NODE_ENV!=="production"&&w(this).warn(`You are retrieving a non-async value (with key '${t}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`),"Mismatching resolver type";return e.resolve()}return this.parent?this.parent.getAsync(t):Promise.resolve(void 0)}getMany(...t){const e={};return t.forEach(s=>e[s]=this.get(s)),e}getManyAsync(...t){const e={};return Promise.all(t.map(s=>this.getAsync(s).then(n=>e[s]=n))).then(()=>e)}createChild(t,e){const s=new Ze(t,e,this);return m(this).children.push(s),s}},$e=class{constructor(t,e,s=!1,n=!1){this.type=t,this.target=e,this.cancelable=!!s,this.bubbles=!!n,this.defaultPrevented=!1}preventDefault(){this.cancelable&&(this.defaultPrevented=!0)}};const C=q(),be=(i,t)=>[].concat(C(i).listenerLookup.get(t.toLowerCase())||[],C(i).listenerLookup.get("*")||[]),we=(i,t,e,s)=>{let n,r;return t instanceof $e?(n=t,r=t.type):(n=new $e(t,i.target,!!e.cancelable,!!e.bubbles),r=t),{event:n,type:r,async:s}};let Hs=class Ge{constructor(t,e){this.target=t,this.parent=e,C(this).listenerLookup=new Map,C(this).children=[]}clear(){C(this).listenerLookup.clear(),C(this).children.forEach(t=>t.clear())}detach(){if(this.parent){const t=C(this.parent).children,e=t.indexOf(this);e>-1&&t.splice(e,1)}}subscribe(t,e,s){const n=C(this).listenerLookup,r=t.toLowerCase();return n.has(r)||n.set(r,[]),n.get(r).push(e),()=>this.unsubscribe(t,e)}subscribeOnce(t,e){const s=this.subscribe(t,(n,r)=>(s(),e(n,r)))}unsubscribe(t,e){const s=C(this).listenerLookup.get(t.toLowerCase());if(s){const n=s.indexOf(e);n>-1&&s.splice(n,1)}}dispatchAsync(t,e,s={}){const{event:n,type:r}=we(this,t,s,!0),o=be(this,r);let a=0;const c=o.length;let h=Promise.resolve();for(a=0;a<c;a++)(l=>{h=h.then(d=>d?Promise.resolve(!0):Promise.resolve(l(n,e)).then(()=>n.defaultPrevented))})(o[a]);return h.then(l=>!l&&n.bubbles&&this.parent?this.parent.dispatchAsync(n,e):l)}dispatch(t,e,s={}){const{event:n,type:r}=we(this,t,s,!1),o=be(this,r);let a=0;const c=o.length;let h=!1;for(a=0;a<c;a++)if(o[a](n,e),n.defaultPrevented){h=!0;break}return!h&&n.bubbles&&this.parent&&(h=this.parent.dispatch(n,e)),h}createChild(t){const e=new Ge(t,this);return C(this).children.push(e),e}};const at=(i,t,e)=>{const s=i.get("$plugins").map(n=>{try{return n.invoke(t,e)}catch(r){w(i).error("An error occured when invoking a plugin.",n,r)}});return Promise.all(s)};let Ls=class{constructor(t){this.widget=t.get("$widget"),this.events=this.widget.events,this.container=this.widget.container,this.initialized=null,this.activated=null,this.initialize=this.initialize.bind(this),this.activate=this.activate.bind(this),this.deactivate=this.deactivate.bind(this),this.invoke=this.invoke.bind(this),this.createInstance()}createInstance(){if(!this.widget.container.get("$instance")){const t=this.widget.container.get("$types"),e=this.widget.container.get("$type");!e&&w(this).error("Unable to create widget. No type is specified.");const s=t[e];!s&&w(this).error(`Unable to create widget. Type '${e}' is not registered.`),this.widget.events.dispatch("widget:create-instance",{},{bubbles:!0});try{this.widget.container.register("$instance",new s(this.container))}catch(n){w(this).error("Unable to create widget type.",n)}this.widget.events.dispatch("widget:instance-created",{},{bubbles:!0})}}initialize(t){return this.initialized=this.initialized||(()=>{const e=this.container.get("$instance"),s=e.initialize||(()=>{});return this.initialized=Promise.resolve(s.call(e,t)).then(()=>at(this.container,"initialize",t)).then(()=>{})})()}activate(t){return(this.initialized||this.initialize()).then(()=>{this.activated=this.activated||(()=>at(this.container,"activate").then(()=>{const e=this.container.get("$instance");return this.activated=e.activate(t)}))()})}deactivate(){const t=this.container.get("$instance"),e=t.deactivate||(()=>{});return at(this.container,"deactivate").then(()=>Promise.resolve(e.call(t))).then(()=>{this.initialized=null,this.activated=null}).then(()=>{})}invoke(t,...e){return at(this.container,"invoke",{command:t,args:e}).then(()=>{const s=this.container.get("$instance");if(s[t])return s[t].apply(s,e);const n=s.invoke;if(n)return n.call(s,t,...e)})}};const U=(i,t)=>{if(!t)return!0;if(typeof t=="string"){const e=t.split(",");for(let s=0,n=e.length;s<n;s++){const r=e[s].trim();if(r===i||r==="*")return!0}}return t instanceof Array?t.indexOf(i)>-1:!1},Rs=(i,t)=>{if(typeof t=="function")return t(i);const e=typeof t=="string"?Ws(t):t;return!(!U(i.implementation.tenant||"",e.tenant||"")||!U(i.implementation.name,e.implementation||"")||!U(i.name,e.widget||"")||!U(i.container.get("$type"),e.type||""))},Us=(i,t)=>{if(typeof t=="function")return t(i);const e=typeof t=="string"?Bs(t):t;return!(!U(i.tenant||"",e.tenant||"")||!U(i.name,e.implementation||""))},Xe=i=>t=>Rs(t,i),zs=i=>t=>Us(t,i),k=i=>i instanceof Array&&i.length===1?i[0]:i,Ws=i=>{const t={},e=i.split(":");return e.length===1?t.widget=k(e[0].split(",")):e.length===2?(t.implementation=k(e[0].split(",")),t.widget=k(e[1].split(","))):(t.tenant=k(e[0].split(",")),t.implementation=k(e[1].split(",")),t.widget=k(e[2].split(","))),t},Bs=i=>{const t={},e=i.split(":");return e.length===1?t.implementation=k(e[0].split(",")):(t.tenant=k(e[0].split(",")),t.implementation=k(e[1].split(","))),t},ut=q(),_e=(i,t,e)=>i.filter(s=>s.stage===t&&Xe(s.selector)(e));function Vs(i){const t=i.container.get("$environment");let e=ut(t).configurationCache;e&&(e=e.filter(s=>s[0]!==i),ut(t).configurationCache=e)}var pt=(i=>(i.Implementation="implementation",i.Widget="widget",i))(pt||{}),S=(i=>(i.Pre="pre",i.Post="post",i))(S||{});const ts=(i,t,e)=>(Object.keys(t).forEach(s=>{const n=t[s];if(typeof n=="function"){const r=n();typeof r.defaultArgs<"u"&&e(r,...r.defaultArgs),i[s]=(...o)=>{const a=Object.assign({},r,{handlerResolver:r.handlerResolver.bind({})});return e(a,...o),i}}else i[s]=ts({},n,e)}),i),Js=(i,t)=>{switch(t){case"implementation":return i.implementation;case"widget":return i}},Ae=(i,t,e,s)=>(s.forEach(n=>{ts(i,n,(r,...o)=>{const a={selector:t,stage:r.stage,handler:c=>{const h=Js(c,r.scope),l={container:h.container,events:h.events},d=r.handlerResolver,u=d(l);let p=ut(e.environment).configurationCache;return p||(p=ut(e.environment).configurationCache=[]),p.find(v=>v.indexOf(h)>-1&&v.indexOf(d)>-1)?Promise.resolve():(p.push([h,d]),Promise.resolve(u(...o)))}};e.instructions.push(a)})}),i);function qs(i,t){function e(s){return Ae({},s,i,t)}return Ae(e,"*",i,t)}const Fs=(i,t,e,s)=>{try{const n=new t(e,s);return{name:i,invoke:(r,o)=>{let a;return n[r]&&(a=n[r].call(n,o)),Promise.resolve(a)},getInstance:()=>n}}catch(n){if(n.message&&n.message.indexOf("is not a constructor")>=0)return{name:i,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw n}};function Ee(i,t){return typeof i>"u"?t:i}let Qs=class{constructor(t={}){this.part=t}createCommand(t,e,s){let n;typeof e=="function"?n={scope:pt.Widget,stage:S.Post,defaultArgs:void 0,handlerResolver:e}:n={scope:Ee(e.scope,pt.Widget),stage:Ee(e.stage,S.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,c)=>{c===o.length-1?r[a]||(r[a]=()=>n):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}};const es=i=>{const t=new Qs({});return i(t),t.get()},Ks=es(i=>{i.createCommand("types.register",{scope:pt.Implementation,stage:S.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:S.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:S.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:S.Pre},t=>(e,s,n)=>{const{container:r}=t;let o=null,a=e,c=s;typeof e=="string"&&(o=e,a=s,c=n);const h=l=>{const{transformPluginSettings:d}=t.container.get("$environmentOptions"),u=d?d(c||{},o,t.container,a):s;try{const p=Fs(o,a,r,u);r.get("$plugins").push(p),l&&p.invoke("initialize",null)}catch(p){w(t).warn("Error when initializing plugin",p)}};t.container.get("$instance")?h(!0):t.events.subscribeOnce("widget:instance-created",()=>h(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})}),Ys=Ks;function Zs(i,t,e=[]){const s=[Ys].concat(e),n=qs(t,s);i(n,t)}let Gs=class{constructor(){this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,e,s,n){this.tasks.push({task:t,resolve:e,reject:s,done:n}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){const e=Promise.resolve(t.task());return Promise.resolve(e).then(this.next).then(()=>e.then(s=>{t.done(),t.resolve(s)})).catch(s=>(t.done(),t.reject(s),this.next()))}return Promise.resolve()})}};const ct=new WeakMap;function Xs(i){return ct.has(i)||ct.set(i,new Gs),t=>new Promise((e,s)=>{const n=ct.get(i);n.add(t,e,s,()=>{n.tasks.length||ct.delete(i)})})}const Ce=i=>typeof i<"u",Y=(i,t)=>{i.events.dispatch("widget:state-change",{state:t},{bubbles:!0}),i.state=t,i.events.dispatch("widget:state-changed",{},{bubbles:!0})},E=q(),ti=i=>{const{container:t,events:e}=i;t.get("$controller")||(t.register("$controller",new Ls(t)),e.dispatch("widget:controller-created",{},{bubbles:!0}))};class ei{constructor(t,e,s){this.state="deactivated",this.name=t,this.implementation=e,this.container=e.container.createChild(this,t),this.events=e.events.createChild(this),E(this).subscriptions=[],s&&e.configure(n=>{const r=n(t);Ce(s.type)&&r.type(s.type),Ce(s.settings)&&r.settings(s.settings),s.plugins&&Object.keys(s.plugins).forEach(o=>{var a;const c=(a=s.plugins)==null?void 0:a[o];r.plugin(o,c)})}),this.load=this.load.bind(this),this.activate=this.activate.bind(this),this.invoke=this.invoke.bind(this),this.deactivate=this.deactivate.bind(this)}load(){return Xs(this)(()=>{E(this).deactivatedPromise=null;const t=this.state==="deactivated";t&&(Y(this,"activating"),this.container.register("$widget",this),this.container.register("$controller",null),this.container.register("$plugins",[]),this.container.register("$type",null),this.container.register("$instance",null)),Y(this,"loading");const e=this.implementation.instructions,s=_e(e,S.Pre,this);return Promise.all(s.map(n=>n.handler(this))).then(()=>{ti(this);const n=_e(e,S.Post,this);return Promise.all(n.map(r=>r.handler(this))).then(()=>{t&&this.container.get("$controller").initialize()})}).then(()=>(Y(this,"activated"),this))})}activate(t){E(this).subscriptions.push(this.implementation.events.subscribe("implementation:configured",()=>{["activated","activating","loading"].indexOf(this.state)>-1&&this.load()}));const e=E(this).activatedPromise;return e?(process.env.NODE_ENV!=="production"&&w(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`,t),e):E(this).activatedPromise=this.load().then(()=>this.container.get("$controller").activate(t))}invoke(t,...e){const s=E(this).activatedPromise,n=(r,...o)=>s.then(this.load).then(()=>this.container.get("$controller").invoke(r,...o));return s?n(t,...e):(process.env.NODE_ENV!=="production"&&w(this).warn("You are invoking a command on a deactivated widget. The invocation will be queued until the widget is activated.",this),new Promise(r=>{const o=this.events.subscribe("widget:state-changed",()=>{this.state==="activated"&&(o(),r(n(t,...e)))})}))}deactivate(){return E(this).deactivatedPromise||(this.state==="deactivated"?Promise.resolve():(Y(this,"deactivating"),E(this).deactivatedPromise=this.container.get("$controller").deactivate().then(()=>(E(this).activatedPromise=null,E(this).subscriptions.forEach(e=>e()),E(this).subscriptions=[],this.container.clear().then(()=>{this.events.clear(),Vs(this),Y(this,"deactivated")})))))}}const Pe=q();class si{constructor(t,e,s=[]){this.instructions=[],this.widgets=new Map,this.name=t.name,this.tenant=t.tenant,this.environment=e,this.container=e.container.createChild(this,this.name),this.events=e.events.createChild(this),this.container.register("$types",{}),Pe(this).configurationApiExtensions=s}load(){const t=Array.from(this.widgets.values());return Promise.all(t.map(e=>e.load())).then(()=>t)}configure(t){return Zs(t,this,Pe(this).configurationApiExtensions),this.events.dispatch("implementation:configured",{implementation:this},{bubbles:!0}),this}createWidget(t,e){const s=new ei(t,this,e);return this.widgets.set(s.name,s),s}}function ii(i,t,e){const s=new si(i,t,e);return i.widgets&&Object.keys(i.widgets).forEach(n=>{var r;const o=(r=i.widgets)==null?void 0:r[n];s.createWidget(n,o)}),s}let xe=class ss{constructor(t,e){this.selectorFactory=e,typeof t=="function"?this.resolver=t:this.resolver=()=>t}append(t){const e=typeof t=="function"?t:()=>t;return new ss(()=>this.all().concat(e()),this.selectorFactory)}all(){return this.resolver().concat([])}query(t){return this.all().filter(this.selectorFactory(t))}find(t){const e=this.query(t);if(e.length)return e[0]}};const ne="#____version____#",Mt=q(),ni=i=>i.tenant?`${i.name}:${i.tenant}`:i.name,is=class{constructor(t,e=[],s={}){this.widgets=new xe(()=>{let n=[];return this.implementations.all().forEach(r=>{n=n.concat(Array.from(r.widgets.values()))}),n},Xe),this.implementations=new xe([],zs),this.name=t,this.container=new js(this,t),this.events=new Hs(this),this.container.register("$version",ne),this.container.register("$environment",this),this.container.register("$environmentOptions",s),Mt(this).configurationApiExtensions=e}createImplementation(t){const e=ni(t);let s=this.implementations.find(e);if(s)return process.env.NODE_ENV!=="production"&&w(s).warn(`Implementation "${e}" already exist on current environment.`),s;const n=Mt(this).configurationApiExtensions;return s=ii(t,this,n),this.implementations=this.implementations.append([s]),this.events.dispatch("implementation:created",{implementation:s}),s}patch(t={}){const{name:e,configurationApiExtensions:s}=t;typeof e<"u"&&e!==null&&(this.name=e),s&&s.forEach(n=>{Mt(this).configurationApiExtensions.push(n)})}static create(t={}){return new is(t.name||"",t.configurationApiExtensions,t.options)}};let ns=is;ns.version=ne;const yt=(i,t,...e)=>typeof t=="string"?i(`[humany] ${t}`,...e):i(t,...e),G=class{constructor(){this.keys=[],this.log=(t,...e)=>this.lookup(t,()=>G.log(...e)),this.warn=(t,...e)=>this.lookup(t,()=>G.warn(...e)),this.error=(t,...e)=>this.lookup(t,()=>G.error(...e)),this.info=(t,...e)=>this.lookup(t,()=>G.info(...e))}lookup(t,e){this.keys.indexOf(t)===-1&&(this.keys.push(t),e())}};let _=G;_.log=(...i)=>yt(console.log,...i);_.warn=(...i)=>yt(console.warn,...i);_.error=(...i)=>yt(console.error,...i);_.info=(...i)=>yt(console.info,...i);const rs=i=>{let t={},e,s;if(typeof i!="object"||i===null)return i;t=Array.isArray(i)?[]:{};for(s in i)e=i[s],t[s]=typeof e=="object"&&e!==null?rs(e):e;return t},ri=rs;function ke(i){let t=0;if(i.length===0)return t.toString();for(let e=0;e<i.length;e++){const s=i.charCodeAt(e);t=(t<<5)-t+s,t=t&t}return t.toString()}let oi=class{constructor(t,e){this.lockWarningTime=t,this.lockErrorTime=e,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,e,s,n){this.tasks.push({task:t,resolve:e,reject:s,done:n}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){let e;const s=setTimeout(()=>{process.env.NODE_ENV!=="production"&&_.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,t),e=setTimeout(()=>{t.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),n=Promise.resolve(t.task()).then(r=>(clearTimeout(s),clearTimeout(e),r));return Promise.resolve(n).then(this.next).then(()=>n.then(r=>{t.done(),t.resolve(r)})).catch(r=>(t.done(),t.reject(r),this.next()))}return Promise.resolve()})}};const ht=new WeakMap;function nt(i,t=5e3,e=1e3){return ht.has(i)||ht.set(i,new oi(t,e)),s=>new Promise((n,r)=>{const o=ht.get(i);o.add(s,n,r,()=>{o.tasks.length||ht.delete(i)})})}const O=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);function F(){return O()+O()+"-"+O()+"-"+O()+"-"+O()+"-"+O()+O()+O()}var ai=Object.defineProperty,ci=Object.defineProperties,hi=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertySymbols,li=Object.prototype.hasOwnProperty,di=Object.prototype.propertyIsEnumerable,Oe=(i,t,e)=>t in i?ai(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Qt=(i,t)=>{for(var e in t||(t={}))li.call(t,e)&&Oe(i,e,t[e]);if(Se)for(var e of Se(t))di.call(t,e)&&Oe(i,e,t[e]);return i},ui=(i,t)=>ci(i,hi(t));const pi=i=>{const t=[];return[(e,s)=>{t.push(i.subscribe(e,s))},()=>{t.forEach(e=>{e()})}]};let $t=class{constructor(t,e=[]){this.platform=t,this.rules=e}match(t){return this.rules.every(e=>!(e.id&&e.id!==t.id||e.type&&e.type!==t.type))}ofType(t){return this.rules.push({type:t}),this}withId(t){return this.rules.push({id:t}),this}select(){return new gi(this.platform,this)}},os=class{constructor(t,e,s){this.platform=t,this.node=e,this.actions=new re(t,new $t(t).withId(e.id),s);const[n,r]=pi(this.platform.events);this.subscribe=n,this.unsubscribe=r}properties(t){return t&&this.node.touchProperties(e=>t(e)),this.node.attributes.properties}context(t){return t&&this.subscribe("components:context-changed",(e,{node:s})=>{s===this.node&&t(this.node.attributes.context)}),this.node.attributes.context}layout(t){return t&&this.subscribe("components:layout-changed",(e,{node:s})=>{s===this.node&&t(this.node.attributes.layout)}),this.node.attributes.layout}writeProperties(t,e){this.node.writeProperties(t,e)}writeContext(t,e){this.node.writeProperties(t,e)}writeLayout(t,e){this.node.writeLayout(t,e)}dispose(){this.unsubscribe(),this.actions.dispose()}};class gi{constructor(t,e,s=!0){this.platform=t,this.target=e,this.clearOnDispose=s,this.removes=[],this.actions=new re(this.platform,this.target)}writeProperties(t,e){this.removes.push(this.platform.write({options:e,attributes:{properties:t},target:this.target,removable:this.clearOnDispose}))}writeContext(t,e){this.removes.push(this.platform.write({options:e,attributes:{context:t},target:this.target,removable:this.clearOnDispose}))}writeLayout(t,e){this.removes.push(this.platform.write({options:e,attributes:{layout:t},target:this.target,removable:this.clearOnDispose}))}dispose(){this.removes.forEach(t=>{t()}),this.actions.dispose()}}const mi=(i,t,e)=>{const s=i.concat(),n=(r,o,a)=>{let c=!0;if(s.length){const h=s.shift(),l=(d,u)=>(c=!1,n(d,Object.assign({},o,u),a));return Promise.resolve(h(r,l,a)).then(d=>ui(Qt({},d),{cancelled:c}))}return Promise.resolve({data:r,cancelled:!1,options:o})};return n(t,{},e)};let re=class{constructor(t,e,s){this.platform=t,this.target=e,this.ns=s,this.subscriptions=[],this.create=this.create.bind(this)}create(t,e=()=>{}){const s={key:t,fn:e,target:this.target,ns:this.ns};this.platform.actionsState.handlers.push(s);const n=()=>{const r=this.platform.actionsState.handlers.indexOf(s);r>-1&&this.platform.actionsState.handlers.splice(r,1)};return this.subscriptions.push(n),n}dispatch(t,e){const s=this.platform.nodes.all.concat(this.platform.nodes.detached),n={},r=this.platform.actionsState.handlers.filter(o=>o.key===t&&(!o.ns||!this.ns||o.ns===this.ns));return Promise.all(r.map(o=>{const a=s.filter(h=>o.target.match(h)&&this.target.match(h)),c=this.platform.actionsState.watchers.filter(h=>h.key===t&&(!h.ns||!this.ns||h.ns===this.ns)&&a.some(l=>h.target.match(l))).map(h=>h.fn);return Promise.all(a.map(h=>{const l=new os(this.platform,h,this.ns);return mi(c,e,l).then(d=>{const{data:u={},options:p,cancelled:v}=d;return Promise.resolve(v?{}:o.fn(u,p,l)).then(f=>{n[h.id]=f})})}))})).then(()=>n)}watch(t,e){let s=t,n=this.ns;const r=t.split(".");r.length>1&&(n=r[0],s=r.splice(1).join("."));const o={fn:e,target:this.target,key:s,ns:n};this.platform.actionsState.watchers.push(o);const a=()=>{const c=this.platform.actionsState.watchers.indexOf(o);c>-1&&this.platform.actionsState.watchers.splice(c,1)};return this.subscriptions.push(a),a}dispose(){this.subscriptions.forEach(t=>t())}};es(i=>{i.createCommand("components",t=>e=>{t.events.subscribeOnce("components:platform-created",(s,{platform:n})=>{e.handlers&&e.handlers.forEach(([r,o])=>{n.addComponentHandler(r,o)})})})});let Ne=class{constructor(t,e){this.events=t,this.tags=[],this.children={},this.changesets=[],this.mountCount=0,this.id=F(),this.type=e,this.attributes={context:{},properties:{},layout:{},tags:[]},this.writeLayout({size:"full",indent:0})}mount(t,e){let s=t.get("mounted-nodes");return s||(s=new Map,t.register("mounted-nodes",s)),s.has(this)?(process.env.NODE_ENV!=="production"&&_.error("Trying to mount an already mounted component node.",this),()=>{}):(this.events.dispatch("components:node-mounted",{node:this}),this.mountCount===0&&(this.mountCount=this.mountCount+1,this.events.dispatch("components:node-enter",{node:this})),()=>{s.delete(this),this.events.dispatch("components:node-unmounted",{node:this}),this.mountCount=this.mountCount-1,this.mountCount===0&&this.events.dispatch("components:node-exit",{node:this})})}appendChild(t,e="default"){if(t.parent){if(t.parent===this)return;t.parent.removeChild(t)}t.parent=this,this.children[e]||(this.children[e]=[]),this.children[e].push(t),this.events.dispatch("components:node-appended",{node:t})}prependChild(t,e="default"){if(t.parent){if(t.parent===this)return;t.parent.removeChild(t)}t.parent=this,this.children[e]||(this.children[e]=[]),this.children[e].unshift(t),this.events.dispatch("components:node-appended",{node:t})}touchProperties(t,e={},s){const n=[{properties:t},e];return this.changesets.push(n),this.events.dispatch("components:set-properties",{node:this}),()=>{if(s){const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-properties",{node:this}))}}}writeProperties(t,e={},s){const n=[{properties:t},e];return this.changesets.push(n),this.events.dispatch("components:set-properties",{node:this}),()=>{if(s){const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-properties",{node:this}))}}}writeLayout(t,e={},s){const n=[{layout:t},e];return this.changesets.push(n),this.events.dispatch("components:set-layout",{node:this}),()=>{if(!s)return;const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-layout",{node:this}))}}writeContext(t,e={},s){const n=[{context:t},e];return this.changesets.push(n),this.events.dispatch("components:set-context",{node:this}),()=>{if(!s)return;const r=this.changesets.indexOf(n);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-context",{node:this}))}}getChildren(t="default"){const e=this.children[t]||[];return e.reduce((s,n,r)=>{const{order:o=r}=n.attributes.layout;return s[o]?s.splice(o,0,n):s[o]=n,s},Array(e.length))}remove(){this.parent&&this.parent.removeChild(this)}removeChild(t){Object.keys(this.children).forEach(e=>{const s=this.children[e],n=s.indexOf(t);n>-1&&(s.splice(n,1),this.events.dispatch("components:node-removed",{node:t,parentNode:this}))}),delete t.parent}};const as=(i,t,e)=>{for(let s=0,n=i.length;s<n&&e(i[s])!==!0;s++){const r=t[i[s].id]||"default",o=i[s].getChildren(r);as(o,t,e)}},oe=(i,t,e)=>{if(e(i)!==!0){const s=t[i.id]||"default",n=i.children[s];as(n,t,e)}},Dt=(i,t)=>{const e=[];return oe(i,t,s=>{e.push(s)}),e},vi=(i,t,e)=>{let s;return oe(i,t,n=>{if(e(n))return s=n,!0}),s};class fi{constructor(t,e,s){this.root=t,this.switches=e,this.all=[],this.visible=[],this.detached=[],s.subscribe("components:node-appended",(n,r)=>{this.all.push(r.node),this.visible=Dt(t,e)}),s.subscribe("components:node-removed",(n,r)=>{let o=this.all.indexOf(r.node);o>-1&&this.all.splice(o,1),o=this.visible.indexOf(r.node),o>-1&&this.visible.splice(o,1),this.visible=Dt(t,e)}),s.subscribe("components:node-switched",(n,r)=>{this.visible=Dt(t,e)})}query(t={}){const e=[];return oe(this.root,this.switches,s=>{Object.keys(t).every(n=>t[n]===s[n])&&e.push(s)}),e}get(t){return vi(this.root,this.switches,e=>e.id===t)||this.detached.find(e=>e.id===t)}}class yi{constructor(){this.handlers=new Map}add(t,e){this.handlers.set(t,e)}get(t){return this.handlers.get(t)}}const $i=i=>{let t=i,e=0;for(;t.parent;)e=e+1,t=t.parent;return e},bi=i=>i.map(([t,e])=>[$i(t),t,e]).sort(([t],[e])=>t-e).map(([,t,e])=>[t,e]),jt=i=>i instanceof Date?!1:i&&typeof i=="object"&&!Array.isArray(i),x=(i,...t)=>{if(!t.length)return i;const e=t.shift();if(jt(i)&&jt(e))for(const s in e)jt(e[s])?(i[s]||Object.assign(i,{[s]:{}}),x(i[s],e[s])):Object.assign(i,{[s]:e[s]});return x(i,...t)},wi=(i,t)=>!i||i==="all"?!0:i.some(e=>t.indexOf(e)>-1),_i=(i,t)=>{let e=[],s=[],n;const r=()=>{process.env.NODE_ENV!=="production"&&console.time("state-processor.flush");const a=new Map,c=bi(e.map((l,d)=>[l,s[d]])),h=(l,d)=>{var u;const p=a.get(l)||{},v=d.context&&!p.context,f=d.properties&&!p.properties,St=d.layout&&!p.layout;a.set(l,{context:p.context||v,properties:p.properties||f,layout:p.layout||St}),f&&(l.attributes.properties={}),St&&(l.attributes.layout={}),v&&(l.attributes.context=x({},(u=l.parent)==null?void 0:u.attributes.context));const me=[],ve=[],fe=[];if(l.changesets.forEach(P=>{const[A,Ot]=P;wi(Ot.breakpoints,i.breakpoints)&&(f&&(typeof A.properties=="function"?me.push(A.properties):x(l.attributes.properties,A.properties)),St&&(typeof A.layout=="function"?ve.push(A.layout):x(l.attributes.layout,A.layout)),v&&(typeof A.context=="function"?fe.push(A.context):x(l.attributes.context,A.context)))}),me.forEach(P=>{x(l.attributes.properties,P(l.attributes.properties))}),ve.forEach(P=>{x(l.attributes.layout,P(l.attributes.layout))}),fe.forEach(P=>{x(l.attributes.context,P(l.attributes.context))}),v||d.recursive){const P=i.getBranch(l),A=d.recursive?d:{context:!!v};l.getChildren(P).forEach(Ot=>{h(Ot,A)})}};process.env.NODE_ENV!=="production"&&console.timeEnd("state-processor.flush"),c.forEach(([l,d])=>{h(l,d)}),e=[],s=[],t(a)},o=()=>{clearTimeout(n),n=setTimeout(r,0)};return(a,c)=>{const h=e.indexOf(a);if(h>-1){const l=s[h];return c.context&&(l.context=!0),c.properties&&(l.properties=!0),c.layout&&(l.layout=!0),c.recursive&&(l.recursive=!0),o()}return e.push(a),s.push(c),o()}};class ae{constructor(t,e={}){this.providers=e,this.breakpoints=[],this.actionsState={handlers:[],watchers:[]},this.switches={},this.changesets=[],this.subscriptions=[],this.customComponentHandler=new yi,this.events=t.events.createChild(this);const s=new Ne(this.events,"root");s.name=`root-${t.name}`,this.nodes=new fi(s,this.switches,this.events);const n=this.processNode=_i(this,r=>{const o=Array.from(r.keys());process.env.NODE_ENV!=="production"&&console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
2
+ ${o.map(a=>`${a.name||"<no name>"} (${a.id})
3
+ `)}`),o.forEach(a=>{const c=r.get(a);a.parent&&a.parent.type==="root"&&this.events.dispatch("components:root-children-changed",{node:a}),c!=null&&c.context&&this.events.dispatch("components:context-changed",{node:a}),c!=null&&c.properties&&this.events.dispatch("components:properties-changed",{node:a}),c!=null&&c.layout&&this.events.dispatch("components:layout-changed",{node:a})}),this.events.dispatch("components:component-model-initialized",{},{bubbles:!0})});Promise.all(Object.keys(e).map(r=>e[r].load(this))),this.subscriptions.push(this.events.subscribe("components:node-appended",(r,o)=>{const{node:a}=o;this.changesets.forEach(c=>{const{changeset:h,target:l,removes:d}=c,[u,p]=h;l.match(o.node)&&(u.properties&&d.push(a.writeProperties(u.properties,p)),u.context&&d.push(a.writeContext(u.context,p)),u.layout&&d.push(a.writeLayout(u.layout,p)))})})),this.subscriptions.push(this.events.subscribe("components:node-appended",(r,o)=>{n(o.node,{properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:set-properties",(r,o)=>{n(o.node,{properties:!0})})),this.subscriptions.push(this.events.subscribe("components:set-context",(r,o)=>{n(o.node,{properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:set-indent",(r,o)=>{n(o.node,{layout:!0})})),this.subscriptions.push(this.events.subscribe("components:set-layout",(r,o)=>{n(o.node,{layout:!0})})),this.subscriptions.push(this.events.subscribe("components:node-switched",(r,{node:o,branch:a})=>{n(o,{layout:!0,recursive:!0,properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:node-removed",(r,{parentNode:o})=>{n(o,{properties:!0})})),this.events.parent&&this.events.parent.dispatch("components:platform-created",{platform:this})}static getInstance(t){return t.getAsync("components")}addBreakpoint(t){this.breakpoints.indexOf(t)===-1&&(this.breakpoints.push(t),this.processNode(this.nodes.root,{context:!0,properties:!0,layout:!0,recursive:!0}))}removeBreakpoint(t){const e=this.breakpoints.indexOf(t);e>-1&&(this.breakpoints.splice(e,1),this.processNode(this.nodes.root,{context:!0,properties:!0,layout:!0,recursive:!0}))}setSwitch(t,e){this.switches[t.id]=e,this.events.dispatch("components:node-switched",{node:t,branch:e})}getBranch(t){return this.switches[t.id]}createNode(t,e={}){const s=new Ne(this.events,t);return e.detached&&this.nodes.detached.push(s),s}components(){return new $t(this)}actions(t,e){return new re(this,t,e)}write(t){const{provider:e,target:s,attributes:n,options:r={},removable:o}=t,a=t.key||F(),c={changeset:[n,r],target:s,removes:[]};if(e){const h=this.providers[e];h.write(a,s,n,r),c.removes.push(()=>{h.remove(a)})}return this.changesets.push(c),this.nodes.all.forEach(h=>{if(s.match(h)){let l=()=>{};n.properties&&(l=h.writeProperties(n.properties,r,o)),n.context&&(l=h.writeContext(n.context,r,o)),n.layout&&(l=h.writeContext(n.layout,r,o)),c.removes.push(l)}}),()=>{if(o){c.removes.forEach(l=>l());const h=this.changesets.indexOf(c);h>-1&&this.changesets.splice(h,1)}}}addComponentHandler(t,e){this.customComponentHandler.add(t,e)}getComponentHandler(t){return this.customComponentHandler.get(t)}dispose(){this.subscriptions.forEach(t=>t())}}const Ai=(i,t)=>({id:i.id,type:i.type,name:i.name,branch:t||"default"}),Ei=(i,t,e,s=F(),n={})=>i.getAsync("components").then(r=>{let o;if(typeof t=="string"){const h=new $t(r);h.ofType(t),o=h}else o=t;const a={},c=h=>{const l=a[h.id];return l?Promise.resolve(l.controller):ae.getInstance(i).then(d=>new os(d,h,s))};r.events.subscribe("components:node-enter",(h,{node:l})=>{o.match(l)&&c(l).then(d=>{Promise.resolve(e(d)).then(u=>{a[l.id]={dispose:u,controller:d}})})}),r.events.subscribe("components:node-exit",(h,{node:l})=>{const d=a[l.id];d&&(d.dispose&&d.dispose(),n.reuseController||(d.controller.dispose(),delete a[l.id]))})}),Ci="#____version____#",cs=class extends ns{constructor(t,e=[]){super(t,e,{transformPluginSettings:(s,n,r)=>{const o=r.get("$settings"),a=o.plugins&&n?o.plugins[n]||{}:{};return Qt(Qt({},a),s)}})}createImplementation(t){const e=super.createImplementation(t);return e.bindings=t.bindings,e}navigate(t,e,s){this.widgets.query(t).forEach(n=>n.invoke("navigate",{route:e,params:s}))}static create(t={}){const e=[Ts].concat(t.configurationApiExtensions||[]);return new cs("humany",e)}static createFromGlobal(t,e={}){if(this.isRuntime(t))return t.patch(e),t;const s=[],n=t&&t._c;n&&n.forEach(o=>s.push(o));const r=this.create(e);return r.container.register("$runtimecfg",s),r}static isRuntime(t){return!!(t&&typeof t=="object"&&t.container&&typeof t.container.get=="function"&&t.container.get("$environment")===t&&t.container.owner===t)}};let Pi=cs;Pi.version=`${Ci} (${ne})`;var xi=Object.defineProperty,Te=Object.getOwnPropertySymbols,ki=Object.prototype.hasOwnProperty,Si=Object.prototype.propertyIsEnumerable,Ie=(i,t,e)=>t in i?xi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,L=(i,t)=>{for(var e in t||(t={}))ki.call(t,e)&&Ie(i,e,t[e]);if(Te)for(var e of Te(t))Si.call(t,e)&&Ie(i,e,t[e]);return i},b=(i=>(i.Cookie="cookie",i.Local="local",i.Session="session",i))(b||{}),bt=(i=>(i.Tenant="tenant",i.Implementation="implementation",i.Widget="widget",i))(bt||{}),$=(i=>(i.Necessary="necessary",i.Functional="functional",i.Analytical="analytical",i.Marketing="marketing",i))($||{});const wt=(i,t,e,s={})=>Me(i,e).then(n=>(process.env.NODE_ENV!=="production"&&n&&_.warn(`createStorageWriter: Attempted to create storage writer using unallowed category.
4
+ Key: ${t}
5
+ Category: ${JSON.stringify(e)}
6
+ Options: ${JSON.stringify(s)}`),r=>(he(i),Me(i,e).then(o=>{if(o){process.env.NODE_ENV!=="production"&&_.warn(`storageWriter: Attempted to write to storage using unallowed category.
7
+ Key: ${t}
8
+ Category: ${JSON.stringify(e)}
9
+ Value: ${JSON.stringify(r)}
10
+ Options: ${JSON.stringify(s)}`);return}const{scope:a=bt.Widget,medium:c=b.Session,duration:h}=s,l=Ni();return l[a][t]=ds(r,e,h),c===b.Cookie?ji(i,l):Li(i,c,l)})))),z=(i,t,e=b.Session)=>(he(i),typeof t>"u"?(process.env.NODE_ENV!=="production"&&_.warn("readStorage: Undefined key passed when reading storage. ",t,e),Promise.resolve(void 0)):e===b.Cookie?Di(i).then(s=>Yt(s,t)):Hi(i,e).then(s=>Yt(s,t))),W=i=>!!Object.entries(i).filter(([t,e])=>typeof e<"u").length,Ht=i=>Object.entries(i).filter(([t,e])=>typeof e<"u").forEach(([t,{value:e}])=>{typeof e>"u"&&delete i[t]}),hs=(i,t)=>{const e={tenant:L(L({},i.tenant),t.tenant),implementation:L(L({},i.implementation),t.implementation),widget:L(L({},i.widget),t.widget)};return Ht(e.tenant),Ht(e.implementation),Ht(e.widget),e},Oi=i=>Object.entries(i).reduce((t,e)=>{const[s,n]=e;return Object.entries(n).forEach(r=>{const[o,{expiration:a}]=r;a&&t.push(a)}),t},[]).slice().sort((t,e)=>new Date(e).valueOf()-new Date(t).valueOf()).shift()||le(),_t=i=>{const{name:t,implementation:{name:e,tenant:s}}=i.get("$widget");return[`humany_${s}`,`humany_${ke(s+e)}`,`humany_${ke(s+e+t)}`]},Lt=i=>{const t=new RegExp(`(?:^|;)\\s?${i}=(.*?)(?:;|$)`,"i"),e=document.cookie.match(t);return e&&e[1]&&JSON.parse(e[1])||void 0},Rt=(i,t,e)=>{const s=`${i}=${JSON.stringify(t).trim()}`,n=`expires=${new Date(e).toUTCString()}`,r="path=/",o="SameSite=None;Secure";return document.cookie=`${s}; ${n}; ${r}; ${o}`},ce=i=>{const[t,e,s]=_t(i),n=Lt(t)||{},r=Lt(e)||{},o=Lt(s)||{};return{tenant:n,implementation:r,widget:o}},ls=(i,t)=>{const e=ce(i),s=hs(e,t),[n,r,o]=_t(i),{tenant:a,implementation:c,widget:h}=s,l=Oi(t),d=le({days:-1});Rt(n,a,W(a)?l:d),Rt(r,c,W(c)?l:d),Rt(o,h,W(h)?l:d)},gt=(i,t)=>{const[e,s,n]=_t(i),r=t.getItem(e)||"{}",o=t.getItem(s)||"{}",a=t.getItem(n)||"{}";return{tenant:JSON.parse(r),implementation:JSON.parse(o),widget:JSON.parse(a)}},Kt=(i,t,e)=>{const s=gt(i,t),n=hs(s,e),[r,o,a]=_t(i),{tenant:c,implementation:h,widget:l}=n;W(c)?t.setItem(r,JSON.stringify(c)):t.removeItem(r),W(h)?t.setItem(o,JSON.stringify(h)):t.removeItem(o),W(l)?t.setItem(a,JSON.stringify(l)):t.removeItem(a)},Ni=()=>({tenant:{},implementation:{},widget:{}}),Ti=i=>i?!!i&&new Date>new Date(i):!1,Yt=(i,t)=>{const e=i.widget[t]||i.implementation[t]||i.tenant[t];return e==null?void 0:e.value},ds=(i,t,e)=>e?{value:i,category:t,expiration:typeof e=="object"?le(e):e}:{value:i,category:t},Ii=(i,t)=>{const e=ri(i);return Object.entries(e).forEach(([s,n])=>{Object.entries(n).forEach(([r,o])=>{const{expiration:a,category:c}=o;(Ti(a)||Mi(t,c))&&(n[r]=ds(void 0,c,a))})}),e},Me=(i,t)=>z(i,"storagePolicy",b.Cookie).then((e=[$.Necessary])=>!!t&&e.indexOf(t)===-1),Mi=(i=[$.Necessary],t)=>!!t&&i.indexOf(t)===-1,he=i=>{const t=ce(i),e=gt(i,window.localStorage),s=gt(i,sessionStorage),n=Yt(t,"storagePolicy"),[r,o,a]=[t,e,s].map(c=>Ii(c,n));ls(i,r),Kt(i,window.localStorage,o),Kt(i,window.sessionStorage,a)},le=(i={days:30})=>{const{days:t=0,hours:e=0,minutes:s=0,seconds:n=0}=i,r=new Date;return r.setTime(r.getTime()+e*60*60*1e3),r.setTime(r.getTime()+t*24*60*60*1e3),r.setTime(r.getTime()+s*60*1e3),r.setTime(r.getTime()+n*1e3),r.toISOString()},Di=i=>nt(document)(()=>ce(i)),ji=(i,t)=>nt(document)(()=>ls(i,t)),Hi=(i,t)=>{const e=t===b.Local?window.localStorage:window.sessionStorage;return nt(e)(()=>gt(i,e))},Li=(i,t,e)=>{const s=t===b.Local?window.localStorage:window.sessionStorage;return nt(s)(()=>Kt(i,s,e))},Ut=(i,t,e,...s)=>{const n=`[${i.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(n,...s);break;case"warning":console.warn(n,...s);break;case"error":console.error(n,...s);break}},Ri=i=>{const t=i.container||i;return{info:(e,...s)=>Ut(t,"info",e,...s),warn:(e,...s)=>Ut(t,"warning",e,...s),error:(e,...s)=>Ut(t,"error",e,...s)}};var mt=(i=>(i.Implementation="implementation",i.Widget="widget",i))(mt||{}),D=(i=>(i.Pre="pre",i.Post="post",i))(D||{});const Ui=(i,t,e,s)=>{try{const n=new t(e,s);return{name:i,invoke:(r,o)=>{let a;return n[r]&&(a=n[r].call(n,o)),Promise.resolve(a)},getInstance:()=>n}}catch(n){if(n.message&&n.message.indexOf("is not a constructor")>=0)return{name:i,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw n}};function De(i,t){return typeof i>"u"?t:i}class zi{constructor(t={}){this.part=t}createCommand(t,e,s){let n;typeof e=="function"?n={scope:mt.Widget,stage:D.Post,defaultArgs:void 0,handlerResolver:e}:n={scope:De(e.scope,mt.Widget),stage:De(e.stage,D.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,c)=>{c===o.length-1?r[a]||(r[a]=()=>n):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}}const us=i=>{const t=new zi({});return i(t),t.get()};us(i=>{i.createCommand("types.register",{scope:mt.Implementation,stage:D.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:D.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:D.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:D.Pre},t=>(e,s,n)=>{const{container:r}=t;let o=null,a=e,c=s;typeof e=="string"&&(o=e,a=s,c=n);const h=l=>{const{transformPluginSettings:d}=t.container.get("$environmentOptions"),u=d?d(c||{},o,t.container,a):s;try{const p=Ui(o,a,r,u);r.get("$plugins").push(p),l&&p.invoke("initialize",null)}catch(p){Ri(t).warn("Error when initializing plugin",p)}};t.container.get("$instance")?h(!0):t.events.subscribeOnce("widget:instance-created",()=>h(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})});us(i=>{i.createCommand("storage",t=>(e={})=>{const{consent:s}=e;if(typeof s<"u"){if(typeof s!="number"&&typeof s!="string"&&!Array.isArray(s)){process.env.NODE_ENV!=="production"&&_.warn(`storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
11
+ Passed consent: ${JSON.stringify(s)}`);return}if(Array.isArray(s)&&!s.every(r=>typeof r=="number"||typeof r=="string")){process.env.NODE_ENV!=="production"&&_.warn(`storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
12
+ Passed consent: ${JSON.stringify(s)}`);return}const n=[$.Necessary,$.Functional,$.Analytical,$.Marketing].filter((r,o,a)=>typeof s=="number"?s>o:typeof s=="string"?a.indexOf(s)+1>o:Array.isArray(s)?s.findIndex(c=>c===o+1||c===r)>-1:!0);return n.indexOf($.Necessary)===-1&&(process.env.NODE_ENV!=="production"&&_.warn(`storagePolicyConfigurationApi: passed consent does not include category: '${$.Necessary}'. Consent has to atleast include the '${$.Necessary}' category.
13
+ Passed consent: ${JSON.stringify(s)}`),n.unshift($.Necessary)),wt(t.container,"storagePolicy",$.Necessary,{medium:b.Cookie,scope:bt.Tenant,duration:{days:365}}).then(r=>r(n)).then(()=>{he(t.container),t.events.dispatch("storage:policy-changed",n)})}})});class Wi{constructor(t){this.controller=t,this.cache=new Map,this.subscriptions=[];const{events:e}=t.container.get("$widget"),s=e.subscribe("data-client:fetched",(n,r)=>{r.type==="contact-method"&&this.cache.set(r.response.id,r.response)});this.subscriptions.push(s)}getConversationLogs(){return this.controller.messages.reduce((e,s)=>{const n=At(s),{content:r,type:o,sender:a,timestamp:c}=n.content,h=this.parseEntry(r,o,a,c);return h&&e.push(h),e},[])}parseEntry(t,e,s,n){const r=h=>{let l=[],d=[],u;if(Array.isArray(h)){const[v,f]=h;u=f}else u=h;return this.createMessageContent(u).length&&(d=[...d,this.createMessageContent(u)]),l=[...l,...this.createMessageOptions(u)],{messagesAsList:d,options:l}};let o=[],a=[];if(Array.isArray(t.items)){const{items:h}=t;h.forEach(l=>{const d=r(l);o=[...o,...d.options],a=[...a,...d.messagesAsList]})}else{const h=r(t);o=[...o,...h.options],a=[...a,...h.messagesAsList]}return{options:o,message:a.length?a.join(`
14
+ `):void 0,source:this.createMessageSource(e),alias:this.createAlias(e,s),timestamp:n}}createMessageSource(t){return t}createAlias(t,e){return t===Q.System?"system":(e==null?void 0:e.name)||"Me"}handleContactMethod(t){if(!this.cache.has(t))return;const e=this.cache.get(t);let s="";return s=this.appendText(s,`${e.clientName}:`),s=this.appendText(s,e.title),e.description&&(s=this.appendText(s,e.title)),s}getDetails(t,e=!0){if(!t)return"";const{header:s,title:n,label:r,description:o,text:a,html:c,body:h,contactMethodId:l}=t;let d="";if(l){const u=this.handleContactMethod(l.toString());u&&(d=this.appendText(d,u,e))}return s&&(d=this.appendText(d,s,e)),n&&(d=this.appendText(d,n,e)),o&&(d=this.appendText(d,o,e)),a&&(d=this.appendText(d,a,e)),r&&(d=this.appendText(d,r,e)),c&&(d=this.appendText(d,c,e)),h&&typeof h=="string"&&(d=this.appendText(d,h,e)),d}createMessageContent(t){let e="";return e=this.getDetails(t),e}createMessageOptions(t){let e=[],s=[];return Array.isArray(t==null?void 0:t.actions)?s=t.actions:typeof(t==null?void 0:t.actions)=="object"&&(s=Object.entries(t.actions).map(([n,r])=>({actionKey:n,label:r}))),s.length&&(e=s.map(n=>this.getDetails(n,!1))),e}appendText(t,e,s=!0){return s&&t.length?`${t}
15
+ ${e}`:t.length?`${t} ${e}`:e}dispose(){this.subscriptions.forEach(t=>{t()})}}class Zt{constructor(t,e){this.provider=t,this.print=(s,n)=>{const r={name:this.name,avatar:this.avatar,id:this.id},o=At(s,n);return this.provider.createEntry(o.key,o.content,Q.Agent,r,o.timestamp)},this.typing=()=>this.provider.setTypingState({name:this.name,avatar:this.avatar}),this.id=e.id||F(),this.name=e.name,this.avatar=e.avatar}update(t){var n;const{name:e,avatar:s}=t;s===null?this.avatar=void 0:s&&(this.avatar=s),e===null?this.name=void 0:e&&(this.name=e),(n=this.provider.controller)==null||n.events.dispatch("conversation:agent-updated",{agent:this})}}class de{constructor(t,e,s){this.name=t,this.controller=s,this.subscriptions=[],this.user=s==null?void 0:s.user,this.options={silent:!1}}static create(t,e,s){return new de(t,e,s)}createAgent(t={}){var e;if(this.controller){const s=this.controller.getAgentById(t.id),n=s?new Zt(this,{...s,...t}):new Zt(this,t);return s||(e=this.controller)==null||e.events.dispatch("conversation:agent-created",{agent:n}),n}}print(t){var e;return(e=this.controller)==null?void 0:e.print(t)}setTypingState(t,e){var s;return(s=this.controller)==null?void 0:s.setTypingState(t,e)}loading(){return this.controller?this.controller.loader():()=>()=>{}}createEntry(t,e,s,n,r){var o;return(o=this.controller)==null?void 0:o.createEntry(t,e,s,n,r)}dispose(){var t;process.env.NODE_ENV!=="production"&&console.log(`conversation-provider: dispose (${this.name})`),(t=this.controller)==null||t.disposeProvider(this),this.controller=null,this.subscriptions.forEach(e=>e())}isRehydrated(){var t;return((t=this.controller)==null?void 0:t.isRehydrated())||Promise.resolve(!1)}getHistory(){var t;return((t=this.controller)==null?void 0:t.getHistory())||[]}complete(){var t;(t=this.controller)==null||t.onCompleteProvider()}setOptions(t={silent:!1}){this.options=t}onUnreadMessage(t){var e;if(this.controller){const s=(e=this.controller)==null?void 0:e.onUnreadMessage(t);return this.subscriptions.push(s),()=>{s()}}}onMounted(t){var e;if(this.controller){const s=(e=this.controller)==null?void 0:e.events.subscribe("conversation:component-mount-changed",t);return this.subscriptions.push(s),t({},this.controller.getComponentMountedState()),()=>{s()}}}}const ps=i=>`conversation-${i}`;class Bi{constructor(){this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let t;const e=new Promise(n=>t=()=>{this._locks-=1,n()}),s=this._locking.then(()=>t);return this._locking=this._locking.then(()=>e),s}}class Vi{constructor(t,e,s){this.container=t,this.enabled=s,this.locker=new Bi,this.initialStoredAgents=[],this.sessionStorageKey=ps(e.id),e.onStarted(async()=>{if(e.messages.length>0)return;const{agents:n}=await this.read(),r=[];n&&n.forEach(a=>{const c=e.providerIndex(a.providerName),h=c>-1?e.registeredProviders[c]:e.createProvider(a.providerName),l=new Zt(h,{name:a.name,avatar:a.avatar,id:a.id});r.push(l)});const{messages:o}=await this.read();o.forEach(a=>{switch(a.type){case"agent":{const c=r.find(h=>{var l;return h.id===((l=a.sender)==null?void 0:l.id)});c&&c.print(a.content.items||a.content,{key:a.key});return}case"user":{e.user.print(a.content.items||a.content,{key:a.key});return}case"system":default:e.print(a.content.items||a.content)}})}),e.onMessageCreated(async(n,r)=>{this.write(r.message,"messages")}),e.events.subscribe("conversation:agent-created",async(n,r)=>{const o={id:r.agent.id,name:r.agent.name,avatar:r.agent.avatar,providerName:r.agent.provider.name};await this.write(o,"agents")}),e.events.subscribe("conversation:agent-updated",async(n,r)=>{const{agents:o}=await this.read();await this.write([...o.map(a=>a.id===r.agent.id?{...a,name:r.agent.name,avatar:r.agent.avatar}:a)],"agents","update")})}setInitialData(t){this.initialStoredAgents=t.agents}async isRehydrated(){const{messages:t}=await this.read();return t.length>0}getStoredAgent(t){if(this.enabled)return this.initialStoredAgents.find(e=>e.id===t)}async write(t,e,s="add"){if(!this.enabled)return;const n=await this.locker.lock();return wt(this.container,this.sessionStorageKey,$.Necessary).then(async r=>{if(s==="add"){const o=await this.read();if(e==="messages"&&o.messages.findIndex(c=>c.key===t.key)>-1){n();return}const a={...o};return e==="messages"?a.messages=[...a.messages,t]:e==="agents"&&(a.agents=[...a.agents,t]),r({...o,...a}).then(()=>{n()})}if(s==="update"&&e==="agents"){const o=await this.read();return r({...o,agents:t}).then(()=>{n()})}return r(t).then(()=>{n()})})}async read(){return z(this.container,this.sessionStorageKey).then(t=>t||{messages:[],agents:[]})}}class Ji{constructor(t){this.controller=t,this.print=(e,s)=>{const n=At(e,s);return this.controller.createEntry(n.key,n.content,Q.User,void 0,n.timestamp)}}}const Gt=async(i,t,e)=>{const s=await i.getAsync("conversation"),n=await i.getAsync("components"),r=s.controllers.find(o=>o.conversation.id===t);if(r){const o=[...r.conversation.providers];o.forEach(c=>{r.conversation.setProviderOptions(c,{silent:!0})}),r.conversation.queueProviders(o),r.conversation.setProviders([e]);const a=n.components().ofType("conversation");n.write({key:"setConversationProvider",attributes:{properties:{providers:[e]}},target:a,provider:"localStorage"})}};class gs{constructor(t){this.writer=t}update(t){const e=this.getNormalizedSettings(t);this.writer(e)}remove(){this.writer(null)}getNormalizedSettings(t){return typeof t=="string"?{body:t}:t.length>-1&&typeof t=="object"?{items:t}:t}}var Q=(i=>(i.User="user",i.Agent="agent",i.System="system",i))(Q||{});const At=(i,t)=>{let e,s=(t==null?void 0:t.key)||F(),n=Date.now();return Array.isArray(i)&&i.length>-1?typeof i[0]=="string"?e={items:[i]}:e={items:i}:typeof i=="string"?e={body:i}:(i=i||{},i.type?e={...i}:(e={body:i.body,actions:i.actions,title:i.title},i.key&&(s=i.key),i.timestamp&&(n=i.timestamp),i.form,i.timestamp===null&&(n=null))),{content:e,key:s,timestamp:n}},je=(i,t)=>{if(!t)return;const e=JSON.stringify(t),s=i.findIndex(n=>e===JSON.stringify(n));if(s>-1)return i.splice(s,1)};class ms{constructor(t,e,s){this.container=t,this.id=e,this.formHandlers={},this.user=new Ji(this),this.providers=[],this.active=!1,this.queuedProviders=[],this.registeredProviders=[],this.loaders=0,this.componentMounted=!1,this.messages=[],this.typingActors=[],this.print=r=>{const o=At(r);return this.createEntry(o.key,o.content,"system",void 0,o.timestamp)};const n=t.get("$widget");this.events=n.events.createChild(this),this.store=new Vi(t,this,s.rehydrate),this.conversationHistory=new Wi(this)}setInitialStorage(t){this.store.setInitialData(t)}setProviders(t){const e=[],s=[];this.providers.reduce((n,r)=>(t.indexOf(r)===-1&&n.push(r),n),[]).forEach(n=>{const r=this.providers.indexOf(n);r>-1&&(e.push(n),this.providers.splice(r,1))}),t.forEach(n=>{this.providers.indexOf(n)===-1&&(s.push(n),this.providers.push(n))}),(s.length||e.length)&&this.events.dispatch("conversation:providers-changed",{added:s,removed:e})}createProvider(t){const e=this.providerIndex(t);if(e>-1)return this.registeredProviders[e];const s=de.create(t,this.container,this);return this.registeredProviders.push(s),s}providerIndex(t){return this.registeredProviders.findIndex(e=>e.name===t)}getAgentById(t){if(t)return this.store.getStoredAgent(t)}dispose(){this.conversationHistory.dispose(),this.registeredProviders.forEach(t=>t.dispose()),this.messages=[],this.events.dispatch("conversation:controller-disposed",this),this.active=!1}onDispose(t){return this.events.subscribe("conversation:controller-disposed",t)}onStarted(t){return this.events.subscribe("conversation:started",t)}onMessageCreated(t){return this.events.subscribe("conversation:message-created",t)}isRehydrated(){return this.store.isRehydrated()}disposeProvider(t){const e=this.providerIndex(t.name);e>-1&&this.registeredProviders.splice(e,1),this.events.dispatch("conversation:providers-changed",{removed:[t.name]}),this.registeredProviders.length||this.dispose()}onProvidersChange(t){return this.events.subscribe("conversation:providers-changed",t)}setComponentMountedState(t){this.componentMounted!==t&&(this.componentMounted=t,t&&(this.events.dispatch("conversation:unread-message",!1),this.events.dispatch("conversation:started",!0),this.active=!0),this.events.dispatch("conversation:component-mount-changed",t))}setProviderOptions(t,e){const s=this.providerIndex(t);s>-1&&this.registeredProviders[s].setOptions(e)}changeProvider(t){this.registeredProviders.find(s=>s.name===t)&&Gt(this.container,this.id,t)}queueProviders(t){this.queuedProviders=t}onCompleteProvider(){const t=this.queuedProviders.pop();t&&Gt(this.container,this.id,t)}getComponentMountedState(){return this.componentMounted}onUnreadMessage(t){return this.events.subscribe("conversation:unread-message",t)}createEntry(t,e,s,n,r){const o={key:t,content:e,type:s,sender:n||null,timestamp:r||r===null?r:Date.now()};this.messages.push(o),o.type==="agent"&&je(this.typingActors,n);const a=new gs(c=>{if(c!==null){const{timestamp:h=void 0,...l}=c;o.content=l,h&&(o.timestamp=h)}else{const h=this.messages.indexOf(o);o.content=null,h>-1&&this.messages.splice(h,1)}this.events.dispatch("conversation:message-updated",{message:o}),this.update()});return this.events.dispatch("conversation:message-created",{message:o}),this.update(),this.componentMounted||this.events.dispatch("conversation:unread-message",!0),a}update(){this.events.dispatch("conversation:updated",{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors})}getMessageStream(){return{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors}}setTypingState(t,e){return this.typingActors.indexOf(t)===-1&&(this.typingActors.push(t),this.update()),()=>{je(this.typingActors,t),this.update()}}loader(){this.loaders=this.loaders+1;let t=!1;return this.loaders===1&&this.update(),()=>{t||(t=!0,this.loaders=this.loaders-1,this.loaders===0&&this.update())}}submitForm(t,e){this.formHandlers[t]={...this.formHandlers[t],submit:e}}validateForm(t,e){this.formHandlers[t]={...this.formHandlers[t],validate:e}}getHistory(){return this.conversationHistory.getConversationLogs()}}const qi=(i,t)=>{const e=i.split("_contact");return t.widgets.get(e[0])},ue=i=>{const t=i.get("$widget"),{name:e,implementation:s}=i.get("$widget"),n=e.indexOf("_contact")>-1?qi(e,s):t,{data:r}=i.get("$settings"),{trigger:o}=n.container.get("$settings"),a=`${e.replace("_contact-method","").replace("_contact","")}_contact-method`,c=s.widgets.get(a);return c&&!o?{chatWidget:c,mainWidget:n,data:r}:{mainWidget:n,data:r}},Fi=i=>{const{chatWidget:t}=ue(i);return!!t},He=(i,t,e)=>{const{mainWidget:s,data:n,chatWidget:r}=ue(i);return r?r.state==="activated"?r.invoke("open").then(()=>{r.container.getAsync("conversation").then(o=>{o.navigateToConversationIfActive(t.id)})}):r.activate().then(()=>{const{trigger:o}=r.container.get("$settings");return o.action="hide",r.invoke("setSettings",()=>({data:n,trigger:o,activate:!0})).then(()=>r.container.getAsync("components").then(a=>{const c=a.components().ofType("contact-method");a.write({key:"setContactMethodId",attributes:{properties:{id:t.id,guideId:t.guideId}},target:c,provider:"localStorage"});const h=a.components().ofType("conversation");a.write({key:"setConversationProvider",attributes:{properties:{providers:[t.clientName]}},target:h,provider:"localStorage"})}))}).then(()=>r.invoke("attach",{key:"contact-method",triggerDOMElement:e,withRenderState:"open"})).then(()=>(wt(r.container,"activeStickyWidget",$.Necessary,{medium:b.Local,scope:bt.Implementation}).then(o=>o(r.name)),r.container.getAsync("conversation").then(o=>{o.setConversationEndedBehavior(Et.Deactivate)}).then(()=>!1))):!r},Qi=(i,t,e="conversation")=>{const{mainWidget:s,chatWidget:n}=ue(i);return s.container.getAsync("conversation").then(r=>{var o;(o=r.setConversationEndedBehavior(Et.Navigate))==null||o.then(()=>{s.container.getAsync("components").then(a=>{const c=a.components().ofType("conversation");a.write({key:"setConversationProvider",attributes:{properties:{providers:[t.clientName]}},target:c,provider:"localStorage"})})})})},lt="conversations";var Et=(i=>(i.Deactivate="deactivate",i.Navigate="navigate",i.None="none",i))(Et||{});class Ct{constructor(t,e){this.container=t,this.components=e,this.controllers=[],this.providers=[],this.disposeProviders={},this.subscriptions=[],this.storageWriter=null,this.buttonQuery=null,this.sessionInfo=null;const s=t.get("$widget");this.events=s.events.createChild(this)}initialize(){wt(this.container,lt,$.Necessary,{medium:b.Local}).then(t=>this.storageWriter=t),z(this.container,lt,b.Local).then(t=>{this.buttonQuery=this.components.components().ofType("conversation-return-button"),t&&(this.sessionInfo=t,t.id&&t.route&&this.writeToComponents({active:!0,alert:{show:!1}}))}),this.events.subscribe("conversation:ended",(t,e)=>{var s;switch((s=this.sessionInfo)==null?void 0:s.conversationEndedBehavior){case"deactivate":this.container.get("$widget").deactivate();break}this.writeToComponents({active:!1}),this.sessionInfo=null,this.storageWriter&&this.storageWriter()})}addSubscription(t){this.subscriptions.push(t)}static getInstance(t,e="conversation"){return nt(t)(()=>t.getAsync(e).then(s=>{let n=s;return n||ae.getInstance(t).then(r=>(n=new Ct(t,r),n.initialize(),t.registerAsync(e,()=>n),n))}))}setConversationEndedBehavior(t){return z(this.container,lt,b.Local).then(e=>{let s=e;return s?s.conversationEndedBehavior=t:s={conversationEndedBehavior:t},this.sessionInfo=s,this.storageWriter&&this.storageWriter(this.sessionInfo)||Promise.resolve()})}async createController(t,e){const s=ps(t),{agents:n}=await z(this.container,s)||{agents:[]},r=this.controllers.findIndex(a=>a.conversation.id===t);let o;return r>-1?o=this.controllers[r].conversation:o=new ms(this.container,t,e),o.setInitialStorage({agents:n||[]}),o}registerProvider(t,e){const s={name:t,handler:e};this.providers.push(s),this.controllers.filter(n=>n.conversation.providers.indexOf(t)>-1).forEach(n=>{this.invokeHandler(s,n)})}registerController(t,e){const s=this.controllers.findIndex(r=>r.conversation.id===t.id);let n;if(s<0){n={conversation:t,component:e},this.controllers.push(n);const r=o=>{o&&this.providers.filter(a=>o.indexOf(a.name)>-1).forEach(a=>{this.invokeHandler(a,n)})};return this.subscriptions.push(t.onDispose((o,a)=>{const c=this.controllers.findIndex(h=>h.conversation===a);c>-1&&this.controllers.splice(c,1),this.components.components().ofType("conversation-return-button").select().writeProperties({active:!1}),this.events.dispatch("conversation:ended",{},{bubbles:!0})})),this.subscriptions.push(t.onProvidersChange((o,a)=>{const{added:c,removed:h=[]}=a;h.forEach(l=>{(this.disposeProviders[l]||[]).forEach(d=>{d()})}),r(c)})),this.subscriptions.push(t.onStarted((o,a)=>{var h;const c={id:t.id,conversationEndedBehavior:(h=this.sessionInfo)==null?void 0:h.conversationEndedBehavior};this.sessionInfo=c,this.storageWriter&&this.storageWriter(c),this.writeToComponents({active:a})})),this.subscriptions.push(t.onUnreadMessage((o,a)=>{this.events.dispatch("conversation:unread-message",a),this.writeToComponents({alert:{show:a}})})),r(t.providers),!0}return n=this.controllers[s],!1}writeToComponents(t,e="conversationReturnButtonState"){this.buttonQuery&&this.components.write({key:"conversationReturnButtonState",attributes:{properties:t},target:this.buttonQuery,provider:"localStorage"})}invokeHandler(t,e){const s=t.handler(e.conversation.createProvider(t.name),e.component);s&&(this.disposeProviders[t.name]||(this.disposeProviders[t.name]=[]),this.disposeProviders[t.name].push(s))}getComponentRoute(){return z(this.container,lt,b.Local).then(t=>t==null?void 0:t.route)}dispose(){Object.keys(this.disposeProviders).forEach(t=>{this.disposeProviders[t].forEach(e=>{e()})}),this.subscriptions.forEach(t=>{t()}),this.controllers=[],this.providers=[]}static async handleContactMethodClick(t,e,s,n){if(Fi(e)){t.preventDefault();let r=document.getElementById("humany-dynamic-anchor");r||(r=document.createElement("a"),r.setAttribute("href","#"),r.id="humany-dynamic-anchor",document.body.appendChild(r)),He(e,s,r)}He(e,s)}static async handleContactMethodSubmit(t,e){var s,n;return(n=(s=e==null?void 0:e.body.form.meta)==null?void 0:s.conversation)!=null&&n.id?Gt(t,e.body.form.meta.conversation.id,e.clientName):Qi(t,e)}}/**
16
+ * @license
17
+ * Copyright 2019 Google LLC
18
+ * SPDX-License-Identifier: BSD-3-Clause
19
+ */const dt=window,pe=dt.ShadowRoot&&(dt.ShadyCSS===void 0||dt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ge=Symbol(),Le=new WeakMap;let vs=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==ge)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(pe&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=Le.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Le.set(e,t))}return t}toString(){return this.cssText}};const Ki=i=>new vs(typeof i=="string"?i:i+"",void 0,ge),fs=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,n,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[r+1],i[0]);return new vs(e,i,ge)},Yi=(i,t)=>{pe?i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const s=document.createElement("style"),n=dt.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)})},Re=pe?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Ki(e)})(i):i;/**
20
+ * @license
21
+ * Copyright 2017 Google LLC
22
+ * SPDX-License-Identifier: BSD-3-Clause
23
+ */var zt;const vt=window,Ue=vt.trustedTypes,Zi=Ue?Ue.emptyScript:"",ze=vt.reactiveElementPolyfillSupport,Xt={toAttribute(i,t){switch(t){case Boolean:i=i?Zi:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},ys=(i,t)=>t!==i&&(t==t||i==i),Wt={attribute:!0,type:String,converter:Xt,reflect:!1,hasChanged:ys},te="finalized";let R=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,s)=>{const n=this._$Ep(s,e);n!==void 0&&(this._$Ev.set(n,s),t.push(n))}),t}static createProperty(t,e=Wt){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,s,e);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||Wt}static finalize(){if(this.hasOwnProperty(te))return!1;this[te]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,s=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of s)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)e.unshift(Re(n))}else t!==void 0&&e.push(Re(t));return e}static _$Ep(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,s;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((s=t.hostConnected)===null||s===void 0||s.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return Yi(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostConnected)===null||s===void 0?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostDisconnected)===null||s===void 0?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e,s=Wt){var n;const r=this.constructor._$Ep(t,s);if(r!==void 0&&s.reflect===!0){const o=(((n=s.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?s.converter:Xt).toAttribute(e,s.type);this._$El=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var s;const n=this.constructor,r=n._$Ev.get(t);if(r!==void 0&&this._$El!==r){const o=n.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)===null||s===void 0?void 0:s.fromAttribute)!==void 0?o.converter:Xt;this._$El=r,this[r]=a.fromAttribute(e,o.type),this._$El=null}}requestUpdate(t,e,s){let n=!0;t!==void 0&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||ys)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,s))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,r)=>this[r]=n),this._$Ei=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var r;return(r=n.hostUpdate)===null||r===void 0?void 0:r.call(n)}),this.update(s)):this._$Ek()}catch(n){throw e=!1,this._$Ek(),n}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdated)===null||n===void 0?void 0:n.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,s)=>this._$EO(s,this[s],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};R[te]=!0,R.elementProperties=new Map,R.elementStyles=[],R.shadowRootOptions={mode:"open"},ze==null||ze({ReactiveElement:R}),((zt=vt.reactiveElementVersions)!==null&&zt!==void 0?zt:vt.reactiveElementVersions=[]).push("1.6.3");/**
24
+ * @license
25
+ * Copyright 2017 Google LLC
26
+ * SPDX-License-Identifier: BSD-3-Clause
27
+ */var Bt;const ft=window,V=ft.trustedTypes,We=V?V.createPolicy("lit-html",{createHTML:i=>i}):void 0,ee="$lit$",N=`lit$${(Math.random()+"").slice(9)}$`,$s="?"+N,Gi=`<${$s}>`,H=document,et=()=>H.createComment(""),st=i=>i===null||typeof i!="object"&&typeof i!="function",bs=Array.isArray,Xi=i=>bs(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",Vt=`[
28
+ \f\r]`,Z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Be=/-->/g,Ve=/>/g,M=RegExp(`>|${Vt}(?:([^\\s"'>=/]+)(${Vt}*=${Vt}*(?:[^
29
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Je=/'/g,qe=/"/g,ws=/^(?:script|style|textarea|title)$/i,tn=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),X=tn(1),I=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),Fe=new WeakMap,j=H.createTreeWalker(H,129,null,!1);function _s(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return We!==void 0?We.createHTML(t):t}const en=(i,t)=>{const e=i.length-1,s=[];let n,r=t===2?"<svg>":"",o=Z;for(let a=0;a<e;a++){const c=i[a];let h,l,d=-1,u=0;for(;u<c.length&&(o.lastIndex=u,l=o.exec(c),l!==null);)u=o.lastIndex,o===Z?l[1]==="!--"?o=Be:l[1]!==void 0?o=Ve:l[2]!==void 0?(ws.test(l[2])&&(n=RegExp("</"+l[2],"g")),o=M):l[3]!==void 0&&(o=M):o===M?l[0]===">"?(o=n??Z,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,h=l[1],o=l[3]===void 0?M:l[3]==='"'?qe:Je):o===qe||o===Je?o=M:o===Be||o===Ve?o=Z:(o=M,n=void 0);const p=o===M&&i[a+1].startsWith("/>")?" ":"";r+=o===Z?c+Gi:d>=0?(s.push(h),c.slice(0,d)+ee+c.slice(d)+N+p):c+N+(d===-2?(s.push(void 0),a):p)}return[_s(i,r+(i[e]||"<?>")+(t===2?"</svg>":"")),s]};class it{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let r=0,o=0;const a=t.length-1,c=this.parts,[h,l]=en(t,e);if(this.el=it.createElement(h,s),j.currentNode=this.el.content,e===2){const d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(n=j.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes()){const d=[];for(const u of n.getAttributeNames())if(u.endsWith(ee)||u.startsWith(N)){const p=l[o++];if(d.push(u),p!==void 0){const v=n.getAttribute(p.toLowerCase()+ee).split(N),f=/([.?@])?(.*)/.exec(p);c.push({type:1,index:r,name:f[2],strings:v,ctor:f[1]==="."?nn:f[1]==="?"?on:f[1]==="@"?an:Pt})}else c.push({type:6,index:r})}for(const u of d)n.removeAttribute(u)}if(ws.test(n.tagName)){const d=n.textContent.split(N),u=d.length-1;if(u>0){n.textContent=V?V.emptyScript:"";for(let p=0;p<u;p++)n.append(d[p],et()),j.nextNode(),c.push({type:2,index:++r});n.append(d[u],et())}}}else if(n.nodeType===8)if(n.data===$s)c.push({type:2,index:r});else{let d=-1;for(;(d=n.data.indexOf(N,d+1))!==-1;)c.push({type:7,index:r}),d+=N.length-1}r++}}static createElement(t,e){const s=H.createElement("template");return s.innerHTML=t,s}}function J(i,t,e=i,s){var n,r,o,a;if(t===I)return t;let c=s!==void 0?(n=e._$Co)===null||n===void 0?void 0:n[s]:e._$Cl;const h=st(t)?void 0:t._$litDirective$;return(c==null?void 0:c.constructor)!==h&&((r=c==null?void 0:c._$AO)===null||r===void 0||r.call(c,!1),h===void 0?c=void 0:(c=new h(i),c._$AT(i,e,s)),s!==void 0?((o=(a=e)._$Co)!==null&&o!==void 0?o:a._$Co=[])[s]=c:e._$Cl=c),c!==void 0&&(t=J(i,c._$AS(i,t.values),c,s)),t}class sn{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:s},parts:n}=this._$AD,r=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:H).importNode(s,!0);j.currentNode=r;let o=j.nextNode(),a=0,c=0,h=n[0];for(;h!==void 0;){if(a===h.index){let l;h.type===2?l=new rt(o,o.nextSibling,this,t):h.type===1?l=new h.ctor(o,h.name,h.strings,this,t):h.type===6&&(l=new cn(o,this,t)),this._$AV.push(l),h=n[++c]}a!==(h==null?void 0:h.index)&&(o=j.nextNode(),a++)}return j.currentNode=H,r}v(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class rt{constructor(t,e,s,n){var r;this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cp=(r=n==null?void 0:n.isConnected)===null||r===void 0||r}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=J(this,t,e),st(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==I&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Xi(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==g&&st(this._$AH)?this._$AA.nextSibling.data=t:this.$(H.createTextNode(t)),this._$AH=t}g(t){var e;const{values:s,_$litType$:n}=t,r=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=it.createElement(_s(n.h,n.h[0]),this.options)),n);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===r)this._$AH.v(s);else{const o=new sn(r,this),a=o.u(this.options);o.v(s),this.$(a),this._$AH=o}}_$AC(t){let e=Fe.get(t.strings);return e===void 0&&Fe.set(t.strings,e=new it(t)),e}T(t){bs(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const r of t)n===e.length?e.push(s=new rt(this.k(et()),this.k(et()),this,this.options)):s=e[n],s._$AI(r),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)===null||s===void 0||s.call(this,!1,!0,e);t&&t!==this._$AB;){const n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class Pt{constructor(t,e,s,n,r){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=g}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,n){const r=this.strings;let o=!1;if(r===void 0)t=J(this,t,e,0),o=!st(t)||t!==this._$AH&&t!==I,o&&(this._$AH=t);else{const a=t;let c,h;for(t=r[0],c=0;c<r.length-1;c++)h=J(this,a[s+c],e,c),h===I&&(h=this._$AH[c]),o||(o=!st(h)||h!==this._$AH[c]),h===g?t=g:t!==g&&(t+=(h??"")+r[c+1]),this._$AH[c]=h}o&&!n&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class nn extends Pt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}}const rn=V?V.emptyScript:"";class on extends Pt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==g?this.element.setAttribute(this.name,rn):this.element.removeAttribute(this.name)}}class an extends Pt{constructor(t,e,s,n,r){super(t,e,s,n,r),this.type=5}_$AI(t,e=this){var s;if((t=(s=J(this,t,e,0))!==null&&s!==void 0?s:g)===I)return;const n=this._$AH,r=t===g&&n!==g||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==g&&(n===g||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;typeof this._$AH=="function"?this._$AH.call((s=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&s!==void 0?s:this.element,t):this._$AH.handleEvent(t)}}class cn{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){J(this,t)}}const Qe=ft.litHtmlPolyfillSupport;Qe==null||Qe(it,rt),((Bt=ft.litHtmlVersions)!==null&&Bt!==void 0?Bt:ft.litHtmlVersions=[]).push("2.8.0");const hn=(i,t,e)=>{var s,n;const r=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:t;let o=r._$litPart$;if(o===void 0){const a=(n=e==null?void 0:e.renderBefore)!==null&&n!==void 0?n:null;r._$litPart$=o=new rt(t.insertBefore(et(),a),a,void 0,e??{})}return o._$AI(i),o};/**
30
+ * @license
31
+ * Copyright 2017 Google LLC
32
+ * SPDX-License-Identifier: BSD-3-Clause
33
+ */var Jt,qt;class B extends R{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=hn(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return I}}B.finalized=!0,B._$litElement$=!0,(Jt=globalThis.litElementHydrateSupport)===null||Jt===void 0||Jt.call(globalThis,{LitElement:B});const Ke=globalThis.litElementPolyfillSupport;Ke==null||Ke({LitElement:B});((qt=globalThis.litElementVersions)!==null&&qt!==void 0?qt:globalThis.litElementVersions=[]).push("3.3.3");/**
34
+ * @license
35
+ * Copyright 2017 Google LLC
36
+ * SPDX-License-Identifier: BSD-3-Clause
37
+ */const ln=(i,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,i)}},dn=(i,t,e)=>{t.constructor.createProperty(e,i)};function xt(i){return(t,e)=>e!==void 0?dn(i,t,e):ln(i,t)}/**
38
+ * @license
39
+ * Copyright 2017 Google LLC
40
+ * SPDX-License-Identifier: BSD-3-Clause
41
+ */function kt(i){return xt({...i,state:!0})}/**
42
+ * @license
43
+ * Copyright 2021 Google LLC
44
+ * SPDX-License-Identifier: BSD-3-Clause
45
+ */var Ft;((Ft=window.HTMLSlotElement)===null||Ft===void 0?void 0:Ft.prototype.assignedElements)!=null;/**
46
+ * @license
47
+ * Copyright 2017 Google LLC
48
+ * SPDX-License-Identifier: BSD-3-Clause
49
+ */const As={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Es=i=>(...t)=>({_$litDirective$:i,values:t});class Cs{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}/**
50
+ * @license
51
+ * Copyright 2018 Google LLC
52
+ * SPDX-License-Identifier: BSD-3-Clause
53
+ */const Ps=Es(class extends Cs{constructor(i){var t;if(super(i),i.type!==As.ATTRIBUTE||i.name!=="class"||((t=i.strings)===null||t===void 0?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var e,s;if(this.it===void 0){this.it=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!(!((e=this.nt)===null||e===void 0)&&e.has(r))&&this.it.add(r);return this.render(t)}const n=i.element.classList;this.it.forEach(r=>{r in t||(n.remove(r),this.it.delete(r))});for(const r in t){const o=!!t[r];o===this.it.has(r)||!((s=this.nt)===null||s===void 0)&&s.has(r)||(o?(n.add(r),this.it.add(r)):(n.remove(r),this.it.delete(r)))}return I}}),y=(i,t,e)=>{i&&e.style.setProperty(t,i)},xs=(i,t)=>{var e,s,n,r,o,a,c,h,l,d,u;y((e=i.colors)==null?void 0:e.primary,"--primary-color",t),y((s=i.colors)==null?void 0:s.secondary,"--secondary-color",t),y((n=i.colors)==null?void 0:n.text,"--text-color",t),y((r=i.colors)==null?void 0:r.link,"--link-color",t),y((o=i.colors)==null?void 0:o.gray,"--gray-color",t),y((a=i.colors)==null?void 0:a.grayDark,"--gray-dark-color",t),y((c=i.spacing)==null?void 0:c.xs,"--spacing-xs",t),y((h=i.spacing)==null?void 0:h.sm,"--spacing-sm",t),y((l=i.spacing)==null?void 0:l.md,"--spacing-md",t),y((d=i.spacing)==null?void 0:d.lg,"--spacing-lg",t),y((u=i.spacing)==null?void 0:u.xl,"--spacing-xl",t),y(i.boxShadow,"--box-shadow",t),y(i.borderRadius,"--border-radius",t),y(i.borderRadiusSm,"--border-radius-sm",t),y(i.fontFamily,"--font-family",t)};var un=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,ot=(i,t,e,s)=>{for(var n=s>1?void 0:s?pn(t,e):t,r=i.length-1,o;r>=0;r--)(o=i[r])&&(n=(s?o(t,e,n):o(n))||n);return s&&n&&un(t,e,n),n};class K extends B{constructor(){super(...arguments),this.active=!1,this.loaded=!1}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(this.symbol),this.loaded=!0,this._applyBranding()}_toggleActive(){this.active=!this.active}_applyBranding(){var s;const t=((s=this.container)==null?void 0:s.get("$settings"))??{},e=t==null?void 0:t.components[t==null?void 0:t.entry];e&&xs(e.context,this)}async _renderSymbol(t){const e=async r=>await Promise.resolve().then(()=>require("./index-17fa2121.js")).then(a=>a[r]);if(!t)return g;const{type:s,content:n}=t;switch(s){case"Telia":{const r=await e(n);return r?X`<telia-icon
54
+ class="trigger-icon"
55
+ svg=${r.svg}
56
+ size="lg"
57
+ ></telia-icon>`:g}case"FontAwesome":return X`<i class="trigger-fa-icon fa fa-${n}"></i>`;case"Uri":return X`<i
58
+ class="trigger-custom-icon"
59
+ style="background: url(${n}) no-repeat center center;background-size: contain;"
60
+ ></i>`;default:return g}}render(){return X`<button
61
+ class=${Ps({trigger:!0,active:this.active,rendered:this.loaded})}
62
+ @click=${this._toggleActive}
63
+ >
64
+ ${this.icon}
65
+ <span class="trigger-close">
66
+ <svg
67
+ width="18"
68
+ height="9"
69
+ viewBox="0 0 18 9"
70
+ fill="none"
71
+ xmlns="http://www.w3.org/2000/svg"
72
+ >
73
+ <path
74
+ d="M9 9C8.81794 9.00045 8.63759 8.96634 8.46939 8.89965C8.3012 8.83295 8.14851 8.735 8.02015 8.61145L0.194523 1.12367C0.068294 0.99862 -0.00155266 0.831133 2.61958e-05 0.657285C0.00160506 0.483436 0.0744832 0.317136 0.202964 0.194202C0.331445 0.0712675 0.505249 0.00153576 0.686941 2.50649e-05C0.868634 -0.00148563 1.04368 0.0653456 1.17437 0.186125L9 7.6739L16.8256 0.186125C16.9563 0.0653456 17.1314 -0.00148563 17.3131 2.50649e-05C17.4948 0.00153576 17.6686 0.0712675 17.797 0.194202C17.9255 0.317136 17.9984 0.483436 18 0.657285C18.0016 0.831133 17.9317 0.99862 17.8055 1.12367L9.97985 8.61145C9.85149 8.735 9.6988 8.83295 9.53061 8.89965C9.36241 8.96634 9.18206 9.00045 9 9Z"
75
+ fill="white"
76
+ />
77
+ </svg>
78
+ </span>
79
+ <span class="trigger-loader">
80
+ <svg viewBox="25 25 50 50">
81
+ <circle
82
+ cx="50"
83
+ cy="50"
84
+ r="20"
85
+ fill="none"
86
+ stroke="#000"
87
+ stroke-width="2"
88
+ stroke-miterlimit="10"
89
+ />
90
+ </svg>
91
+ </span>
92
+ </button>`}}K.styles=[fs`
93
+ :host {
94
+ --voca-rem-multiplier: 0.625;
95
+ display: block;
96
+ box-sizing: border-box;
97
+ }
98
+
99
+ .trigger {
100
+ position: fixed;
101
+ transform: scale(0);
102
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
103
+ bottom: 20px;
104
+ right: 20px;
105
+ z-index: 5;
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: center;
109
+ border: none;
110
+ line-height: 55px;
111
+ height: 55px;
112
+ width: 55px;
113
+ border-radius: 55px;
114
+ cursor: pointer;
115
+ background-color: var(--trigger-bg, var(--primary-color));
116
+ font-family: Lato;
117
+ text-decoration: none;
118
+ border: 3px dashed transparent;
119
+ box-sizing: border-box;
120
+ transition: transform 200ms ease-out;
121
+ }
122
+ .trigger:hover {
123
+ transform: scale(1.1) !important;
124
+ }
125
+ .trigger.rendered {
126
+ transform: scale(1);
127
+ }
128
+ .trigger.active .trigger-icon {
129
+ opacity: 0;
130
+ transform: rotate(-180deg) scale(0);
131
+ }
132
+ .trigger.active .trigger-close {
133
+ opacity: 1;
134
+ transform: rotate(0deg) scale(1);
135
+ }
136
+
137
+ .trigger-icon {
138
+ display: inline-block;
139
+ line-height: inherit;
140
+ text-align: center;
141
+ opacity: 1;
142
+ transform: rotate(0deg) scale(1);
143
+ transition: opacity 200ms ease-out, transform 200ms ease-out;
144
+ color: var(--trigger-text-color, #fff);
145
+ }
146
+ .trigger-close {
147
+ opacity: 0;
148
+ transition: transform 200ms ease-out;
149
+ transform: rotate(180deg) scale(0);
150
+ position: absolute;
151
+ top: 0;
152
+ bottom: 0;
153
+ left: 0;
154
+ right: 0;
155
+ display: flex;
156
+ justify-content: center;
157
+ align-items: center;
158
+ fill: var(--trigger-text-color, #fff);
159
+ }
160
+ `];ot([xt({attribute:!1})],K.prototype,"symbol",2);ot([xt({attribute:!1})],K.prototype,"container",2);ot([kt()],K.prototype,"active",2);ot([kt()],K.prototype,"loaded",2);ot([kt()],K.prototype,"icon",2);const gn=(i,t,e,s,n)=>i.getAsync("componentResolver").then(r=>(r.registerComponent(t,e),Ei(i,t,s||(()=>{}),t,n)));console.log("test12323425324222");const mn=(i,t)=>i.reduce((e,s,n)=>{var o,a;const r={...s,content:[{...s.content,key:s.key}]};if(e.length>0&&s.type!==Q.System){const c=e[e.length-1];if((!t&&t!==0||Math.abs(c.timestamp-s.timestamp)<t)&&((o=c.sender)==null?void 0:o.name)===((a=s.sender)==null?void 0:a.name)&&c.type===s.type)return c.timestamp=s.timestamp,c.content.push({...s.content,key:s.key}),e}return e.push(r),e},[]),vn=async i=>gn(i,"conversation",Promise.resolve().then(()=>require("./conversation-da609cdf.js")),async t=>{const e=await Ct.getInstance(i),{rehydrate:s=!1}=t.properties(),n="component",r=await e.createController(n,{rehydrate:s}),o=e.registerController(r,t),a=3*60*1e3,c=d=>{const{providers:u=[]}=d;if(u){const p=Array.isArray(u)?u:[u];return r.setProviders(p),p}};c(t.properties(c)),r.setComponentMountedState(!0);const h=d=>{const{loading:u,typingActors:p,messages:v}=d;t.writeProperties({loading:u,typingActors:p,messages:mn(v,a)})};h(r.getMessageStream()),o&&(t.writeProperties({conversationControllerId:r.id}),t.actions.create("user-submit",(d,u)=>{if(u){const{preventDefault:p,validationPromise:v}=u;if(p){v&&v().then(f=>{f&&r.user.print(f)});return}}r.user.print(d.text)}),t.actions.create("user-typing",(d,u)=>{}),t.actions.create("form",(d,u)=>{}),t.actions.create("action",(d,u)=>{}),t.actions.create("overlay-mounted",(d,u)=>{}),t.actions.create("show-overlay",(d,u)=>{t.writeProperties({overlay:{conversation:!1,secondary:!1}})}),t.actions.create("hide-overlay",(d,u)=>{t.writeProperties({overlay:null})}),t.actions.create("show-overlay-conversation",(d,u)=>{t.writeProperties({overlay:{conversation:!0,secondary:!1}})}),t.actions.create("hide-overlay-conversation",(d,u)=>{t.writeProperties({overlay:{conversation:!1,secondary:!1}})}));const l=r.events.subscribe("conversation:updated",(d,u)=>{h(u)});return()=>{r.setComponentMountedState(!1),l(),r.active||h({messages:[],typingActors:[],loading:!1})}},{reuseController:!0});var ks=(i=>(i.LinkList="link-list",i.Separator="separator",i.ButtonList="button-list",i.ItemList="item-list",i.Text="text",i.HTML="html",i.VideoRequest="video-request",i))(ks||{});const fn=async(i,t,e)=>{await e};console.log("tes3t123");exports.A=g;exports.ConversationComponent=vn;exports.ConversationController=ms;exports.ConversationEndedBehavior=Et;exports.ConversationEntry=gs;exports.ConversationMessageListItemType=ks;exports.ConversationMessageType=Q;exports.ConversationPlatform=Ct;exports.Et=Ai;exports.P=$t;exports.T=I;exports.e=Es;exports.ht=F;exports.i=fs;exports.i$1=Cs;exports.mapBranding=xs;exports.n=xt;exports.o=Ps;exports.pt=ae;exports.registerCustomMessageComponent=fn;exports.s=B;exports.t=kt;exports.t$1=As;exports.x=X;
@@ -7,4 +7,3 @@ export type { ConversationMessageContent, ConversationMessageSender, Converstati
7
7
  export { registerCustomMessageComponent } from './utils/custom-message';
8
8
  export { ConversationPlatform, ConversationEndedBehavior };
9
9
  export type { UnregisterControllerDelegate };
10
- //# sourceMappingURL=index.d.ts.map
package/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-8e55fd9b.js");exports.ConversationComponent=e.ConversationComponent;exports.ConversationController=e.ConversationController;exports.ConversationEndedBehavior=e.ConversationEndedBehavior;exports.ConversationEntry=e.ConversationEntry;exports.ConversationMessageListItemType=e.ConversationMessageListItemType;exports.ConversationMessageType=e.ConversationMessageType;exports.ConversationPlatform=e.ConversationPlatform;exports.registerCustomMessageComponent=e.registerCustomMessageComponent;
@@ -1,12 +1,11 @@
1
- import { c as s, d as a, b as n, e as r, f as t, C, a as i, r as v } from "./index-c61b2340.js";
1
+ import { f as s, g as n, d as a, j as r, k as t, C, c as i, r as v } from "./index-5ce43fbe.mjs";
2
2
  export {
3
3
  s as ConversationComponent,
4
- a as ConversationController,
5
- n as ConversationEndedBehavior,
4
+ n as ConversationController,
5
+ a as ConversationEndedBehavior,
6
6
  r as ConversationEntry,
7
7
  t as ConversationMessageListItemType,
8
8
  C as ConversationMessageType,
9
9
  i as ConversationPlatform,
10
10
  v as registerCustomMessageComponent
11
11
  };
12
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,49 +1,18 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-conversation-flamingo",
3
- "version": "1.0.14",
4
- "description": "ACE Widget Conversation Platform",
5
- "license": "SEE LICENSE IN LICENSE.txt",
6
- "author": "Telia Company AB",
7
- "keywords": [
8
- "telia"
9
- ],
10
- "main": "dist/index.js",
11
- "sourceMain": "src/index.ts",
12
- "type": "module",
13
- "types": "dist/index.d.ts",
14
- "files": [
15
- "LICENSE.txt",
16
- "README.md",
17
- "dist/"
18
- ],
19
- "publishConfig": {
20
- "access": "public"
21
- },
22
- "sideEffects": true,
3
+ "version": "1.0.37",
23
4
  "dependencies": {
24
- "@telia-ace/widget-services": "^1.0.27",
25
5
  "@telia-ace/widget-utilities": "^1.0.16",
26
- "@webprovisions/platform": "^1.1.3",
27
6
  "lit": "^2.8.0",
28
- "lit-html": "^2.8.0",
29
- "sass": "^1.66.1",
30
- "@teliads/components": "^22.1.1",
31
- "@teliads/icons": "^8.4.0",
32
- "@lit-labs/context": "^0.4.0",
33
7
  "@lit-labs/motion": "^1.0.4",
34
- "@telia-ace/widget-core-flamingo": "1.0.14",
35
- "@telia-ace/widget-runtime-flamingo": "1.0.16"
36
- },
37
- "devDependencies": {
38
- "@telia-ace/widget-developer-tools": "^1.0.22",
39
- "@types/node": "^20.5.4",
40
- "rimraf": "^5.0.1",
41
- "tslib": "^2.6.0",
42
- "typescript": "^5.1.6",
43
- "vite": "^4.4.9"
8
+ "@teliads/icons": "^8.4.0",
9
+ "@teliads/components": "^22.1.1",
10
+ "@telia-ace/widget-runtime-flamingo": "*",
11
+ "@webprovisions/platform": "^1.1.3",
12
+ "@telia-ace/widget-core": "^1.0.27",
13
+ "@telia-ace/widget-services": "^1.0.27"
44
14
  },
45
- "scripts": {
46
- "clean": "rimraf ./dist",
47
- "build": "rimraf ./dist && tsc -emitDeclarationOnly && vite build"
48
- }
49
- }
15
+ "main": "./index.js",
16
+ "module": "./index.mjs",
17
+ "typings": "./index.d.ts"
18
+ }
@@ -0,0 +1,5 @@
1
+ const e = { name: "grid-view", svg: '<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 8H28C29.1046 8 30 8.89543 30 10V28C30 29.1046 29.1046 30 28 30H10C8.89543 30 8 29.1046 8 28V10C8 8.89543 8.89543 8 10 8ZM12 12V26H26V12H12Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10 34H28C29.1046 34 30 34.8954 30 36V54C30 55.1046 29.1046 56 28 56H10C8.89543 56 8 55.1046 8 54V36C8 34.8954 8.89543 34 10 34ZM12 38V52H26V38H12Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M54 8H36C34.8954 8 34 8.89543 34 10V28C34 29.1046 34.8954 30 36 30H54C55.1046 30 56 29.1046 56 28V10C56 8.89543 55.1046 8 54 8ZM38 26V12H52V26H38Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M36 34H54C55.1046 34 56 34.8954 56 36V54C56 55.1046 55.1046 56 54 56H36C34.8954 56 34 55.1046 34 54V36C34 34.8954 34.8954 34 36 34ZM38 38V52H52V38H38Z"/></svg>' }, l = { name: "send", svg: '<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.41642 6.29292C5.99705 5.18016 3.38612 7.41823 4.12858 9.96847L10.5427 32L4.12858 54.0315C3.38612 56.5818 5.99704 58.8198 8.41642 57.7071L58.1942 34.8125C60.6019 33.7051 60.6019 30.2949 58.1942 29.1875L8.41642 6.29292ZM14.2569 29.9351L8.74174 10.9913L49.9295 29.9351H14.2569ZM14.2568 34.0651L8.74174 53.0087L49.9291 34.0651H14.2568Z"/></svg>' };
2
+ export {
3
+ e as g,
4
+ l as s
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e={name:"grid-view",svg:'<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 8H28C29.1046 8 30 8.89543 30 10V28C30 29.1046 29.1046 30 28 30H10C8.89543 30 8 29.1046 8 28V10C8 8.89543 8.89543 8 10 8ZM12 12V26H26V12H12Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10 34H28C29.1046 34 30 34.8954 30 36V54C30 55.1046 29.1046 56 28 56H10C8.89543 56 8 55.1046 8 54V36C8 34.8954 8.89543 34 10 34ZM12 38V52H26V38H12Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M54 8H36C34.8954 8 34 8.89543 34 10V28C34 29.1046 34.8954 30 36 30H54C55.1046 30 56 29.1046 56 28V10C56 8.89543 55.1046 8 54 8ZM38 26V12H52V26H38Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M36 34H54C55.1046 34 56 34.8954 56 36V54C56 55.1046 55.1046 56 54 56H36C34.8954 56 34 55.1046 34 54V36C34 34.8954 34.8954 34 36 34ZM38 38V52H52V38H38Z"/></svg>'},l={name:"send",svg:'<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.41642 6.29292C5.99705 5.18016 3.38612 7.41823 4.12858 9.96847L10.5427 32L4.12858 54.0315C3.38612 56.5818 5.99704 58.8198 8.41642 57.7071L58.1942 34.8125C60.6019 33.7051 60.6019 30.2949 58.1942 29.1875L8.41642 6.29292ZM14.2569 29.9351L8.74174 10.9913L49.9295 29.9351H14.2569ZM14.2568 34.0651L8.74174 53.0087L49.9291 34.0651H14.2568Z"/></svg>'};exports.gridView=e;exports.send=l;
@@ -29,4 +29,3 @@ declare class Store {
29
29
  read(): Promise<StoredConversation>;
30
30
  }
31
31
  export default Store;
32
- //# sourceMappingURL=store.d.ts.map
@@ -49,7 +49,7 @@ export type ConversationMessageUpdateSettings = ConversationMessageContent & {
49
49
  };
50
50
  export type ConversationMessageSender = {
51
51
  name?: string;
52
- avatar?: string | Symbol;
52
+ avatar?: string | SymbolType;
53
53
  id?: string;
54
54
  };
55
55
  export declare enum ConversationMessageListType {
@@ -123,9 +123,8 @@ export type HtmlProperties = {
123
123
  };
124
124
  type HtmlItem = [ConversationMessageListItemType.HTML, HtmlProperties];
125
125
  type ItemPayload = LinkListItem | TextItem | SeparatorItem | ButtonListItem | HtmlItem | VideoRequestItem | ItemListItem;
126
- export type Symbol = {
126
+ export type SymbolType = {
127
127
  type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;
128
128
  content: string;
129
129
  };
130
130
  export {};
131
- //# sourceMappingURL=types.d.ts.map
@@ -7,4 +7,3 @@ export declare class User {
7
7
  key?: string;
8
8
  }) => ConversationEntry;
9
9
  }
10
- //# sourceMappingURL=user.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { Container } from '@webprovisions/platform';
2
2
  export declare const registerCustomMessageComponent: (_container: Container, _type: string, componentImport: any) => Promise<void>;
3
- //# sourceMappingURL=custom-message.d.ts.map
@@ -1,2 +1 @@
1
1
  export { navigateToConversation, openChatWidget, shouldPreventDefault } from './open-chat-widget';
2
- //# sourceMappingURL=index.d.ts.map
@@ -2,4 +2,3 @@ import { Container } from '@webprovisions/platform';
2
2
  export declare const shouldPreventDefault: (container: Container) => boolean;
3
3
  export declare const openChatWidget: (container: Container, contactMethod: any, triggerDOMTarget?: HTMLElement) => boolean | Promise<boolean> | Promise<void>;
4
4
  export declare const navigateToConversation: (container: Container, contactMethod: any, _routeName?: string) => any;
5
- //# sourceMappingURL=open-chat-widget.d.ts.map
@@ -6,4 +6,3 @@ import { Container } from '@webprovisions/platform';
6
6
  * queue will become active again
7
7
  */
8
8
  export declare const swapProvider: (container: Container, conversationId: string, providerName: string) => Promise<void>;
9
- //# sourceMappingURL=swap-provider.d.ts.map
package/LICENSE.txt DELETED
@@ -1,6 +0,0 @@
1
- Copyright © 2021, Telia Company AB. All rights reserved.
2
-
3
- THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
4
- THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
5
- AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
6
- http://www.humany.com/legal