marketplacepos 5.51.2 → 5.51.3
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/Marketplace/{chunk-26E54WQH.js → chunk-2JS77RTQ.js} +1 -1
- package/Marketplace/{chunk-DVJ7VXWL.js → chunk-2MC4ICGX.js} +1 -1
- package/Marketplace/{chunk-NX3QFU4A.js → chunk-3OPIBKGC.js} +1 -1
- package/Marketplace/{chunk-NUF326RW.js → chunk-4H6YQH5Y.js} +1 -1
- package/Marketplace/{chunk-YSYA7XCF.js → chunk-5EGTHBHU.js} +1 -1
- package/Marketplace/{chunk-ICY32GYN.js → chunk-5ZKD2ZJE.js} +1 -1
- package/Marketplace/{chunk-N6VPSXF7.js → chunk-6KAANNEH.js} +2 -2
- package/Marketplace/{chunk-NMOQXVWS.js → chunk-6ZRATZJD.js} +1 -1
- package/Marketplace/{chunk-Q3Z7EEVP.js → chunk-772J5O6W.js} +1 -1
- package/Marketplace/{chunk-DV3BDHBL.js → chunk-7RPUDPF6.js} +1 -1
- package/Marketplace/{chunk-EXKAFEQL.js → chunk-A24BFVXA.js} +1 -1
- package/Marketplace/{chunk-QLFVXMNJ.js → chunk-BQFOS7WM.js} +1 -1
- package/Marketplace/{chunk-OEUA6IL2.js → chunk-CKH47T4N.js} +1 -1
- package/Marketplace/{chunk-MRWGPCR7.js → chunk-D765LK7G.js} +1 -1
- package/Marketplace/{chunk-AMQMYSQR.js → chunk-E22EMCMR.js} +1 -1
- package/Marketplace/{chunk-DOQD3RMB.js → chunk-FSLUPR5I.js} +1 -1
- package/Marketplace/{chunk-KVLHLMO4.js → chunk-FYQFBMXR.js} +1 -1
- package/Marketplace/{chunk-ILFG3IYB.js → chunk-GJANGM3E.js} +1 -1
- package/Marketplace/{chunk-DCMOITWM.js → chunk-GRQA7Y7Y.js} +1 -1
- package/Marketplace/{chunk-75RVMUFO.js → chunk-GYCHAJYH.js} +1 -1
- package/Marketplace/{chunk-HO6XCGRR.js → chunk-HEK6DTVD.js} +1 -1
- package/Marketplace/{chunk-MG7B4OWR.js → chunk-HIGPOY23.js} +1 -1
- package/Marketplace/{chunk-3KECTTUV.js → chunk-JNBROTGJ.js} +1 -1
- package/Marketplace/{chunk-CHCAQ4NV.js → chunk-LI2DXLEI.js} +1 -1
- package/Marketplace/{chunk-UOFJCKS5.js → chunk-LITY3VSE.js} +1 -1
- package/Marketplace/{chunk-UHWLUO2C.js → chunk-LPJSEQGR.js} +1 -1
- package/Marketplace/{chunk-GYQHWDWX.js → chunk-M3EGUVW7.js} +1 -1
- package/Marketplace/{chunk-HPQDUJXF.js → chunk-NJYWKADT.js} +1 -1
- package/Marketplace/{chunk-SLCKHYT3.js → chunk-NYBCG2UK.js} +1 -1
- package/Marketplace/{chunk-WZQRKTBN.js → chunk-PDIHZKEM.js} +1 -1
- package/Marketplace/{chunk-AVTQG66S.js → chunk-PG2DZ63W.js} +1 -1
- package/Marketplace/chunk-PPG26QRX.js +1 -0
- package/Marketplace/{chunk-KHGTW7IV.js → chunk-PRMV4INM.js} +1 -1
- package/Marketplace/{chunk-IUJ6UX3L.js → chunk-QCUYDIE3.js} +1 -1
- package/Marketplace/{chunk-FQM4RKLX.js → chunk-QKXMWSIJ.js} +1 -1
- package/Marketplace/{chunk-UJAA73LE.js → chunk-QREYZRXT.js} +1 -1
- package/Marketplace/{chunk-AVSAALDJ.js → chunk-QVK3OFDS.js} +1 -1
- package/Marketplace/{chunk-575TS45M.js → chunk-RIGKFQ2Q.js} +1 -1
- package/Marketplace/{chunk-QUIZLT5F.js → chunk-RQI26KZX.js} +1 -1
- package/Marketplace/{chunk-BKVIOCLH.js → chunk-SU5GJKTU.js} +1 -1
- package/Marketplace/{chunk-QPELTSKE.js → chunk-TBDHXPBR.js} +1 -1
- package/Marketplace/{chunk-DW7R34MP.js → chunk-TFCSRACM.js} +1 -1
- package/Marketplace/{chunk-VRD2D2BP.js → chunk-TIGXYFOW.js} +1 -1
- package/Marketplace/{chunk-NKN7T3C3.js → chunk-UAQIEHEC.js} +1 -1
- package/Marketplace/{chunk-REDQ2L7Y.js → chunk-V7V5O62J.js} +1 -1
- package/Marketplace/{chunk-PGQYHHH3.js → chunk-VR7NFJRO.js} +1 -1
- package/Marketplace/{chunk-NEB6AMMM.js → chunk-VWETHESQ.js} +1 -1
- package/Marketplace/{chunk-APQWBZOM.js → chunk-VYYJFRP5.js} +1 -1
- package/Marketplace/{chunk-LB276KSA.js → chunk-W4GP3QI7.js} +1 -1
- package/Marketplace/{chunk-BZ7QY7N3.js → chunk-XR3S3ZAY.js} +1 -1
- package/Marketplace/{chunk-QJ7SMXW4.js → chunk-YEVETIZF.js} +1 -1
- package/Marketplace/{chunk-J4552BMI.js → chunk-YH3KWMUX.js} +1 -1
- package/Marketplace/{chunk-JUN3HVEV.js → chunk-YM4QLIHR.js} +1 -1
- package/Marketplace/{chunk-U4ARIHUF.js → chunk-YNWLLBHM.js} +1 -1
- package/Marketplace/{chunk-YFR3EI3B.js → chunk-YTEEAEDW.js} +1 -1
- package/Marketplace/{chunk-4XA7JWTB.js → chunk-Z53UJ4A4.js} +1 -1
- package/Marketplace/{chunk-YMOSVDG5.js → chunk-ZCJEYG3D.js} +1 -1
- package/Marketplace/index.html +2 -2
- package/Marketplace/{main-I5THR2C3.js → main-TW7CIXAJ.js} +1 -1
- package/package.json +1 -1
- package/Marketplace/chunk-5NWJOQN5.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as be}from"./chunk-A6QXXKPR.js";import{b as de,h as we}from"./chunk-J4552BMI.js";import{a as me}from"./chunk-AGBJEXIM.js";import{b as pe,e as _e}from"./chunk-D6JH2KV4.js";import{f as ge,g as fe,ma as U,qa as B,ra as ae}from"./chunk-OHGMB7HJ.js";import{a as _,b as $,c as N,i as g}from"./chunk-66YHNWRR.js";var C=class extends Error{constructor(e,t){let o=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=o}},P=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},S=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},O=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=o}},F=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=o}},q=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=o}},M=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},z=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=o}};var A=class{constructor(e,t,o){this.statusCode=e,this.statusText=t,this.content=o}},k=class{get(e,t){return this.send($(_({},t),{method:"GET",url:e}))}post(e,t){return this.send($(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send($(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var i=(function(r){return r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None",r})(i||{});var I=class{constructor(){}log(e,t){}};I.instance=new I;var Se="9.0.6";var d=class{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,o){if(!(e in t))throw new Error(`Unknown ${o} value: ${e}.`)}},p=class r{static get isBrowser(){return!r.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!r.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!r.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function x(r,e){let t="";return v(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Ee(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Ee(r){let e=new Uint8Array(r),t="";return e.forEach(o=>{let n=o<16?"0":"";t+=`0x${n}${o.toString(16)} `}),t.substr(0,t.length-1)}function v(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function V(r,e,t,o,n,s){return g(this,null,function*(){let c={},[a,l]=E();c[a]=l,r.log(i.Trace,`(${e} transport) sending data. ${x(n,s.logMessageContent)}.`);let u=v(n)?"arraybuffer":"text",f=yield t.post(o,{content:n,headers:_(_({},c),s.headers),responseType:u,timeout:s.timeout,withCredentials:s.withCredentials});r.log(i.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function Ce(r){return r===void 0?new R(i.Information):r===null?I.instance:r.log!==void 0?r:new R(r)}var J=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},R=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let o=`[${new Date().toISOString()}] ${i[e]}: ${t}`;switch(e){case i.Critical:case i.Error:this.out.error(o);break;case i.Warning:this.out.warn(o);break;case i.Information:this.out.info(o);break;default:this.out.log(o);break}}}};function E(){let r="X-SignalR-User-Agent";return p.isNode&&(r="User-Agent"),[r,Te(Se,Pe(),Re(),xe())]}function Te(r,e,t,o){let n="Microsoft SignalR/",s=r.split(".");return n+=`${s[0]}.${s[1]}`,n+=` (${r}; `,e&&e!==""?n+=`${e}; `:n+="Unknown OS; ",n+=`${t}`,o?n+=`; ${o}`:n+="; Unknown Runtime Version",n+=")",n}function Pe(){if(p.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function xe(){if(p.isNode)return process.versions.node}function Re(){return p.isNode?"NodeJS":"Browser"}function K(r){return r.stack?r.stack:r.message?r.message:`${r}`}function ye(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var X=class extends k{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||p.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:N;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(ye());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:N;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return g(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new S;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,o;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),o=new S});let n=null;if(e.timeout){let l=e.timeout;n=setTimeout(()=>{t.abort(),this._logger.log(i.Warning,"Timeout from HTTP request."),o=new P},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},v(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:_({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(l){throw o||(this._logger.log(i.Warning,`Error from HTTP request. ${l}.`),l)}finally{n&&clearTimeout(n),e.abortSignal&&(e.abortSignal.onabort=null)}if(!s.ok){let l=yield ve(s,"text");throw new C(l||s.statusText,s.status)}let a=yield ve(s,e.responseType);return new A(s.status,s.statusText,a)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(o,n)=>t=n.join("; ")),t}};function ve(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}var G=class extends k{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?new Promise((t,o)=>{let n=new XMLHttpRequest;n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(v(e.content)?n.setRequestHeader("Content-Type","application/octet-stream"):n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let s=e.headers;s&&Object.keys(s).forEach(c=>{n.setRequestHeader(c,s[c])}),e.responseType&&(n.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),o(new S)}),e.timeout&&(n.timeout=e.timeout),n.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),n.status>=200&&n.status<300?t(new A(n.status,n.statusText,n.response||n.responseText)):o(new C(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(i.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),o(new C(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(i.Warning,"Timeout from HTTP request."),o(new P)},n.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var Y=class extends k{constructor(e){if(super(),typeof fetch<"u"||p.isNode)this._httpClient=new X(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new G(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}};var y=class r{static write(e){return`${e}${r.RecordSeparator}`}static parse(e){if(e[e.length-1]!==r.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(r.RecordSeparator);return t.pop(),t}};y.RecordSeparatorCode=30;y.RecordSeparator=String.fromCharCode(y.RecordSeparatorCode);var Q=class{writeHandshakeRequest(e){return y.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,o;if(v(e)){let a=new Uint8Array(e),l=a.indexOf(y.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),o=a.byteLength>u?a.slice(u).buffer:null}else{let a=e,l=a.indexOf(y.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=a.substring(0,u),o=a.length>u?a.substring(u):null}let n=y.parse(t),s=JSON.parse(n[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[o,s]}};var h=(function(r){return r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence",r})(h||{});var Z=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new J(this,e)}};var ee=class{constructor(e,t,o){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=o}_send(e){return g(this,null,function*(){let t=this._protocol.writeMessage(e),o=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let n=()=>{},s=()=>{};v(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(o=new Promise((c,a)=>{n=c,s=a})),this._messages.push(new le(t,this._totalMessageCount,n,s))}try{this._reconnectInProgress||(yield this._connection.send(t))}catch{this._disconnected()}yield o})}_ack(e){let t=-1;for(let o=0;o<this._messages.length;o++){let n=this._messages[o];if(n._id<=e.sequenceId)t=o,v(n._message)?this._bufferedByteCount-=n._message.byteLength:this._bufferedByteCount-=n._message.length,n._resolver();else if(this._bufferedByteCount<this._bufferSize)n._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==h.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;let t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}_resend(){return g(this,null,function*(){let e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;yield this._connection.send(this._protocol.writeMessage({type:h.Sequence,sequenceId:e}));let t=this._messages;for(let o of t)yield this._connection.send(o._message);this._reconnectInProgress=!1})}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(let t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case h.Invocation:case h.StreamItem:case h.Completion:case h.StreamInvocation:case h.CancelInvocation:return!0;case h.Close:case h.Sequence:case h.Ping:case h.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(()=>g(this,null,function*(){try{this._reconnectInProgress||(yield this._connection.send(this._protocol.writeMessage({type:h.Ack,sequenceId:this._latestReceivedSequenceId})))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}},le=class{constructor(e,t,o,n){this._message=e,this._id=t,this._resolver=o,this._rejector=n}};var De=30*1e3,$e=15*1e3,Ne=1e5,m=(function(r){return r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting",r})(m||{}),te=class r{static create(e,t,o,n,s,c,a){return new r(e,t,o,n,s,c,a)}constructor(e,t,o,n,s,c,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},d.isRequired(e,"connection"),d.isRequired(t,"logger"),d.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=s??De,this.keepAliveIntervalInMilliseconds=c??$e,this._statefulReconnectBufferSize=a??Ne,this._logger=t,this._protocol=o,this.connection=e,this._reconnectPolicy=n,this._handshakeProtocol=new Q,this.connection.onreceive=l=>this._processIncomingData(l),this.connection.onclose=l=>this._connectionClosed(l),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=m.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:h.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==m.Disconnected&&this._connectionState!==m.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}_startWithStateTransitions(){return g(this,null,function*(){if(this._connectionState!==m.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=m.Connecting,this._logger.log(i.Debug,"Starting HubConnection.");try{yield this._startInternal(),p.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=m.Connected,this._connectionStarted=!0,this._logger.log(i.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(i.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return g(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,o)=>{this._handshakeResolver=t,this._handshakeRejecter=o});yield this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);let o={protocol:this._protocol.name,version:t};if(this._logger.log(i.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(o)),this._logger.log(i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new ee(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return g(this,null,function*(){let e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){if(this._connectionState===m.Disconnected)return this._logger.log(i.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===m.Disconnecting)return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let t=this._connectionState;return this._connectionState=m.Disconnecting,this._logger.log(i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===m.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new S("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}_sendCloseMessage(){return g(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._createStreamInvocation(e,t,n),c,a=new Z;return a.cancelCallback=()=>{let l=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],c.then(()=>this._sendWithProtocol(l))},this._callbacks[s.invocationId]=(l,u)=>{if(u){a.error(u);return}else l&&(l.type===h.Completion?l.error?a.error(new Error(l.error)):a.complete():a.next(l.item))},c=this._sendWithProtocol(s).catch(l=>{a.error(l),delete this._callbacks[s.invocationId]}),this._launchStreams(o,c),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._sendWithProtocol(this._createInvocation(e,t,!0,n));return this._launchStreams(o,s),s}invoke(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._createInvocation(e,t,!1,n);return new Promise((a,l)=>{this._callbacks[s.invocationId]=(f,T)=>{if(T){l(T);return}else f&&(f.type===h.Completion?f.error?l(new Error(f.error)):a(f.result):l(new Error(`Unexpected message type: ${f.type}`)))};let u=this._sendWithProtocol(s).catch(f=>{l(f),delete this._callbacks[s.invocationId]});this._launchStreams(o,u)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();let o=this._methods[e];if(o)if(t){let n=o.indexOf(t);n!==-1&&(o.splice(n,1),o.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){let t=this._protocol.parseMessages(e,this._logger);for(let o of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(o)))switch(o.type){case h.Invocation:this._invokeClientMethod(o).catch(n=>{this._logger.log(i.Error,`Invoke client method threw error: ${K(n)}`)});break;case h.StreamItem:case h.Completion:{let n=this._callbacks[o.invocationId];if(n){o.type===h.Completion&&delete this._callbacks[o.invocationId];try{n(o)}catch(s){this._logger.log(i.Error,`Stream callback threw error: ${K(s)}`)}}break}case h.Ping:break;case h.Close:{this._logger.log(i.Information,"Close message received from server.");let n=o.error?new Error("Server returned an error on close: "+o.error):void 0;o.allowReconnect===!0?this.connection.stop(n):this._stopPromise=this._stopInternal(n);break}case h.Ack:this._messageBuffer&&this._messageBuffer._ack(o);break;case h.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(o);break;default:this._logger.log(i.Warning,`Invalid message type: ${o.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,o;try{[o,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(n){let s="Error parsing handshake response: "+n;this._logger.log(i.Error,s);let c=new Error(s);throw this._handshakeRejecter(c),c}if(t.error){let n="Server returned handshake error: "+t.error;this._logger.log(i.Error,n);let s=new Error(n);throw this._handshakeRejecter(s),s}else this._logger.log(i.Debug,"Server handshake complete.");return this._handshakeResolver(),o}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(()=>g(this,null,function*(){if(this._connectionState===m.Connected)try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return g(this,null,function*(){let t=e.target.toLowerCase(),o=this._methods[t];if(!o){this._logger.log(i.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let n=o.slice(),s=!!e.invocationId,c,a,l;for(let u of n)try{let f=c;c=yield u.apply(this,e.arguments),s&&c&&f&&(this._logger.log(i.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(f){a=f,this._logger.log(i.Error,`A callback for the method '${t}' threw error '${f}'.`)}l?yield this._sendWithProtocol(l):s?(a?l=this._createCompletionMessage(e.invocationId,`${a}`,null):c!==void 0?l=this._createCompletionMessage(e.invocationId,null,c):(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),l=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(l)):c&&this._logger.log(i.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(i.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new S("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===m.Disconnecting?this._completeClose(e):this._connectionState===m.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===m.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=m.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),p.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(i.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return g(this,null,function*(){let t=Date.now(),o=0,n=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(o++,0,n);if(s===null){this._logger.log(i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=m.Reconnecting,e?this._logger.log(i.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(i.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(c=>c.apply(this,[e]))}catch(c){this._logger.log(i.Error,`An onreconnecting callback called with error '${e}' threw error '${c}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(i.Information,`Reconnect attempt number ${o} will start in ${s} ms.`),yield new Promise(c=>{this._reconnectDelayHandle=setTimeout(c,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(i.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(c=>c.apply(this,[this.connection.connectionId]))}catch(c){this._logger.log(i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${c}'.`)}return}catch(c){if(this._logger.log(i.Information,`Reconnect attempt failed because of error '${c}'.`),this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}n=c instanceof Error?c:new Error(c.toString()),s=this._getNextRetryDelay(o++,Date.now()-t,n)}}this._logger.log(i.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:o})}catch(n){return this._logger.log(i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(o=>{let n=t[o];try{n(null,e)}catch(s){this._logger.log(i.Error,`Stream 'error' callback called with '${e}' threw error: ${K(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,o,n){if(o)return n.length!==0?{target:e,arguments:t,streamIds:n,type:h.Invocation}:{target:e,arguments:t,type:h.Invocation};{let s=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:n,type:h.Invocation}:{target:e,arguments:t,invocationId:s.toString(),type:h.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let o in e)e[o].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:n=>{let s;n instanceof Error?s=n.message:n&&n.toString?s=n.toString():s="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,s)))},next:n=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,n)))}})}}_replaceStreamingParams(e){let t=[],o=[];for(let n=0;n<e.length;n++){let s=e[n];if(this._isObservable(s)){let c=this._invocationId;this._invocationId++,t[c]=s,o.push(c.toString()),e.splice(n,1)}}return[t,o]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,o){let n=this._invocationId;return this._invocationId++,o.length!==0?{target:e,arguments:t,invocationId:n.toString(),streamIds:o,type:h.StreamInvocation}:{target:e,arguments:t,invocationId:n.toString(),type:h.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:h.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:h.StreamItem}}_createCompletionMessage(e,t,o){return t?{error:t,invocationId:e,type:h.Completion}:{invocationId:e,result:o,type:h.Completion}}_createCloseMessage(){return{type:h.Close}}};var Ae=[0,2e3,1e4,3e4,null],L=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Ae}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var D=(()=>{class r{}return r.Authorization="Authorization",r.Cookie="Cookie",r})();var oe=class extends k{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return g(this,null,function*(){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=yield this._accessTokenFactory()),this._setAuthorizationHeader(e);let o=yield this._innerClient.send(e);return t&&o.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):o})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[D.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[D.Authorization]&&delete e.headers[D.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var b=(function(r){return r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling",r})(b||{}),w=(function(r){return r[r.Text=1]="Text",r[r.Binary=2]="Binary",r})(w||{});var ne=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var W=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,o){this._httpClient=e,this._logger=t,this._pollAbort=new ne,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){if(d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._url=e,this._logger.log(i.Trace,"(LongPolling transport) Connecting."),t===w.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[o,n]=E(),s=_({[o]:n},this._options.headers),c={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};t===w.Binary&&(c.responseType="arraybuffer");let a=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${a}.`);let l=yield this._httpClient.get(a,c);l.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new C(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,c)})}_poll(e,t){return g(this,null,function*(){try{for(;this._running;)try{let o=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${o}.`);let n=yield this._httpClient.get(o,t);n.statusCode===204?(this._logger.log(i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):n.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${n.statusCode}.`),this._closeError=new C(n.statusText||"",n.statusCode),this._running=!1):n.content?(this._logger.log(i.Trace,`(LongPolling transport) data received. ${x(n.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(n.content)):this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(o){this._running?o instanceof P?this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=o,this._running=!1):this._logger.log(i.Trace,`(LongPolling transport) Poll errored after shutdown: ${o.message}`)}}finally{this._logger.log(i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return g(this,null,function*(){return this._running?V(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return g(this,null,function*(){this._logger.log(i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,o]=E();e[t]=o;let n={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},s;try{yield this._httpClient.delete(this._url,n)}catch(c){s=c}s?s instanceof C&&(s.statusCode===404?this._logger.log(i.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(i.Trace,`(LongPolling transport) Error sending a DELETE request: ${s}`)):this._logger.log(i.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(i.Trace,e),this.onclose(this._closeError)}}};var re=class{constructor(e,t,o,n){this._httpClient=e,this._accessToken=t,this._logger=o,this._options=n,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){return d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,n)=>{let s=!1;if(t!==w.Text){n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let c;if(p.isBrowser||p.isWebWorker)c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(e),l={};l.Cookie=a;let[u,f]=E();l[u]=f,c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{c.onmessage=a=>{if(this.onreceive)try{this._logger.log(i.Trace,`(SSE transport) data received. ${x(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(l){this._close(l);return}},c.onerror=a=>{s?this._close():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},c.onopen=()=>{this._logger.log(i.Information,`SSE connected to ${this._url}`),this._eventSource=c,s=!0,o()}}catch(a){n(a);return}})})}send(e){return g(this,null,function*(){return this._eventSource?V(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var se=class{constructor(e,t,o,n,s,c){this._logger=o,this._accessTokenFactory=t,this._logMessageContent=n,this._webSocketConstructor=s,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=c}connect(e,t){return g(this,null,function*(){d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(WebSockets transport) Connecting.");let o;return this._accessTokenFactory&&(o=yield this._accessTokenFactory()),new Promise((n,s)=>{e=e.replace(/^http/,"ws");let c,a=this._httpClient.getCookieString(e),l=!1;if(p.isNode||p.isReactNative){let u={},[f,T]=E();u[f]=T,o&&(u[D.Authorization]=`Bearer ${o}`),a&&(u[D.Cookie]=a),c=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else o&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(o)}`);c||(c=new this._webSocketConstructor(e)),t===w.Binary&&(c.binaryType="arraybuffer"),c.onopen=u=>{this._logger.log(i.Information,`WebSocket connected to ${e}.`),this._webSocket=c,l=!0,n()},c.onerror=u=>{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="There was an error with the transport",this._logger.log(i.Information,`(WebSockets transport) ${f}.`)},c.onmessage=u=>{if(this._logger.log(i.Trace,`(WebSockets transport) data received. ${x(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(f){this._close(f);return}},c.onclose=u=>{if(l)this._close(u);else{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(i.Trace,`(WebSockets transport) sending data. ${x(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var ke=100,ie=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,d.isRequired(e,"url"),this._logger=Ce(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let o=null,n=null;if(p.isNode&&typeof N<"u"){let s=typeof __webpack_require__=="function"?__non_webpack_require__:N;o=s("ws"),n=s("eventsource")}!p.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:p.isNode&&!t.WebSocket&&o&&(t.WebSocket=o),!p.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:p.isNode&&!t.EventSource&&typeof n<"u"&&(t.EventSource=n),this._httpClient=new oe(t.httpClient||new Y(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return g(this,null,function*(){if(e=e||w.Binary,d.isIn(e,w,"transferFormat"),this._logger.log(i.Debug,`Starting connection with transfer format '${w[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(i.Error,t),yield this._stopPromise,Promise.reject(new S(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(i.Error,t),Promise.reject(new S(t))}this._connectionStarted=!0})}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new he(this.transport)),this._sendQueue.send(e))}stop(e){return g(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return g(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return g(this,null,function*(){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===b.WebSockets)this.transport=this._constructTransport(b.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let o=null,n=0;do{if(o=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new S("The connection was stopped during negotiation.");if(o.error)throw new Error(o.error);if(o.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(o.url&&(t=o.url),o.accessToken){let s=o.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}n++}while(o.url&&n<ke);if(n===ke&&o.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,o,e)}this.transport instanceof W&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(o){return this._logger.log(i.Error,"Failed to start the connection: "+o),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(o)}})}_getNegotiationResponse(e){return g(this,null,function*(){let t={},[o,n]=E();t[o]=n;let s=this._resolveNegotiateUrl(e);this._logger.log(i.Debug,`Sending negotiation request: ${s}.`);try{let c=yield this._httpClient.post(s,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(c.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${c.statusCode}'`));let a=JSON.parse(c.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new M("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(c){let a="Failed to complete negotiation with the server: "+c;return c instanceof C&&c.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(i.Error,a),Promise.reject(new M(a))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,o,n){return g(this,null,function*(){let s=this._createConnectUrl(e,o.connectionToken);if(this._isITransport(t)){this._logger.log(i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(s,n),this.connectionId=o.connectionId;return}let c=[],a=o.availableTransports||[],l=o;for(let u of a){let f=this._resolveTransportOrError(u,t,n,l?.useStatefulReconnect===!0);if(f instanceof Error)c.push(`${u.transport} failed:`),c.push(f);else if(this._isITransport(f)){if(this.transport=f,!l){try{l=yield this._getNegotiationResponse(e)}catch(T){return Promise.reject(T)}s=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(s,n),this.connectionId=l.connectionId;return}catch(T){if(this._logger.log(i.Error,`Failed to start the transport '${u.transport}': ${T}`),l=void 0,c.push(new q(`${u.transport} failed: ${T}`,b[u.transport])),this._connectionState!=="Connecting"){let ue="Failed to select transport before stop() was called.";return this._logger.log(i.Debug,ue),Promise.reject(new S(ue))}}}}return c.length>0?Promise.reject(new z(`Unable to connect to the server with any of the available transports. ${c.join(" ")}`,c)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case b.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new se(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case b.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new re(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case b.LongPolling:return new W(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=o=>g(this,null,function*(){let n=!1;if(this.features.reconnect)try{this.features.disconnected(),yield this.transport.connect(e,t),yield this.features.resend()}catch{n=!0}else{this._stopConnection(o);return}n&&this._stopConnection(o)}):this.transport.onclose=o=>this._stopConnection(o),this.transport.connect(e,t)}_resolveTransportOrError(e,t,o,n){let s=b[e.transport];if(s==null)return this._logger.log(i.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(He(t,s))if(e.transferFormats.map(a=>w[a]).indexOf(o)>=0){if(s===b.WebSockets&&!this._options.WebSocket||s===b.ServerSentEvents&&!this._options.EventSource)return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it is not supported in your environment.'`),new O(`'${b[s]}' is not supported in your environment.`,s);this._logger.log(i.Debug,`Selecting transport '${b[s]}'.`);try{return this.features.reconnect=s===b.WebSockets?n:void 0,this._constructTransport(s)}catch(a){return a}}else return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it does not support the requested transfer format '${w[o]}'.`),new Error(`'${b[s]}' does not support ${w[o]}.`);else return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it was disabled by the client.`),new F(`'${b[s]}' is disabled by the client.`,s)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(i.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(i.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(i.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(i.Error,`Connection disconnected with error '${e}'.`):this._logger.log(i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(i.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!p.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(i.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";let o=new URLSearchParams(t.searchParams);return o.has("negotiateVersion")||o.append("negotiateVersion",this._negotiateVersion.toString()),o.has("useStatefulReconnect")?o.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&o.append("useStatefulReconnect","true"),t.search=o.toString(),t.toString()}};function He(r,e){return!r||(e&r)!==0}var he=class r{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new H,this._transportResult=new H,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new H),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}_sendLoop(){return g(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new H;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):r._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(o){e.reject(o)}}})}static _concatBuffers(e){let t=e.map(s=>s.byteLength).reduce((s,c)=>s+c),o=new Uint8Array(t),n=0;for(let s of e)o.set(new Uint8Array(s),n),n+=s.byteLength;return o.buffer}},H=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var Me="json",ce=class{constructor(){this.name=Me,this.version=2,this.transferFormat=w.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=I.instance);let o=y.parse(e),n=[];for(let s of o){let c=JSON.parse(s);if(typeof c.type!="number")throw new Error("Invalid payload.");switch(c.type){case h.Invocation:this._isInvocationMessage(c);break;case h.StreamItem:this._isStreamItemMessage(c);break;case h.Completion:this._isCompletionMessage(c);break;case h.Ping:break;case h.Close:break;case h.Ack:this._isAckMessage(c);break;case h.Sequence:this._isSequenceMessage(c);break;default:t.log(i.Information,"Unknown message type '"+c.type+"' ignored.");continue}n.push(c)}return n}writeMessage(e){return y.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var Le={trace:i.Trace,debug:i.Debug,info:i.Information,information:i.Information,warn:i.Warning,warning:i.Warning,error:i.Error,critical:i.Critical,none:i.None};function We(r){let e=Le[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}var j=class{configureLogging(e){if(d.isRequired(e,"logging"),je(e))this.logger=e;else if(typeof e=="string"){let t=We(e);this.logger=new R(t)}else this.logger=new R(e);return this}withUrl(e,t){return d.isRequired(e,"url"),d.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=$(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return d.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new L(e):this.reconnectPolicy=e:this.reconnectPolicy=new L,this}withServerTimeout(e){return d.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return d.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){let e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let t=new ie(this.url,e);return te.create(t,this.logger||I.instance,this.protocol||new ce,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function je(r){return r.log!==void 0}var Ie=(()=>{let e=class e{constructor(){this._onShowToast=new ge,this.onShowToast$=this._onShowToast.asObservable()}showToast(o){o.sticky=!0,this._onShowToast.next(o)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=U({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Xo=(()=>{let e=class e{constructor(o,n,s){this.decodeTokenService=o,this.toastr=n,this.httpService=s,this.scanChannelToastr=ae(Ie),this.authService=ae(we),this.channels=this.authService.getChannels(),this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let o=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new fe(o||[])}setNotification(o){let s=[...this._notifications.value,o];this.saveNotificationTotal(s),this._notifications.next(s)}saveNotificationTotal(o=[]){localStorage.setItem("Notifications",JSON.stringify(o))}getNotification(){return this._notifications.asObservable()}getNotificationDetail(o){return this.httpService.post("/api/notification/GetByID",{ID:o})}getNotificationV2Detail(o){return this.httpService.post(me.GetJobScanDetail,{ID:o})}buildConnection(){this.hubConnection=new j().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(i.Information).build(),this.startConnection(),this.onConnectionClose(),this.subscribeNotification()}connectToRegister(){this.hubConnection.invoke("SubscribeGroup",this.parseToken.PID)}subscribeToJobGroup(o){try{this.hubConnection.send("SubscribeGroup",o)}catch(n){console.error("Error subscribing to job group:",n)}}startConnection(){this.hubConnection.start().then(()=>{this.connectToRegister()}).catch(o=>console.log("Error while starting connection: "+o))}onConnectionClose(){this.hubConnection.onclose(()=>{this.buildConnection()})}subscribeNotification(){this.hubConnection.on("Notification",o=>{this.handleNotification(o)})}handleNotification(o){if(typeof o=="string"){let n=JSON.parse(o);this.setNotification(n),n.ID==this.parseToken.PID&&(n.StatusCode!=200?this.toastr.error(n.Message,n.Title,{enableHtml:!0}):this.toastr.success(n.Message,n.Title,{enableHtml:!0}))}else{let n=o.message?JSON.parse(o.message):null;n&&(be.IsNotEmpty(n.Issue)?this.handlingErrorNotification(n):this.handlingSuccessNotification(n))}}handlingSuccessNotification(o){let n=this.channels.find(c=>c.ID===o.ChannelID),s=o.Duration?Math.floor(o.Duration/1e3):0;this.scanChannelToastr.showToast({text:"Scan Job Succeded",detail:`The Job takes <strong>${s}s</strong> to complete.`,severity:"success",data:{channelName:n.Name,channelTypeId:n.TypeID}})}handlingErrorNotification(o){let n=this.channels.find(c=>c.ID===o.ChannelID),s=o.Issue?JSON.parse(o.Issue)?.Message:"Unknown Error";this.scanChannelToastr.showToast({text:"Scan Job Failed",detail:s,severity:"error",data:{channelName:n.Name,channelTypeId:n.TypeID}})}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}};e.\u0275fac=function(n){return new(n||e)(B(de),B(pe),B(_e))},e.\u0275prov=U({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{Ie as a,Xo as b};
|
|
1
|
+
import{a as be}from"./chunk-A6QXXKPR.js";import{b as de,h as we}from"./chunk-YH3KWMUX.js";import{a as me}from"./chunk-AGBJEXIM.js";import{b as pe,e as _e}from"./chunk-D6JH2KV4.js";import{f as ge,g as fe,ma as U,qa as B,ra as ae}from"./chunk-OHGMB7HJ.js";import{a as _,b as $,c as N,i as g}from"./chunk-66YHNWRR.js";var C=class extends Error{constructor(e,t){let o=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=o}},P=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},S=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},O=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=o}},F=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=o}},q=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=o}},M=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},z=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=o}};var A=class{constructor(e,t,o){this.statusCode=e,this.statusText=t,this.content=o}},k=class{get(e,t){return this.send($(_({},t),{method:"GET",url:e}))}post(e,t){return this.send($(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send($(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var i=(function(r){return r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None",r})(i||{});var I=class{constructor(){}log(e,t){}};I.instance=new I;var Se="9.0.6";var d=class{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,o){if(!(e in t))throw new Error(`Unknown ${o} value: ${e}.`)}},p=class r{static get isBrowser(){return!r.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!r.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!r.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function x(r,e){let t="";return v(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Ee(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Ee(r){let e=new Uint8Array(r),t="";return e.forEach(o=>{let n=o<16?"0":"";t+=`0x${n}${o.toString(16)} `}),t.substr(0,t.length-1)}function v(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function V(r,e,t,o,n,s){return g(this,null,function*(){let c={},[a,l]=E();c[a]=l,r.log(i.Trace,`(${e} transport) sending data. ${x(n,s.logMessageContent)}.`);let u=v(n)?"arraybuffer":"text",f=yield t.post(o,{content:n,headers:_(_({},c),s.headers),responseType:u,timeout:s.timeout,withCredentials:s.withCredentials});r.log(i.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function Ce(r){return r===void 0?new R(i.Information):r===null?I.instance:r.log!==void 0?r:new R(r)}var J=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},R=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let o=`[${new Date().toISOString()}] ${i[e]}: ${t}`;switch(e){case i.Critical:case i.Error:this.out.error(o);break;case i.Warning:this.out.warn(o);break;case i.Information:this.out.info(o);break;default:this.out.log(o);break}}}};function E(){let r="X-SignalR-User-Agent";return p.isNode&&(r="User-Agent"),[r,Te(Se,Pe(),Re(),xe())]}function Te(r,e,t,o){let n="Microsoft SignalR/",s=r.split(".");return n+=`${s[0]}.${s[1]}`,n+=` (${r}; `,e&&e!==""?n+=`${e}; `:n+="Unknown OS; ",n+=`${t}`,o?n+=`; ${o}`:n+="; Unknown Runtime Version",n+=")",n}function Pe(){if(p.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function xe(){if(p.isNode)return process.versions.node}function Re(){return p.isNode?"NodeJS":"Browser"}function K(r){return r.stack?r.stack:r.message?r.message:`${r}`}function ye(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var X=class extends k{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||p.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:N;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(ye());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:N;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return g(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new S;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,o;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),o=new S});let n=null;if(e.timeout){let l=e.timeout;n=setTimeout(()=>{t.abort(),this._logger.log(i.Warning,"Timeout from HTTP request."),o=new P},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},v(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:_({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(l){throw o||(this._logger.log(i.Warning,`Error from HTTP request. ${l}.`),l)}finally{n&&clearTimeout(n),e.abortSignal&&(e.abortSignal.onabort=null)}if(!s.ok){let l=yield ve(s,"text");throw new C(l||s.statusText,s.status)}let a=yield ve(s,e.responseType);return new A(s.status,s.statusText,a)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(o,n)=>t=n.join("; ")),t}};function ve(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}var G=class extends k{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?new Promise((t,o)=>{let n=new XMLHttpRequest;n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(v(e.content)?n.setRequestHeader("Content-Type","application/octet-stream"):n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let s=e.headers;s&&Object.keys(s).forEach(c=>{n.setRequestHeader(c,s[c])}),e.responseType&&(n.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),o(new S)}),e.timeout&&(n.timeout=e.timeout),n.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),n.status>=200&&n.status<300?t(new A(n.status,n.statusText,n.response||n.responseText)):o(new C(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(i.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),o(new C(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(i.Warning,"Timeout from HTTP request."),o(new P)},n.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var Y=class extends k{constructor(e){if(super(),typeof fetch<"u"||p.isNode)this._httpClient=new X(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new G(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}};var y=class r{static write(e){return`${e}${r.RecordSeparator}`}static parse(e){if(e[e.length-1]!==r.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(r.RecordSeparator);return t.pop(),t}};y.RecordSeparatorCode=30;y.RecordSeparator=String.fromCharCode(y.RecordSeparatorCode);var Q=class{writeHandshakeRequest(e){return y.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,o;if(v(e)){let a=new Uint8Array(e),l=a.indexOf(y.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),o=a.byteLength>u?a.slice(u).buffer:null}else{let a=e,l=a.indexOf(y.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=a.substring(0,u),o=a.length>u?a.substring(u):null}let n=y.parse(t),s=JSON.parse(n[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[o,s]}};var h=(function(r){return r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence",r})(h||{});var Z=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new J(this,e)}};var ee=class{constructor(e,t,o){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=o}_send(e){return g(this,null,function*(){let t=this._protocol.writeMessage(e),o=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let n=()=>{},s=()=>{};v(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(o=new Promise((c,a)=>{n=c,s=a})),this._messages.push(new le(t,this._totalMessageCount,n,s))}try{this._reconnectInProgress||(yield this._connection.send(t))}catch{this._disconnected()}yield o})}_ack(e){let t=-1;for(let o=0;o<this._messages.length;o++){let n=this._messages[o];if(n._id<=e.sequenceId)t=o,v(n._message)?this._bufferedByteCount-=n._message.byteLength:this._bufferedByteCount-=n._message.length,n._resolver();else if(this._bufferedByteCount<this._bufferSize)n._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==h.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;let t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}_resend(){return g(this,null,function*(){let e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;yield this._connection.send(this._protocol.writeMessage({type:h.Sequence,sequenceId:e}));let t=this._messages;for(let o of t)yield this._connection.send(o._message);this._reconnectInProgress=!1})}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(let t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case h.Invocation:case h.StreamItem:case h.Completion:case h.StreamInvocation:case h.CancelInvocation:return!0;case h.Close:case h.Sequence:case h.Ping:case h.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(()=>g(this,null,function*(){try{this._reconnectInProgress||(yield this._connection.send(this._protocol.writeMessage({type:h.Ack,sequenceId:this._latestReceivedSequenceId})))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}},le=class{constructor(e,t,o,n){this._message=e,this._id=t,this._resolver=o,this._rejector=n}};var De=30*1e3,$e=15*1e3,Ne=1e5,m=(function(r){return r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting",r})(m||{}),te=class r{static create(e,t,o,n,s,c,a){return new r(e,t,o,n,s,c,a)}constructor(e,t,o,n,s,c,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},d.isRequired(e,"connection"),d.isRequired(t,"logger"),d.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=s??De,this.keepAliveIntervalInMilliseconds=c??$e,this._statefulReconnectBufferSize=a??Ne,this._logger=t,this._protocol=o,this.connection=e,this._reconnectPolicy=n,this._handshakeProtocol=new Q,this.connection.onreceive=l=>this._processIncomingData(l),this.connection.onclose=l=>this._connectionClosed(l),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=m.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:h.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==m.Disconnected&&this._connectionState!==m.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}_startWithStateTransitions(){return g(this,null,function*(){if(this._connectionState!==m.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=m.Connecting,this._logger.log(i.Debug,"Starting HubConnection.");try{yield this._startInternal(),p.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=m.Connected,this._connectionStarted=!0,this._logger.log(i.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(i.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return g(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,o)=>{this._handshakeResolver=t,this._handshakeRejecter=o});yield this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);let o={protocol:this._protocol.name,version:t};if(this._logger.log(i.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(o)),this._logger.log(i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new ee(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return g(this,null,function*(){let e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){if(this._connectionState===m.Disconnected)return this._logger.log(i.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===m.Disconnecting)return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let t=this._connectionState;return this._connectionState=m.Disconnecting,this._logger.log(i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===m.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new S("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}_sendCloseMessage(){return g(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._createStreamInvocation(e,t,n),c,a=new Z;return a.cancelCallback=()=>{let l=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],c.then(()=>this._sendWithProtocol(l))},this._callbacks[s.invocationId]=(l,u)=>{if(u){a.error(u);return}else l&&(l.type===h.Completion?l.error?a.error(new Error(l.error)):a.complete():a.next(l.item))},c=this._sendWithProtocol(s).catch(l=>{a.error(l),delete this._callbacks[s.invocationId]}),this._launchStreams(o,c),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._sendWithProtocol(this._createInvocation(e,t,!0,n));return this._launchStreams(o,s),s}invoke(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._createInvocation(e,t,!1,n);return new Promise((a,l)=>{this._callbacks[s.invocationId]=(f,T)=>{if(T){l(T);return}else f&&(f.type===h.Completion?f.error?l(new Error(f.error)):a(f.result):l(new Error(`Unexpected message type: ${f.type}`)))};let u=this._sendWithProtocol(s).catch(f=>{l(f),delete this._callbacks[s.invocationId]});this._launchStreams(o,u)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();let o=this._methods[e];if(o)if(t){let n=o.indexOf(t);n!==-1&&(o.splice(n,1),o.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){let t=this._protocol.parseMessages(e,this._logger);for(let o of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(o)))switch(o.type){case h.Invocation:this._invokeClientMethod(o).catch(n=>{this._logger.log(i.Error,`Invoke client method threw error: ${K(n)}`)});break;case h.StreamItem:case h.Completion:{let n=this._callbacks[o.invocationId];if(n){o.type===h.Completion&&delete this._callbacks[o.invocationId];try{n(o)}catch(s){this._logger.log(i.Error,`Stream callback threw error: ${K(s)}`)}}break}case h.Ping:break;case h.Close:{this._logger.log(i.Information,"Close message received from server.");let n=o.error?new Error("Server returned an error on close: "+o.error):void 0;o.allowReconnect===!0?this.connection.stop(n):this._stopPromise=this._stopInternal(n);break}case h.Ack:this._messageBuffer&&this._messageBuffer._ack(o);break;case h.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(o);break;default:this._logger.log(i.Warning,`Invalid message type: ${o.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,o;try{[o,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(n){let s="Error parsing handshake response: "+n;this._logger.log(i.Error,s);let c=new Error(s);throw this._handshakeRejecter(c),c}if(t.error){let n="Server returned handshake error: "+t.error;this._logger.log(i.Error,n);let s=new Error(n);throw this._handshakeRejecter(s),s}else this._logger.log(i.Debug,"Server handshake complete.");return this._handshakeResolver(),o}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(()=>g(this,null,function*(){if(this._connectionState===m.Connected)try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return g(this,null,function*(){let t=e.target.toLowerCase(),o=this._methods[t];if(!o){this._logger.log(i.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let n=o.slice(),s=!!e.invocationId,c,a,l;for(let u of n)try{let f=c;c=yield u.apply(this,e.arguments),s&&c&&f&&(this._logger.log(i.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(f){a=f,this._logger.log(i.Error,`A callback for the method '${t}' threw error '${f}'.`)}l?yield this._sendWithProtocol(l):s?(a?l=this._createCompletionMessage(e.invocationId,`${a}`,null):c!==void 0?l=this._createCompletionMessage(e.invocationId,null,c):(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),l=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(l)):c&&this._logger.log(i.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(i.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new S("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===m.Disconnecting?this._completeClose(e):this._connectionState===m.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===m.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=m.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),p.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(i.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return g(this,null,function*(){let t=Date.now(),o=0,n=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(o++,0,n);if(s===null){this._logger.log(i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=m.Reconnecting,e?this._logger.log(i.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(i.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(c=>c.apply(this,[e]))}catch(c){this._logger.log(i.Error,`An onreconnecting callback called with error '${e}' threw error '${c}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(i.Information,`Reconnect attempt number ${o} will start in ${s} ms.`),yield new Promise(c=>{this._reconnectDelayHandle=setTimeout(c,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(i.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(c=>c.apply(this,[this.connection.connectionId]))}catch(c){this._logger.log(i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${c}'.`)}return}catch(c){if(this._logger.log(i.Information,`Reconnect attempt failed because of error '${c}'.`),this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}n=c instanceof Error?c:new Error(c.toString()),s=this._getNextRetryDelay(o++,Date.now()-t,n)}}this._logger.log(i.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:o})}catch(n){return this._logger.log(i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(o=>{let n=t[o];try{n(null,e)}catch(s){this._logger.log(i.Error,`Stream 'error' callback called with '${e}' threw error: ${K(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,o,n){if(o)return n.length!==0?{target:e,arguments:t,streamIds:n,type:h.Invocation}:{target:e,arguments:t,type:h.Invocation};{let s=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:n,type:h.Invocation}:{target:e,arguments:t,invocationId:s.toString(),type:h.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let o in e)e[o].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:n=>{let s;n instanceof Error?s=n.message:n&&n.toString?s=n.toString():s="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,s)))},next:n=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,n)))}})}}_replaceStreamingParams(e){let t=[],o=[];for(let n=0;n<e.length;n++){let s=e[n];if(this._isObservable(s)){let c=this._invocationId;this._invocationId++,t[c]=s,o.push(c.toString()),e.splice(n,1)}}return[t,o]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,o){let n=this._invocationId;return this._invocationId++,o.length!==0?{target:e,arguments:t,invocationId:n.toString(),streamIds:o,type:h.StreamInvocation}:{target:e,arguments:t,invocationId:n.toString(),type:h.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:h.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:h.StreamItem}}_createCompletionMessage(e,t,o){return t?{error:t,invocationId:e,type:h.Completion}:{invocationId:e,result:o,type:h.Completion}}_createCloseMessage(){return{type:h.Close}}};var Ae=[0,2e3,1e4,3e4,null],L=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Ae}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var D=(()=>{class r{}return r.Authorization="Authorization",r.Cookie="Cookie",r})();var oe=class extends k{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return g(this,null,function*(){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=yield this._accessTokenFactory()),this._setAuthorizationHeader(e);let o=yield this._innerClient.send(e);return t&&o.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):o})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[D.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[D.Authorization]&&delete e.headers[D.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var b=(function(r){return r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling",r})(b||{}),w=(function(r){return r[r.Text=1]="Text",r[r.Binary=2]="Binary",r})(w||{});var ne=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var W=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,o){this._httpClient=e,this._logger=t,this._pollAbort=new ne,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){if(d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._url=e,this._logger.log(i.Trace,"(LongPolling transport) Connecting."),t===w.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[o,n]=E(),s=_({[o]:n},this._options.headers),c={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};t===w.Binary&&(c.responseType="arraybuffer");let a=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${a}.`);let l=yield this._httpClient.get(a,c);l.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new C(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,c)})}_poll(e,t){return g(this,null,function*(){try{for(;this._running;)try{let o=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${o}.`);let n=yield this._httpClient.get(o,t);n.statusCode===204?(this._logger.log(i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):n.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${n.statusCode}.`),this._closeError=new C(n.statusText||"",n.statusCode),this._running=!1):n.content?(this._logger.log(i.Trace,`(LongPolling transport) data received. ${x(n.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(n.content)):this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(o){this._running?o instanceof P?this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=o,this._running=!1):this._logger.log(i.Trace,`(LongPolling transport) Poll errored after shutdown: ${o.message}`)}}finally{this._logger.log(i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return g(this,null,function*(){return this._running?V(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return g(this,null,function*(){this._logger.log(i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,o]=E();e[t]=o;let n={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},s;try{yield this._httpClient.delete(this._url,n)}catch(c){s=c}s?s instanceof C&&(s.statusCode===404?this._logger.log(i.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(i.Trace,`(LongPolling transport) Error sending a DELETE request: ${s}`)):this._logger.log(i.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(i.Trace,e),this.onclose(this._closeError)}}};var re=class{constructor(e,t,o,n){this._httpClient=e,this._accessToken=t,this._logger=o,this._options=n,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){return d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,n)=>{let s=!1;if(t!==w.Text){n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let c;if(p.isBrowser||p.isWebWorker)c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(e),l={};l.Cookie=a;let[u,f]=E();l[u]=f,c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{c.onmessage=a=>{if(this.onreceive)try{this._logger.log(i.Trace,`(SSE transport) data received. ${x(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(l){this._close(l);return}},c.onerror=a=>{s?this._close():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},c.onopen=()=>{this._logger.log(i.Information,`SSE connected to ${this._url}`),this._eventSource=c,s=!0,o()}}catch(a){n(a);return}})})}send(e){return g(this,null,function*(){return this._eventSource?V(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var se=class{constructor(e,t,o,n,s,c){this._logger=o,this._accessTokenFactory=t,this._logMessageContent=n,this._webSocketConstructor=s,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=c}connect(e,t){return g(this,null,function*(){d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(WebSockets transport) Connecting.");let o;return this._accessTokenFactory&&(o=yield this._accessTokenFactory()),new Promise((n,s)=>{e=e.replace(/^http/,"ws");let c,a=this._httpClient.getCookieString(e),l=!1;if(p.isNode||p.isReactNative){let u={},[f,T]=E();u[f]=T,o&&(u[D.Authorization]=`Bearer ${o}`),a&&(u[D.Cookie]=a),c=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else o&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(o)}`);c||(c=new this._webSocketConstructor(e)),t===w.Binary&&(c.binaryType="arraybuffer"),c.onopen=u=>{this._logger.log(i.Information,`WebSocket connected to ${e}.`),this._webSocket=c,l=!0,n()},c.onerror=u=>{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="There was an error with the transport",this._logger.log(i.Information,`(WebSockets transport) ${f}.`)},c.onmessage=u=>{if(this._logger.log(i.Trace,`(WebSockets transport) data received. ${x(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(f){this._close(f);return}},c.onclose=u=>{if(l)this._close(u);else{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(i.Trace,`(WebSockets transport) sending data. ${x(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var ke=100,ie=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,d.isRequired(e,"url"),this._logger=Ce(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let o=null,n=null;if(p.isNode&&typeof N<"u"){let s=typeof __webpack_require__=="function"?__non_webpack_require__:N;o=s("ws"),n=s("eventsource")}!p.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:p.isNode&&!t.WebSocket&&o&&(t.WebSocket=o),!p.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:p.isNode&&!t.EventSource&&typeof n<"u"&&(t.EventSource=n),this._httpClient=new oe(t.httpClient||new Y(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return g(this,null,function*(){if(e=e||w.Binary,d.isIn(e,w,"transferFormat"),this._logger.log(i.Debug,`Starting connection with transfer format '${w[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(i.Error,t),yield this._stopPromise,Promise.reject(new S(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(i.Error,t),Promise.reject(new S(t))}this._connectionStarted=!0})}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new he(this.transport)),this._sendQueue.send(e))}stop(e){return g(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return g(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return g(this,null,function*(){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===b.WebSockets)this.transport=this._constructTransport(b.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let o=null,n=0;do{if(o=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new S("The connection was stopped during negotiation.");if(o.error)throw new Error(o.error);if(o.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(o.url&&(t=o.url),o.accessToken){let s=o.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}n++}while(o.url&&n<ke);if(n===ke&&o.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,o,e)}this.transport instanceof W&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(o){return this._logger.log(i.Error,"Failed to start the connection: "+o),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(o)}})}_getNegotiationResponse(e){return g(this,null,function*(){let t={},[o,n]=E();t[o]=n;let s=this._resolveNegotiateUrl(e);this._logger.log(i.Debug,`Sending negotiation request: ${s}.`);try{let c=yield this._httpClient.post(s,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(c.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${c.statusCode}'`));let a=JSON.parse(c.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new M("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(c){let a="Failed to complete negotiation with the server: "+c;return c instanceof C&&c.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(i.Error,a),Promise.reject(new M(a))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,o,n){return g(this,null,function*(){let s=this._createConnectUrl(e,o.connectionToken);if(this._isITransport(t)){this._logger.log(i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(s,n),this.connectionId=o.connectionId;return}let c=[],a=o.availableTransports||[],l=o;for(let u of a){let f=this._resolveTransportOrError(u,t,n,l?.useStatefulReconnect===!0);if(f instanceof Error)c.push(`${u.transport} failed:`),c.push(f);else if(this._isITransport(f)){if(this.transport=f,!l){try{l=yield this._getNegotiationResponse(e)}catch(T){return Promise.reject(T)}s=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(s,n),this.connectionId=l.connectionId;return}catch(T){if(this._logger.log(i.Error,`Failed to start the transport '${u.transport}': ${T}`),l=void 0,c.push(new q(`${u.transport} failed: ${T}`,b[u.transport])),this._connectionState!=="Connecting"){let ue="Failed to select transport before stop() was called.";return this._logger.log(i.Debug,ue),Promise.reject(new S(ue))}}}}return c.length>0?Promise.reject(new z(`Unable to connect to the server with any of the available transports. ${c.join(" ")}`,c)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case b.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new se(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case b.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new re(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case b.LongPolling:return new W(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=o=>g(this,null,function*(){let n=!1;if(this.features.reconnect)try{this.features.disconnected(),yield this.transport.connect(e,t),yield this.features.resend()}catch{n=!0}else{this._stopConnection(o);return}n&&this._stopConnection(o)}):this.transport.onclose=o=>this._stopConnection(o),this.transport.connect(e,t)}_resolveTransportOrError(e,t,o,n){let s=b[e.transport];if(s==null)return this._logger.log(i.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(He(t,s))if(e.transferFormats.map(a=>w[a]).indexOf(o)>=0){if(s===b.WebSockets&&!this._options.WebSocket||s===b.ServerSentEvents&&!this._options.EventSource)return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it is not supported in your environment.'`),new O(`'${b[s]}' is not supported in your environment.`,s);this._logger.log(i.Debug,`Selecting transport '${b[s]}'.`);try{return this.features.reconnect=s===b.WebSockets?n:void 0,this._constructTransport(s)}catch(a){return a}}else return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it does not support the requested transfer format '${w[o]}'.`),new Error(`'${b[s]}' does not support ${w[o]}.`);else return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it was disabled by the client.`),new F(`'${b[s]}' is disabled by the client.`,s)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(i.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(i.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(i.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(i.Error,`Connection disconnected with error '${e}'.`):this._logger.log(i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(i.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!p.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(i.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";let o=new URLSearchParams(t.searchParams);return o.has("negotiateVersion")||o.append("negotiateVersion",this._negotiateVersion.toString()),o.has("useStatefulReconnect")?o.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&o.append("useStatefulReconnect","true"),t.search=o.toString(),t.toString()}};function He(r,e){return!r||(e&r)!==0}var he=class r{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new H,this._transportResult=new H,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new H),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}_sendLoop(){return g(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new H;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):r._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(o){e.reject(o)}}})}static _concatBuffers(e){let t=e.map(s=>s.byteLength).reduce((s,c)=>s+c),o=new Uint8Array(t),n=0;for(let s of e)o.set(new Uint8Array(s),n),n+=s.byteLength;return o.buffer}},H=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var Me="json",ce=class{constructor(){this.name=Me,this.version=2,this.transferFormat=w.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=I.instance);let o=y.parse(e),n=[];for(let s of o){let c=JSON.parse(s);if(typeof c.type!="number")throw new Error("Invalid payload.");switch(c.type){case h.Invocation:this._isInvocationMessage(c);break;case h.StreamItem:this._isStreamItemMessage(c);break;case h.Completion:this._isCompletionMessage(c);break;case h.Ping:break;case h.Close:break;case h.Ack:this._isAckMessage(c);break;case h.Sequence:this._isSequenceMessage(c);break;default:t.log(i.Information,"Unknown message type '"+c.type+"' ignored.");continue}n.push(c)}return n}writeMessage(e){return y.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var Le={trace:i.Trace,debug:i.Debug,info:i.Information,information:i.Information,warn:i.Warning,warning:i.Warning,error:i.Error,critical:i.Critical,none:i.None};function We(r){let e=Le[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}var j=class{configureLogging(e){if(d.isRequired(e,"logging"),je(e))this.logger=e;else if(typeof e=="string"){let t=We(e);this.logger=new R(t)}else this.logger=new R(e);return this}withUrl(e,t){return d.isRequired(e,"url"),d.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=$(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return d.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new L(e):this.reconnectPolicy=e:this.reconnectPolicy=new L,this}withServerTimeout(e){return d.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return d.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){let e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let t=new ie(this.url,e);return te.create(t,this.logger||I.instance,this.protocol||new ce,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function je(r){return r.log!==void 0}var Ie=(()=>{let e=class e{constructor(){this._onShowToast=new ge,this.onShowToast$=this._onShowToast.asObservable()}showToast(o){o.sticky=!0,this._onShowToast.next(o)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=U({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Xo=(()=>{let e=class e{constructor(o,n,s){this.decodeTokenService=o,this.toastr=n,this.httpService=s,this.scanChannelToastr=ae(Ie),this.authService=ae(we),this.channels=this.authService.getChannels(),this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let o=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new fe(o||[])}setNotification(o){let s=[...this._notifications.value,o];this.saveNotificationTotal(s),this._notifications.next(s)}saveNotificationTotal(o=[]){localStorage.setItem("Notifications",JSON.stringify(o))}getNotification(){return this._notifications.asObservable()}getNotificationDetail(o){return this.httpService.post("/api/notification/GetByID",{ID:o})}getNotificationV2Detail(o){return this.httpService.post(me.GetJobScanDetail,{ID:o})}buildConnection(){this.hubConnection=new j().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(i.Information).build(),this.startConnection(),this.onConnectionClose(),this.subscribeNotification()}connectToRegister(){this.hubConnection.invoke("SubscribeGroup",this.parseToken.PID)}subscribeToJobGroup(o){try{this.hubConnection.send("SubscribeGroup",o)}catch(n){console.error("Error subscribing to job group:",n)}}startConnection(){this.hubConnection.start().then(()=>{this.connectToRegister()}).catch(o=>console.log("Error while starting connection: "+o))}onConnectionClose(){this.hubConnection.onclose(()=>{this.buildConnection()})}subscribeNotification(){this.hubConnection.on("Notification",o=>{this.handleNotification(o)})}handleNotification(o){if(typeof o=="string"){let n=JSON.parse(o);this.setNotification(n),n.ID==this.parseToken.PID&&(n.StatusCode!=200?this.toastr.error(n.Message,n.Title,{enableHtml:!0}):this.toastr.success(n.Message,n.Title,{enableHtml:!0}))}else{let n=o.message?JSON.parse(o.message):null;n&&(be.IsNotEmpty(n.Issue)?this.handlingErrorNotification(n):this.handlingSuccessNotification(n))}}handlingSuccessNotification(o){let n=this.channels.find(c=>c.ID===o.ChannelID),s=o.Duration?Math.floor(o.Duration/1e3):0;this.scanChannelToastr.showToast({text:"Scan Job Succeded",detail:`The Job takes <strong>${s}s</strong> to complete.`,severity:"success",data:{channelName:n.Name,channelTypeId:n.TypeID}})}handlingErrorNotification(o){let n=this.channels.find(c=>c.ID===o.ChannelID),s=o.Issue?JSON.parse(o.Issue)?.Message:"Unknown Error";this.scanChannelToastr.showToast({text:"Scan Job Failed",detail:s,severity:"error",data:{channelName:n.Name,channelTypeId:n.TypeID}})}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}};e.\u0275fac=function(n){return new(n||e)(B(de),B(pe),B(_e))},e.\u0275prov=U({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{Ie as a,Xo as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ye}from"./chunk-YKKHSYDW.js";import{a as de,b as he}from"./chunk-Z3PLQ27X.js";import"./chunk-VG66LDXQ.js";import{e as me}from"./chunk-
|
|
1
|
+
import{a as ye}from"./chunk-YKKHSYDW.js";import{a as de,b as he}from"./chunk-Z3PLQ27X.js";import"./chunk-VG66LDXQ.js";import{e as me}from"./chunk-NJYWKADT.js";import"./chunk-TQROQOXU.js";import{a as ge}from"./chunk-IQGRGC3E.js";import{c as Ce,d as be}from"./chunk-TUY6YGYA.js";import"./chunk-76AVMRJU.js";import{a as W}from"./chunk-KOQLZV3N.js";import"./chunk-6F37VT6M.js";import"./chunk-2EGTHH3W.js";import"./chunk-LR2YCE6M.js";import"./chunk-BKR7YPEW.js";import"./chunk-BZWZ64N5.js";import{a as xe}from"./chunk-RQI26KZX.js";import"./chunk-VVNLTDLG.js";import"./chunk-OHAT7WXU.js";import"./chunk-L4EPB2CQ.js";import{a as ce}from"./chunk-GNXSEYJF.js";import{a as ue}from"./chunk-7KG3DC5J.js";import{a as fe}from"./chunk-ZZYFVEJO.js";import"./chunk-DLHIDOS3.js";import{a as _e}from"./chunk-27DIE2YS.js";import{a as pe}from"./chunk-V7V5O62J.js";import"./chunk-JU4ZP3HI.js";import"./chunk-3T5VLB63.js";import"./chunk-STOW2RQN.js";import{a as re}from"./chunk-GLBJ4Y4T.js";import"./chunk-XTNXL2IY.js";import"./chunk-KOUB5HRK.js";import"./chunk-QETZ5VDX.js";import{e as le}from"./chunk-WIRXMAIF.js";import"./chunk-S22I47XG.js";import{a as at}from"./chunk-3NCMRK7E.js";import{a as ne}from"./chunk-PRMV4INM.js";import"./chunk-A6QXXKPR.js";import"./chunk-6Q4BDCI5.js";import{g as st}from"./chunk-C4MTEDSW.js";import{b as L,c as ae,d as Ct,e as $}from"./chunk-JMRRXRKO.js";import{b as se}from"./chunk-SNRWOTPO.js";import"./chunk-ROS2QMKF.js";import{c as oe,h as ie}from"./chunk-IA7NJXJD.js";import"./chunk-UEXWQT5J.js";import"./chunk-RM6ZXD3O.js";import"./chunk-R2XKB6UH.js";import"./chunk-RO7WOCSA.js";import"./chunk-3RK6DDJD.js";import"./chunk-UDNUDL5Z.js";import"./chunk-CVHFVFZQ.js";import"./chunk-ZC526ERX.js";import"./chunk-NJNRUDU6.js";import"./chunk-XUDE7VBC.js";import"./chunk-WAZWPRUG.js";import"./chunk-6H7M43WO.js";import"./chunk-HO2TMGLM.js";import{P as _t,Q as Qt,ha as H,la as qt,ma as ft,ua as Kt}from"./chunk-JTKEMQZT.js";import"./chunk-IZZY74PN.js";import"./chunk-O3BS4AC6.js";import{a as it}from"./chunk-ZSUWHVKX.js";import{h as Jt}from"./chunk-YH3KWMUX.js";import"./chunk-X2CTSYKS.js";import"./chunk-QXRG5XYP.js";import{a as Wt}from"./chunk-AGBJEXIM.js";import{b as Ht,c as $t}from"./chunk-NB2H6KA7.js";import{b as ut,c as g}from"./chunk-UPRDDI4K.js";import{A as ee,c as Yt,h as Xt,m as te}from"./chunk-6UM4NHOR.js";import{a as Rt}from"./chunk-RQUCYFCB.js";import"./chunk-RXLMJGUY.js";import{b as zt,e as Gt}from"./chunk-D6JH2KV4.js";import{b as jt,d as ot}from"./chunk-UB3ZV5NW.js";import"./chunk-JPWGFXZT.js";import{B as mt,q as Dt,s as Bt,t as Nt,v as At}from"./chunk-CGSMHTKB.js";import{c as ht,d as gt,f as et,g as Lt,i as nt,k as Ut,m as Zt}from"./chunk-XBIHN6D3.js";import{$c as Ft,Aa as w,Ab as Tt,Bc as Q,Dc as q,Ec as K,Fd as tt,G as F,Gd as j,Hb as I,Ia as M,Lb as k,Lc as Y,Mb as wt,Mc as T,Nb as P,Nc as b,Oc as U,Pa as V,Pc as O,Rc as Z,Sc as z,Tc as X,_b as S,_c as G,aa as ct,ac as f,ad as E,bd as Mt,cc as C,dd as kt,ec as It,fc as Pt,gc as Ot,hc as l,ic as c,jc as d,kc as u,lb as vt,lc as D,ld as Et,ma as bt,mc as B,nc as N,ob as r,oc as A,pa as yt,pc as R,pd as Vt,qc as pt,ra as h,rc as v,sc as J,tb as dt,ub as St,wc as x,ya as p,yc as a,za as m}from"./chunk-OHGMB7HJ.js";import"./chunk-WFMAM73Y.js";import"./chunk-66YHNWRR.js";var Oe=["data-p-icon","exclamation-triangle"],ve=(()=>{class e extends at{pathId;onInit(){this.pathId="url(#"+L()+")"}static \u0275fac=(()=>{let t;return function(n){return(t||(t=V(e)))(n||e)}})();static \u0275cmp=I({type:e,selectors:[["","data-p-icon","exclamation-triangle"]],features:[k],attrs:Oe,decls:7,vars:2,consts:[["d","M13.4018 13.1893H0.598161C0.49329 13.189 0.390283 13.1615 0.299143 13.1097C0.208003 13.0578 0.131826 12.9832 0.0780112 12.8932C0.0268539 12.8015 0 12.6982 0 12.5931C0 12.4881 0.0268539 12.3848 0.0780112 12.293L6.47985 1.08982C6.53679 1.00399 6.61408 0.933574 6.70484 0.884867C6.7956 0.836159 6.897 0.810669 7 0.810669C7.103 0.810669 7.2044 0.836159 7.29516 0.884867C7.38592 0.933574 7.46321 1.00399 7.52015 1.08982L13.922 12.293C13.9731 12.3848 14 12.4881 14 12.5931C14 12.6982 13.9731 12.8015 13.922 12.8932C13.8682 12.9832 13.792 13.0578 13.7009 13.1097C13.6097 13.1615 13.5067 13.189 13.4018 13.1893ZM1.63046 11.989H12.3695L7 2.59425L1.63046 11.989Z","fill","currentColor"],["d","M6.99996 8.78801C6.84143 8.78594 6.68997 8.72204 6.57787 8.60993C6.46576 8.49782 6.40186 8.34637 6.39979 8.18784V5.38703C6.39979 5.22786 6.46302 5.0752 6.57557 4.96265C6.68813 4.85009 6.84078 4.78686 6.99996 4.78686C7.15914 4.78686 7.31179 4.85009 7.42435 4.96265C7.5369 5.0752 7.60013 5.22786 7.60013 5.38703V8.18784C7.59806 8.34637 7.53416 8.49782 7.42205 8.60993C7.30995 8.72204 7.15849 8.78594 6.99996 8.78801Z","fill","currentColor"],["d","M6.99996 11.1887C6.84143 11.1866 6.68997 11.1227 6.57787 11.0106C6.46576 10.8985 6.40186 10.7471 6.39979 10.5885V10.1884C6.39979 10.0292 6.46302 9.87658 6.57557 9.76403C6.68813 9.65147 6.84078 9.58824 6.99996 9.58824C7.15914 9.58824 7.31179 9.65147 7.42435 9.76403C7.5369 9.87658 7.60013 10.0292 7.60013 10.1884V10.5885C7.59806 10.7471 7.53416 10.8985 7.42205 11.0106C7.30995 11.1227 7.15849 11.1866 6.99996 11.1887Z","fill","currentColor"],[3,"id"],["width","14","height","14","fill","white"]],template:function(o,n){o&1&&(w(),D(0,"g"),N(1,"path",0)(2,"path",1)(3,"path",2),B(),D(4,"defs")(5,"clipPath",3),N(6,"rect",4),B()()),o&2&&(S("clip-path",n.pathId),r(5),J("id",n.pathId))},encapsulation:2})}return e})();var Fe=["data-p-icon","info-circle"],Se=(()=>{class e extends at{pathId;onInit(){this.pathId="url(#"+L()+")"}static \u0275fac=(()=>{let t;return function(n){return(t||(t=V(e)))(n||e)}})();static \u0275cmp=I({type:e,selectors:[["","data-p-icon","info-circle"]],features:[k],attrs:Fe,decls:5,vars:2,consts:[["fill-rule","evenodd","clip-rule","evenodd","d","M3.11101 12.8203C4.26215 13.5895 5.61553 14 7 14C8.85652 14 10.637 13.2625 11.9497 11.9497C13.2625 10.637 14 8.85652 14 7C14 5.61553 13.5895 4.26215 12.8203 3.11101C12.0511 1.95987 10.9579 1.06266 9.67879 0.532846C8.3997 0.00303296 6.99224 -0.13559 5.63437 0.134506C4.2765 0.404603 3.02922 1.07129 2.05026 2.05026C1.07129 3.02922 0.404603 4.2765 0.134506 5.63437C-0.13559 6.99224 0.00303296 8.3997 0.532846 9.67879C1.06266 10.9579 1.95987 12.0511 3.11101 12.8203ZM3.75918 2.14976C4.71846 1.50879 5.84628 1.16667 7 1.16667C8.5471 1.16667 10.0308 1.78125 11.1248 2.87521C12.2188 3.96918 12.8333 5.45291 12.8333 7C12.8333 8.15373 12.4912 9.28154 11.8502 10.2408C11.2093 11.2001 10.2982 11.9478 9.23232 12.3893C8.16642 12.8308 6.99353 12.9463 5.86198 12.7212C4.73042 12.4962 3.69102 11.9406 2.87521 11.1248C2.05941 10.309 1.50384 9.26958 1.27876 8.13803C1.05367 7.00647 1.16919 5.83358 1.61071 4.76768C2.05222 3.70178 2.79989 2.79074 3.75918 2.14976ZM7.00002 4.8611C6.84594 4.85908 6.69873 4.79698 6.58977 4.68801C6.48081 4.57905 6.4187 4.43185 6.41669 4.27776V3.88888C6.41669 3.73417 6.47815 3.58579 6.58754 3.4764C6.69694 3.367 6.84531 3.30554 7.00002 3.30554C7.15473 3.30554 7.3031 3.367 7.4125 3.4764C7.52189 3.58579 7.58335 3.73417 7.58335 3.88888V4.27776C7.58134 4.43185 7.51923 4.57905 7.41027 4.68801C7.30131 4.79698 7.1541 4.85908 7.00002 4.8611ZM7.00002 10.6945C6.84594 10.6925 6.69873 10.6304 6.58977 10.5214C6.48081 10.4124 6.4187 10.2652 6.41669 10.1111V6.22225C6.41669 6.06754 6.47815 5.91917 6.58754 5.80977C6.69694 5.70037 6.84531 5.63892 7.00002 5.63892C7.15473 5.63892 7.3031 5.70037 7.4125 5.80977C7.52189 5.91917 7.58335 6.06754 7.58335 6.22225V10.1111C7.58134 10.2652 7.51923 10.4124 7.41027 10.5214C7.30131 10.6304 7.1541 10.6925 7.00002 10.6945Z","fill","currentColor"],[3,"id"],["width","14","height","14","fill","white"]],template:function(o,n){o&1&&(w(),D(0,"g"),N(1,"path",0),B(),D(2,"defs")(3,"clipPath",1),N(4,"rect",2),B()()),o&2&&(S("clip-path",n.pathId),r(3),J("id",n.pathId))},encapsulation:2})}return e})();var Te=`
|
|
2
2
|
.p-toast {
|
|
3
3
|
width: dt('toast.width');
|
|
4
4
|
white-space: pre-line;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as zt}from"./chunk-E7LOFZQV.js";import"./chunk-YLQBIIZH.js";import{b as Xt}from"./chunk-7T5DBPDP.js";import"./chunk-OH5T7D7O.js";import{a as Kt,b as Jt}from"./chunk-FH2KAM6J.js";import{a as Yt}from"./chunk-YKKHSYDW.js";import{a as Ht}from"./chunk-WTHYLNPX.js";import{a as ct,b as Gt,c as jt,d as mt,e as pt}from"./chunk-HPQDUJXF.js";import"./chunk-TQROQOXU.js";import{a as Wt}from"./chunk-IQGRGC3E.js";import{d as R,e as B}from"./chunk-BZWZ64N5.js";import"./chunk-OHAT7WXU.js";import"./chunk-L4EPB2CQ.js";import"./chunk-GNXSEYJF.js";import"./chunk-DLHIDOS3.js";import"./chunk-REDQ2L7Y.js";import"./chunk-STOW2RQN.js";import"./chunk-GLBJ4Y4T.js";import"./chunk-XTNXL2IY.js";import"./chunk-KOUB5HRK.js";import"./chunk-QETZ5VDX.js";import"./chunk-WIRXMAIF.js";import"./chunk-S22I47XG.js";import"./chunk-3NCMRK7E.js";import"./chunk-KHGTW7IV.js";import"./chunk-A6QXXKPR.js";import"./chunk-C4MTEDSW.js";import"./chunk-JMRRXRKO.js";import{b as Bt}from"./chunk-SNRWOTPO.js";import"./chunk-ROS2QMKF.js";import"./chunk-IA7NJXJD.js";import{a as Rt}from"./chunk-UEXWQT5J.js";import{b as qt,c as Qt}from"./chunk-RPHZK33A.js";import"./chunk-3SCX7IMW.js";import"./chunk-JHSG3KRS.js";import"./chunk-K4Q33QIR.js";import"./chunk-JRCXHF2X.js";import"./chunk-M27MYADT.js";import"./chunk-TBVMCNS2.js";import"./chunk-RM6ZXD3O.js";import"./chunk-R2XKB6UH.js";import"./chunk-RO7WOCSA.js";import"./chunk-3RK6DDJD.js";import"./chunk-UDNUDL5Z.js";import"./chunk-CVHFVFZQ.js";import"./chunk-ZC526ERX.js";import"./chunk-NJNRUDU6.js";import"./chunk-XUDE7VBC.js";import"./chunk-WAZWPRUG.js";import"./chunk-6H7M43WO.js";import"./chunk-HO2TMGLM.js";import"./chunk-JTKEMQZT.js";import{c as $t}from"./chunk-IZZY74PN.js";import"./chunk-O3BS4AC6.js";import"./chunk-ZSUWHVKX.js";import"./chunk-J4552BMI.js";import"./chunk-X2CTSYKS.js";import"./chunk-QXRG5XYP.js";import"./chunk-AGBJEXIM.js";import"./chunk-NB2H6KA7.js";import{b as Ct,c as h}from"./chunk-UPRDDI4K.js";import{A as et,B as $,c as tt,e as nt,h as L,i as W,l as st,m as Mt,n as Y,q as H,r as wt,s as X,t as Vt,u as Ut,v as Lt,z as K}from"./chunk-6UM4NHOR.js";import"./chunk-RQUCYFCB.js";import"./chunk-RXLMJGUY.js";import{b as Dt,e as Z}from"./chunk-D6JH2KV4.js";import"./chunk-UB3ZV5NW.js";import"./chunk-JPWGFXZT.js";import{B as A,w as S}from"./chunk-CGSMHTKB.js";import"./chunk-XBIHN6D3.js";import{$ as Pt,$c as lt,Hb as x,K as At,M as Ft,Nc as f,Oa as D,Oc as at,Pc as q,Rc as Et,Sc as Nt,Tc as Ot,Z as z,_c as I,ac as C,ca as ht,cc as g,dc as w,ea as E,f as St,fc as V,gc as U,hc as d,ic as c,id as v,jc as s,jd as T,kc as _,ma as N,ob as p,ra as u,rc as j,tb as M,td as kt,ud as b,v as P,wc as F,ya as O,yc as l,za as k}from"./chunk-OHGMB7HJ.js";import"./chunk-WFMAM73Y.js";import"./chunk-66YHNWRR.js";var J=(function(t){return t[t.SINGLE_DROP_DOWN=1]="SINGLE_DROP_DOWN",t[t.SINGLE_COMBO_BOX=2]="SINGLE_COMBO_BOX",t[t.FREE_TEXT_FILED=3]="FREE_TEXT_FILED",t[t.MULTI_DROP_DOWN=4]="MULTI_DROP_DOWN",t[t.MULTI_COMBO_BOX=5]="MULTI_COMBO_BOX",t})(J||{});var it=(function(t){return t[t.FORMAT_NORMAL=1]="FORMAT_NORMAL",t[t.FORMAT_QUANTITATIVE_WITH_UNIT=2]="FORMAT_QUANTITATIVE_WITH_UNIT",t})(it||{});var ot=(function(t){return t[t.VALIDATOR_NO_VALIDATE_TYPE=0]="VALIDATOR_NO_VALIDATE_TYPE",t[t.VALIDATOR_INT_TYPE=1]="VALIDATOR_INT_TYPE",t[t.VALIDATOR_STRING_TYPE=2]="VALIDATOR_STRING_TYPE",t[t.VALIDATOR_FLOAT_TYPE=3]="VALIDATOR_FLOAT_TYPE",t[t.VALIDATOR_DATE_TYPE=4]="VALIDATOR_DATE_TYPE",t})(ot||{});var gt=class extends st{setValue(r,i){if(r instanceof Date){let n=Math.floor(r.getTime()/1e3);super.setValue(n,i)}else super.setValue(r,i)}},bt=(()=>{let r=class r{constructor(){this.shopeeUploadService=u(ct),this.formBuilder=u(K)}getAttributes(n){return this.shopeeUploadService.getAttributes(n.channelId,n.categoryId).pipe(P(e=>this.setLabelToIndonesian(e)))}setLabelToIndonesian(n=[]){let e,a;return n=n.map(o=>(e=o?.multi_lang?.find(m=>m.language=="id"),o.attribute_value_list=o?.attribute_value_list?.map(m=>(a=m?.multi_lang?.find(y=>y.language=="id"),m.name=a?.value,m)),o.name=e?.value?e?.value:o.name,o)),n}createFormGroup(n){let e=this.formBuilder.group({}),a=[];return n.forEach(o=>{if(a=[],o.mandatory&&a.push(nt.required),o?.attribute_info?.format_type==it.FORMAT_QUANTITATIVE_WITH_UNIT&&o?.attribute_info?.input_type==J.FREE_TEXT_FILED){let m=this.formBuilder.group({unit:new st(null),value:new st(null,a)});e.addControl(JSON.stringify(o.attribute_id),m)}else o?.attribute_info?.input_type==J.FREE_TEXT_FILED&&o?.attribute_info?.input_validation_type==ot.VALIDATOR_DATE_TYPE?e.addControl(JSON.stringify(o.attribute_id),new gt(null,a)):e.addControl(JSON.stringify(o.attribute_id),this.formBuilder.control(null,a))}),e}getFilteredAttributes(n,e){let a=JSON.parse(JSON.stringify(n)),o=Object.keys(e),m=a.filter(y=>o.findIndex(ft=>parseInt(ft)==y.attribute_id||y.mandatory)!=-1);return m=this.filterSelectedAttributes(m,e),m}filterSelectedAttributes(n,e){return n.map(o=>{switch(o.attribute_info.input_type){case J.MULTI_COMBO_BOX:h.IsNotEmpty(e[o.attribute_id])?o.attribute_value_list=o.attribute_value_list.filter(m=>e[o.attribute_id]?.findIndex(y=>y==m.value_id)!=-1):o.attribute_value_list=[];break;case J.FREE_TEXT_FILED:o.attribute_info.format_type==it.FORMAT_QUANTITATIVE_WITH_UNIT?o.attribute_value_list=this.setSelectedQuantitativeAttr(e[o.attribute_id]?.value,e[o.attribute_id]?.unit):o.attribute_info.input_validation_type==ot.VALIDATOR_DATE_TYPE?o.attribute_value_list=this.setSelectedDateAttr(e[o.attribute_id]):o.attribute_value_list=this.setSelectedQuantitativeAttr(e[o.attribute_id]);break;default:o.attribute_value_list=o.attribute_value_list.filter(m=>m.value_id==e[o.attribute_id])}return o}).filter(o=>o?.attribute_value_list?.length>0)}setSelectedQuantitativeAttr(n,e){let a=[];if(h.IsNotEmpty(n)){let o={value_id:0,original_value_name:JSON.stringify(n)};h.IsNotEmpty(e)&&(o.value_unit=e),a=[o]}return a}setSelectedDateAttr(n){let e=[];return h.IsNotEmpty(n)&&(e=[{value_id:0,original_value_name:JSON.stringify(n)}]),e}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();var yt=()=>[];function ne(t,r){t&1&&(c(0,"span",4),f(1,"*"),s())}function re(t,r){if(t&1&&_(0,"ng-select",5),t&2){let i=l().$implicit;d("multiple",!0)("formControlName",i.attribute_id)("items",i.attribute_value_list?i.attribute_value_list:lt(4,yt))("placeholder","Pilih "+(i==null?null:i.name))}}function ae(t,r){if(t&1&&_(0,"input",7),t&2){let i=l(2).$implicit;d("formControlName",i.attribute_id)("placeholder","Isi "+(i==null?null:i.name))}}function le(t,r){if(t&1&&(c(0,"option",14),f(1),s()),t&2){let i=r.$implicit;d("value",i),p(),at(i)}}function se(t,r){if(t&1&&(c(0,"div",9),_(1,"input",11),c(2,"select",12)(3,"option",13),f(4,"Unit"),s(),V(5,le,2,2,"option",14,w),s()()),t&2){let i=l(3).$implicit;d("formGroupName",i.attribute_id),p(),d("placeholder","Isi "+(i==null?null:i.name)),p(2),d("value",null),p(2),U(i==null||i.attribute_info==null?null:i.attribute_info.attribute_unit_list)}}function ce(t,r){if(t&1&&_(0,"input",10),t&2){let i=l(3).$implicit;d("formControlName",i.attribute_id)("placeholder","Isi "+(i==null?null:i.name))}}function me(t,r){if(t&1&&C(0,se,7,3,"div",9)(1,ce,1,2,"input",10),t&2){let i=l(2).$implicit,n=l(2);g((i==null||i.attribute_info==null?null:i.attribute_info.format_type)==n.formatType.FORMAT_QUANTITATIVE_WITH_UNIT?0:1)}}function pe(t,r){if(t&1&&_(0,"datepicker",8),t&2){let i=l(2).$implicit;d("formControlName",i.attribute_id)}}function de(t,r){if(t&1&&C(0,ae,1,2,"input",7)(1,me,2,1)(2,pe,1,1,"datepicker",8),t&2){let i,n=l().$implicit,e=l(2);g((i=n==null||n.attribute_info==null?null:n.attribute_info.input_validation_type)===e.validationType.VALIDATOR_STRING_TYPE?0:i===e.validationType.VALIDATOR_FLOAT_TYPE?1:i===e.validationType.VALIDATOR_DATE_TYPE?2:-1)}}function ue(t,r){if(t&1&&_(0,"ng-select",6),t&2){let i=l().$implicit;d("formControlName",i.attribute_id)("items",i.attribute_value_list?i.attribute_value_list:lt(3,yt))("placeholder","Pilih "+(i==null?null:i.name))}}function _e(t,r){if(t&1&&_(0,"ng-select",6),t&2){let i=l().$implicit;d("formControlName",i.attribute_id)("items",i.attribute_value_list?i.attribute_value_list:lt(3,yt))("placeholder","Pilih "+(i==null?null:i.name))}}function fe(t,r){if(t&1&&(c(0,"div",2)(1,"div",3),C(2,ne,2,0,"span",4),c(3,"span"),f(4),s()(),C(5,re,1,5,"ng-select",5)(6,de,3,1)(7,ue,1,4,"ng-select",6)(8,_e,1,4,"ng-select",6),s()),t&2){let i,n=r.$implicit,e=l(2);p(2),g(n.mandatory?2:-1),p(2),q(" ",n==null?null:n.name," "),p(),g((i=n==null||n.attribute_info==null?null:n.attribute_info.input_type)===e.inputType.MULTI_COMBO_BOX?5:i===e.inputType.FREE_TEXT_FILED?6:i===e.inputType.SINGLE_COMBO_BOX?7:8)}}function he(t,r){if(t&1&&(c(0,"form",0)(1,"div",1),V(2,fe,9,3,"div",2,w),s()()),t&2){let i=l();d("formGroup",i.form),p(2),U(r)}}var Zt=(()=>{let r=class r{constructor(){this.formCategoryService=u(bt),this.channelType=b(void 0),this.categoryId=b(void 0),this.channelId=b(void 0),this.channelProductUpload=b(void 0),this.attributesChanges=new M,this.inputType=J,this.formatType=it,this.validationType=ot}ngOnChanges(){let n=this.categoryId(),e=this.channelId();h.IsNotEmpty(n)&&h.IsNotEmpty(e)&&(this.attributes$=this.formCategoryService.getAttributes({categoryId:n,channelId:e,channelType:this.channelType()}).pipe(E(a=>{this.form=this.formCategoryService.createFormGroup(a),this.listenToFormChange(a)}),z(1)))}listenToFormChange(n){let e=[];this.formSubscription=this.form.valueChanges.subscribe(a=>{e=this.formCategoryService.getFilteredAttributes(n,a),this.attributesChanges.emit(e)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["shopee-attribute-form"]],inputs:{channelType:[1,"channelType"],categoryId:[1,"categoryId"],channelId:[1,"channelId"],channelProductUpload:[1,"channelProductUpload"]},outputs:{attributesChanges:"attributesChanges"},features:[I([bt]),D],decls:2,vars:3,consts:[[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],[1,"text-danger"],["bindLabel","name","bindValue","value_id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","value_id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"],[1,"attribute-datepicker",3,"formControlName"],[1,"d-flex","align-items-center",3,"formGroupName"],["type","text","autoNum","",1,"form-control",3,"formControlName","placeholder"],["formControlName","value","type","text","autoNum","",1,"form-control","me-1",2,"width","200px",3,"placeholder"],["name","unit","id","unit","formControlName","unit",1,"form-control"],["disabled","","selected","",3,"value"],[3,"value"]],template:function(e,a){if(e&1&&(C(0,he,4,1,"form",0),v(1,"async")),e&2){let o;g((o=T(1,1,a.attributes$))?0:-1,o)}},dependencies:[A,B,R,$,Y,Ut,Lt,tt,Vt,L,W,H,X,wt,Ht,Qt,qt,S],styles:["input[_ngcontent-%COMP%], select[_ngcontent-%COMP%]{height:36px;border-radius:4px} datepicker.attribute-datepicker>mat-form-field.mat-mdc-form-field>.mat-mdc-text-field-wrapper{height:36px} datepicker.attribute-datepicker .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-top:11px!important;padding-bottom:11px!important;height:36px;min-height:36px!important} datepicker.attribute-datepicker mat-datepicker-toggle>button.mat-mdc-icon-button.mat-mdc-button-base{--mat-icon-button-state-layer-size: 36px}"]});let t=r;return t})();var Q=(function(t){return t.TIKTOK_SHOP="TIKTOK_SHOP",t.TOKOPEDIA="TOKOPEDIA",t})(Q||{});var vt=(()=>{let r=class r{constructor(){this.httpService=u(Z),this.formBuilder=u(K),this.uploadProductService=u(pt)}getAttributes(n,e){return this.httpService.get("api/product/tiktok/GetAttributes",[{key:"ID",value:n},{key:"CategoryID",value:e}]).pipe(At(o=>this.uploadProductService.selectedProduct$.pipe(P(m=>(o=this.mappingAttributeSalesProperty(o,m),o)))))}mappingAttributeSalesProperty(n,e){let a=0;return n.filter(o=>(o.type=="SALES_PROPERTY"&&(a+=1),a>1?(a=0,!1):!0)).map(o=>(o.type=="SALES_PROPERTY"&&(o.name="Jenis Variant",o.is_multiple_selection=!1,o.is_required=this.isProductHasMoreVariant(e),o.values=[{id:"Warna",name:"Warna"},{id:"Ukuran",name:"Ukuran"}]),o))}isProductHasMoreVariant(n){let e=!1,a=[];return n.forEach(o=>{o.Variants&&a.push(o.Variants.length)}),e=a.some(o=>o>1),e}createFormGroup(n){let e=this.formBuilder.group({}),a=[];return n.forEach(o=>{a=[],o.is_required&&a.push(nt.required),e.addControl(o.id,this.formBuilder.control(null,a))}),e.addControl("listingPlatform",this.formBuilder.control([Q.TIKTOK_SHOP,Q.TOKOPEDIA],[nt.required])),e}getFilteredAttributes(n,e){let a=JSON.parse(JSON.stringify(n)),o=Object.keys(e),m=a.filter(y=>o.findIndex(ft=>parseInt(ft)==y.id)!=-1);return m=this.filterSelectedAttributes(m,e),m}filterSelectedAttributes(n,e){return n.map(o=>(h.IsNotEmpty(o.values)?o.is_multiple_selection?o.values=o.values.filter(m=>e[o.id]?.includes(m.id)):o.values=o.values.filter(m=>m.id==e[o.id]):e[o.id]&&(o.values=[{id:null,name:e[o.id]}]),o)).filter(o=>o?.values?.length>0)}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();function Ce(t,r){t&1&&(c(0,"small",5),f(1," Platform is required "),s())}function ge(t,r){t&1&&(c(0,"span",5),f(1,"*"),s())}function be(t,r){if(t&1&&_(0,"ng-select",6),t&2){let i=l().$implicit;d("multiple",!0)("formControlName",i.id)("items",i.values)("placeholder","Pilih "+(i==null?null:i.name))}}function ye(t,r){if(t&1&&_(0,"ng-select",7),t&2){let i=l().$implicit;d("formControlName",i.id)("items",i.values)("placeholder","Pilih "+(i==null?null:i.name))}}function ve(t,r){if(t&1&&_(0,"input",8),t&2){let i=l().$implicit;d("formControlName",i.id)("placeholder",i==null?null:i.name)}}function Te(t,r){if(t&1&&(c(0,"small",5),f(1),s()),t&2){let i=l().$implicit;p(),q(" ",i==null?null:i.name," is mandatory ")}}function xe(t,r){if(t&1&&(c(0,"div",2)(1,"div",3),C(2,ge,2,0,"span",5),c(3,"span"),f(4),s()(),C(5,be,1,4,"ng-select",6)(6,ye,1,3,"ng-select",7)(7,ve,1,2,"input",8),C(8,Te,2,1,"small",5),s()),t&2){let i=r.$implicit;p(2),g(i.is_required?2:-1),p(2),q(" ",i==null?null:i.name," "),p(),g(i.is_multiple_selection?5:i.values!==null&&i.values.length>0?6:7),p(3),g(i.is_required?8:-1)}}function Ie(t,r){if(t&1&&(c(0,"form",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"span"),f(5," Platform Options"),s()(),_(6,"ng-select",4),C(7,Ce,2,0,"small",5),s(),V(8,xe,9,4,"div",2,w),s()()),t&2){let i,n=l();d("formGroup",n.form),p(6),d("multiple",!0)("items",n.platformOptions)("clearable",!1),p(),g(!(n.form==null||(i=n.form.get("listingPlatform").errors)==null)&&i.required?7:-1),p(),U(r)}}var te=(()=>{let r=class r{constructor(){this.tiktokAttributeFormService=u(vt),this.channelId=b(void 0),this.categoryId=b(void 0),this.platformChange=kt({alias:"onPlatformChanges"}),this.formSubscription=new St,this.attributesChanges=new M,this.platformOptions=[{label:"TikTok Shop",value:Q.TIKTOK_SHOP},{label:"Tokopedia",value:Q.TOKOPEDIA}]}ngOnChanges(){let n=this.categoryId(),e=this.channelId();h.IsNotEmpty(n)&&h.IsNotEmpty(e)&&(this.attributes$=this.tiktokAttributeFormService.getAttributes(e,n).pipe(P(a=>a.filter(o=>!(o.type=="PRODUCT_PROPERTY"&&(h.IsEmpty(o.values)||o.values?.length==0)&&o.is_customizable==!1))),E(a=>{this.form=this.tiktokAttributeFormService.createFormGroup(a),this.listenToFormChange(a)}),z(1)))}listenToFormChange(n){let e=[];this.form.valueChanges.pipe(ht(this.formSubscription)).subscribe(a=>{delete a.listingPlatform,e=this.tiktokAttributeFormService.getFilteredAttributes(n,a),this.attributesChanges.emit(e)}),this.form.get("listingPlatform").valueChanges.pipe(Pt(this.form.get("listingPlatform").value),ht(this.formSubscription)).subscribe(a=>{this.platformChange.emit(a)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["tiktok-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{platformChange:"onPlatformChanges",attributesChanges:"attributesChanges"},features:[I([vt]),D],decls:2,vars:3,consts:[[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","listingPlatform","bindLabel","label","bindValue","value","placeholder","Platform Options",3,"multiple","items","clearable"],[1,"text-danger"],["bindLabel","name","bindValue","id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"]],template:function(e,a){if(e&1&&(C(0,Ie,10,5,"form",0),v(1,"async")),e&2){let o;g((o=T(1,1,a.attributes$))?0:-1,o)}},dependencies:[A,B,R,$,Y,tt,L,W,H,X,et,S],encapsulation:2});let t=r;return t})();var Tt=(()=>{let r=class r{constructor(){this.woocommerceUploadService=u(mt)}getAttributes(n,e){return this.woocommerceUploadService.getAttributes(n,e).pipe(P(a=>a.map(o=>({key:o.name,label:o.name}))))}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();var ee=(()=>{let r=class r{constructor(){this.wooAttributeFormService=u(Tt),this.channelId=b(),this.categoryId=b(),this.attributesChanges=new M}ngOnChanges(){h.IsNotEmpty(this.categoryId())&&h.IsNotEmpty(this.channelId())&&(this.attributes$=this.wooAttributeFormService.getAttributes(this.channelId(),this.categoryId()))}onSelectAttribute(n){this.attributesChanges.emit([n.key])}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["wooocommerce-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{attributesChanges:"attributesChanges"},features:[I([Tt]),D],decls:6,vars:3,consts:[[1,"row"],[1,"col-6"],[1,"mb-1"],["bindLabel","label","bindValue","id","placeholder","Pilih Atribut",3,"change","items"]],template:function(e,a){e&1&&(c(0,"div",0)(1,"div",1)(2,"div",2),f(3,"Atribut"),s(),c(4,"ng-select",3),v(5,"async"),F("change",function(m){return a.onSelectAttribute(m)}),s()()()),e&2&&(p(4),d("items",T(5,1,a.attributes$)))},dependencies:[A,et,B,R,$,S],encapsulation:2});let t=r;return t})();var xt=(()=>{let r=class r{constructor(){this.httpService=u(Z),this.formBuilder=u(K)}getAttributes(n,e){return this.httpService.get("api/product/tokopedia/GetAttributes",[{key:"ID",value:n},{key:"CategoryID",value:e}]).pipe(P(o=>o))}createFormGroup(n){let e=this.formBuilder.group({});return n.forEach(a=>{e.addControl(a.variant,this.formBuilder.control(null))}),e}convertAttributes(n={}){return Object.values(n).filter(a=>a!==null).map(a=>JSON.stringify(a))}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();function Se(t,r){if(t&1&&(c(0,"div",2)(1,"div",3),f(2),s(),_(3,"ng-select",4),s()),t&2){let i=r.$implicit;p(2),q(" ",i==null?null:i.variant," "),p(),d("formControlName",i.variant)("items",i.values)("placeholder","Pilih "+(i==null?null:i.variant))}}function Ae(t,r){if(t&1&&(c(0,"form",0)(1,"div",1),V(2,Se,4,4,"div",2,w),s()()),t&2){let i=l();d("formGroup",i.form),p(2),U(r)}}var ie=(()=>{let r=class r{constructor(){this.tokpedAttrFormService=u(xt),this.channelId=b(void 0),this.categoryId=b(void 0),this.attributesChanges=new M}ngOnInit(){}ngOnChanges(n){let e=this.categoryId(),a=this.channelId();h.IsNotEmpty(e)&&h.IsNotEmpty(a)&&(this.attributes$=this.tokpedAttrFormService.getAttributes(a,e).pipe(E(o=>{this.form=this.tokpedAttrFormService.createFormGroup(o),this.listenToFormChange()})))}listenToFormChange(){let n=[];this.formSubscription=this.form.valueChanges.subscribe(e=>{n=this.tokpedAttrFormService.convertAttributes(e),this.attributesChanges.emit(n)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["tokopedia-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{attributesChanges:"attributesChanges"},features:[I([xt]),D],decls:2,vars:3,consts:[[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"]],template:function(e,a){if(e&1&&(C(0,Ae,4,1,"form",0),v(1,"async")),e&2){let o;g((o=T(1,1,a.attributes$))?0:-1,o)}},dependencies:[A,B,R,$,Y,L,W,H,X,S],encapsulation:2});let t=r;return t})();var It=(()=>{let r=class r{constructor(){this.httpService=u(Z),this.formBuilder=u(K)}getAttributes(n){return this.httpService.get("api/product/shopify/GetAttributes",[{key:"ID",value:n}]).pipe(E(a=>(a.Options.StatusOptions=a.Options.Status.map(o=>({id:o,name:o})),a)))}createFormGroup(n){let e=this.formBuilder.group({});return Object.keys(n.Attribute).forEach(o=>{e.addControl(o,this.formBuilder.control(null))}),e}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();function Fe(t,r){if(t&1&&(c(0,"form",0)(1,"div",1)(2,"div",2)(3,"div",3),f(4," Brand "),s(),_(5,"input",4),s(),c(6,"div",5)(7,"div",3),f(8," Product Type "),s(),_(9,"input",6),s(),c(10,"div",5)(11,"div",3),f(12," Status "),s(),_(13,"ng-select",7),s()()()),t&2){let i=l();d("formGroup",i.form),p(13),d("items",r.Options.StatusOptions)}}var oe=(()=>{let r=class r{constructor(){this.channelId=b(void 0),this.attributesChanges=new M,this.shopifyFormService=u(It)}ngOnChanges(n){n.channelId&&(this.attributes$=this.shopifyFormService.getAttributes(this.channelId()).pipe(E(e=>{this.form=this.shopifyFormService.createFormGroup(e),this.listenToFormChange()})))}listenToFormChange(){this.formSubscription=this.form.valueChanges.pipe(Ft(500)).subscribe(n=>{this.attributesChanges.emit([n])})}ngOnDestroy(){this.formSubscription.unsubscribe()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["shopify-attribute-form"]],inputs:{channelId:[1,"channelId"]},outputs:{attributesChanges:"attributesChanges"},features:[I([It]),D],decls:2,vars:3,consts:[[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","Brand","type","text","placeholder","brand",1,"form-control"],[1,"col-6"],["formControlName","ProductType","type","text","placeholder","Product Type",1,"form-control"],["formControlName","Status","bindLabel","name","bindValue","id","placeholder","Status",3,"items"]],template:function(e,a){if(e&1&&(C(0,Fe,14,2,"form",0),v(1,"async")),e&2){let o;g((o=T(1,1,a.attributes$))?0:-1,o)}},dependencies:[A,$,Y,tt,L,W,H,X,B,R,S],encapsulation:2});let t=r;return t})();function Pe(t,r){if(t&1&&(c(0,"div",6),_(1,"app-product-card",9),s()),t&2){let i=r.$implicit;p(),d("productId",i==null?null:i.ID)("title",i==null?null:i.Name)("image",i==null?null:i.ThumbnailUrl)("description",(i==null||i.Variants==null?null:i.Variants.length)>1?(i==null||i.Variants==null?null:i.Variants.length)+" Variants":null)("imageForZoom",i==null?null:i.ImageUrl)("code",i==null||i.Variants[0]==null?null:i.Variants[0].Code)("showFooter",!1)}}function Ee(t,r){if(t&1){let i=j();c(0,"mat-checkbox",21),Ot("ngModelChange",function(e){O(i);let a=l().$implicit;return Nt(a.selected,e)||(a.selected=e),k(e)}),F("ngModelChange",function(){let e=O(i),a=l(),o=a.$implicit,m=a.$index,y=l();return k(y.onSelectChannel(o,m,e))}),s()}if(t&2){let i=l().$implicit;Et("ngModel",i.selected)}}function Ne(t,r){if(t&1&&(c(0,"div",18),_(1,"input",22),s()),t&2){let i=l().$implicit,n=l();d("matTooltip",i.type==n.channelType.Shopify||i.type==n.channelType.ShopifyV2?"Cannot change category, please change category in admin.shopify.com":i.type==n.channelType.Plugo?"You can change the category after the product has been uploaded to the Plugo Dashboard.":"")}}function Oe(t,r){if(t&1){let i=j();c(0,"app-channel-category-select",23),F("selectedCategory",function(e){O(i);let a=l().$index,o=l();return k(o.onCategoryChange(a,e))}),s()}if(t&2){let i=l().$implicit,n=l();d("disabled",!i.selected||i.selected&&i.type==n.channelType.Lazada)("channelId",i.id)("channelType",i.type)("categoryId",i.categoryId)}}function ke(t,r){if(t&1){let i=j();c(0,"shopee-attribute-form",27),F("attributesChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onAttributesChange(a,e))}),s()}if(t&2){let i=l(2).$implicit;d("categoryId",i.categoryId)("channelId",i.id)("channelType",i.type)}}function De(t,r){if(t&1){let i=j();c(0,"tiktok-attribute-form",28),F("attributesChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onAttributesChange(a,e))})("onPlatformChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onPlatformChange(a,e))}),s()}if(t&2){let i=l(2).$implicit;d("categoryId",i.categoryId)("channelId",i.id)}}function Me(t,r){if(t&1){let i=j();c(0,"wooocommerce-attribute-form",29),F("attributesChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onAttributesChange(a,e))}),s()}if(t&2){let i=l(2).$implicit;d("categoryId",i.categoryId)("channelId",i.id)}}function we(t,r){if(t&1){let i=j();c(0,"tokopedia-attribute-form",29),F("attributesChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onAttributesChange(a,e))}),s()}if(t&2){let i=l(2).$implicit;d("categoryId",i.categoryId)("channelId",i.id)}}function Ve(t,r){if(t&1&&(c(0,"div",20)(1,"div",24),C(2,ke,1,3,"shopee-attribute-form",25)(3,De,1,2,"tiktok-attribute-form",26)(4,Me,1,2,"wooocommerce-attribute-form",26)(5,we,1,2,"tokopedia-attribute-form",26),s()()),t&2){let i,n=l().$implicit,e=l();p(2),g((i=n.type)===e.channelType.Shopee?2:i===e.channelType.Tiktok?3:i===e.channelType.WooCommerce?4:i===e.channelType.Tokopedia?5:-1)}}function Ue(t,r){if(t&1){let i=j();c(0,"div",20)(1,"div",24)(2,"shopify-attribute-form",30),F("attributesChanges",function(e){O(i);let a=l().$index,o=l();return k(o.onAttributesChange(a,e))}),s()()()}if(t&2){let i=l().$implicit;p(2),d("channelId",i.id)}}function Le(t,r){if(t&1&&(c(0,"div",8)(1,"div",10)(2,"div",11)(3,"div",12)(4,"div",13)(5,"div"),C(6,Ee,1,1,"mat-checkbox",14),v(7,"async"),s(),c(8,"div"),_(9,"app-channel-logo",15),s(),c(10,"div",16)(11,"span"),f(12),s()()()(),c(13,"div",12)(14,"div",17),C(15,Ne,2,1,"div",18)(16,Oe,1,4,"app-channel-category-select",19),s()()(),C(17,Ve,6,1,"div",20)(18,Ue,3,1,"div",20),s()()),t&2){let i,n=r.$implicit,e=l();p(6),g((i=T(7,8,e.defaultCategories$))?6:-1,i),p(3),d("typeId",n.type)("showChannelName",!1),p(),d("matTooltip",n.name)("matTooltipShowDelay",2500),p(2),at(n.name),p(3),g(n.type==e.channelType.Shopify||n.type==e.channelType.Plugo||n.type==e.channelType.ShopifyV2?15:16),p(2),g(n.categoryId&&e.channelType.Lazada!=n.type&&n.selected?17:(e.channelType.Shopify==n.type||n.type==e.channelType.ShopifyV2)&&n.selected?18:-1)}}var en=(()=>{let r=class r{constructor(){this.toastr=u(Dt),this.uploadProductService=u(pt),this.selectedProducts$=this.uploadProductService.selectedProduct$,this.channelProductUploads=this.uploadProductService.channelProductUpload,this.channelType=Ct,this.defaultCategories$=this.uploadProductService.getDefaultCategory().pipe(z(1))}onCategoryChange(n,e){this.channelProductUploads.update(a=>a.map((o,m)=>(m==n&&(o.categoryId=e,o.attributes=[]),o)))}onPlatformChange(n,e){this.channelProductUploads.update(a=>a.map((o,m)=>(m==n&&(o.listing_platforms=e),o)))}onAttributesChange(n,e){this.channelProductUploads.update(a=>a.map((o,m)=>(m==n&&(o.attributes=e),o)))}tiktokPlatformChanges(n,e){this.channelProductUploads.update(a=>a.map((o,m)=>(m==n&&(o.listing_platforms=e),o)))}onSelectChannel(n,e,a){this.channelProductUploads.update(o=>o.map((m,y)=>{if(y==e&&n.selected){let _t=this.findCategoryByChannelId(n.id,a);m.categoryId=_t?.DefaultCategoryID}return y==e&&!n.selected&&(m.categoryId=null),m}))}findCategoryByChannelId(n,e){return e.find(a=>a.ID===n)}onUploadProduct(){if(this.checkTiktokPlatform()==!1){this.toastr.error("Please select at least one platform for TikTok channel","Platform is Required");return}this.uploadProductService.onUploadProduct(this.channelProductUploads())}checkTiktokPlatform(){return this.channelProductUploads().every(e=>e.type==Ct.Tiktok&&h.IsNotEmpty(e?.categoryId)?e.listing_platforms.length>0:!0)}ngOnDestroy(){this.uploadProductService.clearSelectedProduct()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["app-product-upload"]],features:[I([ct,Gt,jt,mt])],decls:17,vars:5,consts:[["headerTitle","Upload Product To Channel",3,"hideSearchBox","hideSearchDropdown"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click","disabled"],["aria-hidden","true",1,"fa","fa-upload"],[1,"container-fluid","mt-6"],[1,"ps-3","mt-8","pb-5","fw-medium"],[1,"row","mb-10","ps-3"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[1,"ps-3","mb-8","border-bottom","pb-5","fw-medium"],[1,"row","mb-6"],[3,"productId","title","image","description","imageForZoom","code","showFooter"],[1,"col-12"],[1,"row"],[1,"col-3"],[1,"d-flex","align-items-center"],["color","primary",1,"example-margin",3,"ngModel"],[3,"typeId","showChannelName"],[2,"overflow","hidden","text-overflow","ellipsis","white-space","nowrap",3,"matTooltip","matTooltipShowDelay"],[1,"w-100"],["matTooltipPosition","above",3,"matTooltip"],[3,"disabled","channelId","channelType","categoryId"],[1,"row","my-3"],["color","primary",1,"example-margin",3,"ngModelChange","ngModel"],["disabled","","type","text","placeholder","Category Unavailable",1,"form-control","rounded-1",2,"height","35px"],[3,"selectedCategory","disabled","channelId","channelType","categoryId"],[1,"col-12","ps-11"],[3,"categoryId","channelId","channelType"],[3,"categoryId","channelId"],[3,"attributesChanges","categoryId","channelId","channelType"],[3,"attributesChanges","onPlatformChanges","categoryId","channelId"],[3,"attributesChanges","categoryId","channelId"],[3,"attributesChanges","channelId"]],template:function(e,a){if(e&1&&(c(0,"mainpanel",0)(1,"actions")(2,"button",1),F("click",function(){return a.onUploadProduct()}),_(3,"i",2),f(4," Upload "),s()(),c(5,"content")(6,"div",3)(7,"h3",4),f(8,"Product To Upload"),s(),c(9,"div",5),V(10,Pe,2,7,"div",6,w),v(12,"async"),s(),c(13,"h3",7),f(14,"Channel To Upload"),s(),V(15,Le,19,10,"div",8,w),s()()()),e&2){let o;d("hideSearchBox",!0)("hideSearchDropdown",!0),p(2),d("disabled",((o=a.channelProductUploads())==null?null:o.length)==0),p(8),U(T(12,3,a.selectedProducts$)),p(5),U(a.channelProductUploads())}},dependencies:[A,Xt,Bt,Jt,Kt,Yt,et,L,Mt,Rt,$t,te,ee,ie,oe,Wt,zt,Zt,S],encapsulation:2});let t=r;return t})();export{en as ProductUploadComponent};
|
|
1
|
+
import{a as zt}from"./chunk-E7LOFZQV.js";import"./chunk-YLQBIIZH.js";import{b as Xt}from"./chunk-7T5DBPDP.js";import"./chunk-OH5T7D7O.js";import{a as Kt,b as Jt}from"./chunk-FH2KAM6J.js";import{a as Yt}from"./chunk-YKKHSYDW.js";import{a as Ht}from"./chunk-WTHYLNPX.js";import{a as ct,b as Gt,c as jt,d as mt,e as pt}from"./chunk-NJYWKADT.js";import"./chunk-TQROQOXU.js";import{a as Wt}from"./chunk-IQGRGC3E.js";import{d as R,e as B}from"./chunk-BZWZ64N5.js";import"./chunk-OHAT7WXU.js";import"./chunk-L4EPB2CQ.js";import"./chunk-GNXSEYJF.js";import"./chunk-DLHIDOS3.js";import"./chunk-V7V5O62J.js";import"./chunk-STOW2RQN.js";import"./chunk-GLBJ4Y4T.js";import"./chunk-XTNXL2IY.js";import"./chunk-KOUB5HRK.js";import"./chunk-QETZ5VDX.js";import"./chunk-WIRXMAIF.js";import"./chunk-S22I47XG.js";import"./chunk-3NCMRK7E.js";import"./chunk-PRMV4INM.js";import"./chunk-A6QXXKPR.js";import"./chunk-C4MTEDSW.js";import"./chunk-JMRRXRKO.js";import{b as Bt}from"./chunk-SNRWOTPO.js";import"./chunk-ROS2QMKF.js";import"./chunk-IA7NJXJD.js";import{a as Rt}from"./chunk-UEXWQT5J.js";import{b as qt,c as Qt}from"./chunk-RPHZK33A.js";import"./chunk-3SCX7IMW.js";import"./chunk-JHSG3KRS.js";import"./chunk-K4Q33QIR.js";import"./chunk-JRCXHF2X.js";import"./chunk-M27MYADT.js";import"./chunk-TBVMCNS2.js";import"./chunk-RM6ZXD3O.js";import"./chunk-R2XKB6UH.js";import"./chunk-RO7WOCSA.js";import"./chunk-3RK6DDJD.js";import"./chunk-UDNUDL5Z.js";import"./chunk-CVHFVFZQ.js";import"./chunk-ZC526ERX.js";import"./chunk-NJNRUDU6.js";import"./chunk-XUDE7VBC.js";import"./chunk-WAZWPRUG.js";import"./chunk-6H7M43WO.js";import"./chunk-HO2TMGLM.js";import"./chunk-JTKEMQZT.js";import{c as $t}from"./chunk-IZZY74PN.js";import"./chunk-O3BS4AC6.js";import"./chunk-ZSUWHVKX.js";import"./chunk-YH3KWMUX.js";import"./chunk-X2CTSYKS.js";import"./chunk-QXRG5XYP.js";import"./chunk-AGBJEXIM.js";import"./chunk-NB2H6KA7.js";import{b as Ct,c as h}from"./chunk-UPRDDI4K.js";import{A as et,B as $,c as tt,e as nt,h as L,i as W,l as st,m as Mt,n as Y,q as H,r as wt,s as X,t as Vt,u as Ut,v as Lt,z as K}from"./chunk-6UM4NHOR.js";import"./chunk-RQUCYFCB.js";import"./chunk-RXLMJGUY.js";import{b as Dt,e as Z}from"./chunk-D6JH2KV4.js";import"./chunk-UB3ZV5NW.js";import"./chunk-JPWGFXZT.js";import{B as A,w as S}from"./chunk-CGSMHTKB.js";import"./chunk-XBIHN6D3.js";import{$ as Pt,$c as lt,Hb as x,K as At,M as Ft,Nc as f,Oa as D,Oc as at,Pc as q,Rc as Et,Sc as Nt,Tc as Ot,Z as z,_c as I,ac as C,ca as ht,cc as g,dc as w,ea as E,f as St,fc as V,gc as U,hc as d,ic as c,id as v,jc as s,jd as T,kc as _,ma as N,ob as p,ra as u,rc as j,tb as M,td as kt,ud as b,v as P,wc as F,ya as O,yc as l,za as k}from"./chunk-OHGMB7HJ.js";import"./chunk-WFMAM73Y.js";import"./chunk-66YHNWRR.js";var J=(function(t){return t[t.SINGLE_DROP_DOWN=1]="SINGLE_DROP_DOWN",t[t.SINGLE_COMBO_BOX=2]="SINGLE_COMBO_BOX",t[t.FREE_TEXT_FILED=3]="FREE_TEXT_FILED",t[t.MULTI_DROP_DOWN=4]="MULTI_DROP_DOWN",t[t.MULTI_COMBO_BOX=5]="MULTI_COMBO_BOX",t})(J||{});var it=(function(t){return t[t.FORMAT_NORMAL=1]="FORMAT_NORMAL",t[t.FORMAT_QUANTITATIVE_WITH_UNIT=2]="FORMAT_QUANTITATIVE_WITH_UNIT",t})(it||{});var ot=(function(t){return t[t.VALIDATOR_NO_VALIDATE_TYPE=0]="VALIDATOR_NO_VALIDATE_TYPE",t[t.VALIDATOR_INT_TYPE=1]="VALIDATOR_INT_TYPE",t[t.VALIDATOR_STRING_TYPE=2]="VALIDATOR_STRING_TYPE",t[t.VALIDATOR_FLOAT_TYPE=3]="VALIDATOR_FLOAT_TYPE",t[t.VALIDATOR_DATE_TYPE=4]="VALIDATOR_DATE_TYPE",t})(ot||{});var gt=class extends st{setValue(r,i){if(r instanceof Date){let n=Math.floor(r.getTime()/1e3);super.setValue(n,i)}else super.setValue(r,i)}},bt=(()=>{let r=class r{constructor(){this.shopeeUploadService=u(ct),this.formBuilder=u(K)}getAttributes(n){return this.shopeeUploadService.getAttributes(n.channelId,n.categoryId).pipe(P(e=>this.setLabelToIndonesian(e)))}setLabelToIndonesian(n=[]){let e,a;return n=n.map(o=>(e=o?.multi_lang?.find(m=>m.language=="id"),o.attribute_value_list=o?.attribute_value_list?.map(m=>(a=m?.multi_lang?.find(y=>y.language=="id"),m.name=a?.value,m)),o.name=e?.value?e?.value:o.name,o)),n}createFormGroup(n){let e=this.formBuilder.group({}),a=[];return n.forEach(o=>{if(a=[],o.mandatory&&a.push(nt.required),o?.attribute_info?.format_type==it.FORMAT_QUANTITATIVE_WITH_UNIT&&o?.attribute_info?.input_type==J.FREE_TEXT_FILED){let m=this.formBuilder.group({unit:new st(null),value:new st(null,a)});e.addControl(JSON.stringify(o.attribute_id),m)}else o?.attribute_info?.input_type==J.FREE_TEXT_FILED&&o?.attribute_info?.input_validation_type==ot.VALIDATOR_DATE_TYPE?e.addControl(JSON.stringify(o.attribute_id),new gt(null,a)):e.addControl(JSON.stringify(o.attribute_id),this.formBuilder.control(null,a))}),e}getFilteredAttributes(n,e){let a=JSON.parse(JSON.stringify(n)),o=Object.keys(e),m=a.filter(y=>o.findIndex(ft=>parseInt(ft)==y.attribute_id||y.mandatory)!=-1);return m=this.filterSelectedAttributes(m,e),m}filterSelectedAttributes(n,e){return n.map(o=>{switch(o.attribute_info.input_type){case J.MULTI_COMBO_BOX:h.IsNotEmpty(e[o.attribute_id])?o.attribute_value_list=o.attribute_value_list.filter(m=>e[o.attribute_id]?.findIndex(y=>y==m.value_id)!=-1):o.attribute_value_list=[];break;case J.FREE_TEXT_FILED:o.attribute_info.format_type==it.FORMAT_QUANTITATIVE_WITH_UNIT?o.attribute_value_list=this.setSelectedQuantitativeAttr(e[o.attribute_id]?.value,e[o.attribute_id]?.unit):o.attribute_info.input_validation_type==ot.VALIDATOR_DATE_TYPE?o.attribute_value_list=this.setSelectedDateAttr(e[o.attribute_id]):o.attribute_value_list=this.setSelectedQuantitativeAttr(e[o.attribute_id]);break;default:o.attribute_value_list=o.attribute_value_list.filter(m=>m.value_id==e[o.attribute_id])}return o}).filter(o=>o?.attribute_value_list?.length>0)}setSelectedQuantitativeAttr(n,e){let a=[];if(h.IsNotEmpty(n)){let o={value_id:0,original_value_name:JSON.stringify(n)};h.IsNotEmpty(e)&&(o.value_unit=e),a=[o]}return a}setSelectedDateAttr(n){let e=[];return h.IsNotEmpty(n)&&(e=[{value_id:0,original_value_name:JSON.stringify(n)}]),e}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();var yt=()=>[];function ne(t,r){t&1&&(c(0,"span",4),f(1,"*"),s())}function re(t,r){if(t&1&&_(0,"ng-select",5),t&2){let i=l().$implicit;d("multiple",!0)("formControlName",i.attribute_id)("items",i.attribute_value_list?i.attribute_value_list:lt(4,yt))("placeholder","Pilih "+(i==null?null:i.name))}}function ae(t,r){if(t&1&&_(0,"input",7),t&2){let i=l(2).$implicit;d("formControlName",i.attribute_id)("placeholder","Isi "+(i==null?null:i.name))}}function le(t,r){if(t&1&&(c(0,"option",14),f(1),s()),t&2){let i=r.$implicit;d("value",i),p(),at(i)}}function se(t,r){if(t&1&&(c(0,"div",9),_(1,"input",11),c(2,"select",12)(3,"option",13),f(4,"Unit"),s(),V(5,le,2,2,"option",14,w),s()()),t&2){let i=l(3).$implicit;d("formGroupName",i.attribute_id),p(),d("placeholder","Isi "+(i==null?null:i.name)),p(2),d("value",null),p(2),U(i==null||i.attribute_info==null?null:i.attribute_info.attribute_unit_list)}}function ce(t,r){if(t&1&&_(0,"input",10),t&2){let i=l(3).$implicit;d("formControlName",i.attribute_id)("placeholder","Isi "+(i==null?null:i.name))}}function me(t,r){if(t&1&&C(0,se,7,3,"div",9)(1,ce,1,2,"input",10),t&2){let i=l(2).$implicit,n=l(2);g((i==null||i.attribute_info==null?null:i.attribute_info.format_type)==n.formatType.FORMAT_QUANTITATIVE_WITH_UNIT?0:1)}}function pe(t,r){if(t&1&&_(0,"datepicker",8),t&2){let i=l(2).$implicit;d("formControlName",i.attribute_id)}}function de(t,r){if(t&1&&C(0,ae,1,2,"input",7)(1,me,2,1)(2,pe,1,1,"datepicker",8),t&2){let i,n=l().$implicit,e=l(2);g((i=n==null||n.attribute_info==null?null:n.attribute_info.input_validation_type)===e.validationType.VALIDATOR_STRING_TYPE?0:i===e.validationType.VALIDATOR_FLOAT_TYPE?1:i===e.validationType.VALIDATOR_DATE_TYPE?2:-1)}}function ue(t,r){if(t&1&&_(0,"ng-select",6),t&2){let i=l().$implicit;d("formControlName",i.attribute_id)("items",i.attribute_value_list?i.attribute_value_list:lt(3,yt))("placeholder","Pilih "+(i==null?null:i.name))}}function _e(t,r){if(t&1&&_(0,"ng-select",6),t&2){let i=l().$implicit;d("formControlName",i.attribute_id)("items",i.attribute_value_list?i.attribute_value_list:lt(3,yt))("placeholder","Pilih "+(i==null?null:i.name))}}function fe(t,r){if(t&1&&(c(0,"div",2)(1,"div",3),C(2,ne,2,0,"span",4),c(3,"span"),f(4),s()(),C(5,re,1,5,"ng-select",5)(6,de,3,1)(7,ue,1,4,"ng-select",6)(8,_e,1,4,"ng-select",6),s()),t&2){let i,n=r.$implicit,e=l(2);p(2),g(n.mandatory?2:-1),p(2),q(" ",n==null?null:n.name," "),p(),g((i=n==null||n.attribute_info==null?null:n.attribute_info.input_type)===e.inputType.MULTI_COMBO_BOX?5:i===e.inputType.FREE_TEXT_FILED?6:i===e.inputType.SINGLE_COMBO_BOX?7:8)}}function he(t,r){if(t&1&&(c(0,"form",0)(1,"div",1),V(2,fe,9,3,"div",2,w),s()()),t&2){let i=l();d("formGroup",i.form),p(2),U(r)}}var Zt=(()=>{let r=class r{constructor(){this.formCategoryService=u(bt),this.channelType=b(void 0),this.categoryId=b(void 0),this.channelId=b(void 0),this.channelProductUpload=b(void 0),this.attributesChanges=new M,this.inputType=J,this.formatType=it,this.validationType=ot}ngOnChanges(){let n=this.categoryId(),e=this.channelId();h.IsNotEmpty(n)&&h.IsNotEmpty(e)&&(this.attributes$=this.formCategoryService.getAttributes({categoryId:n,channelId:e,channelType:this.channelType()}).pipe(E(a=>{this.form=this.formCategoryService.createFormGroup(a),this.listenToFormChange(a)}),z(1)))}listenToFormChange(n){let e=[];this.formSubscription=this.form.valueChanges.subscribe(a=>{e=this.formCategoryService.getFilteredAttributes(n,a),this.attributesChanges.emit(e)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["shopee-attribute-form"]],inputs:{channelType:[1,"channelType"],categoryId:[1,"categoryId"],channelId:[1,"channelId"],channelProductUpload:[1,"channelProductUpload"]},outputs:{attributesChanges:"attributesChanges"},features:[I([bt]),D],decls:2,vars:3,consts:[[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],[1,"text-danger"],["bindLabel","name","bindValue","value_id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","value_id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"],[1,"attribute-datepicker",3,"formControlName"],[1,"d-flex","align-items-center",3,"formGroupName"],["type","text","autoNum","",1,"form-control",3,"formControlName","placeholder"],["formControlName","value","type","text","autoNum","",1,"form-control","me-1",2,"width","200px",3,"placeholder"],["name","unit","id","unit","formControlName","unit",1,"form-control"],["disabled","","selected","",3,"value"],[3,"value"]],template:function(e,a){if(e&1&&(C(0,he,4,1,"form",0),v(1,"async")),e&2){let o;g((o=T(1,1,a.attributes$))?0:-1,o)}},dependencies:[A,B,R,$,Y,Ut,Lt,tt,Vt,L,W,H,X,wt,Ht,Qt,qt,S],styles:["input[_ngcontent-%COMP%], select[_ngcontent-%COMP%]{height:36px;border-radius:4px} datepicker.attribute-datepicker>mat-form-field.mat-mdc-form-field>.mat-mdc-text-field-wrapper{height:36px} datepicker.attribute-datepicker .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-top:11px!important;padding-bottom:11px!important;height:36px;min-height:36px!important} datepicker.attribute-datepicker mat-datepicker-toggle>button.mat-mdc-icon-button.mat-mdc-button-base{--mat-icon-button-state-layer-size: 36px}"]});let t=r;return t})();var Q=(function(t){return t.TIKTOK_SHOP="TIKTOK_SHOP",t.TOKOPEDIA="TOKOPEDIA",t})(Q||{});var vt=(()=>{let r=class r{constructor(){this.httpService=u(Z),this.formBuilder=u(K),this.uploadProductService=u(pt)}getAttributes(n,e){return this.httpService.get("api/product/tiktok/GetAttributes",[{key:"ID",value:n},{key:"CategoryID",value:e}]).pipe(At(o=>this.uploadProductService.selectedProduct$.pipe(P(m=>(o=this.mappingAttributeSalesProperty(o,m),o)))))}mappingAttributeSalesProperty(n,e){let a=0;return n.filter(o=>(o.type=="SALES_PROPERTY"&&(a+=1),a>1?(a=0,!1):!0)).map(o=>(o.type=="SALES_PROPERTY"&&(o.name="Jenis Variant",o.is_multiple_selection=!1,o.is_required=this.isProductHasMoreVariant(e),o.values=[{id:"Warna",name:"Warna"},{id:"Ukuran",name:"Ukuran"}]),o))}isProductHasMoreVariant(n){let e=!1,a=[];return n.forEach(o=>{o.Variants&&a.push(o.Variants.length)}),e=a.some(o=>o>1),e}createFormGroup(n){let e=this.formBuilder.group({}),a=[];return n.forEach(o=>{a=[],o.is_required&&a.push(nt.required),e.addControl(o.id,this.formBuilder.control(null,a))}),e.addControl("listingPlatform",this.formBuilder.control([Q.TIKTOK_SHOP,Q.TOKOPEDIA],[nt.required])),e}getFilteredAttributes(n,e){let a=JSON.parse(JSON.stringify(n)),o=Object.keys(e),m=a.filter(y=>o.findIndex(ft=>parseInt(ft)==y.id)!=-1);return m=this.filterSelectedAttributes(m,e),m}filterSelectedAttributes(n,e){return n.map(o=>(h.IsNotEmpty(o.values)?o.is_multiple_selection?o.values=o.values.filter(m=>e[o.id]?.includes(m.id)):o.values=o.values.filter(m=>m.id==e[o.id]):e[o.id]&&(o.values=[{id:null,name:e[o.id]}]),o)).filter(o=>o?.values?.length>0)}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();function Ce(t,r){t&1&&(c(0,"small",5),f(1," Platform is required "),s())}function ge(t,r){t&1&&(c(0,"span",5),f(1,"*"),s())}function be(t,r){if(t&1&&_(0,"ng-select",6),t&2){let i=l().$implicit;d("multiple",!0)("formControlName",i.id)("items",i.values)("placeholder","Pilih "+(i==null?null:i.name))}}function ye(t,r){if(t&1&&_(0,"ng-select",7),t&2){let i=l().$implicit;d("formControlName",i.id)("items",i.values)("placeholder","Pilih "+(i==null?null:i.name))}}function ve(t,r){if(t&1&&_(0,"input",8),t&2){let i=l().$implicit;d("formControlName",i.id)("placeholder",i==null?null:i.name)}}function Te(t,r){if(t&1&&(c(0,"small",5),f(1),s()),t&2){let i=l().$implicit;p(),q(" ",i==null?null:i.name," is mandatory ")}}function xe(t,r){if(t&1&&(c(0,"div",2)(1,"div",3),C(2,ge,2,0,"span",5),c(3,"span"),f(4),s()(),C(5,be,1,4,"ng-select",6)(6,ye,1,3,"ng-select",7)(7,ve,1,2,"input",8),C(8,Te,2,1,"small",5),s()),t&2){let i=r.$implicit;p(2),g(i.is_required?2:-1),p(2),q(" ",i==null?null:i.name," "),p(),g(i.is_multiple_selection?5:i.values!==null&&i.values.length>0?6:7),p(3),g(i.is_required?8:-1)}}function Ie(t,r){if(t&1&&(c(0,"form",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"span"),f(5," Platform Options"),s()(),_(6,"ng-select",4),C(7,Ce,2,0,"small",5),s(),V(8,xe,9,4,"div",2,w),s()()),t&2){let i,n=l();d("formGroup",n.form),p(6),d("multiple",!0)("items",n.platformOptions)("clearable",!1),p(),g(!(n.form==null||(i=n.form.get("listingPlatform").errors)==null)&&i.required?7:-1),p(),U(r)}}var te=(()=>{let r=class r{constructor(){this.tiktokAttributeFormService=u(vt),this.channelId=b(void 0),this.categoryId=b(void 0),this.platformChange=kt({alias:"onPlatformChanges"}),this.formSubscription=new St,this.attributesChanges=new M,this.platformOptions=[{label:"TikTok Shop",value:Q.TIKTOK_SHOP},{label:"Tokopedia",value:Q.TOKOPEDIA}]}ngOnChanges(){let n=this.categoryId(),e=this.channelId();h.IsNotEmpty(n)&&h.IsNotEmpty(e)&&(this.attributes$=this.tiktokAttributeFormService.getAttributes(e,n).pipe(P(a=>a.filter(o=>!(o.type=="PRODUCT_PROPERTY"&&(h.IsEmpty(o.values)||o.values?.length==0)&&o.is_customizable==!1))),E(a=>{this.form=this.tiktokAttributeFormService.createFormGroup(a),this.listenToFormChange(a)}),z(1)))}listenToFormChange(n){let e=[];this.form.valueChanges.pipe(ht(this.formSubscription)).subscribe(a=>{delete a.listingPlatform,e=this.tiktokAttributeFormService.getFilteredAttributes(n,a),this.attributesChanges.emit(e)}),this.form.get("listingPlatform").valueChanges.pipe(Pt(this.form.get("listingPlatform").value),ht(this.formSubscription)).subscribe(a=>{this.platformChange.emit(a)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["tiktok-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{platformChange:"onPlatformChanges",attributesChanges:"attributesChanges"},features:[I([vt]),D],decls:2,vars:3,consts:[[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","listingPlatform","bindLabel","label","bindValue","value","placeholder","Platform Options",3,"multiple","items","clearable"],[1,"text-danger"],["bindLabel","name","bindValue","id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"]],template:function(e,a){if(e&1&&(C(0,Ie,10,5,"form",0),v(1,"async")),e&2){let o;g((o=T(1,1,a.attributes$))?0:-1,o)}},dependencies:[A,B,R,$,Y,tt,L,W,H,X,et,S],encapsulation:2});let t=r;return t})();var Tt=(()=>{let r=class r{constructor(){this.woocommerceUploadService=u(mt)}getAttributes(n,e){return this.woocommerceUploadService.getAttributes(n,e).pipe(P(a=>a.map(o=>({key:o.name,label:o.name}))))}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();var ee=(()=>{let r=class r{constructor(){this.wooAttributeFormService=u(Tt),this.channelId=b(),this.categoryId=b(),this.attributesChanges=new M}ngOnChanges(){h.IsNotEmpty(this.categoryId())&&h.IsNotEmpty(this.channelId())&&(this.attributes$=this.wooAttributeFormService.getAttributes(this.channelId(),this.categoryId()))}onSelectAttribute(n){this.attributesChanges.emit([n.key])}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["wooocommerce-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{attributesChanges:"attributesChanges"},features:[I([Tt]),D],decls:6,vars:3,consts:[[1,"row"],[1,"col-6"],[1,"mb-1"],["bindLabel","label","bindValue","id","placeholder","Pilih Atribut",3,"change","items"]],template:function(e,a){e&1&&(c(0,"div",0)(1,"div",1)(2,"div",2),f(3,"Atribut"),s(),c(4,"ng-select",3),v(5,"async"),F("change",function(m){return a.onSelectAttribute(m)}),s()()()),e&2&&(p(4),d("items",T(5,1,a.attributes$)))},dependencies:[A,et,B,R,$,S],encapsulation:2});let t=r;return t})();var xt=(()=>{let r=class r{constructor(){this.httpService=u(Z),this.formBuilder=u(K)}getAttributes(n,e){return this.httpService.get("api/product/tokopedia/GetAttributes",[{key:"ID",value:n},{key:"CategoryID",value:e}]).pipe(P(o=>o))}createFormGroup(n){let e=this.formBuilder.group({});return n.forEach(a=>{e.addControl(a.variant,this.formBuilder.control(null))}),e}convertAttributes(n={}){return Object.values(n).filter(a=>a!==null).map(a=>JSON.stringify(a))}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();function Se(t,r){if(t&1&&(c(0,"div",2)(1,"div",3),f(2),s(),_(3,"ng-select",4),s()),t&2){let i=r.$implicit;p(2),q(" ",i==null?null:i.variant," "),p(),d("formControlName",i.variant)("items",i.values)("placeholder","Pilih "+(i==null?null:i.variant))}}function Ae(t,r){if(t&1&&(c(0,"form",0)(1,"div",1),V(2,Se,4,4,"div",2,w),s()()),t&2){let i=l();d("formGroup",i.form),p(2),U(r)}}var ie=(()=>{let r=class r{constructor(){this.tokpedAttrFormService=u(xt),this.channelId=b(void 0),this.categoryId=b(void 0),this.attributesChanges=new M}ngOnInit(){}ngOnChanges(n){let e=this.categoryId(),a=this.channelId();h.IsNotEmpty(e)&&h.IsNotEmpty(a)&&(this.attributes$=this.tokpedAttrFormService.getAttributes(a,e).pipe(E(o=>{this.form=this.tokpedAttrFormService.createFormGroup(o),this.listenToFormChange()})))}listenToFormChange(){let n=[];this.formSubscription=this.form.valueChanges.subscribe(e=>{n=this.tokpedAttrFormService.convertAttributes(e),this.attributesChanges.emit(n)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["tokopedia-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{attributesChanges:"attributesChanges"},features:[I([xt]),D],decls:2,vars:3,consts:[[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"]],template:function(e,a){if(e&1&&(C(0,Ae,4,1,"form",0),v(1,"async")),e&2){let o;g((o=T(1,1,a.attributes$))?0:-1,o)}},dependencies:[A,B,R,$,Y,L,W,H,X,S],encapsulation:2});let t=r;return t})();var It=(()=>{let r=class r{constructor(){this.httpService=u(Z),this.formBuilder=u(K)}getAttributes(n){return this.httpService.get("api/product/shopify/GetAttributes",[{key:"ID",value:n}]).pipe(E(a=>(a.Options.StatusOptions=a.Options.Status.map(o=>({id:o,name:o})),a)))}createFormGroup(n){let e=this.formBuilder.group({});return Object.keys(n.Attribute).forEach(o=>{e.addControl(o,this.formBuilder.control(null))}),e}};r.\u0275fac=function(e){return new(e||r)},r.\u0275prov=N({token:r,factory:r.\u0275fac});let t=r;return t})();function Fe(t,r){if(t&1&&(c(0,"form",0)(1,"div",1)(2,"div",2)(3,"div",3),f(4," Brand "),s(),_(5,"input",4),s(),c(6,"div",5)(7,"div",3),f(8," Product Type "),s(),_(9,"input",6),s(),c(10,"div",5)(11,"div",3),f(12," Status "),s(),_(13,"ng-select",7),s()()()),t&2){let i=l();d("formGroup",i.form),p(13),d("items",r.Options.StatusOptions)}}var oe=(()=>{let r=class r{constructor(){this.channelId=b(void 0),this.attributesChanges=new M,this.shopifyFormService=u(It)}ngOnChanges(n){n.channelId&&(this.attributes$=this.shopifyFormService.getAttributes(this.channelId()).pipe(E(e=>{this.form=this.shopifyFormService.createFormGroup(e),this.listenToFormChange()})))}listenToFormChange(){this.formSubscription=this.form.valueChanges.pipe(Ft(500)).subscribe(n=>{this.attributesChanges.emit([n])})}ngOnDestroy(){this.formSubscription.unsubscribe()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["shopify-attribute-form"]],inputs:{channelId:[1,"channelId"]},outputs:{attributesChanges:"attributesChanges"},features:[I([It]),D],decls:2,vars:3,consts:[[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","Brand","type","text","placeholder","brand",1,"form-control"],[1,"col-6"],["formControlName","ProductType","type","text","placeholder","Product Type",1,"form-control"],["formControlName","Status","bindLabel","name","bindValue","id","placeholder","Status",3,"items"]],template:function(e,a){if(e&1&&(C(0,Fe,14,2,"form",0),v(1,"async")),e&2){let o;g((o=T(1,1,a.attributes$))?0:-1,o)}},dependencies:[A,$,Y,tt,L,W,H,X,B,R,S],encapsulation:2});let t=r;return t})();function Pe(t,r){if(t&1&&(c(0,"div",6),_(1,"app-product-card",9),s()),t&2){let i=r.$implicit;p(),d("productId",i==null?null:i.ID)("title",i==null?null:i.Name)("image",i==null?null:i.ThumbnailUrl)("description",(i==null||i.Variants==null?null:i.Variants.length)>1?(i==null||i.Variants==null?null:i.Variants.length)+" Variants":null)("imageForZoom",i==null?null:i.ImageUrl)("code",i==null||i.Variants[0]==null?null:i.Variants[0].Code)("showFooter",!1)}}function Ee(t,r){if(t&1){let i=j();c(0,"mat-checkbox",21),Ot("ngModelChange",function(e){O(i);let a=l().$implicit;return Nt(a.selected,e)||(a.selected=e),k(e)}),F("ngModelChange",function(){let e=O(i),a=l(),o=a.$implicit,m=a.$index,y=l();return k(y.onSelectChannel(o,m,e))}),s()}if(t&2){let i=l().$implicit;Et("ngModel",i.selected)}}function Ne(t,r){if(t&1&&(c(0,"div",18),_(1,"input",22),s()),t&2){let i=l().$implicit,n=l();d("matTooltip",i.type==n.channelType.Shopify||i.type==n.channelType.ShopifyV2?"Cannot change category, please change category in admin.shopify.com":i.type==n.channelType.Plugo?"You can change the category after the product has been uploaded to the Plugo Dashboard.":"")}}function Oe(t,r){if(t&1){let i=j();c(0,"app-channel-category-select",23),F("selectedCategory",function(e){O(i);let a=l().$index,o=l();return k(o.onCategoryChange(a,e))}),s()}if(t&2){let i=l().$implicit,n=l();d("disabled",!i.selected||i.selected&&i.type==n.channelType.Lazada)("channelId",i.id)("channelType",i.type)("categoryId",i.categoryId)}}function ke(t,r){if(t&1){let i=j();c(0,"shopee-attribute-form",27),F("attributesChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onAttributesChange(a,e))}),s()}if(t&2){let i=l(2).$implicit;d("categoryId",i.categoryId)("channelId",i.id)("channelType",i.type)}}function De(t,r){if(t&1){let i=j();c(0,"tiktok-attribute-form",28),F("attributesChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onAttributesChange(a,e))})("onPlatformChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onPlatformChange(a,e))}),s()}if(t&2){let i=l(2).$implicit;d("categoryId",i.categoryId)("channelId",i.id)}}function Me(t,r){if(t&1){let i=j();c(0,"wooocommerce-attribute-form",29),F("attributesChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onAttributesChange(a,e))}),s()}if(t&2){let i=l(2).$implicit;d("categoryId",i.categoryId)("channelId",i.id)}}function we(t,r){if(t&1){let i=j();c(0,"tokopedia-attribute-form",29),F("attributesChanges",function(e){O(i);let a=l(2).$index,o=l();return k(o.onAttributesChange(a,e))}),s()}if(t&2){let i=l(2).$implicit;d("categoryId",i.categoryId)("channelId",i.id)}}function Ve(t,r){if(t&1&&(c(0,"div",20)(1,"div",24),C(2,ke,1,3,"shopee-attribute-form",25)(3,De,1,2,"tiktok-attribute-form",26)(4,Me,1,2,"wooocommerce-attribute-form",26)(5,we,1,2,"tokopedia-attribute-form",26),s()()),t&2){let i,n=l().$implicit,e=l();p(2),g((i=n.type)===e.channelType.Shopee?2:i===e.channelType.Tiktok?3:i===e.channelType.WooCommerce?4:i===e.channelType.Tokopedia?5:-1)}}function Ue(t,r){if(t&1){let i=j();c(0,"div",20)(1,"div",24)(2,"shopify-attribute-form",30),F("attributesChanges",function(e){O(i);let a=l().$index,o=l();return k(o.onAttributesChange(a,e))}),s()()()}if(t&2){let i=l().$implicit;p(2),d("channelId",i.id)}}function Le(t,r){if(t&1&&(c(0,"div",8)(1,"div",10)(2,"div",11)(3,"div",12)(4,"div",13)(5,"div"),C(6,Ee,1,1,"mat-checkbox",14),v(7,"async"),s(),c(8,"div"),_(9,"app-channel-logo",15),s(),c(10,"div",16)(11,"span"),f(12),s()()()(),c(13,"div",12)(14,"div",17),C(15,Ne,2,1,"div",18)(16,Oe,1,4,"app-channel-category-select",19),s()()(),C(17,Ve,6,1,"div",20)(18,Ue,3,1,"div",20),s()()),t&2){let i,n=r.$implicit,e=l();p(6),g((i=T(7,8,e.defaultCategories$))?6:-1,i),p(3),d("typeId",n.type)("showChannelName",!1),p(),d("matTooltip",n.name)("matTooltipShowDelay",2500),p(2),at(n.name),p(3),g(n.type==e.channelType.Shopify||n.type==e.channelType.Plugo||n.type==e.channelType.ShopifyV2?15:16),p(2),g(n.categoryId&&e.channelType.Lazada!=n.type&&n.selected?17:(e.channelType.Shopify==n.type||n.type==e.channelType.ShopifyV2)&&n.selected?18:-1)}}var en=(()=>{let r=class r{constructor(){this.toastr=u(Dt),this.uploadProductService=u(pt),this.selectedProducts$=this.uploadProductService.selectedProduct$,this.channelProductUploads=this.uploadProductService.channelProductUpload,this.channelType=Ct,this.defaultCategories$=this.uploadProductService.getDefaultCategory().pipe(z(1))}onCategoryChange(n,e){this.channelProductUploads.update(a=>a.map((o,m)=>(m==n&&(o.categoryId=e,o.attributes=[]),o)))}onPlatformChange(n,e){this.channelProductUploads.update(a=>a.map((o,m)=>(m==n&&(o.listing_platforms=e),o)))}onAttributesChange(n,e){this.channelProductUploads.update(a=>a.map((o,m)=>(m==n&&(o.attributes=e),o)))}tiktokPlatformChanges(n,e){this.channelProductUploads.update(a=>a.map((o,m)=>(m==n&&(o.listing_platforms=e),o)))}onSelectChannel(n,e,a){this.channelProductUploads.update(o=>o.map((m,y)=>{if(y==e&&n.selected){let _t=this.findCategoryByChannelId(n.id,a);m.categoryId=_t?.DefaultCategoryID}return y==e&&!n.selected&&(m.categoryId=null),m}))}findCategoryByChannelId(n,e){return e.find(a=>a.ID===n)}onUploadProduct(){if(this.checkTiktokPlatform()==!1){this.toastr.error("Please select at least one platform for TikTok channel","Platform is Required");return}this.uploadProductService.onUploadProduct(this.channelProductUploads())}checkTiktokPlatform(){return this.channelProductUploads().every(e=>e.type==Ct.Tiktok&&h.IsNotEmpty(e?.categoryId)?e.listing_platforms.length>0:!0)}ngOnDestroy(){this.uploadProductService.clearSelectedProduct()}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=x({type:r,selectors:[["app-product-upload"]],features:[I([ct,Gt,jt,mt])],decls:17,vars:5,consts:[["headerTitle","Upload Product To Channel",3,"hideSearchBox","hideSearchDropdown"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click","disabled"],["aria-hidden","true",1,"fa","fa-upload"],[1,"container-fluid","mt-6"],[1,"ps-3","mt-8","pb-5","fw-medium"],[1,"row","mb-10","ps-3"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[1,"ps-3","mb-8","border-bottom","pb-5","fw-medium"],[1,"row","mb-6"],[3,"productId","title","image","description","imageForZoom","code","showFooter"],[1,"col-12"],[1,"row"],[1,"col-3"],[1,"d-flex","align-items-center"],["color","primary",1,"example-margin",3,"ngModel"],[3,"typeId","showChannelName"],[2,"overflow","hidden","text-overflow","ellipsis","white-space","nowrap",3,"matTooltip","matTooltipShowDelay"],[1,"w-100"],["matTooltipPosition","above",3,"matTooltip"],[3,"disabled","channelId","channelType","categoryId"],[1,"row","my-3"],["color","primary",1,"example-margin",3,"ngModelChange","ngModel"],["disabled","","type","text","placeholder","Category Unavailable",1,"form-control","rounded-1",2,"height","35px"],[3,"selectedCategory","disabled","channelId","channelType","categoryId"],[1,"col-12","ps-11"],[3,"categoryId","channelId","channelType"],[3,"categoryId","channelId"],[3,"attributesChanges","categoryId","channelId","channelType"],[3,"attributesChanges","onPlatformChanges","categoryId","channelId"],[3,"attributesChanges","categoryId","channelId"],[3,"attributesChanges","channelId"]],template:function(e,a){if(e&1&&(c(0,"mainpanel",0)(1,"actions")(2,"button",1),F("click",function(){return a.onUploadProduct()}),_(3,"i",2),f(4," Upload "),s()(),c(5,"content")(6,"div",3)(7,"h3",4),f(8,"Product To Upload"),s(),c(9,"div",5),V(10,Pe,2,7,"div",6,w),v(12,"async"),s(),c(13,"h3",7),f(14,"Channel To Upload"),s(),V(15,Le,19,10,"div",8,w),s()()()),e&2){let o;d("hideSearchBox",!0)("hideSearchDropdown",!0),p(2),d("disabled",((o=a.channelProductUploads())==null?null:o.length)==0),p(8),U(T(12,3,a.selectedProducts$)),p(5),U(a.channelProductUploads())}},dependencies:[A,Xt,Bt,Jt,Kt,Yt,et,L,Mt,Rt,$t,te,ee,ie,oe,Wt,zt,Zt,S],encapsulation:2});let t=r;return t})();export{en as ProductUploadComponent};
|