@telia-ace/ace-chat-flamingo 1.1.18-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/index.js +3 -0
- package/index.mjs +1228 -0
- package/package.json +16 -0
- package/plugin.d.ts +2 -0
- package/provider.d.ts +10 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChatProviderPlugin } from './plugin';
|
package/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let _;const vt=new Uint8Array(16);function yt(){if(!_&&(_=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!_))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _(vt)}const d=[];for(let r=0;r<256;++r)d.push((r+256).toString(16).slice(1));function bt(r,e=0){return d[r[e+0]]+d[r[e+1]]+d[r[e+2]]+d[r[e+3]]+"-"+d[r[e+4]]+d[r[e+5]]+"-"+d[r[e+6]]+d[r[e+7]]+"-"+d[r[e+8]]+d[r[e+9]]+"-"+d[r[e+10]]+d[r[e+11]]+d[r[e+12]]+d[r[e+13]]+d[r[e+14]]+d[r[e+15]]}const mt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),G={randomUUID:mt};function wt(r,e,t){if(G.randomUUID&&!e&&!r)return G.randomUUID();r=r||{};const n=r.random||(r.rng||yt)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return bt(n)}var $=function(r,e){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},$(r,e)};function g(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");$(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function St(r,e,t,n){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function u(f){try{c(n.next(f))}catch(b){s(b)}}function a(f){try{c(n.throw(f))}catch(b){s(b)}}function c(f){f.done?o(f.value):i(f.value).then(u,a)}c((n=n.apply(r,e||[])).next())})}function J(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(c){return function(f){return a([c,f])}}function a(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(f){c=[6,f],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function S(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function O(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o}function U(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))}function w(r){return this instanceof w?(this.v=r,this):new w(r)}function gt(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(l){n[l]&&(i[l]=function(v){return new Promise(function(E,p){o.push([l,v,E,p])>1||u(l,v)})})}function u(l,v){try{a(n[l](v))}catch(E){b(o[0][3],E)}}function a(l){l.value instanceof w?Promise.resolve(l.value.v).then(c,f):b(o[0][2],l)}function c(l){u("next",l)}function f(l){u("throw",l)}function b(l,v){l(v),o.shift(),o.length&&u(o[0][0],o[0][1])}}function xt(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof S=="function"?S(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=r[o]&&function(s){return new Promise(function(u,a){s=r[o](s),i(u,a,s.done,s.value)})}}function i(o,s,u,a){Promise.resolve(a).then(function(c){o({value:c,done:u})},s)}}function h(r){return typeof r=="function"}function Q(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var j=Q(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
2
|
+
`+t.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function C(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var A=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=S(s),a=u.next();!a.done;a=u.next()){var c=a.value;c.remove(this)}}catch(p){e={error:p}}finally{try{a&&!a.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else s.remove(this);var f=this.initialTeardown;if(h(f))try{f()}catch(p){o=p instanceof j?p.errors:[p]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var l=S(b),v=l.next();!v.done;v=l.next()){var E=v.value;try{H(E)}catch(p){o=o??[],p instanceof j?o=U(U([],O(o)),O(p.errors)):o.push(p)}}}catch(p){n={error:p}}finally{try{v&&!v.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}if(o)throw new j(o)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)H(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&C(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&C(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}(),W=A.EMPTY;function X(r){return r instanceof A||r&&"closed"in r&&h(r.remove)&&h(r.add)&&h(r.unsubscribe)}function H(r){h(r)?r():r.unsubscribe()}var Z={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},R={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=R.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,U([r,e],O(t))):setTimeout.apply(void 0,U([r,e],O(t)))},clearTimeout:function(r){var e=R.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function N(r){R.setTimeout(function(){throw r})}function q(){}function P(r){r()}var L=function(r){g(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,X(t)&&t.add(n)):n.destination=Pt,n}return e.create=function(t,n,i){return new F(t,n,i)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(A),Et=Function.prototype.bind;function k(r,e){return Et.call(r,e)}var _t=function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){I(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){I(n)}else I(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){I(t)}},r}(),F=function(r){g(e,r);function e(t,n,i){var o=r.call(this)||this,s;if(h(t)||!t)s={next:t??void 0,error:n??void 0,complete:i??void 0};else{var u;o&&Z.useDeprecatedNextContext?(u=Object.create(t),u.unsubscribe=function(){return o.unsubscribe()},s={next:t.next&&k(t.next,u),error:t.error&&k(t.error,u),complete:t.complete&&k(t.complete,u)}):s=t}return o.destination=new _t(s),o}return e}(L);function I(r){N(r)}function It(r){throw r}var Pt={closed:!0,next:q,error:It,complete:q},D=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ot(r){return r}function Ut(r){return r.length===0?Ot:r.length===1?r[0]:function(t){return r.reduce(function(n,i){return i(n)},t)}}var y=function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,o=Tt(e)?e:new F(e,t,n);return P(function(){var s=i,u=s.operator,a=s.source;o.add(u?u.call(o,a):a?i._subscribe(o):i._trySubscribe(o))}),o},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=z(t),new t(function(i,o){var s=new F({next:function(u){try{e(u)}catch(a){o(a),s.unsubscribe()}},error:o,complete:i});n.subscribe(s)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[D]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ut(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=z(e),new e(function(n,i){var o;t.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},r.create=function(e){return new r(e)},r}();function z(r){var e;return(e=r??Z.Promise)!==null&&e!==void 0?e:Promise}function At(r){return r&&h(r.next)&&h(r.error)&&h(r.complete)}function Tt(r){return r&&r instanceof L||At(r)&&X(r)}function jt(r){return h(r==null?void 0:r.lift)}function V(r){return function(e){if(jt(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function tt(r,e,t,n,i){return new kt(r,e,t,n,i)}var kt=function(r){g(e,r);function e(t,n,i,o,s,u){var a=r.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=u,a._next=n?function(c){try{n(c)}catch(f){t.error(f)}}:r.prototype._next,a._error=o?function(c){try{o(c)}catch(f){t.error(f)}finally{this.unsubscribe()}}:r.prototype._error,a._complete=i?function(){try{i()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,a}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(L),$t=Q(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),x=function(r){g(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new K(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new $t},e.prototype.next=function(t){var n=this;P(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=S(n.currentObservers),u=s.next();!u.done;u=s.next()){var a=u.value;a.next(t)}}catch(c){i={error:c}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;P(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;P(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?W:(this.currentObservers=null,u.push(t),new A(function(){n.currentObservers=null,C(u,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?t.error(o):s&&t.complete()},e.prototype.asObservable=function(){var t=new y;return t.source=this,t},e.create=function(t,n){return new K(t,n)},e}(y),K=function(r){g(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:W},e}(x),rt=function(r){g(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,o=t._value;if(n)throw i;return this._throwIfClosed(),o},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(x),Ct=new y(function(r){return r.complete()});function Rt(r){return r&&h(r.schedule)}function Ft(r){return r[r.length-1]}function Lt(r){return Rt(Ft(r))?r.pop():void 0}var et=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function nt(r){return h(r==null?void 0:r.then)}function it(r){return h(r[D])}function ot(r){return Symbol.asyncIterator&&h(r==null?void 0:r[Symbol.asyncIterator])}function st(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Dt(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ut=Dt();function ct(r){return h(r==null?void 0:r[ut])}function at(r){return gt(this,arguments,function(){var t,n,i,o;return J(this,function(s){switch(s.label){case 0:t=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,w(t.read())];case 3:return n=s.sent(),i=n.value,o=n.done,o?[4,w(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,w(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function lt(r){return h(r==null?void 0:r.getReader)}function Y(r){if(r instanceof y)return r;if(r!=null){if(it(r))return Vt(r);if(et(r))return Yt(r);if(nt(r))return Bt(r);if(ot(r))return ft(r);if(ct(r))return Mt(r);if(lt(r))return Gt(r)}throw st(r)}function Vt(r){return new y(function(e){var t=r[D]();if(h(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Yt(r){return new y(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Bt(r){return new y(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,N)})}function Mt(r){return new y(function(e){var t,n;try{for(var i=S(r),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){t={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}function ft(r){return new y(function(e){Ht(r,e).catch(function(t){return e.error(t)})})}function Gt(r){return ft(at(r))}function Ht(r,e){var t,n,i,o;return St(this,void 0,void 0,function(){var s,u;return J(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),t=xt(r),a.label=1;case 1:return[4,t.next()];case 2:if(n=a.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=a.sent(),i={error:u},[3,11];case 6:return a.trys.push([6,,9,10]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function m(r,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=e.schedule(function(){t(),i?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(o),!i)return o}function ht(r,e){return e===void 0&&(e=0),V(function(t,n){t.subscribe(tt(n,function(i){return m(n,r,function(){return n.next(i)},e)},function(){return m(n,r,function(){return n.complete()},e)},function(i){return m(n,r,function(){return n.error(i)},e)}))})}function dt(r,e){return e===void 0&&(e=0),V(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function qt(r,e){return Y(r).pipe(dt(e),ht(e))}function zt(r,e){return Y(r).pipe(dt(e),ht(e))}function Kt(r,e){return new y(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}function Jt(r,e){return new y(function(t){var n;return m(t,e,function(){n=r[ut](),m(t,e,function(){var i,o,s;try{i=n.next(),o=i.value,s=i.done}catch(u){t.error(u);return}s?t.complete():t.next(o)},0,!0)}),function(){return h(n==null?void 0:n.return)&&n.return()}})}function pt(r,e){if(!r)throw new Error("Iterable cannot be null");return new y(function(t){m(t,e,function(){var n=r[Symbol.asyncIterator]();m(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}function Qt(r,e){return pt(at(r),e)}function Wt(r,e){if(r!=null){if(it(r))return qt(r,e);if(et(r))return Kt(r,e);if(nt(r))return zt(r,e);if(ot(r))return pt(r,e);if(ct(r))return Jt(r,e);if(lt(r))return Qt(r,e)}throw st(r)}function Xt(r,e){return e?Wt(r,e):Y(r)}function Zt(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Lt(r);return Xt(r,t)}function Nt(r){return r<=0?function(){return Ct}:V(function(e,t){var n=0;e.subscribe(tt(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}class tr{constructor(e,t){this.id=e,this.entries$=new rt([]),t.addEventListener("user-submit",n=>{if(!this.provider){console.warn("No provider activated, unable to print message to conversation.");return}this.provider.onUserSubmit(n.detail)})}write(e){this.entries$.pipe(Nt(1)).subscribe(t=>{this.entries$.next([...t,e])})}entries(){return this.entries$.asObservable()}setProvider(e){this.provider=e,this.provider.actions().subscribe(t=>{this.write(t)})}isTyping(){return this.provider?this.provider.isTyping():Zt(!1)}}class B{constructor(){this.sessions=new Map,this.registeredProviders=new Map,this.activeSessionId=null}static async getInstance(e){let t=await e.get("conversation");return t||(t=new B,await e.register("conversation",t),t)}registerProvider(e,t){this.registeredProviders.set(e,t)}createSession(e){const t=new tr(wt(),e),n=this.getProviderByConfiguration(e);if(n){const i=n();t.setProvider(i)}return this.sessions.set(t.id,t),this.activeSessionId=t.id,t}getProviderByConfiguration(e){const[t]=e.properties.providers||[];if(!t){console.warn("No providers registered. You most likely forgot to add a provider to the conversation component properties.");return}return this.registeredProviders.get(t)}}var T=(r=>(r.User="user",r.Agent="agent",r.System="system",r))(T||{});class M{constructor(e,t,n){this.type=e,this.sender=t,this.messages=n,this.didUpdate=new x,this.timestamp=Date.now()}update(e){this.messages=[{items:e}],this.didUpdate.next(this)}}class rr{constructor(e){this.name=e,this.print$=new x}print(e){const t=new M(T.Agent,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class er{constructor(e){this.name=e,this.print$=new x}print(e){const t=new M(T.User,{name:this.name},[{items:[["html",{content:e}]]}]);return this.print$.next(t),t}subscribe(){return this.print$.asObservable()}}class nr{constructor(e){this.name=e,this.print$=new x,this.typingState$=new rt(!1)}onUserSubmit(e){this.print(T.User,e.text)}print(e,t){const n=new M(e,{name:""},[{items:[["html",{content:t}]]}]);return this.printEntry(n)}printEntry(e){return this.print$.next(e),e}createAgent(e){const t=new rr(e);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}createUser(e){const t=new er(e);return t.subscribe().subscribe(n=>{this.printEntry(n)}),t}setTypingState(e){this.typingState$.next(e)}isTyping(){return this.typingState$.asObservable()}actions(){return this.print$.asObservable()}}class ir extends nr{constructor(e){super(e),this.agent=this.createAgent(""),this.user=this.createUser("")}printAgent(e){const t=this.agent.print(e);return this.setTypingState(!1),t}onUserSubmit(e){this.user.print(e.text)}}const or=async r=>{const e=await B.getInstance(r.container);e==null||e.registerProvider("ace-conversational-hub-provider",()=>new ir("ace-chat"))};exports.ChatProviderPlugin=or;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,1228 @@
|
|
|
1
|
+
let _;
|
|
2
|
+
const vt = new Uint8Array(16);
|
|
3
|
+
function yt() {
|
|
4
|
+
if (!_ && (_ = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !_))
|
|
5
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
6
|
+
return _(vt);
|
|
7
|
+
}
|
|
8
|
+
const p = [];
|
|
9
|
+
for (let r = 0; r < 256; ++r)
|
|
10
|
+
p.push((r + 256).toString(16).slice(1));
|
|
11
|
+
function bt(r, e = 0) {
|
|
12
|
+
return p[r[e + 0]] + p[r[e + 1]] + p[r[e + 2]] + p[r[e + 3]] + "-" + p[r[e + 4]] + p[r[e + 5]] + "-" + p[r[e + 6]] + p[r[e + 7]] + "-" + p[r[e + 8]] + p[r[e + 9]] + "-" + p[r[e + 10]] + p[r[e + 11]] + p[r[e + 12]] + p[r[e + 13]] + p[r[e + 14]] + p[r[e + 15]];
|
|
13
|
+
}
|
|
14
|
+
const mt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), G = {
|
|
15
|
+
randomUUID: mt
|
|
16
|
+
};
|
|
17
|
+
function wt(r, e, t) {
|
|
18
|
+
if (G.randomUUID && !e && !r)
|
|
19
|
+
return G.randomUUID();
|
|
20
|
+
r = r || {};
|
|
21
|
+
const n = r.random || (r.rng || yt)();
|
|
22
|
+
if (n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, e) {
|
|
23
|
+
t = t || 0;
|
|
24
|
+
for (let i = 0; i < 16; ++i)
|
|
25
|
+
e[t + i] = n[i];
|
|
26
|
+
return e;
|
|
27
|
+
}
|
|
28
|
+
return bt(n);
|
|
29
|
+
}
|
|
30
|
+
var $ = function(r, e) {
|
|
31
|
+
return $ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
|
|
32
|
+
t.__proto__ = n;
|
|
33
|
+
} || function(t, n) {
|
|
34
|
+
for (var i in n)
|
|
35
|
+
Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
|
|
36
|
+
}, $(r, e);
|
|
37
|
+
};
|
|
38
|
+
function g(r, e) {
|
|
39
|
+
if (typeof e != "function" && e !== null)
|
|
40
|
+
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
41
|
+
$(r, e);
|
|
42
|
+
function t() {
|
|
43
|
+
this.constructor = r;
|
|
44
|
+
}
|
|
45
|
+
r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
46
|
+
}
|
|
47
|
+
function St(r, e, t, n) {
|
|
48
|
+
function i(o) {
|
|
49
|
+
return o instanceof t ? o : new t(function(s) {
|
|
50
|
+
s(o);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return new (t || (t = Promise))(function(o, s) {
|
|
54
|
+
function u(f) {
|
|
55
|
+
try {
|
|
56
|
+
c(n.next(f));
|
|
57
|
+
} catch (b) {
|
|
58
|
+
s(b);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function a(f) {
|
|
62
|
+
try {
|
|
63
|
+
c(n.throw(f));
|
|
64
|
+
} catch (b) {
|
|
65
|
+
s(b);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function c(f) {
|
|
69
|
+
f.done ? o(f.value) : i(f.value).then(u, a);
|
|
70
|
+
}
|
|
71
|
+
c((n = n.apply(r, e || [])).next());
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function J(r, e) {
|
|
75
|
+
var t = { label: 0, sent: function() {
|
|
76
|
+
if (o[0] & 1)
|
|
77
|
+
throw o[1];
|
|
78
|
+
return o[1];
|
|
79
|
+
}, trys: [], ops: [] }, n, i, o, s;
|
|
80
|
+
return s = { next: u(0), throw: u(1), return: u(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
81
|
+
return this;
|
|
82
|
+
}), s;
|
|
83
|
+
function u(c) {
|
|
84
|
+
return function(f) {
|
|
85
|
+
return a([c, f]);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function a(c) {
|
|
89
|
+
if (n)
|
|
90
|
+
throw new TypeError("Generator is already executing.");
|
|
91
|
+
for (; s && (s = 0, c[0] && (t = 0)), t; )
|
|
92
|
+
try {
|
|
93
|
+
if (n = 1, i && (o = c[0] & 2 ? i.return : c[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, c[1])).done)
|
|
94
|
+
return o;
|
|
95
|
+
switch (i = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
|
|
96
|
+
case 0:
|
|
97
|
+
case 1:
|
|
98
|
+
o = c;
|
|
99
|
+
break;
|
|
100
|
+
case 4:
|
|
101
|
+
return t.label++, { value: c[1], done: !1 };
|
|
102
|
+
case 5:
|
|
103
|
+
t.label++, i = c[1], c = [0];
|
|
104
|
+
continue;
|
|
105
|
+
case 7:
|
|
106
|
+
c = t.ops.pop(), t.trys.pop();
|
|
107
|
+
continue;
|
|
108
|
+
default:
|
|
109
|
+
if (o = t.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
110
|
+
t = 0;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
|
|
114
|
+
t.label = c[1];
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (c[0] === 6 && t.label < o[1]) {
|
|
118
|
+
t.label = o[1], o = c;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
if (o && t.label < o[2]) {
|
|
122
|
+
t.label = o[2], t.ops.push(c);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
o[2] && t.ops.pop(), t.trys.pop();
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
c = e.call(r, t);
|
|
129
|
+
} catch (f) {
|
|
130
|
+
c = [6, f], i = 0;
|
|
131
|
+
} finally {
|
|
132
|
+
n = o = 0;
|
|
133
|
+
}
|
|
134
|
+
if (c[0] & 5)
|
|
135
|
+
throw c[1];
|
|
136
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function S(r) {
|
|
140
|
+
var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], n = 0;
|
|
141
|
+
if (t)
|
|
142
|
+
return t.call(r);
|
|
143
|
+
if (r && typeof r.length == "number")
|
|
144
|
+
return {
|
|
145
|
+
next: function() {
|
|
146
|
+
return r && n >= r.length && (r = void 0), { value: r && r[n++], done: !r };
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
150
|
+
}
|
|
151
|
+
function O(r, e) {
|
|
152
|
+
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
153
|
+
if (!t)
|
|
154
|
+
return r;
|
|
155
|
+
var n = t.call(r), i, o = [], s;
|
|
156
|
+
try {
|
|
157
|
+
for (; (e === void 0 || e-- > 0) && !(i = n.next()).done; )
|
|
158
|
+
o.push(i.value);
|
|
159
|
+
} catch (u) {
|
|
160
|
+
s = { error: u };
|
|
161
|
+
} finally {
|
|
162
|
+
try {
|
|
163
|
+
i && !i.done && (t = n.return) && t.call(n);
|
|
164
|
+
} finally {
|
|
165
|
+
if (s)
|
|
166
|
+
throw s.error;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return o;
|
|
170
|
+
}
|
|
171
|
+
function U(r, e, t) {
|
|
172
|
+
if (t || arguments.length === 2)
|
|
173
|
+
for (var n = 0, i = e.length, o; n < i; n++)
|
|
174
|
+
(o || !(n in e)) && (o || (o = Array.prototype.slice.call(e, 0, n)), o[n] = e[n]);
|
|
175
|
+
return r.concat(o || Array.prototype.slice.call(e));
|
|
176
|
+
}
|
|
177
|
+
function w(r) {
|
|
178
|
+
return this instanceof w ? (this.v = r, this) : new w(r);
|
|
179
|
+
}
|
|
180
|
+
function gt(r, e, t) {
|
|
181
|
+
if (!Symbol.asyncIterator)
|
|
182
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
183
|
+
var n = t.apply(r, e || []), i, o = [];
|
|
184
|
+
return i = {}, s("next"), s("throw"), s("return"), i[Symbol.asyncIterator] = function() {
|
|
185
|
+
return this;
|
|
186
|
+
}, i;
|
|
187
|
+
function s(l) {
|
|
188
|
+
n[l] && (i[l] = function(v) {
|
|
189
|
+
return new Promise(function(E, d) {
|
|
190
|
+
o.push([l, v, E, d]) > 1 || u(l, v);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function u(l, v) {
|
|
195
|
+
try {
|
|
196
|
+
a(n[l](v));
|
|
197
|
+
} catch (E) {
|
|
198
|
+
b(o[0][3], E);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function a(l) {
|
|
202
|
+
l.value instanceof w ? Promise.resolve(l.value.v).then(c, f) : b(o[0][2], l);
|
|
203
|
+
}
|
|
204
|
+
function c(l) {
|
|
205
|
+
u("next", l);
|
|
206
|
+
}
|
|
207
|
+
function f(l) {
|
|
208
|
+
u("throw", l);
|
|
209
|
+
}
|
|
210
|
+
function b(l, v) {
|
|
211
|
+
l(v), o.shift(), o.length && u(o[0][0], o[0][1]);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function xt(r) {
|
|
215
|
+
if (!Symbol.asyncIterator)
|
|
216
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
217
|
+
var e = r[Symbol.asyncIterator], t;
|
|
218
|
+
return e ? e.call(r) : (r = typeof S == "function" ? S(r) : r[Symbol.iterator](), t = {}, n("next"), n("throw"), n("return"), t[Symbol.asyncIterator] = function() {
|
|
219
|
+
return this;
|
|
220
|
+
}, t);
|
|
221
|
+
function n(o) {
|
|
222
|
+
t[o] = r[o] && function(s) {
|
|
223
|
+
return new Promise(function(u, a) {
|
|
224
|
+
s = r[o](s), i(u, a, s.done, s.value);
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function i(o, s, u, a) {
|
|
229
|
+
Promise.resolve(a).then(function(c) {
|
|
230
|
+
o({ value: c, done: u });
|
|
231
|
+
}, s);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function h(r) {
|
|
235
|
+
return typeof r == "function";
|
|
236
|
+
}
|
|
237
|
+
function Q(r) {
|
|
238
|
+
var e = function(n) {
|
|
239
|
+
Error.call(n), n.stack = new Error().stack;
|
|
240
|
+
}, t = r(e);
|
|
241
|
+
return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
|
|
242
|
+
}
|
|
243
|
+
var j = Q(function(r) {
|
|
244
|
+
return function(t) {
|
|
245
|
+
r(this), this.message = t ? t.length + ` errors occurred during unsubscription:
|
|
246
|
+
` + t.map(function(n, i) {
|
|
247
|
+
return i + 1 + ") " + n.toString();
|
|
248
|
+
}).join(`
|
|
249
|
+
`) : "", this.name = "UnsubscriptionError", this.errors = t;
|
|
250
|
+
};
|
|
251
|
+
});
|
|
252
|
+
function C(r, e) {
|
|
253
|
+
if (r) {
|
|
254
|
+
var t = r.indexOf(e);
|
|
255
|
+
0 <= t && r.splice(t, 1);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
var A = function() {
|
|
259
|
+
function r(e) {
|
|
260
|
+
this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
261
|
+
}
|
|
262
|
+
return r.prototype.unsubscribe = function() {
|
|
263
|
+
var e, t, n, i, o;
|
|
264
|
+
if (!this.closed) {
|
|
265
|
+
this.closed = !0;
|
|
266
|
+
var s = this._parentage;
|
|
267
|
+
if (s)
|
|
268
|
+
if (this._parentage = null, Array.isArray(s))
|
|
269
|
+
try {
|
|
270
|
+
for (var u = S(s), a = u.next(); !a.done; a = u.next()) {
|
|
271
|
+
var c = a.value;
|
|
272
|
+
c.remove(this);
|
|
273
|
+
}
|
|
274
|
+
} catch (d) {
|
|
275
|
+
e = { error: d };
|
|
276
|
+
} finally {
|
|
277
|
+
try {
|
|
278
|
+
a && !a.done && (t = u.return) && t.call(u);
|
|
279
|
+
} finally {
|
|
280
|
+
if (e)
|
|
281
|
+
throw e.error;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
else
|
|
285
|
+
s.remove(this);
|
|
286
|
+
var f = this.initialTeardown;
|
|
287
|
+
if (h(f))
|
|
288
|
+
try {
|
|
289
|
+
f();
|
|
290
|
+
} catch (d) {
|
|
291
|
+
o = d instanceof j ? d.errors : [d];
|
|
292
|
+
}
|
|
293
|
+
var b = this._finalizers;
|
|
294
|
+
if (b) {
|
|
295
|
+
this._finalizers = null;
|
|
296
|
+
try {
|
|
297
|
+
for (var l = S(b), v = l.next(); !v.done; v = l.next()) {
|
|
298
|
+
var E = v.value;
|
|
299
|
+
try {
|
|
300
|
+
H(E);
|
|
301
|
+
} catch (d) {
|
|
302
|
+
o = o ?? [], d instanceof j ? o = U(U([], O(o)), O(d.errors)) : o.push(d);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
} catch (d) {
|
|
306
|
+
n = { error: d };
|
|
307
|
+
} finally {
|
|
308
|
+
try {
|
|
309
|
+
v && !v.done && (i = l.return) && i.call(l);
|
|
310
|
+
} finally {
|
|
311
|
+
if (n)
|
|
312
|
+
throw n.error;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (o)
|
|
317
|
+
throw new j(o);
|
|
318
|
+
}
|
|
319
|
+
}, r.prototype.add = function(e) {
|
|
320
|
+
var t;
|
|
321
|
+
if (e && e !== this)
|
|
322
|
+
if (this.closed)
|
|
323
|
+
H(e);
|
|
324
|
+
else {
|
|
325
|
+
if (e instanceof r) {
|
|
326
|
+
if (e.closed || e._hasParent(this))
|
|
327
|
+
return;
|
|
328
|
+
e._addParent(this);
|
|
329
|
+
}
|
|
330
|
+
(this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e);
|
|
331
|
+
}
|
|
332
|
+
}, r.prototype._hasParent = function(e) {
|
|
333
|
+
var t = this._parentage;
|
|
334
|
+
return t === e || Array.isArray(t) && t.includes(e);
|
|
335
|
+
}, r.prototype._addParent = function(e) {
|
|
336
|
+
var t = this._parentage;
|
|
337
|
+
this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
|
|
338
|
+
}, r.prototype._removeParent = function(e) {
|
|
339
|
+
var t = this._parentage;
|
|
340
|
+
t === e ? this._parentage = null : Array.isArray(t) && C(t, e);
|
|
341
|
+
}, r.prototype.remove = function(e) {
|
|
342
|
+
var t = this._finalizers;
|
|
343
|
+
t && C(t, e), e instanceof r && e._removeParent(this);
|
|
344
|
+
}, r.EMPTY = function() {
|
|
345
|
+
var e = new r();
|
|
346
|
+
return e.closed = !0, e;
|
|
347
|
+
}(), r;
|
|
348
|
+
}(), W = A.EMPTY;
|
|
349
|
+
function X(r) {
|
|
350
|
+
return r instanceof A || r && "closed" in r && h(r.remove) && h(r.add) && h(r.unsubscribe);
|
|
351
|
+
}
|
|
352
|
+
function H(r) {
|
|
353
|
+
h(r) ? r() : r.unsubscribe();
|
|
354
|
+
}
|
|
355
|
+
var Z = {
|
|
356
|
+
onUnhandledError: null,
|
|
357
|
+
onStoppedNotification: null,
|
|
358
|
+
Promise: void 0,
|
|
359
|
+
useDeprecatedSynchronousErrorHandling: !1,
|
|
360
|
+
useDeprecatedNextContext: !1
|
|
361
|
+
}, R = {
|
|
362
|
+
setTimeout: function(r, e) {
|
|
363
|
+
for (var t = [], n = 2; n < arguments.length; n++)
|
|
364
|
+
t[n - 2] = arguments[n];
|
|
365
|
+
var i = R.delegate;
|
|
366
|
+
return i != null && i.setTimeout ? i.setTimeout.apply(i, U([r, e], O(t))) : setTimeout.apply(void 0, U([r, e], O(t)));
|
|
367
|
+
},
|
|
368
|
+
clearTimeout: function(r) {
|
|
369
|
+
var e = R.delegate;
|
|
370
|
+
return ((e == null ? void 0 : e.clearTimeout) || clearTimeout)(r);
|
|
371
|
+
},
|
|
372
|
+
delegate: void 0
|
|
373
|
+
};
|
|
374
|
+
function N(r) {
|
|
375
|
+
R.setTimeout(function() {
|
|
376
|
+
throw r;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function q() {
|
|
380
|
+
}
|
|
381
|
+
function P(r) {
|
|
382
|
+
r();
|
|
383
|
+
}
|
|
384
|
+
var L = function(r) {
|
|
385
|
+
g(e, r);
|
|
386
|
+
function e(t) {
|
|
387
|
+
var n = r.call(this) || this;
|
|
388
|
+
return n.isStopped = !1, t ? (n.destination = t, X(t) && t.add(n)) : n.destination = Pt, n;
|
|
389
|
+
}
|
|
390
|
+
return e.create = function(t, n, i) {
|
|
391
|
+
return new F(t, n, i);
|
|
392
|
+
}, e.prototype.next = function(t) {
|
|
393
|
+
this.isStopped || this._next(t);
|
|
394
|
+
}, e.prototype.error = function(t) {
|
|
395
|
+
this.isStopped || (this.isStopped = !0, this._error(t));
|
|
396
|
+
}, e.prototype.complete = function() {
|
|
397
|
+
this.isStopped || (this.isStopped = !0, this._complete());
|
|
398
|
+
}, e.prototype.unsubscribe = function() {
|
|
399
|
+
this.closed || (this.isStopped = !0, r.prototype.unsubscribe.call(this), this.destination = null);
|
|
400
|
+
}, e.prototype._next = function(t) {
|
|
401
|
+
this.destination.next(t);
|
|
402
|
+
}, e.prototype._error = function(t) {
|
|
403
|
+
try {
|
|
404
|
+
this.destination.error(t);
|
|
405
|
+
} finally {
|
|
406
|
+
this.unsubscribe();
|
|
407
|
+
}
|
|
408
|
+
}, e.prototype._complete = function() {
|
|
409
|
+
try {
|
|
410
|
+
this.destination.complete();
|
|
411
|
+
} finally {
|
|
412
|
+
this.unsubscribe();
|
|
413
|
+
}
|
|
414
|
+
}, e;
|
|
415
|
+
}(A), Et = Function.prototype.bind;
|
|
416
|
+
function k(r, e) {
|
|
417
|
+
return Et.call(r, e);
|
|
418
|
+
}
|
|
419
|
+
var _t = function() {
|
|
420
|
+
function r(e) {
|
|
421
|
+
this.partialObserver = e;
|
|
422
|
+
}
|
|
423
|
+
return r.prototype.next = function(e) {
|
|
424
|
+
var t = this.partialObserver;
|
|
425
|
+
if (t.next)
|
|
426
|
+
try {
|
|
427
|
+
t.next(e);
|
|
428
|
+
} catch (n) {
|
|
429
|
+
I(n);
|
|
430
|
+
}
|
|
431
|
+
}, r.prototype.error = function(e) {
|
|
432
|
+
var t = this.partialObserver;
|
|
433
|
+
if (t.error)
|
|
434
|
+
try {
|
|
435
|
+
t.error(e);
|
|
436
|
+
} catch (n) {
|
|
437
|
+
I(n);
|
|
438
|
+
}
|
|
439
|
+
else
|
|
440
|
+
I(e);
|
|
441
|
+
}, r.prototype.complete = function() {
|
|
442
|
+
var e = this.partialObserver;
|
|
443
|
+
if (e.complete)
|
|
444
|
+
try {
|
|
445
|
+
e.complete();
|
|
446
|
+
} catch (t) {
|
|
447
|
+
I(t);
|
|
448
|
+
}
|
|
449
|
+
}, r;
|
|
450
|
+
}(), F = function(r) {
|
|
451
|
+
g(e, r);
|
|
452
|
+
function e(t, n, i) {
|
|
453
|
+
var o = r.call(this) || this, s;
|
|
454
|
+
if (h(t) || !t)
|
|
455
|
+
s = {
|
|
456
|
+
next: t ?? void 0,
|
|
457
|
+
error: n ?? void 0,
|
|
458
|
+
complete: i ?? void 0
|
|
459
|
+
};
|
|
460
|
+
else {
|
|
461
|
+
var u;
|
|
462
|
+
o && Z.useDeprecatedNextContext ? (u = Object.create(t), u.unsubscribe = function() {
|
|
463
|
+
return o.unsubscribe();
|
|
464
|
+
}, s = {
|
|
465
|
+
next: t.next && k(t.next, u),
|
|
466
|
+
error: t.error && k(t.error, u),
|
|
467
|
+
complete: t.complete && k(t.complete, u)
|
|
468
|
+
}) : s = t;
|
|
469
|
+
}
|
|
470
|
+
return o.destination = new _t(s), o;
|
|
471
|
+
}
|
|
472
|
+
return e;
|
|
473
|
+
}(L);
|
|
474
|
+
function I(r) {
|
|
475
|
+
N(r);
|
|
476
|
+
}
|
|
477
|
+
function It(r) {
|
|
478
|
+
throw r;
|
|
479
|
+
}
|
|
480
|
+
var Pt = {
|
|
481
|
+
closed: !0,
|
|
482
|
+
next: q,
|
|
483
|
+
error: It,
|
|
484
|
+
complete: q
|
|
485
|
+
}, D = function() {
|
|
486
|
+
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
487
|
+
}();
|
|
488
|
+
function Ot(r) {
|
|
489
|
+
return r;
|
|
490
|
+
}
|
|
491
|
+
function Ut(r) {
|
|
492
|
+
return r.length === 0 ? Ot : r.length === 1 ? r[0] : function(t) {
|
|
493
|
+
return r.reduce(function(n, i) {
|
|
494
|
+
return i(n);
|
|
495
|
+
}, t);
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
var y = function() {
|
|
499
|
+
function r(e) {
|
|
500
|
+
e && (this._subscribe = e);
|
|
501
|
+
}
|
|
502
|
+
return r.prototype.lift = function(e) {
|
|
503
|
+
var t = new r();
|
|
504
|
+
return t.source = this, t.operator = e, t;
|
|
505
|
+
}, r.prototype.subscribe = function(e, t, n) {
|
|
506
|
+
var i = this, o = Tt(e) ? e : new F(e, t, n);
|
|
507
|
+
return P(function() {
|
|
508
|
+
var s = i, u = s.operator, a = s.source;
|
|
509
|
+
o.add(u ? u.call(o, a) : a ? i._subscribe(o) : i._trySubscribe(o));
|
|
510
|
+
}), o;
|
|
511
|
+
}, r.prototype._trySubscribe = function(e) {
|
|
512
|
+
try {
|
|
513
|
+
return this._subscribe(e);
|
|
514
|
+
} catch (t) {
|
|
515
|
+
e.error(t);
|
|
516
|
+
}
|
|
517
|
+
}, r.prototype.forEach = function(e, t) {
|
|
518
|
+
var n = this;
|
|
519
|
+
return t = z(t), new t(function(i, o) {
|
|
520
|
+
var s = new F({
|
|
521
|
+
next: function(u) {
|
|
522
|
+
try {
|
|
523
|
+
e(u);
|
|
524
|
+
} catch (a) {
|
|
525
|
+
o(a), s.unsubscribe();
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
error: o,
|
|
529
|
+
complete: i
|
|
530
|
+
});
|
|
531
|
+
n.subscribe(s);
|
|
532
|
+
});
|
|
533
|
+
}, r.prototype._subscribe = function(e) {
|
|
534
|
+
var t;
|
|
535
|
+
return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(e);
|
|
536
|
+
}, r.prototype[D] = function() {
|
|
537
|
+
return this;
|
|
538
|
+
}, r.prototype.pipe = function() {
|
|
539
|
+
for (var e = [], t = 0; t < arguments.length; t++)
|
|
540
|
+
e[t] = arguments[t];
|
|
541
|
+
return Ut(e)(this);
|
|
542
|
+
}, r.prototype.toPromise = function(e) {
|
|
543
|
+
var t = this;
|
|
544
|
+
return e = z(e), new e(function(n, i) {
|
|
545
|
+
var o;
|
|
546
|
+
t.subscribe(function(s) {
|
|
547
|
+
return o = s;
|
|
548
|
+
}, function(s) {
|
|
549
|
+
return i(s);
|
|
550
|
+
}, function() {
|
|
551
|
+
return n(o);
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
}, r.create = function(e) {
|
|
555
|
+
return new r(e);
|
|
556
|
+
}, r;
|
|
557
|
+
}();
|
|
558
|
+
function z(r) {
|
|
559
|
+
var e;
|
|
560
|
+
return (e = r ?? Z.Promise) !== null && e !== void 0 ? e : Promise;
|
|
561
|
+
}
|
|
562
|
+
function At(r) {
|
|
563
|
+
return r && h(r.next) && h(r.error) && h(r.complete);
|
|
564
|
+
}
|
|
565
|
+
function Tt(r) {
|
|
566
|
+
return r && r instanceof L || At(r) && X(r);
|
|
567
|
+
}
|
|
568
|
+
function jt(r) {
|
|
569
|
+
return h(r == null ? void 0 : r.lift);
|
|
570
|
+
}
|
|
571
|
+
function V(r) {
|
|
572
|
+
return function(e) {
|
|
573
|
+
if (jt(e))
|
|
574
|
+
return e.lift(function(t) {
|
|
575
|
+
try {
|
|
576
|
+
return r(t, this);
|
|
577
|
+
} catch (n) {
|
|
578
|
+
this.error(n);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
throw new TypeError("Unable to lift unknown Observable type");
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
function tt(r, e, t, n, i) {
|
|
585
|
+
return new kt(r, e, t, n, i);
|
|
586
|
+
}
|
|
587
|
+
var kt = function(r) {
|
|
588
|
+
g(e, r);
|
|
589
|
+
function e(t, n, i, o, s, u) {
|
|
590
|
+
var a = r.call(this, t) || this;
|
|
591
|
+
return a.onFinalize = s, a.shouldUnsubscribe = u, a._next = n ? function(c) {
|
|
592
|
+
try {
|
|
593
|
+
n(c);
|
|
594
|
+
} catch (f) {
|
|
595
|
+
t.error(f);
|
|
596
|
+
}
|
|
597
|
+
} : r.prototype._next, a._error = o ? function(c) {
|
|
598
|
+
try {
|
|
599
|
+
o(c);
|
|
600
|
+
} catch (f) {
|
|
601
|
+
t.error(f);
|
|
602
|
+
} finally {
|
|
603
|
+
this.unsubscribe();
|
|
604
|
+
}
|
|
605
|
+
} : r.prototype._error, a._complete = i ? function() {
|
|
606
|
+
try {
|
|
607
|
+
i();
|
|
608
|
+
} catch (c) {
|
|
609
|
+
t.error(c);
|
|
610
|
+
} finally {
|
|
611
|
+
this.unsubscribe();
|
|
612
|
+
}
|
|
613
|
+
} : r.prototype._complete, a;
|
|
614
|
+
}
|
|
615
|
+
return e.prototype.unsubscribe = function() {
|
|
616
|
+
var t;
|
|
617
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
618
|
+
var n = this.closed;
|
|
619
|
+
r.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
|
|
620
|
+
}
|
|
621
|
+
}, e;
|
|
622
|
+
}(L), $t = Q(function(r) {
|
|
623
|
+
return function() {
|
|
624
|
+
r(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
625
|
+
};
|
|
626
|
+
}), x = function(r) {
|
|
627
|
+
g(e, r);
|
|
628
|
+
function e() {
|
|
629
|
+
var t = r.call(this) || this;
|
|
630
|
+
return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t;
|
|
631
|
+
}
|
|
632
|
+
return e.prototype.lift = function(t) {
|
|
633
|
+
var n = new K(this, this);
|
|
634
|
+
return n.operator = t, n;
|
|
635
|
+
}, e.prototype._throwIfClosed = function() {
|
|
636
|
+
if (this.closed)
|
|
637
|
+
throw new $t();
|
|
638
|
+
}, e.prototype.next = function(t) {
|
|
639
|
+
var n = this;
|
|
640
|
+
P(function() {
|
|
641
|
+
var i, o;
|
|
642
|
+
if (n._throwIfClosed(), !n.isStopped) {
|
|
643
|
+
n.currentObservers || (n.currentObservers = Array.from(n.observers));
|
|
644
|
+
try {
|
|
645
|
+
for (var s = S(n.currentObservers), u = s.next(); !u.done; u = s.next()) {
|
|
646
|
+
var a = u.value;
|
|
647
|
+
a.next(t);
|
|
648
|
+
}
|
|
649
|
+
} catch (c) {
|
|
650
|
+
i = { error: c };
|
|
651
|
+
} finally {
|
|
652
|
+
try {
|
|
653
|
+
u && !u.done && (o = s.return) && o.call(s);
|
|
654
|
+
} finally {
|
|
655
|
+
if (i)
|
|
656
|
+
throw i.error;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
}, e.prototype.error = function(t) {
|
|
662
|
+
var n = this;
|
|
663
|
+
P(function() {
|
|
664
|
+
if (n._throwIfClosed(), !n.isStopped) {
|
|
665
|
+
n.hasError = n.isStopped = !0, n.thrownError = t;
|
|
666
|
+
for (var i = n.observers; i.length; )
|
|
667
|
+
i.shift().error(t);
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
}, e.prototype.complete = function() {
|
|
671
|
+
var t = this;
|
|
672
|
+
P(function() {
|
|
673
|
+
if (t._throwIfClosed(), !t.isStopped) {
|
|
674
|
+
t.isStopped = !0;
|
|
675
|
+
for (var n = t.observers; n.length; )
|
|
676
|
+
n.shift().complete();
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
}, e.prototype.unsubscribe = function() {
|
|
680
|
+
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
|
|
681
|
+
}, Object.defineProperty(e.prototype, "observed", {
|
|
682
|
+
get: function() {
|
|
683
|
+
var t;
|
|
684
|
+
return ((t = this.observers) === null || t === void 0 ? void 0 : t.length) > 0;
|
|
685
|
+
},
|
|
686
|
+
enumerable: !1,
|
|
687
|
+
configurable: !0
|
|
688
|
+
}), e.prototype._trySubscribe = function(t) {
|
|
689
|
+
return this._throwIfClosed(), r.prototype._trySubscribe.call(this, t);
|
|
690
|
+
}, e.prototype._subscribe = function(t) {
|
|
691
|
+
return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
|
|
692
|
+
}, e.prototype._innerSubscribe = function(t) {
|
|
693
|
+
var n = this, i = this, o = i.hasError, s = i.isStopped, u = i.observers;
|
|
694
|
+
return o || s ? W : (this.currentObservers = null, u.push(t), new A(function() {
|
|
695
|
+
n.currentObservers = null, C(u, t);
|
|
696
|
+
}));
|
|
697
|
+
}, e.prototype._checkFinalizedStatuses = function(t) {
|
|
698
|
+
var n = this, i = n.hasError, o = n.thrownError, s = n.isStopped;
|
|
699
|
+
i ? t.error(o) : s && t.complete();
|
|
700
|
+
}, e.prototype.asObservable = function() {
|
|
701
|
+
var t = new y();
|
|
702
|
+
return t.source = this, t;
|
|
703
|
+
}, e.create = function(t, n) {
|
|
704
|
+
return new K(t, n);
|
|
705
|
+
}, e;
|
|
706
|
+
}(y), K = function(r) {
|
|
707
|
+
g(e, r);
|
|
708
|
+
function e(t, n) {
|
|
709
|
+
var i = r.call(this) || this;
|
|
710
|
+
return i.destination = t, i.source = n, i;
|
|
711
|
+
}
|
|
712
|
+
return e.prototype.next = function(t) {
|
|
713
|
+
var n, i;
|
|
714
|
+
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.next) === null || i === void 0 || i.call(n, t);
|
|
715
|
+
}, e.prototype.error = function(t) {
|
|
716
|
+
var n, i;
|
|
717
|
+
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.error) === null || i === void 0 || i.call(n, t);
|
|
718
|
+
}, e.prototype.complete = function() {
|
|
719
|
+
var t, n;
|
|
720
|
+
(n = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || n === void 0 || n.call(t);
|
|
721
|
+
}, e.prototype._subscribe = function(t) {
|
|
722
|
+
var n, i;
|
|
723
|
+
return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && i !== void 0 ? i : W;
|
|
724
|
+
}, e;
|
|
725
|
+
}(x), rt = function(r) {
|
|
726
|
+
g(e, r);
|
|
727
|
+
function e(t) {
|
|
728
|
+
var n = r.call(this) || this;
|
|
729
|
+
return n._value = t, n;
|
|
730
|
+
}
|
|
731
|
+
return Object.defineProperty(e.prototype, "value", {
|
|
732
|
+
get: function() {
|
|
733
|
+
return this.getValue();
|
|
734
|
+
},
|
|
735
|
+
enumerable: !1,
|
|
736
|
+
configurable: !0
|
|
737
|
+
}), e.prototype._subscribe = function(t) {
|
|
738
|
+
var n = r.prototype._subscribe.call(this, t);
|
|
739
|
+
return !n.closed && t.next(this._value), n;
|
|
740
|
+
}, e.prototype.getValue = function() {
|
|
741
|
+
var t = this, n = t.hasError, i = t.thrownError, o = t._value;
|
|
742
|
+
if (n)
|
|
743
|
+
throw i;
|
|
744
|
+
return this._throwIfClosed(), o;
|
|
745
|
+
}, e.prototype.next = function(t) {
|
|
746
|
+
r.prototype.next.call(this, this._value = t);
|
|
747
|
+
}, e;
|
|
748
|
+
}(x), Ct = new y(function(r) {
|
|
749
|
+
return r.complete();
|
|
750
|
+
});
|
|
751
|
+
function Rt(r) {
|
|
752
|
+
return r && h(r.schedule);
|
|
753
|
+
}
|
|
754
|
+
function Ft(r) {
|
|
755
|
+
return r[r.length - 1];
|
|
756
|
+
}
|
|
757
|
+
function Lt(r) {
|
|
758
|
+
return Rt(Ft(r)) ? r.pop() : void 0;
|
|
759
|
+
}
|
|
760
|
+
var et = function(r) {
|
|
761
|
+
return r && typeof r.length == "number" && typeof r != "function";
|
|
762
|
+
};
|
|
763
|
+
function nt(r) {
|
|
764
|
+
return h(r == null ? void 0 : r.then);
|
|
765
|
+
}
|
|
766
|
+
function it(r) {
|
|
767
|
+
return h(r[D]);
|
|
768
|
+
}
|
|
769
|
+
function ot(r) {
|
|
770
|
+
return Symbol.asyncIterator && h(r == null ? void 0 : r[Symbol.asyncIterator]);
|
|
771
|
+
}
|
|
772
|
+
function st(r) {
|
|
773
|
+
return new TypeError("You provided " + (r !== null && typeof r == "object" ? "an invalid object" : "'" + r + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
774
|
+
}
|
|
775
|
+
function Dt() {
|
|
776
|
+
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
777
|
+
}
|
|
778
|
+
var ut = Dt();
|
|
779
|
+
function ct(r) {
|
|
780
|
+
return h(r == null ? void 0 : r[ut]);
|
|
781
|
+
}
|
|
782
|
+
function at(r) {
|
|
783
|
+
return gt(this, arguments, function() {
|
|
784
|
+
var t, n, i, o;
|
|
785
|
+
return J(this, function(s) {
|
|
786
|
+
switch (s.label) {
|
|
787
|
+
case 0:
|
|
788
|
+
t = r.getReader(), s.label = 1;
|
|
789
|
+
case 1:
|
|
790
|
+
s.trys.push([1, , 9, 10]), s.label = 2;
|
|
791
|
+
case 2:
|
|
792
|
+
return [4, w(t.read())];
|
|
793
|
+
case 3:
|
|
794
|
+
return n = s.sent(), i = n.value, o = n.done, o ? [4, w(void 0)] : [3, 5];
|
|
795
|
+
case 4:
|
|
796
|
+
return [2, s.sent()];
|
|
797
|
+
case 5:
|
|
798
|
+
return [4, w(i)];
|
|
799
|
+
case 6:
|
|
800
|
+
return [4, s.sent()];
|
|
801
|
+
case 7:
|
|
802
|
+
return s.sent(), [3, 2];
|
|
803
|
+
case 8:
|
|
804
|
+
return [3, 10];
|
|
805
|
+
case 9:
|
|
806
|
+
return t.releaseLock(), [7];
|
|
807
|
+
case 10:
|
|
808
|
+
return [2];
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
function lt(r) {
|
|
814
|
+
return h(r == null ? void 0 : r.getReader);
|
|
815
|
+
}
|
|
816
|
+
function Y(r) {
|
|
817
|
+
if (r instanceof y)
|
|
818
|
+
return r;
|
|
819
|
+
if (r != null) {
|
|
820
|
+
if (it(r))
|
|
821
|
+
return Vt(r);
|
|
822
|
+
if (et(r))
|
|
823
|
+
return Yt(r);
|
|
824
|
+
if (nt(r))
|
|
825
|
+
return Bt(r);
|
|
826
|
+
if (ot(r))
|
|
827
|
+
return ft(r);
|
|
828
|
+
if (ct(r))
|
|
829
|
+
return Mt(r);
|
|
830
|
+
if (lt(r))
|
|
831
|
+
return Gt(r);
|
|
832
|
+
}
|
|
833
|
+
throw st(r);
|
|
834
|
+
}
|
|
835
|
+
function Vt(r) {
|
|
836
|
+
return new y(function(e) {
|
|
837
|
+
var t = r[D]();
|
|
838
|
+
if (h(t.subscribe))
|
|
839
|
+
return t.subscribe(e);
|
|
840
|
+
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
function Yt(r) {
|
|
844
|
+
return new y(function(e) {
|
|
845
|
+
for (var t = 0; t < r.length && !e.closed; t++)
|
|
846
|
+
e.next(r[t]);
|
|
847
|
+
e.complete();
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
function Bt(r) {
|
|
851
|
+
return new y(function(e) {
|
|
852
|
+
r.then(function(t) {
|
|
853
|
+
e.closed || (e.next(t), e.complete());
|
|
854
|
+
}, function(t) {
|
|
855
|
+
return e.error(t);
|
|
856
|
+
}).then(null, N);
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
function Mt(r) {
|
|
860
|
+
return new y(function(e) {
|
|
861
|
+
var t, n;
|
|
862
|
+
try {
|
|
863
|
+
for (var i = S(r), o = i.next(); !o.done; o = i.next()) {
|
|
864
|
+
var s = o.value;
|
|
865
|
+
if (e.next(s), e.closed)
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
} catch (u) {
|
|
869
|
+
t = { error: u };
|
|
870
|
+
} finally {
|
|
871
|
+
try {
|
|
872
|
+
o && !o.done && (n = i.return) && n.call(i);
|
|
873
|
+
} finally {
|
|
874
|
+
if (t)
|
|
875
|
+
throw t.error;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
e.complete();
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
function ft(r) {
|
|
882
|
+
return new y(function(e) {
|
|
883
|
+
Ht(r, e).catch(function(t) {
|
|
884
|
+
return e.error(t);
|
|
885
|
+
});
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
function Gt(r) {
|
|
889
|
+
return ft(at(r));
|
|
890
|
+
}
|
|
891
|
+
function Ht(r, e) {
|
|
892
|
+
var t, n, i, o;
|
|
893
|
+
return St(this, void 0, void 0, function() {
|
|
894
|
+
var s, u;
|
|
895
|
+
return J(this, function(a) {
|
|
896
|
+
switch (a.label) {
|
|
897
|
+
case 0:
|
|
898
|
+
a.trys.push([0, 5, 6, 11]), t = xt(r), a.label = 1;
|
|
899
|
+
case 1:
|
|
900
|
+
return [4, t.next()];
|
|
901
|
+
case 2:
|
|
902
|
+
if (n = a.sent(), !!n.done)
|
|
903
|
+
return [3, 4];
|
|
904
|
+
if (s = n.value, e.next(s), e.closed)
|
|
905
|
+
return [2];
|
|
906
|
+
a.label = 3;
|
|
907
|
+
case 3:
|
|
908
|
+
return [3, 1];
|
|
909
|
+
case 4:
|
|
910
|
+
return [3, 11];
|
|
911
|
+
case 5:
|
|
912
|
+
return u = a.sent(), i = { error: u }, [3, 11];
|
|
913
|
+
case 6:
|
|
914
|
+
return a.trys.push([6, , 9, 10]), n && !n.done && (o = t.return) ? [4, o.call(t)] : [3, 8];
|
|
915
|
+
case 7:
|
|
916
|
+
a.sent(), a.label = 8;
|
|
917
|
+
case 8:
|
|
918
|
+
return [3, 10];
|
|
919
|
+
case 9:
|
|
920
|
+
if (i)
|
|
921
|
+
throw i.error;
|
|
922
|
+
return [7];
|
|
923
|
+
case 10:
|
|
924
|
+
return [7];
|
|
925
|
+
case 11:
|
|
926
|
+
return e.complete(), [2];
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
function m(r, e, t, n, i) {
|
|
932
|
+
n === void 0 && (n = 0), i === void 0 && (i = !1);
|
|
933
|
+
var o = e.schedule(function() {
|
|
934
|
+
t(), i ? r.add(this.schedule(null, n)) : this.unsubscribe();
|
|
935
|
+
}, n);
|
|
936
|
+
if (r.add(o), !i)
|
|
937
|
+
return o;
|
|
938
|
+
}
|
|
939
|
+
function ht(r, e) {
|
|
940
|
+
return e === void 0 && (e = 0), V(function(t, n) {
|
|
941
|
+
t.subscribe(tt(n, function(i) {
|
|
942
|
+
return m(n, r, function() {
|
|
943
|
+
return n.next(i);
|
|
944
|
+
}, e);
|
|
945
|
+
}, function() {
|
|
946
|
+
return m(n, r, function() {
|
|
947
|
+
return n.complete();
|
|
948
|
+
}, e);
|
|
949
|
+
}, function(i) {
|
|
950
|
+
return m(n, r, function() {
|
|
951
|
+
return n.error(i);
|
|
952
|
+
}, e);
|
|
953
|
+
}));
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
function pt(r, e) {
|
|
957
|
+
return e === void 0 && (e = 0), V(function(t, n) {
|
|
958
|
+
n.add(r.schedule(function() {
|
|
959
|
+
return t.subscribe(n);
|
|
960
|
+
}, e));
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
function qt(r, e) {
|
|
964
|
+
return Y(r).pipe(pt(e), ht(e));
|
|
965
|
+
}
|
|
966
|
+
function zt(r, e) {
|
|
967
|
+
return Y(r).pipe(pt(e), ht(e));
|
|
968
|
+
}
|
|
969
|
+
function Kt(r, e) {
|
|
970
|
+
return new y(function(t) {
|
|
971
|
+
var n = 0;
|
|
972
|
+
return e.schedule(function() {
|
|
973
|
+
n === r.length ? t.complete() : (t.next(r[n++]), t.closed || this.schedule());
|
|
974
|
+
});
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
function Jt(r, e) {
|
|
978
|
+
return new y(function(t) {
|
|
979
|
+
var n;
|
|
980
|
+
return m(t, e, function() {
|
|
981
|
+
n = r[ut](), m(t, e, function() {
|
|
982
|
+
var i, o, s;
|
|
983
|
+
try {
|
|
984
|
+
i = n.next(), o = i.value, s = i.done;
|
|
985
|
+
} catch (u) {
|
|
986
|
+
t.error(u);
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
s ? t.complete() : t.next(o);
|
|
990
|
+
}, 0, !0);
|
|
991
|
+
}), function() {
|
|
992
|
+
return h(n == null ? void 0 : n.return) && n.return();
|
|
993
|
+
};
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
function dt(r, e) {
|
|
997
|
+
if (!r)
|
|
998
|
+
throw new Error("Iterable cannot be null");
|
|
999
|
+
return new y(function(t) {
|
|
1000
|
+
m(t, e, function() {
|
|
1001
|
+
var n = r[Symbol.asyncIterator]();
|
|
1002
|
+
m(t, e, function() {
|
|
1003
|
+
n.next().then(function(i) {
|
|
1004
|
+
i.done ? t.complete() : t.next(i.value);
|
|
1005
|
+
});
|
|
1006
|
+
}, 0, !0);
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
function Qt(r, e) {
|
|
1011
|
+
return dt(at(r), e);
|
|
1012
|
+
}
|
|
1013
|
+
function Wt(r, e) {
|
|
1014
|
+
if (r != null) {
|
|
1015
|
+
if (it(r))
|
|
1016
|
+
return qt(r, e);
|
|
1017
|
+
if (et(r))
|
|
1018
|
+
return Kt(r, e);
|
|
1019
|
+
if (nt(r))
|
|
1020
|
+
return zt(r, e);
|
|
1021
|
+
if (ot(r))
|
|
1022
|
+
return dt(r, e);
|
|
1023
|
+
if (ct(r))
|
|
1024
|
+
return Jt(r, e);
|
|
1025
|
+
if (lt(r))
|
|
1026
|
+
return Qt(r, e);
|
|
1027
|
+
}
|
|
1028
|
+
throw st(r);
|
|
1029
|
+
}
|
|
1030
|
+
function Xt(r, e) {
|
|
1031
|
+
return e ? Wt(r, e) : Y(r);
|
|
1032
|
+
}
|
|
1033
|
+
function Zt() {
|
|
1034
|
+
for (var r = [], e = 0; e < arguments.length; e++)
|
|
1035
|
+
r[e] = arguments[e];
|
|
1036
|
+
var t = Lt(r);
|
|
1037
|
+
return Xt(r, t);
|
|
1038
|
+
}
|
|
1039
|
+
function Nt(r) {
|
|
1040
|
+
return r <= 0 ? function() {
|
|
1041
|
+
return Ct;
|
|
1042
|
+
} : V(function(e, t) {
|
|
1043
|
+
var n = 0;
|
|
1044
|
+
e.subscribe(tt(t, function(i) {
|
|
1045
|
+
++n <= r && (t.next(i), r <= n && t.complete());
|
|
1046
|
+
}));
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
class tr {
|
|
1050
|
+
constructor(e, t) {
|
|
1051
|
+
this.id = e, this.entries$ = new rt([]), t.addEventListener("user-submit", (n) => {
|
|
1052
|
+
if (!this.provider) {
|
|
1053
|
+
console.warn(
|
|
1054
|
+
"No provider activated, unable to print message to conversation."
|
|
1055
|
+
);
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
this.provider.onUserSubmit(n.detail);
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
write(e) {
|
|
1062
|
+
this.entries$.pipe(Nt(1)).subscribe((t) => {
|
|
1063
|
+
this.entries$.next([...t, e]);
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
entries() {
|
|
1067
|
+
return this.entries$.asObservable();
|
|
1068
|
+
}
|
|
1069
|
+
setProvider(e) {
|
|
1070
|
+
this.provider = e, this.provider.actions().subscribe((t) => {
|
|
1071
|
+
this.write(t);
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
isTyping() {
|
|
1075
|
+
return this.provider ? this.provider.isTyping() : Zt(!1);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
class B {
|
|
1079
|
+
constructor() {
|
|
1080
|
+
this.sessions = /* @__PURE__ */ new Map(), this.registeredProviders = /* @__PURE__ */ new Map(), this.activeSessionId = null;
|
|
1081
|
+
}
|
|
1082
|
+
static async getInstance(e) {
|
|
1083
|
+
let t = await e.get("conversation");
|
|
1084
|
+
return t || (t = new B(), await e.register("conversation", t), t);
|
|
1085
|
+
}
|
|
1086
|
+
registerProvider(e, t) {
|
|
1087
|
+
this.registeredProviders.set(e, t);
|
|
1088
|
+
}
|
|
1089
|
+
createSession(e) {
|
|
1090
|
+
const t = new tr(wt(), e), n = this.getProviderByConfiguration(e);
|
|
1091
|
+
if (n) {
|
|
1092
|
+
const i = n();
|
|
1093
|
+
t.setProvider(i);
|
|
1094
|
+
}
|
|
1095
|
+
return this.sessions.set(t.id, t), this.activeSessionId = t.id, t;
|
|
1096
|
+
}
|
|
1097
|
+
getProviderByConfiguration(e) {
|
|
1098
|
+
const [t] = e.properties.providers || [];
|
|
1099
|
+
if (!t) {
|
|
1100
|
+
console.warn(
|
|
1101
|
+
"No providers registered. You most likely forgot to add a provider to the conversation component properties."
|
|
1102
|
+
);
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
return this.registeredProviders.get(t);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
var T = /* @__PURE__ */ ((r) => (r.User = "user", r.Agent = "agent", r.System = "system", r))(T || {});
|
|
1109
|
+
class M {
|
|
1110
|
+
constructor(e, t, n) {
|
|
1111
|
+
this.type = e, this.sender = t, this.messages = n, this.didUpdate = new x(), this.timestamp = Date.now();
|
|
1112
|
+
}
|
|
1113
|
+
update(e) {
|
|
1114
|
+
this.messages = [
|
|
1115
|
+
{
|
|
1116
|
+
items: e
|
|
1117
|
+
}
|
|
1118
|
+
], this.didUpdate.next(this);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
class rr {
|
|
1122
|
+
constructor(e) {
|
|
1123
|
+
this.name = e, this.print$ = new x();
|
|
1124
|
+
}
|
|
1125
|
+
print(e) {
|
|
1126
|
+
const t = new M(
|
|
1127
|
+
T.Agent,
|
|
1128
|
+
{ name: this.name },
|
|
1129
|
+
[
|
|
1130
|
+
{
|
|
1131
|
+
items: [["html", { content: e }]]
|
|
1132
|
+
}
|
|
1133
|
+
]
|
|
1134
|
+
);
|
|
1135
|
+
return this.print$.next(t), t;
|
|
1136
|
+
}
|
|
1137
|
+
subscribe() {
|
|
1138
|
+
return this.print$.asObservable();
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
class er {
|
|
1142
|
+
constructor(e) {
|
|
1143
|
+
this.name = e, this.print$ = new x();
|
|
1144
|
+
}
|
|
1145
|
+
print(e) {
|
|
1146
|
+
const t = new M(
|
|
1147
|
+
T.User,
|
|
1148
|
+
{ name: this.name },
|
|
1149
|
+
[
|
|
1150
|
+
{
|
|
1151
|
+
items: [["html", { content: e }]]
|
|
1152
|
+
}
|
|
1153
|
+
]
|
|
1154
|
+
);
|
|
1155
|
+
return this.print$.next(t), t;
|
|
1156
|
+
}
|
|
1157
|
+
subscribe() {
|
|
1158
|
+
return this.print$.asObservable();
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
class nr {
|
|
1162
|
+
constructor(e) {
|
|
1163
|
+
this.name = e, this.print$ = new x(), this.typingState$ = new rt(!1);
|
|
1164
|
+
}
|
|
1165
|
+
onUserSubmit(e) {
|
|
1166
|
+
this.print(T.User, e.text);
|
|
1167
|
+
}
|
|
1168
|
+
print(e, t) {
|
|
1169
|
+
const n = new M(
|
|
1170
|
+
e,
|
|
1171
|
+
{
|
|
1172
|
+
name: ""
|
|
1173
|
+
},
|
|
1174
|
+
[
|
|
1175
|
+
{
|
|
1176
|
+
items: [["html", { content: t }]]
|
|
1177
|
+
}
|
|
1178
|
+
]
|
|
1179
|
+
);
|
|
1180
|
+
return this.printEntry(n);
|
|
1181
|
+
}
|
|
1182
|
+
printEntry(e) {
|
|
1183
|
+
return this.print$.next(e), e;
|
|
1184
|
+
}
|
|
1185
|
+
createAgent(e) {
|
|
1186
|
+
const t = new rr(e);
|
|
1187
|
+
return t.subscribe().subscribe((n) => {
|
|
1188
|
+
this.printEntry(n);
|
|
1189
|
+
}), t;
|
|
1190
|
+
}
|
|
1191
|
+
createUser(e) {
|
|
1192
|
+
const t = new er(e);
|
|
1193
|
+
return t.subscribe().subscribe((n) => {
|
|
1194
|
+
this.printEntry(n);
|
|
1195
|
+
}), t;
|
|
1196
|
+
}
|
|
1197
|
+
setTypingState(e) {
|
|
1198
|
+
this.typingState$.next(e);
|
|
1199
|
+
}
|
|
1200
|
+
isTyping() {
|
|
1201
|
+
return this.typingState$.asObservable();
|
|
1202
|
+
}
|
|
1203
|
+
actions() {
|
|
1204
|
+
return this.print$.asObservable();
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
class ir extends nr {
|
|
1208
|
+
constructor(e) {
|
|
1209
|
+
super(e), this.agent = this.createAgent(""), this.user = this.createUser("");
|
|
1210
|
+
}
|
|
1211
|
+
printAgent(e) {
|
|
1212
|
+
const t = this.agent.print(e);
|
|
1213
|
+
return this.setTypingState(!1), t;
|
|
1214
|
+
}
|
|
1215
|
+
onUserSubmit(e) {
|
|
1216
|
+
this.user.print(e.text);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
const or = async (r) => {
|
|
1220
|
+
const e = await B.getInstance(r.container);
|
|
1221
|
+
e == null || e.registerProvider(
|
|
1222
|
+
"ace-conversational-hub-provider",
|
|
1223
|
+
() => new ir("ace-chat")
|
|
1224
|
+
);
|
|
1225
|
+
};
|
|
1226
|
+
export {
|
|
1227
|
+
or as ChatProviderPlugin
|
|
1228
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telia-ace/ace-chat-flamingo",
|
|
3
|
+
"version": "1.1.18-rc.4",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@telia-ace/widget-core-flamingo": "1.1.18-rc.4",
|
|
6
|
+
"@telia-ace/widget-conversation-flamingo": "1.1.18-rc.4"
|
|
7
|
+
},
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"module": "./index.mjs",
|
|
10
|
+
"typings": "./index.d.ts",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"registry": "https://registry.npmjs.org"
|
|
14
|
+
},
|
|
15
|
+
"private": false
|
|
16
|
+
}
|
package/plugin.d.ts
ADDED
package/provider.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConversationEntry, ConversationProvider } from '@telia-ace/widget-conversation-flamingo';
|
|
2
|
+
export declare class ChatProvider extends ConversationProvider {
|
|
3
|
+
private agent;
|
|
4
|
+
private user;
|
|
5
|
+
constructor(name: string);
|
|
6
|
+
printAgent(text: string): ConversationEntry;
|
|
7
|
+
onUserSubmit(action: {
|
|
8
|
+
text: string;
|
|
9
|
+
}): void;
|
|
10
|
+
}
|