"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var u={throughQueue:!1,queueId:"",queueName:"",queueNumber:"",queuePosition:"",queueWaitingTime:0};function e(u){return(null==u?void 0:u.queueId)||(null==u?void 0:u.queue)||""}exports.getCurrentCallQueueContext=function(n,i){var l=e(n),o=function(u){return(null==u?void 0:u.queueName)||""}(n),d=function(u,n){var i,l,o,d,r,t,v=e(u),a=(null===(i=null==n?void 0:n.waitingCallersById)||void 0===i?void 0:i[null==u?void 0:u.linkedId])||(null===(l=null==n?void 0:n.waitingCallersById)||void 0===l?void 0:l[null==u?void 0:u.uniqueId]);if(a)return a;var q=(null===(o=null==n?void 0:n.waitingCallersByChannel)||void 0===o?void 0:o[(null===(d=null==u?void 0:u.chSource)||void 0===d?void 0:d.channel)||""])||(null===(r=null==n?void 0:n.waitingCallersByChannel)||void 0===r?void 0:r[(null===(t=null==u?void 0:u.chDest)||void 0===t?void 0:t.channel)||""]);if(q)return q;var c=function(u,e){return u&&(null==e?void 0:e.waitingCallersByNumber[u])||[]}(null==u?void 0:u.counterpartNum,n);return v?c.find((function(u){return(null==u?void 0:u.queue)===v})):1===c.length?c[0]:void 0}(n,i),r=l||(null==d?void 0:d.queue)||"",t=r?i.byQueue[r]:void 0,v=o||(null==t?void 0:t.name)||(null==d?void 0:d.queueName)||"",a=n.queueNumber||(null==t?void 0:t.queue)||r,q=Boolean(n.throughQueue||function(u,e){return u||e}(v,a));return q?{throughQueue:q,queueId:r,queueName:v,queueNumber:a,queuePosition:(null==d?void 0:d.position)||"",queueWaitingTime:(null==d?void 0:d.waitingTime)||0}:u};
//# sourceMappingURL=queue.js.map
