isdata-customer-sdk 0.1.69 → 0.1.70

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.
@@ -23,5 +23,5 @@ return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();functio
23
23
 
24
24
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
25
  */
26
- return function(){var e=t,n=e.lib,r=n.WordArray,i=n.Hasher,o=e.algo,a=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),s=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),f=r.create([0,1518500249,1859775393,2400959708,2840853838]),l=r.create([1352829926,1548603684,1836072691,2053994217,0]),h=o.RIPEMD160=i.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var r=e+n,i=t[r];t[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,h,w,m,b,x,I,A,S,D,B,k=this._hash.words,C=f.words,E=l.words,O=a.words,j=u.words,R=s.words,P=c.words;x=o=k[0],I=h=k[1],A=w=k[2],S=m=k[3],D=b=k[4];for(n=0;n<80;n+=1)B=o+t[e+O[n]]|0,B+=n<16?p(h,w,m)+C[0]:n<32?d(h,w,m)+C[1]:n<48?v(h,w,m)+C[2]:n<64?g(h,w,m)+C[3]:y(h,w,m)+C[4],B|=0,B=_(B,R[n]),B=B+b|0,o=b,b=m,m=_(w,10),w=h,h=B,B=x+t[e+j[n]]|0,B+=n<16?y(I,A,S)+E[0]:n<32?g(I,A,S)+E[1]:n<48?v(I,A,S)+E[2]:n<64?d(I,A,S)+E[3]:p(I,A,S)+E[4],B|=0,B=_(B,P[n]),B=B+D|0,x=D,D=S,S=_(A,10),A=I,I=B;B=k[1]+w+S|0,k[1]=k[2]+m+D|0,k[2]=k[3]+b+x|0,k[3]=k[4]+o+I|0,k[4]=k[0]+h+A|0,k[0]=B},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,o=i.words,a=0;a<5;a++){var u=o[a];o[a]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return i},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,n){return t^e^n}function d(t,e,n){return t&e|~t&n}function v(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function y(t,e,n){return t^(e|~n)}function _(t,e){return t<<e|t>>>32-e}e.RIPEMD160=i._createHelper(h),e.HmacRIPEMD160=i._createHmacHelper(h)}(Math),t.RIPEMD160}))},8111:function(t,e,n){"use strict";var r=n(6518),i=n(4576),o=n(679),a=n(8551),u=n(4901),s=n(2787),c=n(2106),f=n(4659),l=n(9039),h=n(9297),p=n(8227),d=n(7657).IteratorPrototype,v=n(3724),g=n(6395),y="constructor",_="Iterator",w=p("toStringTag"),m=TypeError,b=i[_],x=g||!u(b)||b.prototype!==d||!l((function(){b({})})),I=function(){if(o(this,d),s(this)===d)throw new m("Abstract class Iterator not directly constructable")},A=function(t,e){v?c(d,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===d)throw new m("You can't redefine this property");h(this,t)?this[t]=e:f(this,t,e)}}):d[t]=e};h(d,w)||A(w,_),!x&&h(d,y)&&d[y]!==Object||A(y,I),I.prototype=d,r({global:!0,constructor:!0,forced:x},{Iterator:I})},8124:function(t,e,n){(function(e,r){t.exports=r(n(9021),n(7165))})(0,(function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}))},8227:function(t,e,n){"use strict";var r=n(4576),i=n(5745),o=n(9297),a=n(3392),u=n(4495),s=n(7040),c=r.Symbol,f=i("wks"),l=s?c["for"]||c:c&&c.withoutSetter||a;t.exports=function(t){return o(f,t)||(f[t]=u&&o(c,t)?c[t]:l("Symbol."+t)),f[t]}},8454:function(t,e,n){(function(e,r){t.exports=r(n(9021),n(7165))})(0,(function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e}(),t.mode.ECB}))},8480:function(t,e,n){"use strict";var r=n(1828),i=n(8727),o=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},8551:function(t,e,n){"use strict";var r=n(34),i=String,o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not an object")}},8622:function(t,e,n){"use strict";var r=n(4576),i=n(4901),o=r.WeakMap;t.exports=i(o)&&/native code/.test(String(o))},8686:function(t,e,n){"use strict";var r=n(3724),i=n(9039);t.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8727:function(t){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8773:function(t,e){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);e.f=i?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},8981:function(t,e,n){"use strict";var r=n(7750),i=Object;t.exports=function(t){return i(r(t))}},9012:function(t){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},9021:function(t,e,n){(function(e,n){t.exports=n()})(0,(function(){var t=t||function(t,e){var r;if("undefined"!==typeof window&&window.crypto&&(r=window.crypto),"undefined"!==typeof self&&self.crypto&&(r=self.crypto),"undefined"!==typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!==typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&"undefined"!==typeof n.g&&n.g.crypto&&(r=n.g.crypto),!r)try{r=n(477)}catch(g){}var i=function(){if(r){if("function"===typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(g){}if("function"===typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(g){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),a={},u=a.lib={},s=u.Base=function(){return{extend:function(t){var e=o(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),c=u.WordArray=s.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var a=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var u=0;u<i;u+=4)e[r+u>>>2]=n[u>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=s.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(i());return new c.init(e,t)}}),f=a.enc={},l=f.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new c.init(n,e/2)}},h=f.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new c.init(n,e)}},p=f.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},d=u.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,i=r.words,o=r.sigBytes,a=this.blockSize,u=4*a,s=o/u;s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0);var f=s*a,l=t.min(4*f,o);if(f){for(var h=0;h<f;h+=a)this._doProcessBlock(i,h);n=i.splice(0,f),r.sigBytes-=l}return new c.init(n,l)},clone:function(){var t=s.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),v=(u.Hasher=d.extend({cfg:s.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new v.HMAC.init(t,n).finalize(e)}}}),a.algo={});return a}(Math);return t}))},9039:function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},9106:function(t,e,n){"use strict";var r=n(9516);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(r.isURLSearchParams(e))o=e.toString();else{var a=[];r.forEach(e,(function(t,e){null!==t&&"undefined"!==typeof t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,(function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),a.push(i(e)+"="+i(t))})))})),o=a.join("&")}if(o){var u=t.indexOf("#");-1!==u&&(t=t.slice(0,u)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},9137:function(t){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},9297:function(t,e,n){"use strict";var r=n(9504),i=n(8981),o=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(i(t),e)}},9306:function(t,e,n){"use strict";var r=n(4901),i=n(6823),o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not a function")}},9433:function(t,e,n){"use strict";var r=n(4576),i=Object.defineProperty;t.exports=function(t,e){try{i(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},9462:function(t,e,n){"use strict";var r=n(9565),i=n(2360),o=n(6699),a=n(6279),u=n(8227),s=n(1181),c=n(5966),f=n(7657).IteratorPrototype,l=n(2529),h=n(9539),p=u("toStringTag"),d="IteratorHelper",v="WrapForValidIterator",g=s.set,y=function(t){var e=s.getterFor(t?v:d);return a(i(f),{next:function(){var n=e(this);if(t)return n.nextHandler();if(n.done)return l(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:l(r,n.done)}catch(i){throw n.done=!0,i}},return:function(){var n=e(this),i=n.iterator;if(n.done=!0,t){var o=c(i,"return");return o?r(o,i):l(void 0,!0)}if(n.inner)try{h(n.inner.iterator,"normal")}catch(a){return h(i,"throw",a)}return i&&h(i,"normal"),l(void 0,!0)}})},_=y(!0),w=y(!1);o(w,p,"Iterator Helper"),t.exports=function(t,e,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=e?v:d,i.returnHandlerResult=!!n,i.nextHandler=t,i.counter=0,i.done=!1,g(this,i)};return r.prototype=e?_:w,r}},9504:function(t,e,n){"use strict";var r=n(616),i=Function.prototype,o=i.call,a=r&&i.bind.bind(o,o);t.exports=r?a:function(t){return function(){return o.apply(t,arguments)}}},9506:function(t,e,n){(function(e,r){t.exports=r(n(9021),n(5471),n(1025))})(0,(function(t){return function(){var e=t,n=e.lib,r=n.Base,i=n.WordArray,o=e.algo,a=o.MD5,u=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var n,r=this.cfg,o=r.hasher.create(),a=i.create(),u=a.words,s=r.keySize,c=r.iterations;while(u.length<s){n&&o.update(n),n=o.update(t).finalize(e),o.reset();for(var f=1;f<c;f++)n=o.finalize(n),o.reset();a.concat(n)}return a.sigBytes=4*s,a}});e.EvpKDF=function(t,e,n){return u.create(n).compute(t,e)}}(),t.EvpKDF}))},9516:function(t,e,n){"use strict";var r=n(9012),i=Object.prototype.toString;function o(t){return"[object Array]"===i.call(t)}function a(t){return"undefined"===typeof t}function u(t){return null!==t&&!a(t)&&null!==t.constructor&&!a(t.constructor)&&"function"===typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function s(t){return"[object ArrayBuffer]"===i.call(t)}function c(t){return"undefined"!==typeof FormData&&t instanceof FormData}function f(t){var e;return e="undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function l(t){return"string"===typeof t}function h(t){return"number"===typeof t}function p(t){return null!==t&&"object"===typeof t}function d(t){if("[object Object]"!==i.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function v(t){return"[object Date]"===i.call(t)}function g(t){return"[object File]"===i.call(t)}function y(t){return"[object Blob]"===i.call(t)}function _(t){return"[object Function]"===i.call(t)}function w(t){return p(t)&&_(t.pipe)}function m(t){return"undefined"!==typeof URLSearchParams&&t instanceof URLSearchParams}function b(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function x(){return("undefined"===typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!==typeof window&&"undefined"!==typeof document)}function I(t,e){if(null!==t&&"undefined"!==typeof t)if("object"!==typeof t&&(t=[t]),o(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function A(){var t={};function e(e,n){d(t[n])&&d(e)?t[n]=A(t[n],e):d(e)?t[n]=A({},e):o(e)?t[n]=e.slice():t[n]=e}for(var n=0,r=arguments.length;n<r;n++)I(arguments[n],e);return t}function S(t,e,n){return I(e,(function(e,i){t[i]=n&&"function"===typeof e?r(e,n):e})),t}function D(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}t.exports={isArray:o,isArrayBuffer:s,isBuffer:u,isFormData:c,isArrayBufferView:f,isString:l,isNumber:h,isObject:p,isPlainObject:d,isUndefined:a,isDate:v,isFile:g,isBlob:y,isFunction:_,isStream:w,isURLSearchParams:m,isStandardBrowserEnv:x,forEach:I,merge:A,extend:S,trim:b,stripBOM:D}},9519:function(t,e,n){"use strict";var r,i,o=n(4576),a=n(2839),u=o.process,s=o.Deno,c=u&&u.versions||s&&s.version,f=c&&c.v8;f&&(r=f.split("."),i=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(r=a.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/),r&&(i=+r[1]))),t.exports=i},9539:function(t,e,n){"use strict";var r=n(9565),i=n(8551),o=n(5966);t.exports=function(t,e,n){var a,u;i(t);try{if(a=o(t,"return"),!a){if("throw"===e)throw n;return n}a=r(a,t)}catch(s){u=!0,a=s}if("throw"===e)throw n;if(u)throw a;return i(a),n}},9547:function(t,e,n){"use strict";n(4114),n(8111),n(7588);var r=n(2543),i=n.n(r);class o{constructor(){this.__listeners={}}register(...t){let e,n;3==t.length?(e=`${t[0]}-${t[1]}`,n=t[2]):(e=t[0],n=t[1]),this.__listeners[e]=this.__listeners[e]||[],this.__listeners[e].push({callback:n})}fireEvent(...t){let e,n;3==t.length?(e=`${t[0]}-${t[1]}`,n=t[2]):(e=t[0],n=t[1]);let r=this.__listeners[e]||[],o=!0;return i().forEach(r,(t=>{let e=t.callback,r=e.call(null,n);if(!1===r)return o=!1,!1})),o}unregister(...t){let e,n;3==t.length?(e=`${t[0]}-${t[1]}`,n=t[2]):(e=t[0],n=t[1]),i().isString(e)&&!i().isEmpty(this.__listeners[e])&&i().remove(this.__listeners[e],(t=>t.callback===n||void 0===n))}hasListener(t){return i().isString(t)&&!i().isEmpty(this.__listeners[t])}clearAll(){this.__listeners={}}}const a=new o;e.A=a},9557:function(t,e,n){(function(e,r){t.exports=r(n(9021),n(3240),n(1380))})(0,(function(t){return function(){var e=t,n=e.x64,r=n.Word,i=n.WordArray,o=e.algo,a=o.SHA512,u=o.SHA384=a.extend({_doReset:function(){this._hash=new i.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=16,t}});e.SHA384=a._createHelper(u),e.HmacSHA384=a._createHmacHelper(u)}(),t.SHA384}))},9565:function(t,e,n){"use strict";var r=n(616),i=Function.prototype.call;t.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},9615:function(t,e,n){"use strict";var r=n(9137),i=n(4680);t.exports=function(t,e){return t&&!r(e)?i(t,e):e}},9617:function(t,e,n){"use strict";var r=n(5397),i=n(5610),o=n(6198),a=function(t){return function(e,n,a){var u=r(e),s=o(u);if(0===s)return!t&&-1;var c,f=i(a,s);if(t&&n!==n){while(s>f)if(c=u[f++],c!==c)return!0}else for(;s>f;f++)if((t||f in u)&&u[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},9641:function(t){t.exports={version:"0.23.0"}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}!function(){n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,{a:e}),e}}(),function(){n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}}(),function(){n.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t}}(),function(){n.p=""}();var r={};return function(){"use strict";if(n.r(r),n.d(r,{ChatClientMgr:function(){return bt},addAndCleanDocument:function(){return At},addEventAction:function(){return yt},addIMMapping:function(){return Y},addObjectUsedTimes:function(){return H},addWindowTrustedOrigin:function(){return vt},createFileFromUrl:function(){return pt},decrypt:function(){return ut},destroyEventCenter:function(){return a},extractFilenameFromUrl:function(){return dt},fireEvent:function(){return s},getAIRobotInfos:function(){return Q},getAPPInfosByID:function(){return X},getAllUserInfosByGroupID:function(){return V},getAppCustomData:function(){return et},getAppPortalMenuDatas:function(){return _},getAuthPic:function(){return ot},getChildrenOfficeInfosByID:function(){return J},getCurrentUserPortalPageID:function(){return A},getDifyFileType:function(){return St},getGroupMappingsByAccount:function(){return K},getIMHanlder:function(){return It},getIntegrateAppInfoByID:function(){return nt},getKey:function(){return ft},getLoginPageNotices:function(){return j},getMappingAppInfoByID:function(){return O},getMenuDatasByGroupID:function(){return w},getMenuDatasByRoleIDs:function(){return m},getObjectUseTimes:function(){return W},getOfficeInfosByIDs:function(){return q},getPageIDByComponentID:function(){return F},getPojectDptsByUserAndGroupID:function(){return Z},getPoratlAppID:function(){return y},getPortalAccessToken:function(){return R},getPortalAppCustomConfig:function(){return M},getPortalPageConfig:function(){return B},getPortalPageMenuID:function(){return E},getPortalUserInfo:function(){return P},getPortalUserMappingInfos:function(){return D},getPortalUserSig:function(){return T},getRobotInfoByID:function(){return xt},getRoleIDsByUserAndGroupID:function(){return x},getThirdAppPathByKey:function(){return L},getUrlParamValue:function(){return ht},getUserAllMappngPortal:function(){return S},hasListener:function(){return c},initEventCenter:function(){return o},initFrameWindowListener:function(){return wt},loginAccount:function(){return ct},logoutAccount:function(){return at},queryAndStoreAppVariable:function(){return N},queryAppVariable:function(){return z},queryAssetById:function(){return lt},queryGroupIDByOfficeId:function(){return U},queryGroupInfosByOfficeId:function(){return $},queryOfficeInfosById:function(){return G},registerEventListener:function(){return i},removeEventAction:function(){return _t},removeEventListener:function(){return u},removeWindowTrustedOrigin:function(){return gt},sendWindowMessage:function(){return mt},setPortalPageConfig:function(){return k},switchPortalLogin:function(){return st},updateIMMapping:function(){return tt},updateUserSelectPortal:function(){return C},validateSSOPageLoaded:function(){return b}}),"undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(n.p=e[1])}const i=(t,e)=>{let n=window.rjEventCenter;n||(o(),n=window.rjEventCenter),n&&n.register&&n.register(t,e)},o=()=>{if(window.rjEventCenter)console.log(`事件中心已经初始化,不需要重新初始化:时间戳: ${(new Date).toLocaleString()}`);else{console.log(`初始化事件中心:时间戳: ${(new Date).toLocaleString()}`);let t=n(9547).A;window.rjEventCenter=t}},a=()=>{window.rjEventCenter&&(window.rjEventCenter.clearAll(),window.rjEventCenter=null,console.log(`事件中心已清理:时间戳: ${(new Date).toLocaleString()}`))},u=(t,e)=>{let n=window.rjEventCenter;n&&n.unregister&&n.unregister(t,e)},s=(t,e)=>{let n=window.rjEventCenter;n&&n.fireEvent&&n.fireEvent(t,e)},c=t=>{let e=window.rjEventCenter;return!(!e||!e.hasListener)&&e.hasListener(t)};n(4114),n(8111),n(2489),n(116),n(7588);var f=n(2505),l=n.n(f),h=n(3992);let p="";const d=(t="")=>{t&&(t.startsWith("/")&&(t=t.slice(1,t.length)),t.endsWith("/")&&(t=t.slice(0,-1)));const e=l().create({baseURL:`${p}/${t?t+"/":""}sdata/rest`,timeout:6e4,validateStatus:function(t){return t>=200&&t<300},headers:window.location.search&&h.parse(window.location.search).token||window.token?{token:h.parse(window.location.search).token||window.token}:{}});return e.defaults.headers.post["Content-Type"]="application/json",e.interceptors.response.use((t=>{let{data:e}=t;return"string"===typeof e&&(e=JSON.parse(e)),!e||200===e.status||e instanceof Blob?e instanceof Blob?(t.data=e,t):(t.data=e&&e.result,t):Promise.reject(t)}),(t=>{if(!t.response||401!==t.response.status)return Promise.reject(t.response)})),e};let v=window.prefixPath||"";var g=d(v);const y=(t,e)=>{let n="";return t?n=window.appSdk.getAppId():(n=window.sessionStorage.getItem("iportal_app_id"),n||e.forEach((t=>{"iPortal_app_id"==t.name&&(n=t.default_value)})),n||(n=window.appSdk.getAppId())),n},_=async(t,e,n,r)=>{let i=y(n,r),o=await x(t,i,e),a=await w(e,o),u=window.appSdk.getAppId(),s=a.filter((t=>{if(n)return!0;if(t.app_id==i)return!0;{let e=t.children,n=!1;return e&&e.length>0&&e.forEach((t=>{let e=t.children;if(e&&e.length>0){let t=e.filter((t=>t.app_id===u));t&&t.length>0&&(n=!0)}})),n}}));return s},w=async(t,e)=>{let n={param:{id:t}},r=await g.post("/dataservice/rest/orchestration/getMenuDatasByGroupID",n),i=r.data.resultDatas,o=r.data.menuTypes;if(e&&e.length>0){let n=await m(e,t),r=n.data.quickMenuMappingDatas||[],a={};for(const t of r){let e=t.menu_mapping_id;a[e]=t}let u=n.data.menuMappingDatas||[];for(const t of u){let e=t.id;a[e]=t}return I(i,o,a)}return I(i,o,[])},m=async(t,e)=>{let n={param:{role_ids:t,group_id:e}},r=await g.post("/dataservice/rest/orchestration/getQuckMenuMappingsByRoleIDs",n);return r},b=async(t,e,n)=>{let r={param:{app_id:t,appSecret:e,returnUrl:n}},i=await g.post("/dataservice/rest/orchestration/validateSSOPageLoaded",r),o=i.data.count;return o},x=async(t,e,n)=>{let r={param:{user_id:t,app_id:e,group_id:n}},i=await g.post("/dataservice/rest/orchestration/getRoleIDsByUserAndGroupID",r),o=i.data.portal_role_ids;return o},I=(t,e,n)=>{let r={},i={};for(const a of t){let t=a.id,e={id:t,index:a.menu_id,name:a.title,sort:a.sort,actionType:a.actionType,url:a.url,iconClass:a.image,children:[],app_id:a.app_id,menu_id:a.menu_id,beyond_type:a.menu_type?a.menu_type:"RJVIEW-OTHERS",beyond_type_sort:a.menu_type_sort?a.menu_type_sort:999};n?(n[t]||"4"==a.type)&&(r[t]=e):r[t]=e}for(const a of e){let t=a.id;i[t]=a}for(const a of t){let t=a.type;if("5"==t){let t=r[a.id];if(!t)continue;let e=a.parent_id,n=t.beyond_type,o=r[e],u=o.children,s=u.find((t=>t.id==n));if(s){let e=s.children;e.push(t),t.typeItem=s}else{let e=i[n],r=e?{id:n,index:n,name:e.title,children:[],sort:e.value}:{id:n,index:n,name:"其他",children:[],sort:999},o=r.children;o.push(t),u.push(r),t.typeItem=r}}}const o=[];for(const a of t){let t=a.type;if("4"==t){let t=r[a.id];if(!t)continue;let e=t.children,n=0;for(const r of e){let t=r.children,e=t.length;if(n+=e,e>0)break}if(0==n)continue;o.push(t);let i=t.children;i.sort(((t,e)=>Number.isNaN(t.sort)?1:Number.isNaN(e.sort)?-1:t.sort-e.sort));for(let r of i){let t=r.children;t.sort(((t,e)=>Number.isNaN(t.sort)?1:Number.isNaN(e.sort)?-1:t.sort-e.sort))}}}return o.sort(((t,e)=>Number.isNaN(t.sort)?1:Number.isNaN(e.sort)?-1:t.sort-e.sort)),o},A=async t=>{let e={param:{userData:t}},n=await g.post("/dataservice/rest/orchestration/getPortalPageID",e),r=n.data.portal_id;return r},S=t=>{let e={param:{userData:t}};return g.post("/dataservice/rest/orchestration/getUserAllMappngPortal",e)},D=async t=>{let e={param:{operateData:t}},n=await g.post("/dataservice/rest/orchestration/getPortalUserMappingInfos",e),r=n.data.portalMapping;return r},B=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getPortalPageConfig",e),r=n.data.portal_page_config||"[]";return r},k=t=>{let e={param:t};return g.post("/dataservice/rest/orchestration/setPortalPageConfig",e)},C=t=>{let e={param:{portalMappingData:t}};return g.post("/dataservice/rest/orchestration/updateUserSelectPortal",e)},E=async(t,e)=>{let n={param:{id:t,appid:e}},r=await g.post("/dataservice/rest/orchestration/getPortalPageMenuID",n),i=r.data.menu_id;return i},O=async(t,e)=>{let n={param:{appID:t,groupID:e}},r=await g.post("/dataservice/rest/orchestration/getPortalMappingAppInfoByID",n),i=r.data.appInfo;return i},j=async()=>{let t={param:{id:"1005"}},e=await g.post("/dataservice/rest/orchestration/getNoticeInfosByAppTypeID",t),n=e.data.resultDatas;return n},R=async(t,e)=>{let n=await g.get(`/appAuth/getAccessToken?appKey=${t}&appSecret=${e}`),r=n.data;return r},P=async(t,e)=>{let n=await g.get(`/systhirdapp/user/getUserByCode?code=${t}&access_token=${e}`),r=n.data;return r},T=async(t,e,n)=>{let r={param:{userID:t,im_type:e,group_id:n}},i=await g.post("/dataservice/rest/orchestration/getIMUserSigByID",r),o=i.data.userSig;return o},M=async t=>{let e={param:{groupID:t}},n=await g.post("/dataservice/rest/orchestration/getPortalAppCustomConfig",e),r=n.data.configInfo;return r},U=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getGroupIDByDptID",e),r=n.data.resultDptData,i=r.id;return i},z=(t,e)=>{if(e&&e.length>0)for(let n=0;n<e.length;n++)if(e[n].name==t)return e[n].default_value;return""},L=async(t,e,n)=>{let r={param:{appKey:t,appSecret:e,groupID:n}},i=await g.post("/dataservice/rest/orchestration/getThirdAppPathByKey",r),o=i.data.path;return o},N=(t,e)=>{let n=window.sessionStorage.getItem("isdata_app_variable_"+t);return n||(n=z(t,e),n&&window.sessionStorage.setItem("isdata_app_variable_"+t,n)),n},H=t=>{let e={param:{operateData:t}};return g.post("/dataservice/rest/orchestration/addObjectUsedTimes",e)},W=t=>{let e={param:{objectInfo:t}};return g.post("/dataservice/rest/orchestration/getObjectUseTimes",e)},F=async t=>{let e={param:{componentID:t}},n=await g.post("/dataservice/rest/orchestration/getPageIDByComponentID",e),r=n.data.page_id;return r},K=async t=>{let e={param:{account:t}},n=await g.post("/dataservice/rest/orchestration/getGourpMappingsByAccountName",e),r=n.data.resultGroups;return r},$=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getGroupIDByDptID",e),r=n.data.resultDptData;return r},q=async t=>{let e={param:{ids:t}},n=await g.post("/dataservice/rest/orchestration/getOfficeInfosByIDs",e),r=n.data.officeInfos;return r},G=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getOfficeInfosByID",e),r=n.data.officeData;return r},X=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getAPPInfosByID",e),r=n.data.appInfo;return r},V=async t=>{let e={param:{groupID:t}},n=await g.post("/dataservice/rest/orchestration/getAllUserInfosByGroupID",e),r=n.data.resultDatas;return r},J=async t=>{let e={param:{officeID:t}},n=await g.post("/dataservice/rest/orchestration/getChildrenOfficeInfosByID",e),r=n.data.resultDatas;return r},Z=async(t,e)=>{let n={param:{userID:t,groupID:e}},r=await g.post("/dataservice/rest/orchestration/getPojectDptsByUserAndGroupID",n),i={dptDatas:r.data.officeDatas,userMappings:r.data.userMappings};return i},Y=async(t,e,n,r)=>{let i={param:{data:{userID:t,im_type:e,group_id:n,userSig:r}}},o=await g.post("/dataservice/rest/orchestration/addIMMapping",i),a=o.data;return a},Q=async(t,e)=>{let n={param:{userID:t,groupID:e}},r=await g.post("/dataservice/rest/orchestration/getAIRobotInfos",n),i=r.data.robotInfos;return i},tt=async(t,e,n,r)=>{let i={param:{userID:t,im_type:e,groupID:n,userSig:r}},o=await g.post("/dataservice/rest/orchestration/updateIMMapping",i),a=o.data;return a},et=async t=>{let e={param:{appID:t}},n=await g.post("/dataservice/rest/orchestration/getAppCustomData",e),r=n.data.customData;return r=r?JSON.parse(r):{},r},nt=async t=>{let e={param:{appID:t}},n=await g.post("/dataservice/rest/orchestration/getIntegrateAppInfoByID",e),r=n.data.appInfo;return r};var rt=n(1396),it=n.n(rt);const ot=()=>g.get("/system/authority/getAuthPic?module=loginPassword",{responseType:"arraybuffer"}),at=async t=>{let e=await g.get(`/system/authority/logout?isMobileLogout=${t}`),n=JSON.parse(e.request.response),r=n.code;return"10110020"==r?(window.sessionStorage.clear(),{code:r,message:n.message}):{code:r,message:n.message}},ut=async t=>{let e=await ft();const n=it().AES.decrypt(t,e).toString(it().enc.Utf8);return n},st=async(t,e,n)=>{let r=window.sessionStorage.getItem("iportal_login_user_key");r=await ut(r),t.password=r;let i=await at(n),o=i.code,a=i.message;if("10110020"==o){let n=await ct(t,e);return n}return{code:o,message:a}},ct=async(t,e)=>{let n={param:{loginData:{account:t.account_view,group_id:t.groupid,imageCode:t.imageCode}}},r=await g.post("/dataservice/rest/orchestration/getLoginPortalAccountKey",n),i=await ft(),o=JSON.parse(r.request.response),a=o.result.code;if(10001==a){let n=o.result.codeData.code,u=n,s=o.result.codeData.key;if(n=it().AES.decrypt(n,i).toString(it().enc.Utf8),s=it().AES.decrypt(s,i).toString(it().enc.Utf8),s==t.password){if(n=window.appSdk.Encrypt(n),t.password=n,r=await g.post(`/system/authority/loginAccount4Application?authPicCode=${t.imageCode}&dataappId=${e}&mobileOrWeb=web`,t),o=JSON.parse(r.request.response),a=o.code,10110004==a){let e=o.id;return window.sessionStorage.setItem("iportal_login_user_id",e),window.sessionStorage.setItem("iportal_group_id",t.groupid),window.sessionStorage.setItem("iportal_login_user_key",u),{code:a}}return{code:a,message:o.message}}return{code:a,message:"账户密码错误!"}}return{code:a,message:o.result.message}},ft=async()=>{let t={param:{}},e=await g.post("/dataservice/rest/orchestration/getKey",t),n=e.data.key;return n},lt=(t,e=200)=>g.post(`/asset/getAssetData?asset_id=${t}&count=${e}`,{filters:[]}),ht=(t,e)=>{try{const n=new URL(t),r=n.searchParams.get(e);return r&&-1!==r.indexOf("#")?r.split("#")[0]:r}catch(n){return console.error("URL 格式错误:",n),""}},pt=async(t,e)=>{try{const n=await fetch(t);if(!n.ok)throw new Error(`网络请求失败: ${n.status} ${n.statusText}`);const r=await n.blob(),i=e||dt(t);return new File([r],i,{type:r.type,lastModified:Date.now()})}catch(n){throw console.error("创建 File 失败:",n),n}},dt=t=>{try{const e=new URL(t);return e.pathname.split("/").pop()||"downloaded_file"}catch(e){return"downloaded_file"}};n(3579);const vt=t=>{let e=window.SDATA_WINDOW_TRUSTED_ORIGINS;e||(window.SDATA_WINDOW_TRUSTED_ORIGINS=[]),e.includes(t)||e.push(t)},gt=t=>{let e=window.SDATA_WINDOW_TRUSTED_ORIGINS;e||(window.SDATA_WINDOW_TRUSTED_ORIGINS=[]);let n=e.indexOf(t);n>-1&&e.splice(n,1)},yt=(t,e)=>{let n=window.sdataEventActions;n||(window.sdataEventActions={}),window.sdataEventActions[t]=e},_t=t=>{let e=window.sdataEventActions;e||(window.sdataEventActions={}),delete window.sdataEventActions[t]},wt=()=>{let t=window.SDATA_WINDOW_TRUSTED_ORIGINS;t||(window.SDATA_WINDOW_TRUSTED_ORIGINS=[]);let e=window.sdataEventActions;e||(window.sdataEventActions={}),window.addEventListener("message",(async t=>{const e=window.SDATA_WINDOW_TRUSTED_ORIGINS.some((e=>t.origin===e||new RegExp(e).test(t.origin)));if(!e)return void console.log("拒绝非可信源消息:",t.origin);let n=t.data?.eventKey;if(!n)return;let r=t.origin;if(console.log(`收到${r}页面消息:`,t.data),"sdata_alllife_event_response"===n){let e=t.data.eventOperateKey,n=window.sdataEventActions[e];delete window.sdataEventActions[e],n&&await n(t.data.data,t)}else{let e=window.sdataEventActions[n],i={eventKey:"sdata_alllife_event_response",eventOperateKey:t.data.eventOperateKey,data:{}};if(e){let n=await e(t.data.data,t);i.data=n}t.source.postMessage(i,r)}}))},mt=async(t,e,n,r,i)=>{let o=(new Date).getTime(),a=Math.floor(1e4*Math.random())+1,u=`${n}_${o}_${a}`;yt(u,i);let s={eventOperateKey:u,eventKey:n,data:r};t.postMessage(s,e)};class bt{constructor(t,e){this.handler=e,this.actionKey=t.actionKey,this.appSKID=t.appSKID,this.imType=t.imType,this.groupID=t.groupID,this.userID=t.userID,this.chatType=t.chatType||0,this.singleChatID=t.singleChatID||"",this.customParams=t.customParams||{},this.chartOrigin=t.chartOrigin,console.log("ChatClientMgr init:",this.actionKey)}makeKey(t){return`${t}-${this.actionKey}`}async init(){this.handler.addChatListener(this.makeKey("sdata_get_access_token"),(async t=>await this.handler.getPortalAccessToken(t))),this.handler.addChatListener(this.makeKey("sdata_get_portal_user_info"),(async t=>await this.handler.getPortalUserInfo(t))),this.handler.addChatListener(this.makeKey("sdata_get_portal_user_sig"),(async t=>{let e=t.userID,n=t.im_type,r=t.group_id;return await this.handler.getPortalUserSig(e,n,r)})),this.handler.addChatListener(this.makeKey("sdata_add_im_mapping"),(async t=>{let e=t.userID,n=t.im_type,r=t.userSig;return await this.handler.addIMMapping(e,n,r,this.groupID)})),this.handler.addChatListener(this.makeKey("sdata_update_im_mapping"),(async t=>await this.handler.updateIMMapping(t))),this.handler.addChatListener(this.makeKey("sdata_get_users_by_group_id"),(async t=>await this.handler.getAllUserInfosByGroupID(t))),this.handler.addChatListener(this.makeKey("sdata_get_dpts_by_group_id"),(async t=>await this.handler.getChildrenOfficeInfosByID(t))),this.handler.addChatListener(this.makeKey("sdata_get_project_dpts_by_user_group_id"),(async t=>await this.handler.getPojectDptsByUserAndGroupID(t))),this.handler.addChatListener(this.makeKey("sdata_get_ai_robot_infos"),(async t=>{let e=t.groupID,n=t.userID;return this.userID==n&&this.groupID==e?this.getAIRobotInfos():[]})),this.handler.addChatListener(this.makeKey("sdata_get_test_user_sig"),(async t=>{let e=t.SDKAppID,n=t.userID,r=await this.handler.genTestUserSig({SDKAppID:e,userID:n}),i=r.userSig;return i})),this.handler.addChatListener(this.makeKey("sdata_send_message_to_chat_server"),(async(t,e)=>{let n=t.message,r=n.from,i=await this.sendMessageToChatServer(r,n);return i})),this.handler.addChatListener(this.makeKey("sdata_close_frame_window"),(async(t,e)=>this.handler.closeWindow())),this.handler.addChatListener(this.makeKey("sdata_alllife_event_regist"),(async(t,e)=>{this.appSKID=t.appid,this.imType=t.im_type,await this.initChatAIs();let n={type:this.getChatTypeKey(this.chatType),singleChatID:this.singleChatID,customParams:this.customParams};console.log("charParams",n),this.handler.fireEventToChatWindow(e,this.chartOrigin,this.makeKey("sdata_alllife_initChat"),n,(t=>{t&&this.handler.onChatInitFinished()}))}))}getChatTypeKey(t){switch(t){case 0:return"IM_MULTIPLE_MODE";case 1:return"IM_SINGLE_MODE";case 2:return"IM_EMBED_MODE";default:return"IM_MULTIPLE_MODE"}}async initChatAIs(){if(window.imClient)this.chatAIClient=window.imClient;else{let t=await this.handler.getChatClientClasses();const{TencentCloudChat:e,TIMUploadPlugin:n}=t;window.imClient=e.create({SDKAppID:this.appSKID,storage:{enable:!0}}),window.imClient.registerPlugin({"tim-upload-plugin":n}),window.imClient.on(e.EVENT.SDK_READY,this.onChatAIReady.bind(this)),window.imClient.charAIs={},this.chatAIClient=window.imClient}this.chatAIClient.charAIs||(this.chatAIClient.charAIs={});let t=await this.handler.getAIRobotInfos(this.userID,this.groupID);t&&t.length>0&&t.forEach((async t=>{let e=t.id;if(!this.chatAIClient.charAIs[e]){t.chatID=e;let n=await this.handler.getPortalUserSig(e,this.imType,this.groupID);n||(n=await this.generateUserSigAndAdd(e)),t.userSig=n,this.chatAIClient.charAIs[e]={robot:t,messageCache:[]}}}))}async generateUserSigAndUpdate(t){let e=await this.handler.genTestUserSig({SDKAppID:this.appSKID,userID:t}),n=e.userSig;if(n){await this.chatAIClient.login({userID:t,userSig:n}),await this.chatAIClient.logout();let e={userID:t,userSig:n,im_type:this.imType,group_id:this.groupID};await this.handler.updateIMMapping(e)}return n}async generateUserSigAndAdd(t){let e=await this.handler.genTestUserSig({SDKAppID:this.appSKID,userID:t}),n=e.userSig;return n&&(await this.chatAIClient.login({userID:t,userSig:n}),await this.chatAIClient.logout(),await this.handler.addIMMapping(t,this.imType,n,this.groupID)),n}onChatAIReady(t){let e=this.chatAIClient.lastRobotID,n=this.getAIRobotInfoByID(e);if(console.log(`[AI chat] ${n.name}已经就绪:`,t),this.chatAIClient){let t=this.getAIRobotCacheMessagesByID(e);if(console.log(`[AI chat] ${n.name}就绪后查到的缓存信息:`,t),console.log(`[AI chat] ${n.name}所有信息仓:`,this.chatAIClient.charAIs),t&&t.length>0){const r=[...t];t.splice(0,t.length),r.forEach((t=>{console.log(`[AI chat] ${n.name}发送缓存消息:`,t),this.sendMessageToChatServer(e,t)}))}}}getAIRobotInfos(){let t=[];for(let e in this.chatAIClient.charAIs)t.push(this.chatAIClient.charAIs[e].robot);return t}getAIRobotInfoByID(t){return this.chatAIClient.charAIs[t]?this.chatAIClient.charAIs[t].robot:null}getAIRobotCacheMessagesByID(t){return this.chatAIClient.charAIs[t]?this.chatAIClient.charAIs[t].messageCache:[]}async sendMessageToChatServer(t,e){let n=this.getAIRobotInfoByID(t);if(this.chatAIClient.lastRobotID!=t){console.log(`[AI chat]需要新机器人回答,切换到新机器人${n.name}`),this.chatAIClient.lastRobotID&&await this.chatAIClient.logout();try{await this.chatAIClient.login({userID:t,userSig:n.userSig})}catch(r){console.log(`[AI chat]${n.name}登录失败`,r);let i=r.code;if(70001==i){console.log(`[AI chat]${n.name}UserSig过期,重新生成userSig`);let i=await this.generateUserSigAndUpdate(t);try{return await this.chatAIClient.login({userID:t,userSig:i}),void this.sendMessageToChatServer(t,e)}catch(r){return void console.log(`[AI chat]${n.name}重新登录失败`,r)}}}}if(this.chatAIClient.lastRobotID=t,this.chatAIClient&&this.chatAIClient.isReady()){let t=await this.chatAIClient.createTextMessage(e);this.chatAIClient.sendMessage(t).then((t=>{console.log(`[AI chat]${n.name}发送信息成功`,t)}),(t=>{console.log(`[AI chat]${n.name}发送失败`,t)}))}else{let r=this.getAIRobotCacheMessagesByID(t);r.push(e),console.log(`[AI chat]${n.name}未就绪,缓存后消息:`,r)}}converToAIServerParams(t,e,n){let r="",i=t.type;switch(i){case"TIMTextElem":r=t.payload?.text||"";break;case"TIMImageElem":break;case"TIMSoundElem":break;case"TIMVideoFileElem":break;case"TIMFileElem":break;default:break}let o=t.cloudCustomData||{},a=o.conversation_id||"",u={prompt:r,params:n||{},robotKey:e.password,conversation_id:a||"",userID:t.from||""};return u}abort(){this.chatAIClient=null}}const xt=async(t,e)=>{let n={param:{id:t,groupID:e}},r=await g.post("/dataservice/rest/orchestration/getRobotInfoByID",n),i=r.data.robotInfo;return i},It=t=>{let e={genTestUserSig:async t=>{},getChatClientClasses:async()=>[],getAIRobotInfos:async(t,e)=>Q(t,e),getPortalUserSig:async(t,e,n)=>T(t,e,n),addIMMapping:async(t,e,n,r)=>Y(t,e,r,n),updateIMMapping:async t=>{let e=t.userID,n=t.im_type,r=t.group_id,i=t.userSig;return tt(e,n,r,i)},getPortalAccessToken:async t=>{let e=t.appKey,n=t.appSecret;return R(e,n)},getPortalUserInfo:async t=>{let e=t.code,n=t.access_token;return P(e,n)},getAllUserInfosByGroupID:async t=>{let e=t.groupID;return V(e)},getChildrenOfficeInfosByID:async t=>{let e=t.groupID;return J(e)},getPojectDptsByUserAndGroupID:async t=>{let e=t.groupID,n=t.userID;return Z(n,e)},closeWindow:()=>!0,addChatListener:async(t,e)=>{await yt(t,e)},fireEventToChatWindow:async(t,e,n,r,i)=>{await mt(t.source,e,n,r,i)},onChatInitFinished:async()=>{}};return e={...e,...t},e},At=async(t,e={})=>{let n=window.smardaten_api_context_path,r=`${n}/storage_area/public${t}`,i=r.split(".").pop().toLowerCase();i=St(i);let o=window.anonymousIsLogin||window.currentUser,a=e.userID||o?.id,u=e.appID||y(!1,[]),s=await et(u),c=e.aiAgentServerIP||s?.aiAgentServerIP||"",f=`${c}/addAndCleanDocument`,l={params:{inputs:{fileName:e.fileName||Dt(r)},files:[{type:i,transfer_method:e.transfer_method||"remote_url",url:r}],user:a}};g.post(f,JSON.stringify(l)).then((t=>{console.log("发送消息成功:",t)})).catch((t=>{console.error("发送消息失败:",t)}))},St=t=>{let e={DOCX:"document",TXT:"document",MD:"document",MARKDOWN:"document",MDX:"document",PDF:"document",HTML:"document",XLSX:"document",XLS:"document",VTT:"document",DOC:"document",CSV:"document",EML:"document",MSG:"document",PPTX:"document",PPT:"document",XML:"document",EPUB:"document",JPG:"image",JPEG:"image",PNG:"image",GIF:"image",WEBP:"image",MP3:"audio",M4A:"audio",WAV:"audio",WEBM:"audio",MPGA:"audio",MP4:"video",MOV:"video",MPEG:"video"},n=t.toUpperCase();return e[n]||"custom"},Dt=t=>{try{const e=new URL(t);return e.pathname.split("/").pop()||"downloaded_file"}catch(e){return"downloaded_file"}}}(),r}()}));
26
+ return function(){var e=t,n=e.lib,r=n.WordArray,i=n.Hasher,o=e.algo,a=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),s=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),f=r.create([0,1518500249,1859775393,2400959708,2840853838]),l=r.create([1352829926,1548603684,1836072691,2053994217,0]),h=o.RIPEMD160=i.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var r=e+n,i=t[r];t[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,h,w,m,b,x,I,A,S,D,B,k=this._hash.words,C=f.words,E=l.words,O=a.words,j=u.words,R=s.words,P=c.words;x=o=k[0],I=h=k[1],A=w=k[2],S=m=k[3],D=b=k[4];for(n=0;n<80;n+=1)B=o+t[e+O[n]]|0,B+=n<16?p(h,w,m)+C[0]:n<32?d(h,w,m)+C[1]:n<48?v(h,w,m)+C[2]:n<64?g(h,w,m)+C[3]:y(h,w,m)+C[4],B|=0,B=_(B,R[n]),B=B+b|0,o=b,b=m,m=_(w,10),w=h,h=B,B=x+t[e+j[n]]|0,B+=n<16?y(I,A,S)+E[0]:n<32?g(I,A,S)+E[1]:n<48?v(I,A,S)+E[2]:n<64?d(I,A,S)+E[3]:p(I,A,S)+E[4],B|=0,B=_(B,P[n]),B=B+D|0,x=D,D=S,S=_(A,10),A=I,I=B;B=k[1]+w+S|0,k[1]=k[2]+m+D|0,k[2]=k[3]+b+x|0,k[3]=k[4]+o+I|0,k[4]=k[0]+h+A|0,k[0]=B},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,o=i.words,a=0;a<5;a++){var u=o[a];o[a]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return i},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,n){return t^e^n}function d(t,e,n){return t&e|~t&n}function v(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function y(t,e,n){return t^(e|~n)}function _(t,e){return t<<e|t>>>32-e}e.RIPEMD160=i._createHelper(h),e.HmacRIPEMD160=i._createHmacHelper(h)}(Math),t.RIPEMD160}))},8111:function(t,e,n){"use strict";var r=n(6518),i=n(4576),o=n(679),a=n(8551),u=n(4901),s=n(2787),c=n(2106),f=n(4659),l=n(9039),h=n(9297),p=n(8227),d=n(7657).IteratorPrototype,v=n(3724),g=n(6395),y="constructor",_="Iterator",w=p("toStringTag"),m=TypeError,b=i[_],x=g||!u(b)||b.prototype!==d||!l((function(){b({})})),I=function(){if(o(this,d),s(this)===d)throw new m("Abstract class Iterator not directly constructable")},A=function(t,e){v?c(d,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===d)throw new m("You can't redefine this property");h(this,t)?this[t]=e:f(this,t,e)}}):d[t]=e};h(d,w)||A(w,_),!x&&h(d,y)&&d[y]!==Object||A(y,I),I.prototype=d,r({global:!0,constructor:!0,forced:x},{Iterator:I})},8124:function(t,e,n){(function(e,r){t.exports=r(n(9021),n(7165))})(0,(function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}))},8227:function(t,e,n){"use strict";var r=n(4576),i=n(5745),o=n(9297),a=n(3392),u=n(4495),s=n(7040),c=r.Symbol,f=i("wks"),l=s?c["for"]||c:c&&c.withoutSetter||a;t.exports=function(t){return o(f,t)||(f[t]=u&&o(c,t)?c[t]:l("Symbol."+t)),f[t]}},8454:function(t,e,n){(function(e,r){t.exports=r(n(9021),n(7165))})(0,(function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e}(),t.mode.ECB}))},8480:function(t,e,n){"use strict";var r=n(1828),i=n(8727),o=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},8551:function(t,e,n){"use strict";var r=n(34),i=String,o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not an object")}},8622:function(t,e,n){"use strict";var r=n(4576),i=n(4901),o=r.WeakMap;t.exports=i(o)&&/native code/.test(String(o))},8686:function(t,e,n){"use strict";var r=n(3724),i=n(9039);t.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8727:function(t){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8773:function(t,e){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);e.f=i?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},8981:function(t,e,n){"use strict";var r=n(7750),i=Object;t.exports=function(t){return i(r(t))}},9012:function(t){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},9021:function(t,e,n){(function(e,n){t.exports=n()})(0,(function(){var t=t||function(t,e){var r;if("undefined"!==typeof window&&window.crypto&&(r=window.crypto),"undefined"!==typeof self&&self.crypto&&(r=self.crypto),"undefined"!==typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!==typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&"undefined"!==typeof n.g&&n.g.crypto&&(r=n.g.crypto),!r)try{r=n(477)}catch(g){}var i=function(){if(r){if("function"===typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(g){}if("function"===typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(g){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),a={},u=a.lib={},s=u.Base=function(){return{extend:function(t){var e=o(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),c=u.WordArray=s.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var a=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var u=0;u<i;u+=4)e[r+u>>>2]=n[u>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=s.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(i());return new c.init(e,t)}}),f=a.enc={},l=f.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new c.init(n,e/2)}},h=f.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new c.init(n,e)}},p=f.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},d=u.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,i=r.words,o=r.sigBytes,a=this.blockSize,u=4*a,s=o/u;s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0);var f=s*a,l=t.min(4*f,o);if(f){for(var h=0;h<f;h+=a)this._doProcessBlock(i,h);n=i.splice(0,f),r.sigBytes-=l}return new c.init(n,l)},clone:function(){var t=s.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),v=(u.Hasher=d.extend({cfg:s.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new v.HMAC.init(t,n).finalize(e)}}}),a.algo={});return a}(Math);return t}))},9039:function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},9106:function(t,e,n){"use strict";var r=n(9516);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(r.isURLSearchParams(e))o=e.toString();else{var a=[];r.forEach(e,(function(t,e){null!==t&&"undefined"!==typeof t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,(function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),a.push(i(e)+"="+i(t))})))})),o=a.join("&")}if(o){var u=t.indexOf("#");-1!==u&&(t=t.slice(0,u)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},9137:function(t){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},9297:function(t,e,n){"use strict";var r=n(9504),i=n(8981),o=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(i(t),e)}},9306:function(t,e,n){"use strict";var r=n(4901),i=n(6823),o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not a function")}},9433:function(t,e,n){"use strict";var r=n(4576),i=Object.defineProperty;t.exports=function(t,e){try{i(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},9462:function(t,e,n){"use strict";var r=n(9565),i=n(2360),o=n(6699),a=n(6279),u=n(8227),s=n(1181),c=n(5966),f=n(7657).IteratorPrototype,l=n(2529),h=n(9539),p=u("toStringTag"),d="IteratorHelper",v="WrapForValidIterator",g=s.set,y=function(t){var e=s.getterFor(t?v:d);return a(i(f),{next:function(){var n=e(this);if(t)return n.nextHandler();if(n.done)return l(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:l(r,n.done)}catch(i){throw n.done=!0,i}},return:function(){var n=e(this),i=n.iterator;if(n.done=!0,t){var o=c(i,"return");return o?r(o,i):l(void 0,!0)}if(n.inner)try{h(n.inner.iterator,"normal")}catch(a){return h(i,"throw",a)}return i&&h(i,"normal"),l(void 0,!0)}})},_=y(!0),w=y(!1);o(w,p,"Iterator Helper"),t.exports=function(t,e,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=e?v:d,i.returnHandlerResult=!!n,i.nextHandler=t,i.counter=0,i.done=!1,g(this,i)};return r.prototype=e?_:w,r}},9504:function(t,e,n){"use strict";var r=n(616),i=Function.prototype,o=i.call,a=r&&i.bind.bind(o,o);t.exports=r?a:function(t){return function(){return o.apply(t,arguments)}}},9506:function(t,e,n){(function(e,r){t.exports=r(n(9021),n(5471),n(1025))})(0,(function(t){return function(){var e=t,n=e.lib,r=n.Base,i=n.WordArray,o=e.algo,a=o.MD5,u=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var n,r=this.cfg,o=r.hasher.create(),a=i.create(),u=a.words,s=r.keySize,c=r.iterations;while(u.length<s){n&&o.update(n),n=o.update(t).finalize(e),o.reset();for(var f=1;f<c;f++)n=o.finalize(n),o.reset();a.concat(n)}return a.sigBytes=4*s,a}});e.EvpKDF=function(t,e,n){return u.create(n).compute(t,e)}}(),t.EvpKDF}))},9516:function(t,e,n){"use strict";var r=n(9012),i=Object.prototype.toString;function o(t){return"[object Array]"===i.call(t)}function a(t){return"undefined"===typeof t}function u(t){return null!==t&&!a(t)&&null!==t.constructor&&!a(t.constructor)&&"function"===typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function s(t){return"[object ArrayBuffer]"===i.call(t)}function c(t){return"undefined"!==typeof FormData&&t instanceof FormData}function f(t){var e;return e="undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function l(t){return"string"===typeof t}function h(t){return"number"===typeof t}function p(t){return null!==t&&"object"===typeof t}function d(t){if("[object Object]"!==i.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function v(t){return"[object Date]"===i.call(t)}function g(t){return"[object File]"===i.call(t)}function y(t){return"[object Blob]"===i.call(t)}function _(t){return"[object Function]"===i.call(t)}function w(t){return p(t)&&_(t.pipe)}function m(t){return"undefined"!==typeof URLSearchParams&&t instanceof URLSearchParams}function b(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function x(){return("undefined"===typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!==typeof window&&"undefined"!==typeof document)}function I(t,e){if(null!==t&&"undefined"!==typeof t)if("object"!==typeof t&&(t=[t]),o(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function A(){var t={};function e(e,n){d(t[n])&&d(e)?t[n]=A(t[n],e):d(e)?t[n]=A({},e):o(e)?t[n]=e.slice():t[n]=e}for(var n=0,r=arguments.length;n<r;n++)I(arguments[n],e);return t}function S(t,e,n){return I(e,(function(e,i){t[i]=n&&"function"===typeof e?r(e,n):e})),t}function D(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}t.exports={isArray:o,isArrayBuffer:s,isBuffer:u,isFormData:c,isArrayBufferView:f,isString:l,isNumber:h,isObject:p,isPlainObject:d,isUndefined:a,isDate:v,isFile:g,isBlob:y,isFunction:_,isStream:w,isURLSearchParams:m,isStandardBrowserEnv:x,forEach:I,merge:A,extend:S,trim:b,stripBOM:D}},9519:function(t,e,n){"use strict";var r,i,o=n(4576),a=n(2839),u=o.process,s=o.Deno,c=u&&u.versions||s&&s.version,f=c&&c.v8;f&&(r=f.split("."),i=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(r=a.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/),r&&(i=+r[1]))),t.exports=i},9539:function(t,e,n){"use strict";var r=n(9565),i=n(8551),o=n(5966);t.exports=function(t,e,n){var a,u;i(t);try{if(a=o(t,"return"),!a){if("throw"===e)throw n;return n}a=r(a,t)}catch(s){u=!0,a=s}if("throw"===e)throw n;if(u)throw a;return i(a),n}},9547:function(t,e,n){"use strict";n(4114),n(8111),n(7588);var r=n(2543),i=n.n(r);class o{constructor(){this.__listeners={}}register(...t){let e,n;3==t.length?(e=`${t[0]}-${t[1]}`,n=t[2]):(e=t[0],n=t[1]),this.__listeners[e]=this.__listeners[e]||[],this.__listeners[e].push({callback:n})}fireEvent(...t){let e,n;3==t.length?(e=`${t[0]}-${t[1]}`,n=t[2]):(e=t[0],n=t[1]);let r=this.__listeners[e]||[],o=!0;return i().forEach(r,(t=>{let e=t.callback,r=e.call(null,n);if(!1===r)return o=!1,!1})),o}unregister(...t){let e,n;3==t.length?(e=`${t[0]}-${t[1]}`,n=t[2]):(e=t[0],n=t[1]),i().isString(e)&&!i().isEmpty(this.__listeners[e])&&i().remove(this.__listeners[e],(t=>t.callback===n||void 0===n))}hasListener(t){return i().isString(t)&&!i().isEmpty(this.__listeners[t])}clearAll(){this.__listeners={}}}const a=new o;e.A=a},9557:function(t,e,n){(function(e,r){t.exports=r(n(9021),n(3240),n(1380))})(0,(function(t){return function(){var e=t,n=e.x64,r=n.Word,i=n.WordArray,o=e.algo,a=o.SHA512,u=o.SHA384=a.extend({_doReset:function(){this._hash=new i.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=16,t}});e.SHA384=a._createHelper(u),e.HmacSHA384=a._createHmacHelper(u)}(),t.SHA384}))},9565:function(t,e,n){"use strict";var r=n(616),i=Function.prototype.call;t.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},9615:function(t,e,n){"use strict";var r=n(9137),i=n(4680);t.exports=function(t,e){return t&&!r(e)?i(t,e):e}},9617:function(t,e,n){"use strict";var r=n(5397),i=n(5610),o=n(6198),a=function(t){return function(e,n,a){var u=r(e),s=o(u);if(0===s)return!t&&-1;var c,f=i(a,s);if(t&&n!==n){while(s>f)if(c=u[f++],c!==c)return!0}else for(;s>f;f++)if((t||f in u)&&u[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},9641:function(t){t.exports={version:"0.23.0"}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}!function(){n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,{a:e}),e}}(),function(){n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}}(),function(){n.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t}}(),function(){n.p=""}();var r={};return function(){"use strict";if(n.r(r),n.d(r,{ChatClientMgr:function(){return bt},addAndCleanDocument:function(){return At},addEventAction:function(){return yt},addIMMapping:function(){return Y},addObjectUsedTimes:function(){return H},addWindowTrustedOrigin:function(){return vt},createFileFromUrl:function(){return pt},decrypt:function(){return ut},destroyEventCenter:function(){return a},extractFilenameFromUrl:function(){return dt},fireEvent:function(){return s},getAIRobotInfos:function(){return Q},getAPPInfosByID:function(){return X},getAllUserInfosByGroupID:function(){return V},getAppCustomData:function(){return et},getAppPortalMenuDatas:function(){return _},getAuthPic:function(){return ot},getChildrenOfficeInfosByID:function(){return J},getCurrentUserPortalPageID:function(){return A},getDifyFileType:function(){return St},getGroupMappingsByAccount:function(){return K},getIMHanlder:function(){return It},getIntegrateAppInfoByID:function(){return nt},getKey:function(){return ft},getLoginPageNotices:function(){return j},getMappingAppInfoByID:function(){return O},getMenuDatasByGroupID:function(){return w},getMenuDatasByRoleIDs:function(){return m},getObjectUseTimes:function(){return W},getOfficeInfosByIDs:function(){return q},getPageIDByComponentID:function(){return F},getPojectDptsByUserAndGroupID:function(){return Z},getPoratlAppID:function(){return y},getPortalAccessToken:function(){return R},getPortalAppCustomConfig:function(){return M},getPortalPageConfig:function(){return B},getPortalPageMenuID:function(){return E},getPortalUserInfo:function(){return P},getPortalUserMappingInfos:function(){return D},getPortalUserSig:function(){return T},getRobotInfoByID:function(){return xt},getRoleIDsByUserAndGroupID:function(){return x},getThirdAppPathByKey:function(){return L},getUrlParamValue:function(){return ht},getUserAllMappngPortal:function(){return S},hasListener:function(){return c},initEventCenter:function(){return o},initFrameWindowListener:function(){return wt},loginAccount:function(){return ct},logoutAccount:function(){return at},queryAndStoreAppVariable:function(){return N},queryAppVariable:function(){return z},queryAssetById:function(){return lt},queryGroupIDByOfficeId:function(){return U},queryGroupInfosByOfficeId:function(){return $},queryOfficeInfosById:function(){return G},registerEventListener:function(){return i},removeEventAction:function(){return _t},removeEventListener:function(){return u},removeWindowTrustedOrigin:function(){return gt},sendWindowMessage:function(){return mt},setPortalPageConfig:function(){return k},switchPortalLogin:function(){return st},updateIMMapping:function(){return tt},updateUserSelectPortal:function(){return C},validateSSOPageLoaded:function(){return b}}),"undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(n.p=e[1])}const i=(t,e)=>{let n=window.rjEventCenter;n||(o(),n=window.rjEventCenter),n&&n.register&&n.register(t,e)},o=()=>{if(window.rjEventCenter)console.log(`事件中心已经初始化,不需要重新初始化:时间戳: ${(new Date).toLocaleString()}`);else{console.log(`初始化事件中心:时间戳: ${(new Date).toLocaleString()}`);let t=n(9547).A;window.rjEventCenter=t}},a=()=>{window.rjEventCenter&&(window.rjEventCenter.clearAll(),window.rjEventCenter=null,console.log(`事件中心已清理:时间戳: ${(new Date).toLocaleString()}`))},u=(t,e)=>{let n=window.rjEventCenter;n&&n.unregister&&n.unregister(t,e)},s=(t,e)=>{let n=window.rjEventCenter;n&&n.fireEvent&&n.fireEvent(t,e)},c=t=>{let e=window.rjEventCenter;return!(!e||!e.hasListener)&&e.hasListener(t)};n(4114),n(8111),n(2489),n(116),n(7588);var f=n(2505),l=n.n(f),h=n(3992);let p="";const d=(t="")=>{t&&(t.startsWith("/")&&(t=t.slice(1,t.length)),t.endsWith("/")&&(t=t.slice(0,-1)));const e=l().create({baseURL:`${p}/${t?t+"/":""}sdata/rest`,timeout:6e4,validateStatus:function(t){return t>=200&&t<300},headers:window.location.search&&h.parse(window.location.search).token||window.token?{token:h.parse(window.location.search).token||window.token}:{}});return e.defaults.headers.post["Content-Type"]="application/json",e.interceptors.response.use((t=>{let{data:e}=t;return"string"===typeof e&&(e=JSON.parse(e)),!e||200===e.status||e instanceof Blob?e instanceof Blob?(t.data=e,t):(t.data=e&&e.result,t):Promise.reject(t)}),(t=>{if(!t.response||401!==t.response.status)return Promise.reject(t.response)})),e};let v=window.prefixPath||"";var g=d(v);const y=(t,e)=>{let n="";return t?n=window.appSdk.getAppId():(n=window.sessionStorage.getItem("iportal_app_id"),n||e.forEach((t=>{"iPortal_app_id"==t.name&&(n=t.default_value)})),n||(n=window.appSdk.getAppId())),n},_=async(t,e,n,r)=>{let i=y(n,r),o=await x(t,i,e),a=await w(e,o),u=window.appSdk.getAppId(),s=a.filter((t=>{if(n)return!0;if(t.app_id==i)return!0;{let e=t.children,n=!1;return e&&e.length>0&&e.forEach((t=>{let e=t.children;if(e&&e.length>0){let t=e.filter((t=>t.app_id===u));t&&t.length>0&&(n=!0)}})),n}}));return s},w=async(t,e)=>{let n={param:{id:t}},r=await g.post("/dataservice/rest/orchestration/getMenuDatasByGroupID",n),i=r.data.resultDatas,o=r.data.menuTypes;if(e&&e.length>0){let n=await m(e,t),r=n.data.quickMenuMappingDatas||[],a={};for(const t of r){let e=t.menu_mapping_id;a[e]=t}let u=n.data.menuMappingDatas||[];for(const t of u){let e=t.id;a[e]=t}return I(i,o,a)}return I(i,o,[])},m=async(t,e)=>{let n={param:{role_ids:t,group_id:e}},r=await g.post("/dataservice/rest/orchestration/getQuckMenuMappingsByRoleIDs",n);return r},b=async(t,e,n)=>{let r={param:{app_id:t,appSecret:e,returnUrl:n}},i=await g.post("/dataservice/rest/orchestration/validateSSOPageLoaded",r),o=i.data.count;return o},x=async(t,e,n)=>{let r={param:{user_id:t,app_id:e,group_id:n}},i=await g.post("/dataservice/rest/orchestration/getRoleIDsByUserAndGroupID",r),o=i.data.portal_role_ids;return o},I=(t,e,n)=>{let r={},i={};for(const a of t){let t=a.id,e={id:t,index:a.menu_id,name:a.title,sort:a.sort,actionType:a.actionType,url:a.url,iconClass:a.image,children:[],app_id:a.app_id,menu_id:a.menu_id,beyond_type:a.menu_type?a.menu_type:"RJVIEW-OTHERS",beyond_type_sort:a.menu_type_sort?a.menu_type_sort:999};n?(n[t]||"4"==a.type)&&(r[t]=e):r[t]=e}for(const a of e){let t=a.id;i[t]=a}for(const a of t){let t=a.type;if("5"==t){let t=r[a.id];if(!t)continue;let e=a.parent_id,n=t.beyond_type,o=r[e],u=o.children,s=u.find((t=>t.id==n));if(s){let e=s.children;e.push(t),t.typeItem=s}else{let e=i[n],r=e?{id:n,index:n,name:e.title,children:[],sort:e.value}:{id:n,index:n,name:"其他",children:[],sort:999},o=r.children;o.push(t),u.push(r),t.typeItem=r}}}const o=[];for(const a of t){let t=a.type;if("4"==t){let t=r[a.id];if(!t)continue;let e=t.children,n=0;for(const r of e){let t=r.children,e=t.length;if(n+=e,e>0)break}if(0==n)continue;o.push(t);let i=t.children;i.sort(((t,e)=>Number.isNaN(t.sort)?1:Number.isNaN(e.sort)?-1:t.sort-e.sort));for(let r of i){let t=r.children;t.sort(((t,e)=>Number.isNaN(t.sort)?1:Number.isNaN(e.sort)?-1:t.sort-e.sort))}}}return o.sort(((t,e)=>Number.isNaN(t.sort)?1:Number.isNaN(e.sort)?-1:t.sort-e.sort)),o},A=async t=>{let e={param:{userData:t}},n=await g.post("/dataservice/rest/orchestration/getPortalPageID",e),r=n.data.portal_id;return r},S=t=>{let e={param:{userData:t}};return g.post("/dataservice/rest/orchestration/getUserAllMappngPortal",e)},D=async t=>{let e={param:{operateData:t}},n=await g.post("/dataservice/rest/orchestration/getPortalUserMappingInfos",e),r=n.data.portalMapping;return r},B=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getPortalPageConfig",e),r=n.data.portal_page_config||"[]";return r},k=t=>{let e={param:t};return g.post("/dataservice/rest/orchestration/setPortalPageConfig",e)},C=t=>{let e={param:{portalMappingData:t}};return g.post("/dataservice/rest/orchestration/updateUserSelectPortal",e)},E=async(t,e)=>{let n={param:{id:t,appid:e}},r=await g.post("/dataservice/rest/orchestration/getPortalPageMenuID",n),i=r.data.menu_id;return i},O=async(t,e)=>{let n={param:{appID:t,groupID:e}},r=await g.post("/dataservice/rest/orchestration/getPortalMappingAppInfoByID",n),i=r.data.appInfo;return i},j=async()=>{let t={param:{id:"1005"}},e=await g.post("/dataservice/rest/orchestration/getNoticeInfosByAppTypeID",t),n=e.data.resultDatas;return n},R=async(t,e)=>{let n=await g.get(`/appAuth/getAccessToken?appKey=${t}&appSecret=${e}`),r=n.data;return r},P=async(t,e)=>{let n=await g.get(`/systhirdapp/user/getUserByCode?code=${t}&access_token=${e}`),r=n.data;return r},T=async(t,e,n)=>{let r={param:{userID:t,im_type:e,group_id:n}},i=await g.post("/dataservice/rest/orchestration/getIMUserSigByID",r),o=i.data.userSig;return o},M=async t=>{let e={param:{groupID:t}},n=await g.post("/dataservice/rest/orchestration/getPortalAppCustomConfig",e),r=n.data.configInfo;return r},U=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getGroupIDByDptID",e),r=n.data.resultDptData,i=r.id;return i},z=(t,e)=>{if(e&&e.length>0)for(let n=0;n<e.length;n++)if(e[n].name==t)return e[n].default_value;return""},L=async(t,e,n)=>{let r={param:{appKey:t,appSecret:e,groupID:n}},i=await g.post("/dataservice/rest/orchestration/getThirdAppPathByKey",r),o=i.data.path;return o},N=(t,e)=>{let n=window.sessionStorage.getItem("isdata_app_variable_"+t);return n||(n=z(t,e),n&&window.sessionStorage.setItem("isdata_app_variable_"+t,n)),n},H=t=>{let e={param:{operateData:t}};return g.post("/dataservice/rest/orchestration/addObjectUsedTimes",e)},W=t=>{let e={param:{objectInfo:t}};return g.post("/dataservice/rest/orchestration/getObjectUseTimes",e)},F=async t=>{let e={param:{componentID:t}},n=await g.post("/dataservice/rest/orchestration/getPageIDByComponentID",e),r=n.data.page_id;return r},K=async t=>{let e={param:{account:t}},n=await g.post("/dataservice/rest/orchestration/getGourpMappingsByAccountName",e),r=n.data.resultGroups;return r},$=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getGroupIDByDptID",e),r=n.data.resultDptData;return r},q=async t=>{let e={param:{ids:t}},n=await g.post("/dataservice/rest/orchestration/getOfficeInfosByIDs",e),r=n.data.officeInfos;return r},G=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getOfficeInfosByID",e),r=n.data.officeData;return r},X=async t=>{let e={param:{id:t}},n=await g.post("/dataservice/rest/orchestration/getAPPInfosByID",e),r=n.data.appInfo;return r},V=async t=>{let e={param:{groupID:t}},n=await g.post("/dataservice/rest/orchestration/getAllUserInfosByGroupID",e),r=n.data.resultDatas;return r},J=async t=>{let e={param:{officeID:t}},n=await g.post("/dataservice/rest/orchestration/getChildrenOfficeInfosByID",e),r=n.data.resultDatas;return r},Z=async(t,e)=>{let n={param:{userID:t,groupID:e}},r=await g.post("/dataservice/rest/orchestration/getPojectDptsByUserAndGroupID",n),i={dptDatas:r.data.officeDatas,userMappings:r.data.userMappings};return i},Y=async(t,e,n,r)=>{let i={param:{data:{userID:t,im_type:e,group_id:n,userSig:r}}},o=await g.post("/dataservice/rest/orchestration/addIMMapping",i),a=o.data;return a},Q=async(t,e)=>{let n={param:{userID:t,groupID:e}},r=await g.post("/dataservice/rest/orchestration/getAIRobotInfos",n),i=r.data.robotInfos;return i},tt=async(t,e,n,r)=>{let i={param:{userID:t,im_type:e,groupID:n,userSig:r}},o=await g.post("/dataservice/rest/orchestration/updateIMMapping",i),a=o.data;return a},et=async t=>{let e={param:{appID:t}},n=await g.post("/dataservice/rest/orchestration/getAppCustomData",e),r=n.data.customData;return r=r?JSON.parse(r):{},r},nt=async t=>{let e={param:{appID:t}},n=await g.post("/dataservice/rest/orchestration/getIntegrateAppInfoByID",e),r=n.data.appInfo;return r};var rt=n(1396),it=n.n(rt);const ot=()=>g.get("/system/authority/getAuthPic?module=loginPassword",{responseType:"arraybuffer"}),at=async t=>{let e=await g.get(`/system/authority/logout?isMobileLogout=${t}`),n=JSON.parse(e.request.response),r=n.code;return"10110020"==r?(window.sessionStorage.clear(),{code:r,message:n.message}):{code:r,message:n.message}},ut=async t=>{let e=await ft();const n=it().AES.decrypt(t,e).toString(it().enc.Utf8);return n},st=async(t,e,n)=>{let r=window.sessionStorage.getItem("iportal_login_user_key");r=await ut(r),t.password=r;let i=await at(n),o=i.code,a=i.message;if("10110020"==o){let n=await ct(t,e);return n}return{code:o,message:a}},ct=async(t,e)=>{let n={param:{loginData:{account:t.account_view,group_id:t.groupid,imageCode:t.imageCode}}},r=await g.post("/dataservice/rest/orchestration/getLoginPortalAccountKey",n),i=await ft(),o=JSON.parse(r.request.response),a=o.result.code;if(10001==a){let n=o.result.codeData.code,u=n,s=o.result.codeData.key;if(n=it().AES.decrypt(n,i).toString(it().enc.Utf8),s=it().AES.decrypt(s,i).toString(it().enc.Utf8),s==t.password){if(n=window.appSdk.Encrypt(n),t.password=n,r=await g.post(`/system/authority/loginAccount4Application?authPicCode=${t.imageCode}&dataappId=${e}&mobileOrWeb=web`,t),o=JSON.parse(r.request.response),a=o.code,10110004==a){let e=o.id;return window.sessionStorage.setItem("iportal_login_user_id",e),window.sessionStorage.setItem("iportal_group_id",t.groupid),window.sessionStorage.setItem("iportal_login_user_key",u),{code:a}}return{code:a,message:o.message}}return{code:a,message:"账户密码错误!"}}return{code:a,message:o.result.message}},ft=async()=>{let t={param:{}},e=await g.post("/dataservice/rest/orchestration/getKey",t),n=e.data.key;return n},lt=(t,e=200)=>g.post(`/asset/getAssetData?asset_id=${t}&count=${e}`,{filters:[]}),ht=(t,e)=>{try{const n=new URL(t),r=n.searchParams.get(e);return r&&-1!==r.indexOf("#")?r.split("#")[0]:r}catch(n){return console.error("URL 格式错误:",n),""}},pt=async(t,e)=>{try{const n=await fetch(t);if(!n.ok)throw new Error(`网络请求失败: ${n.status} ${n.statusText}`);const r=await n.blob(),i=e||dt(t);return new File([r],i,{type:r.type,lastModified:Date.now()})}catch(n){throw console.error("创建 File 失败:",n),n}},dt=t=>{try{const e=new URL(t);return e.pathname.split("/").pop()||"downloaded_file"}catch(e){return"downloaded_file"}};n(3579);const vt=t=>{let e=window.SDATA_WINDOW_TRUSTED_ORIGINS;e||(window.SDATA_WINDOW_TRUSTED_ORIGINS=[]),e.includes(t)||e.push(t)},gt=t=>{let e=window.SDATA_WINDOW_TRUSTED_ORIGINS;e||(window.SDATA_WINDOW_TRUSTED_ORIGINS=[]);let n=e.indexOf(t);n>-1&&e.splice(n,1)},yt=(t,e)=>{let n=window.sdataEventActions;n||(window.sdataEventActions={}),window.sdataEventActions[t]=e},_t=t=>{let e=window.sdataEventActions;e||(window.sdataEventActions={}),delete window.sdataEventActions[t]},wt=()=>{let t=window.SDATA_WINDOW_TRUSTED_ORIGINS;t||(window.SDATA_WINDOW_TRUSTED_ORIGINS=[]);let e=window.sdataEventActions;e||(window.sdataEventActions={}),window.addEventListener("message",(async t=>{const e=window.SDATA_WINDOW_TRUSTED_ORIGINS.some((e=>t.origin===e||new RegExp(e).test(t.origin)));if(!e)return void console.log("拒绝非可信源消息:",t.origin);let n=t.data?.eventKey;if(!n)return;let r=t.origin;if(console.log(`收到${r}页面消息:`,t.data),"sdata_alllife_event_response"===n){let e=t.data.eventOperateKey,n=window.sdataEventActions[e];delete window.sdataEventActions[e],n&&await n(t.data.data,t)}else{let e=window.sdataEventActions[n],i={eventKey:"sdata_alllife_event_response",eventOperateKey:t.data.eventOperateKey,data:{}};if(e){let n=await e(t.data.data,t);i.data=n}t.source.postMessage(i,r)}}))},mt=async(t,e,n,r,i)=>{let o=(new Date).getTime(),a=Math.floor(1e4*Math.random())+1,u=`${n}_${o}_${a}`;yt(u,i);let s={eventOperateKey:u,eventKey:n,data:r};t.postMessage(s,e)};class bt{constructor(t,e){this.handler=e,this.actionKey=t.actionKey,this.appSKID=t.appSKID,this.imType=t.imType,this.groupID=t.groupID,this.userID=t.userID,this.chatType=t.chatType||0,this.singleChatID=t.singleChatID||"",this.customParams=t.customParams||{},this.chartOrigin=t.chartOrigin,console.log("ChatClientMgr init:",this.actionKey)}makeKey(t){return`${t}-${this.actionKey}`}async init(){this.handler.addChatListener(this.makeKey("sdata_get_access_token"),(async t=>await this.handler.getPortalAccessToken(t))),this.handler.addChatListener(this.makeKey("sdata_get_portal_user_info"),(async t=>await this.handler.getPortalUserInfo(t))),this.handler.addChatListener(this.makeKey("sdata_get_portal_user_sig"),(async t=>{let e=t.userID,n=t.im_type,r=t.group_id;return await this.handler.getPortalUserSig(e,n,r)})),this.handler.addChatListener(this.makeKey("sdata_add_im_mapping"),(async t=>{let e=t.userID,n=t.im_type,r=t.userSig;return await this.handler.addIMMapping(e,n,r,this.groupID)})),this.handler.addChatListener(this.makeKey("sdata_update_im_mapping"),(async t=>await this.handler.updateIMMapping(t))),this.handler.addChatListener(this.makeKey("sdata_get_users_by_group_id"),(async t=>await this.handler.getAllUserInfosByGroupID(t))),this.handler.addChatListener(this.makeKey("sdata_get_dpts_by_group_id"),(async t=>await this.handler.getChildrenOfficeInfosByID(t))),this.handler.addChatListener(this.makeKey("sdata_get_project_dpts_by_user_group_id"),(async t=>await this.handler.getPojectDptsByUserAndGroupID(t))),this.handler.addChatListener(this.makeKey("sdata_get_ai_robot_infos"),(async t=>{let e=t.groupID,n=t.userID;return this.userID==n&&this.groupID==e?this.getAIRobotInfos():[]})),this.handler.addChatListener(this.makeKey("sdata_get_test_user_sig"),(async t=>{let e=t.SDKAppID,n=t.userID,r=await this.handler.genTestUserSig({SDKAppID:e,userID:n}),i=r.userSig;return i})),this.handler.addChatListener(this.makeKey("sdata_send_message_to_chat_server"),(async(t,e)=>{let n=t.message,r=n.from,i=await this.sendMessageToChatServer(r,n);return i})),this.handler.addChatListener(this.makeKey("sdata_close_frame_window"),(async(t,e)=>this.handler.closeWindow())),this.handler.addChatListener(this.makeKey("sdata_alllife_event_regist"),(async(t,e)=>{this.appSKID=t.appid,this.imType=t.im_type,await this.initChatAIs();let n={type:this.getChatTypeKey(this.chatType),singleChatID:this.singleChatID,customParams:this.customParams};console.log("charParams",n),this.handler.fireEventToChatWindow(e,this.chartOrigin,this.makeKey("sdata_alllife_initChat"),n,(t=>{t&&this.handler.onChatInitFinished()}))}))}getChatTypeKey(t){switch(t){case 0:return"IM_MULTIPLE_MODE";case 1:return"IM_SINGLE_MODE";case 2:return"IM_EMBED_MODE";default:return"IM_MULTIPLE_MODE"}}async initChatAIs(){if(window.imClient)this.chatAIClient=window.imClient;else{let t=await this.handler.getChatClientClasses();const{TencentCloudChat:e,TIMUploadPlugin:n}=t;window.imClient=e.create({SDKAppID:this.appSKID,storage:{enable:!0}}),window.imClient.registerPlugin({"tim-upload-plugin":n}),window.imClient.on(e.EVENT.SDK_READY,this.onChatAIReady.bind(this)),window.imClient.charAIs={},this.chatAIClient=window.imClient}this.chatAIClient.charAIs||(this.chatAIClient.charAIs={});let t=await this.handler.getAIRobotInfos(this.userID,this.groupID);t&&t.length>0&&t.forEach((async t=>{let e=t.id;if(!this.chatAIClient.charAIs[e]){t.chatID=e;let n=await this.handler.getPortalUserSig(e,this.imType,this.groupID);n||(n=await this.generateUserSigAndAdd(e)),t.userSig=n,this.chatAIClient.charAIs[e]={robot:t,messageCache:[]}}}))}async generateUserSigAndUpdate(t){let e=await this.handler.genTestUserSig({SDKAppID:this.appSKID,userID:t}),n=e.userSig;if(n){await this.chatAIClient.login({userID:t,userSig:n}),await this.chatAIClient.logout();let e={userID:t,userSig:n,im_type:this.imType,group_id:this.groupID};await this.handler.updateIMMapping(e)}return n}async generateUserSigAndAdd(t){let e=await this.handler.genTestUserSig({SDKAppID:this.appSKID,userID:t}),n=e.userSig;return n&&(await this.chatAIClient.login({userID:t,userSig:n}),await this.chatAIClient.logout(),await this.handler.addIMMapping(t,this.imType,n,this.groupID)),n}onChatAIReady(t){let e=this.chatAIClient.lastRobotID,n=this.getAIRobotInfoByID(e);if(console.log(`[AI chat] ${n.name}已经就绪:`,t),this.chatAIClient){let t=this.getAIRobotCacheMessagesByID(e);if(console.log(`[AI chat] ${n.name}就绪后查到的缓存信息:`,t),console.log(`[AI chat] ${n.name}所有信息仓:`,this.chatAIClient.charAIs),t&&t.length>0){const r=[...t];t.splice(0,t.length),r.forEach((t=>{console.log(`[AI chat] ${n.name}发送缓存消息:`,t),this.sendMessageToChatServer(e,t)}))}}}getAIRobotInfos(){let t=[];for(let e in this.chatAIClient.charAIs)t.push(this.chatAIClient.charAIs[e].robot);return t}getAIRobotInfoByID(t){return this.chatAIClient.charAIs[t]?this.chatAIClient.charAIs[t].robot:null}getAIRobotCacheMessagesByID(t){return this.chatAIClient.charAIs[t]?this.chatAIClient.charAIs[t].messageCache:[]}async sendMessageToChatServer(t,e){let n=this.getAIRobotInfoByID(t);if(this.chatAIClient.lastRobotID!=t){console.log(`[AI chat]需要新机器人回答,切换到新机器人${n.name}`),this.chatAIClient.lastRobotID&&await this.chatAIClient.logout();try{await this.chatAIClient.login({userID:t,userSig:n.userSig})}catch(r){console.log(`[AI chat]${n.name}登录失败`,r);let i=r.code;if(70001==i){console.log(`[AI chat]${n.name}UserSig过期,重新生成userSig`);let i=await this.generateUserSigAndUpdate(t);try{return await this.chatAIClient.login({userID:t,userSig:i}),void this.sendMessageToChatServer(t,e)}catch(r){return void console.log(`[AI chat]${n.name}重新登录失败`,r)}}}}if(this.chatAIClient.lastRobotID=t,this.chatAIClient&&this.chatAIClient.isReady()){let t=await this.chatAIClient.createTextMessage(e);this.chatAIClient.sendMessage(t).then((t=>{console.log(`[AI chat]${n.name}发送信息成功`,t)}),(t=>{console.log(`[AI chat]${n.name}发送失败`,t)}))}else{let r=this.getAIRobotCacheMessagesByID(t);r.push(e),console.log(`[AI chat]${n.name}未就绪,缓存后消息:`,r)}}converToAIServerParams(t,e,n){let r="",i=t.type;switch(i){case"TIMTextElem":r=t.payload?.text||"";break;case"TIMImageElem":break;case"TIMSoundElem":break;case"TIMVideoFileElem":break;case"TIMFileElem":break;default:break}let o=t.cloudCustomData||{},a=o.conversation_id||"",u={prompt:r,params:n||{},robotKey:e.password,conversation_id:a||"",userID:t.from||""};return u}abort(){this.chatAIClient=null}}const xt=async(t,e)=>{let n={param:{id:t,groupID:e}},r=await g.post("/dataservice/rest/orchestration/getRobotInfoByID",n),i=r.data.robotInfo;return i},It=t=>{let e={genTestUserSig:async t=>{},getChatClientClasses:async()=>[],getAIRobotInfos:async(t,e)=>Q(t,e),getPortalUserSig:async(t,e,n)=>T(t,e,n),addIMMapping:async(t,e,n,r)=>Y(t,e,r,n),updateIMMapping:async t=>{let e=t.userID,n=t.im_type,r=t.group_id,i=t.userSig;return tt(e,n,r,i)},getPortalAccessToken:async t=>{let e=t.appKey,n=t.appSecret;return R(e,n)},getPortalUserInfo:async t=>{let e=t.code,n=t.access_token;return P(e,n)},getAllUserInfosByGroupID:async t=>{let e=t.groupID;return V(e)},getChildrenOfficeInfosByID:async t=>{let e=t.groupID;return J(e)},getPojectDptsByUserAndGroupID:async t=>{let e=t.groupID,n=t.userID;return Z(n,e)},closeWindow:()=>!0,addChatListener:async(t,e)=>{await yt(t,e)},fireEventToChatWindow:async(t,e,n,r,i)=>{await mt(t.source,e,n,r,i)},onChatInitFinished:async()=>{}};return e={...e,...t},e},At=async(t,e={})=>{let n=window.smardaten_api_context_path,r=`${n}/storage_area/public${t}`,i=r.split(".").pop().toLowerCase(),o=e.fileName?`${e.fileName}.${i}`:Dt(r);i=St(i);let a=window.anonymousIsLogin||window.currentUser,u=e.userID||a?.id,s=e.appID||y(!1,[]),c=await et(s),f=e.aiAgentServerIP||c?.aiAgentServerIP||"",l=`${f}/addAndCleanDocument`,h={params:{inputs:{fileName:o},files:[{type:i,transfer_method:e.transfer_method||"remote_url",url:r}],user:u}};g.post(l,JSON.stringify(h)).then((t=>{console.log("发送消息成功:",t)})).catch((t=>{console.error("发送消息失败:",t)}))},St=t=>{let e={DOCX:"document",TXT:"document",MD:"document",MARKDOWN:"document",MDX:"document",PDF:"document",HTML:"document",XLSX:"document",XLS:"document",VTT:"document",DOC:"document",CSV:"document",EML:"document",MSG:"document",PPTX:"document",PPT:"document",XML:"document",EPUB:"document",JPG:"image",JPEG:"image",PNG:"image",GIF:"image",WEBP:"image",MP3:"audio",M4A:"audio",WAV:"audio",WEBM:"audio",MPGA:"audio",MP4:"video",MOV:"video",MPEG:"video"},n=t.toUpperCase();return e[n]||"custom"},Dt=t=>{try{const e=new URL(t);return e.pathname.split("/").pop()||"downloaded_file"}catch(e){return"downloaded_file"}}}(),r}()}));
27
27
  //# sourceMappingURL=index.umd.min.js.map