@bitrix24/b24jssdk 0.1.5 → 0.1.6
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/dist/commonjs/index.cjs +5 -5
- package/dist/commonjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/index.mjs.map +1 -1
- package/dist/umd/index.js +5 -5
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +3 -3
package/dist/umd/index.min.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[zi]=this[zi]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=rr(o);n[c]||(pu(s,o),n[c]=!0)}return v.isArray(e)?e.forEach(i):i(e),this}};Ae.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),v.reduceDescriptors(Ae.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}}),v.freezeMethods(Ae);function _n(r,e){const t=this||tr,n=e||t,s=Ae.from(n.headers);let i=n.data;return v.forEach(r,function(c){i=c.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Ji(r){return!!(r&&r.__CANCEL__)}function xt(r,e,t){H.call(this,r??"canceled",H.ERR_CANCELED,e,t),this.name="CanceledError"}v.inherits(xt,H,{__CANCEL__:!0});function Zi(r,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new H("Request failed with status code "+t.status,[H.ERR_BAD_REQUEST,H.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function gu(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function mu(r,e){r=r||10;const t=new Array(r),n=new Array(r);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),l=n[i];o||(o=u),t[s]=a,n[s]=u;let h=i,f=0;for(;h!==s;)f+=t[h++],h=h%r;if(s=(s+1)%r,s===i&&(i=(i+1)%r),u-o<e)return;const d=l&&u-l;return d?Math.round(f*1e3/d):void 0}}function yu(r,e){let t=0,n=1e3/e,s,i;const o=(u,l=Date.now())=>{t=l,s=null,i&&(clearTimeout(i),i=null),r.apply(null,u)};return[(...u)=>{const l=Date.now(),h=l-t;h>=n?o(u,l):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-h)))},()=>s&&o(s)]}const Lr=(r,e,t=3)=>{let n=0;const s=mu(50,250);return yu(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,a=o-n,u=s(a),l=o<=c;n=o;const h={loaded:o,total:c,progress:c?o/c:void 0,bytes:a,rate:u||void 0,estimated:u&&c&&l?(c-o)/u:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};r(h)},t)},Gi=(r,e)=>{const t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},Yi=r=>(...e)=>v.asap(()=>r(...e)),wu=Oe.hasStandardBrowserEnv?function(){const e=Oe.navigator&&/(msie|trident)/i.test(Oe.navigator.userAgent),t=document.createElement("a");let n;function s(i){let o=i;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=s(window.location.href),function(o){const c=v.isString(o)?s(o):o;return c.protocol===n.protocol&&c.host===n.host}}():function(){return function(){return!0}}(),bu=Oe.hasStandardBrowserEnv?{write(r,e,t,n,s,i){const o=[r+"="+encodeURIComponent(e)];v.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),v.isString(n)&&o.push("path="+n),v.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(r){const e=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Su(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function _u(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Ki(r,e){return r&&!Su(e)?_u(r,e):e}const Qi=r=>r instanceof Ae?{...r}:r;function yt(r,e){e=e||{};const t={};function n(u,l,h){return v.isPlainObject(u)&&v.isPlainObject(l)?v.merge.call({caseless:h},u,l):v.isPlainObject(l)?v.merge({},l):v.isArray(l)?l.slice():l}function s(u,l,h){if(v.isUndefined(l)){if(!v.isUndefined(u))return n(void 0,u,h)}else return n(u,l,h)}function i(u,l){if(!v.isUndefined(l))return n(void 0,l)}function o(u,l){if(v.isUndefined(l)){if(!v.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function c(u,l,h){if(h in e)return n(u,l);if(h in r)return n(void 0,u)}const a={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,l)=>s(Qi(u),Qi(l),!0)};return v.forEach(Object.keys(Object.assign({},r,e)),function(l){const h=a[l]||s,f=h(r[l],e[l],l);v.isUndefined(f)&&h!==c||(t[l]=f)}),t}const Xi=r=>{const e=yt({},r);let{data:t,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=e;e.headers=o=Ae.from(o),e.url=Wi(Ki(e.baseURL,e.url),r.params,r.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let a;if(v.isFormData(t)){if(Oe.hasStandardBrowserEnv||Oe.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[u,...l]=a?a.split(";").map(h=>h.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...l].join("; "))}}if(Oe.hasStandardBrowserEnv&&(n&&v.isFunction(n)&&(n=n(e)),n||n!==!1&&wu(e.url))){const u=s&&i&&bu.read(i);u&&o.set(s,u)}return e},vu=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,n){const s=Xi(r);let i=s.data;const o=Ae.from(s.headers).normalize();let{responseType:c,onUploadProgress:a,onDownloadProgress:u}=s,l,h,f,d,p;function g(){d&&d(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function y(){if(!m)return;const _=Ae.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),k={data:!c||c==="text"||c==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:_,config:r,request:m};Zi(function(E){t(E),g()},function(E){n(E),g()},k),m=null}"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(y)},m.onabort=function(){m&&(n(new H("Request aborted",H.ECONNABORTED,r,m)),m=null)},m.onerror=function(){n(new H("Network Error",H.ERR_NETWORK,r,m)),m=null},m.ontimeout=function(){let b=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const k=s.transitional||Hi;s.timeoutErrorMessage&&(b=s.timeoutErrorMessage),n(new H(b,k.clarifyTimeoutError?H.ETIMEDOUT:H.ECONNABORTED,r,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&v.forEach(o.toJSON(),function(b,k){m.setRequestHeader(k,b)}),v.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),c&&c!=="json"&&(m.responseType=s.responseType),u&&([f,p]=Lr(u,!0),m.addEventListener("progress",f)),a&&m.upload&&([h,d]=Lr(a),m.upload.addEventListener("progress",h),m.upload.addEventListener("loadend",d)),(s.cancelToken||s.signal)&&(l=_=>{m&&(n(!_||_.type?new xt(null,r,m):_),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const w=gu(s.url);if(w&&Oe.protocols.indexOf(w)===-1){n(new H("Unsupported protocol "+w+":",H.ERR_BAD_REQUEST,r));return}m.send(i||null)})},ku=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,s;const i=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;n.abort(l instanceof H?l:new xt(l instanceof Error?l.message:l))}};let o=e&&setTimeout(()=>{o=null,i(new H(`timeout ${e} of ms exceeded`,H.ETIMEDOUT))},e);const c=()=>{r&&(o&&clearTimeout(o),o=null,r.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),r=null)};r.forEach(u=>u.addEventListener("abort",i));const{signal:a}=n;return a.unsubscribe=()=>v.asap(c),a}},Eu=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let n=0,s;for(;n<t;)s=n+e,yield r.slice(n,s),n=s},Tu=async function*(r,e){for await(const t of Ou(r))yield*Eu(t,e)},Ou=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},eo=(r,e,t,n)=>{const s=Tu(r,e);let i=0,o,c=a=>{o||(o=!0,n&&n(a))};return new ReadableStream({async pull(a){try{const{done:u,value:l}=await s.next();if(u){c(),a.close();return}let h=l.byteLength;if(t){let f=i+=h;t(f)}a.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(a){return c(a),s.return()}},{highWaterMark:2})},Fr=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",to=Fr&&typeof ReadableStream=="function",Au=Fr&&(typeof TextEncoder=="function"?(r=>e=>r.encode(e))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),ro=(r,...e)=>{try{return!!r(...e)}catch{return!1}},Iu=to&&ro(()=>{let r=!1;const e=new Request(Oe.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!e}),no=64*1024,vn=to&&ro(()=>v.isReadableStream(new Response("").body)),Pr={stream:vn&&(r=>r.body)};Fr&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Pr[e]&&(Pr[e]=v.isFunction(r[e])?t=>t[e]():(t,n)=>{throw new H(`Response type '${e}' is not supported`,H.ERR_NOT_SUPPORT,n)})})})(new Response);const Cu=async r=>{if(r==null)return 0;if(v.isBlob(r))return r.size;if(v.isSpecCompliantForm(r))return(await new Request(Oe.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(v.isArrayBufferView(r)||v.isArrayBuffer(r))return r.byteLength;if(v.isURLSearchParams(r)&&(r=r+""),v.isString(r))return(await Au(r)).byteLength},Nu=async(r,e)=>{const t=v.toFiniteNumber(r.getContentLength());return t??Cu(e)},kn={http:Kl,xhr:vu,fetch:Fr&&(async r=>{let{url:e,method:t,data:n,signal:s,cancelToken:i,timeout:o,onDownloadProgress:c,onUploadProgress:a,responseType:u,headers:l,withCredentials:h="same-origin",fetchOptions:f}=Xi(r);u=u?(u+"").toLowerCase():"text";let d=ku([s,i&&i.toAbortSignal()],o),p;const g=d&&d.unsubscribe&&(()=>{d.unsubscribe()});let m;try{if(a&&Iu&&t!=="get"&&t!=="head"&&(m=await Nu(l,n))!==0){let k=new Request(e,{method:"POST",body:n,duplex:"half"}),S;if(v.isFormData(n)&&(S=k.headers.get("content-type"))&&l.setContentType(S),k.body){const[E,N]=Gi(m,Lr(Yi(a)));n=eo(k.body,no,E,N)}}v.isString(h)||(h=h?"include":"omit");const y="credentials"in Request.prototype;p=new Request(e,{...f,signal:d,method:t.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:y?h:void 0});let w=await fetch(p);const _=vn&&(u==="stream"||u==="response");if(vn&&(c||_&&g)){const k={};["status","statusText","headers"].forEach(x=>{k[x]=w[x]});const S=v.toFiniteNumber(w.headers.get("content-length")),[E,N]=c&&Gi(S,Lr(Yi(c),!0))||[];w=new Response(eo(w.body,no,E,()=>{N&&N(),g&&g()}),k)}u=u||"text";let b=await Pr[v.findKey(Pr,u)||"text"](w,r);return!_&&g&&g(),await new Promise((k,S)=>{Zi(k,S,{data:b,headers:Ae.from(w.headers),status:w.status,statusText:w.statusText,config:r,request:p})})}catch(y){throw g&&g(),y&&y.name==="TypeError"&&/fetch/i.test(y.message)?Object.assign(new H("Network Error",H.ERR_NETWORK,r,p),{cause:y.cause||y}):H.from(y,y&&y.code,r,p)}})};v.forEach(kn,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const so=r=>`- ${r}`,Ru=r=>v.isFunction(r)||r===null||r===!1,io={getAdapter:r=>{r=v.isArray(r)?r:[r];const{length:e}=r;let t,n;const s={};for(let i=0;i<e;i++){t=r[i];let o;if(n=t,!Ru(t)&&(n=kn[(o=String(t)).toLowerCase()],n===void 0))throw new H(`Unknown adapter '${o}'`);if(n)break;s[o||"#"+i]=n}if(!n){const i=Object.entries(s).map(([c,a])=>`adapter ${c} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
|
|
4
4
|
`+i.map(so).join(`
|
|
5
5
|
`):" "+so(i[0]):"as no adapter specified";throw new H("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:kn};function En(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new xt(null,r)}function oo(r){return En(r),r.headers=Ae.from(r.headers),r.data=_n.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),io.getAdapter(r.adapter||tr.adapter)(r).then(function(n){return En(r),n.data=_n.call(r,r.transformResponse,n),n.headers=Ae.from(n.headers),n},function(n){return Ji(n)||(En(r),n&&n.response&&(n.response.data=_n.call(r,r.transformResponse,n.response),n.response.headers=Ae.from(n.response.headers))),Promise.reject(n)})}const ao="1.7.7",Tn={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Tn[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});const co={};Tn.transitional=function(e,t,n){function s(i,o){return"[Axios v"+ao+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,c)=>{if(e===!1)throw new H(s(o," has been removed"+(t?" in "+t:"")),H.ERR_DEPRECATED);return t&&!co[o]&&(co[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,c):!0}};function Lu(r,e,t){if(typeof r!="object")throw new H("options must be an object",H.ERR_BAD_OPTION_VALUE);const n=Object.keys(r);let s=n.length;for(;s-- >0;){const i=n[s],o=e[i];if(o){const c=r[i],a=c===void 0||o(c,i,r);if(a!==!0)throw new H("option "+i+" must be "+a,H.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new H("Unknown option "+i,H.ERR_BAD_OPTION)}}const On={assertOptions:Lu,validators:Tn},it=On.validators;let wt=class{constructor(e){this.defaults=e,this.interceptors={request:new Vi,response:new Vi}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
6
|
-
`+i):n.stack=i}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=yt(this.defaults,t);const{transitional:n,paramsSerializer:s,headers:i}=t;n!==void 0&&On.assertOptions(n,{silentJSONParsing:it.transitional(it.boolean),forcedJSONParsing:it.transitional(it.boolean),clarifyTimeoutError:it.transitional(it.boolean)},!1),s!=null&&(v.isFunction(s)?t.paramsSerializer={serialize:s}:On.assertOptions(s,{encode:it.function,serialize:it.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&v.merge(i.common,i[t.method]);i&&v.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),t.headers=Ae.concat(o,i);const c=[];let a=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(t)===!1||(a=a&&g.synchronous,c.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let l,h=0,f;if(!a){const p=[oo.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,u),f=p.length,l=Promise.resolve(t);h<f;)l=l.then(p[h++],p[h++]);return l}f=c.length;let d=t;for(h=0;h<f;){const p=c[h++],g=c[h++];try{d=p(d)}catch(m){g.call(this,m);break}}try{l=oo.call(this,d)}catch(p){return Promise.reject(p)}for(h=0,f=u.length;h<f;)l=l.then(u[h++],u[h++]);return l}getUri(e){e=yt(this.defaults,e);const t=Ki(e.baseURL,e.url);return Wi(t,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){wt.prototype[e]=function(t,n){return this.request(yt(n||{},{method:e,url:t,data:(n||{}).data}))}}),v.forEach(["post","put","patch"],function(e){function t(n){return function(i,o,c){return this.request(yt(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}wt.prototype[e]=t(),wt.prototype[e+"Form"]=t(!0)});let Fu=class Jo{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{n.subscribe(c),i=c}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,c){n.reason||(n.reason=new xt(i,o,c),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Jo(function(s){e=s}),cancel:e}}};function Pu(r){return function(t){return r.apply(null,t)}}function Mu(r){return v.isObject(r)&&r.isAxiosError===!0}const An={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(An).forEach(([r,e])=>{An[e]=r});function lo(r){const e=new wt(r),t=Oi(wt.prototype.request,e);return v.extend(t,wt.prototype,e,{allOwnKeys:!0}),v.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return lo(yt(r,s))},t}const ae=lo(tr);ae.Axios=wt,ae.CanceledError=xt,ae.CancelToken=Fu,ae.isCancel=Ji,ae.VERSION=ao,ae.toFormData=Nr,ae.AxiosError=H,ae.Cancel=ae.CanceledError,ae.all=function(e){return Promise.all(e)},ae.spread=Pu,ae.isAxiosError=Mu,ae.mergeConfig=yt,ae.AxiosHeaders=Ae,ae.formToJSON=r=>qi(v.isHTMLForm(r)?new FormData(r):r),ae.getAdapter=io.getAdapter,ae.HttpStatusCode=An,ae.default=ae;const{Axios:af,AxiosError:uo,CanceledError:cf,isCancel:lf,CancelToken:uf,VERSION:hf,all:ff,Cancel:df,isAxiosError:pf,spread:gf,toFormData:mf,AxiosHeaders:yf,HttpStatusCode:wf,formToJSON:bf,getAdapter:Sf,mergeConfig:_f}=ae,xu=String.prototype.replace,Du=/%20/g,ho={RFC1738:"RFC1738",RFC3986:"RFC3986"},In={RFC1738:function(r){return xu.call(r,Du,"+")},RFC3986:function(r){return String(r)}},ju=ho.RFC1738,fo=ho.RFC3986,Cn=Object.prototype.hasOwnProperty,bt=Array.isArray,qe=function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Uu=function(e){for(;e.length>1;){const t=e.pop(),n=t.obj[t.prop];if(bt(n)){const s=[];for(let i=0;i<n.length;++i)typeof n[i]<"u"&&s.push(n[i]);t.obj[t.prop]=s}}},Bu=function(e,t){const n=t&&t.plainObjects?Object.create(null):{};for(let s=0;s<e.length;++s)typeof e[s]<"u"&&(n[s]=e[s]);return n},$u=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(bt(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Cn.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);let s=e;return bt(e)&&!bt(t)&&(s=Bu(e,n)),bt(e)&&bt(t)?(t.forEach(function(i,o){if(Cn.call(e,o)){const c=e[o];c&&typeof c=="object"&&i&&typeof i=="object"?e[o]=r(c,i,n):e.push(i)}else e[o]=i}),e):Object.keys(t).reduce(function(i,o){const c=t[o];return Cn.call(i,o)?i[o]=r(i[o],c,n):i[o]=c,i},s)},Wu=function(r,e,t){const n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Nn=1024,Vu=function(e,t,n,s,i){if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let c="";for(let a=0;a<o.length;a+=Nn){const u=o.length>=Nn?o.slice(a,a+Nn):o,l=[];for(let h=0;h<u.length;++h){let f=u.charCodeAt(h);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||i===ju&&(f===40||f===41)){l[l.length]=u.charAt(h);continue}if(f<128){l[l.length]=qe[f];continue}if(f<2048){l[l.length]=qe[192|f>>6]+qe[128|f&63];continue}if(f<55296||f>=57344){l[l.length]=qe[224|f>>12]+qe[128|f>>6&63]+qe[128|f&63];continue}h+=1,f=65536+((f&1023)<<10|u.charCodeAt(h)&1023),l[l.length]=qe[240|f>>18]+qe[128|f>>12&63]+qe[128|f>>6&63]+qe[128|f&63]}c+=l.join("")}return c},Hu=function(e){const t=[{obj:{o:e},prop:"o"}],n=[];for(let s=0;s<t.length;++s){const i=t[s],o=i.obj[i.prop],c=Object.keys(o);for(let a=0;a<c.length;++a){const u=c[a],l=o[u];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(t.push({obj:o,prop:u}),n.push(l))}}return Uu(t),e},qu=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},zu=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Ju=function(e,t){return[].concat(e,t)},Rn=function(e,t){if(bt(e)){const n=[];for(let s=0;s<e.length;s+=1)n.push(t(e[s]));return n}return t(e)},Zu=Object.prototype.hasOwnProperty,po={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ze=Array.isArray,Gu=Array.prototype.push,go=function(r,e){Gu.apply(r,ze(e)?e:[e])},Yu=Date.prototype.toISOString,mo=fo,fe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Vu,encodeValuesOnly:!1,format:mo,formatter:In[mo],indices:!1,serializeDate:function(e){return Yu.call(e)},skipNulls:!1,strictNullHandling:!1},Ku=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Ln={},yo=function(e,t,n,s,i,o,c,a,u,l,h,f,d,p,g,m,y,w){let _=e,b=w,k=0,S=!1;for(;(b=b.get(Ln))!==void 0&&!S;){const J=b.get(e);if(k+=1,typeof J<"u"){if(J===k)throw new RangeError("Cyclic object value");S=!0}typeof b.get(Ln)>"u"&&(k=0)}if(typeof l=="function"?_=l(t,_):_ instanceof Date?_=d(_):n==="comma"&&ze(_)&&(_=Rn(_,function(J){return J instanceof Date?d(J):J})),_===null){if(o)return u&&!m?u(t,fe.encoder,y,"key",p):t;_=""}if(Ku(_)||zu(_)){if(u){const J=m?t:u(t,fe.encoder,y,"key",p);return[g(J)+"="+g(u(_,fe.encoder,y,"value",p))]}return[g(t)+"="+g(String(_))]}const E=[];if(typeof _>"u")return E;let N;if(n==="comma"&&ze(_))m&&u&&(_=Rn(_,u)),N=[{value:_.length>0?_.join(",")||null:void 0}];else if(ze(l))N=l;else{const J=Object.keys(_);N=h?J.sort(h):J}const x=a?t.replace(/\./g,"%2E"):t,M=s&&ze(_)&&_.length===1?x+"[]":x;if(i&&ze(_)&&_.length===0)return M+"[]";for(let J=0;J<N.length;++J){const we=N[J],q=typeof we=="object"&&typeof we.value<"u"?we.value:_[we];if(c&&q===null)continue;const Q=f&&a?we.replace(/\./g,"%2E"):we,B=ze(_)?typeof n=="function"?n(M,Q):M:M+(f?"."+Q:"["+Q+"]");w.set(e,k);const de=new WeakMap;de.set(Ln,w),go(E,yo(q,B,n,s,i,o,c,a,n==="comma"&&m&&ze(_)?null:u,l,h,f,d,p,g,m,y,de))}return E},Qu=function(e){if(!e)return fe;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");const t=e.charset||fe.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=fo;if(typeof e.format<"u"){if(!Zu.call(In,e.format))throw new TypeError("Unknown format option provided.");n=e.format}const s=In[n];let i=fe.filter;(typeof e.filter=="function"||ze(e.filter))&&(i=e.filter);let o;if(e.arrayFormat in po?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=fe.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const c=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:fe.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:fe.addQueryPrefix,allowDots:c,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:fe.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:fe.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?fe.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:fe.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:fe.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:fe.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:fe.encodeValuesOnly,filter:i,format:n,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:fe.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:fe.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:fe.strictNullHandling}};function wo(r,e){let t=r;const n=Qu(e);let s,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):ze(n.filter)&&(i=n.filter,s=i);const o=[];if(typeof t!="object"||t===null)return"";const c=po[n.arrayFormat],a=c==="comma"&&n.commaRoundTrip;s||(s=Object.keys(t)),n.sort&&s.sort(n.sort);const u=new WeakMap;for(let f=0;f<s.length;++f){const d=s[f];n.skipNulls&&t[d]===null||go(o,yo(t[d],d,c,a,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}const l=o.join(n.delimiter);let h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),l.length>0?h+l:""}const Fn=Object.prototype.hasOwnProperty,Xu=Array.isArray,ce={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Wu,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},eh=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},bo=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},th="utf8=%26%2310003%3B",rh="utf8=%E2%9C%93",nh=function(e,t){const n={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,o=s.split(t.delimiter,i);let c=-1,a,u=t.charset;if(t.charsetSentinel)for(a=0;a<o.length;++a)o[a].indexOf("utf8=")===0&&(o[a]===rh?u="utf-8":o[a]===th&&(u="iso-8859-1"),c=a,a=o.length);for(a=0;a<o.length;++a){if(a===c)continue;const l=o[a],h=l.indexOf("]="),f=h===-1?l.indexOf("="):h+1;let d,p;f===-1?(d=t.decoder(l,ce.decoder,u,"key"),p=t.strictNullHandling?null:""):(d=t.decoder(l.slice(0,f),ce.decoder,u,"key"),p=Rn(bo(l.slice(f+1),t),function(m){return t.decoder(m,ce.decoder,u,"value")})),p&&t.interpretNumericEntities&&u==="iso-8859-1"&&(p=eh(p)),l.indexOf("[]=")>-1&&(p=Xu(p)?[p]:p);const g=Fn.call(n,d);g&&t.duplicates==="combine"?n[d]=Ju(n[d],p):(!g||t.duplicates==="last")&&(n[d]=p)}return n},sh=function(r,e,t,n){let s=n?e:bo(e,t);for(let i=r.length-1;i>=0;--i){let o;const c=r[i];if(c==="[]"&&t.parseArrays)o=t.allowEmptyArrays&&s===""?[]:[].concat(s);else{o=t.plainObjects?Object.create(null):{};const a=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,u=t.decodeDotInKeys?a.replace(/%2E/g,"."):a,l=parseInt(u,10);!t.parseArrays&&u===""?o={0:s}:!isNaN(l)&&c!==u&&String(l)===u&&l>=0&&t.parseArrays&&l<=t.arrayLimit?(o=[],o[l]=s):u!=="__proto__"&&(o[u]=s)}s=o}return s},ih=function(e,t,n,s){if(!e)return;const i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,c=/(\[[^[\]]*])/g;let a=n.depth>0&&o.exec(i);const u=a?i.slice(0,a.index):i,l=[];if(u){if(!n.plainObjects&&Fn.call(Object.prototype,u)&&!n.allowPrototypes)return;l.push(u)}let h=0;for(;n.depth>0&&(a=c.exec(i))!==null&&h<n.depth;){if(h+=1,!n.plainObjects&&Fn.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;l.push(a[1])}return a&&l.push("["+i.slice(a.index)+"]"),sh(l,t,n,s)},oh=function(e){if(!e)return ce;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");const t=typeof e.charset>"u"?ce.charset:e.charset,n=typeof e.duplicates>"u"?ce.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:ce.allowDots:!!e.allowDots,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:ce.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:ce.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:ce.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:ce.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ce.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:ce.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:ce.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:ce.decoder,delimiter:typeof e.delimiter=="string"||qu(e.delimiter)?e.delimiter:ce.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:ce.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:ce.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:ce.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:ce.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ce.strictNullHandling}};function ah(r,e){const t=oh(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};const n=typeof r=="string"?nh(r,t):r;let s=t.plainObjects?Object.create(null):{};const i=Object.keys(n);for(let o=0;o<i.length;++o){const c=i[o],a=ih(c,n[c],t,typeof r=="string");s=$u(s,a,t)}return t.allowSparse===!0?s:Hu(s)}class So{#e;#t;#r;#n;_logger=null;_loggerSystem=null;#s="";#o=!1;#i="";constructor(e,t,n){this.#e=ae.create({baseURL:e,...n}),this.#t=t,this.#r=new al,this.#n=new hl}setLogger(e){this._logger=e,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}getSystemLogger(){return this._loggerSystem===null&&(this._loggerSystem=be.build("SystemLogger"),this._loggerSystem.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!0,[I.warn]:!0,[I.error]:!0,[I.trace]:!1})),this._loggerSystem}setRestrictionManagerParams(e){this.#r.params=e}getRestrictionManagerParams(){return this.#r.params}setLogTag(e){this.#s=e}clearLogTag(){this.#s=""}async batch(e,t=!0){const n=Array.isArray(e),s=n?[]:{};let i=0;const o=(c,a)=>{let u=null,l=null;if(Array.isArray(c)?(u=c[0],l=c[1]):c.method&&(u=c.method,l=c.params),u){i++;const h=u+"?"+wo(l);n||Array.isArray(s)?s.push(h):s[a]=h}};if(n)for(const[c,a]of e.entries())o(a,c);else for(const[c,a]of Object.entries(e))o(a,c);return i<1?Promise.resolve(new Pt):this.call("batch",{halt:t?1:0,cmd:s}).then(c=>{const a=c.getData().result,u=n?[]:{},l=(p,g)=>{if(typeof a.result[g]<"u"||typeof a.result_error[g]<"u"){const m=p.split("?"),y=new fn({result:R.isUndefined(a.result[g])?{}:a.result[g],error:a?.result_error[g]||void 0,total:a.result_total[g],next:a.result_next[g]},{method:m[0]||"",params:ah(m[1]||""),start:0},c.getStatus());n||Array.isArray(u)?u.push(y):u[g]=y}};if(Array.isArray(s))for(const[p,g]of s.entries())l(g,p);else for(const[p,g]of Object.entries(s))l(g,p);let h;const f=p=>new Qt({status:0,answerError:{error:p.getErrorMessages().join("; "),errorDescription:`batch ${p.getQuery().method}: ${wo(p.getQuery().params,{encode:!1})}`},cause:p.getErrors().next().value}),d=new Pt;if(n||Array.isArray(u)){h=[];for(const p of u){if(p.getStatus()!==200||!p.isSuccess){const g=f(p);if(!t&&!p.isSuccess){d.addError(g);continue}return Promise.reject(g)}h.push(p.getData().result)}}else{h={};for(const p of Object.keys(u)){const g=u[p];if(g.getStatus()!==200||!g.isSuccess){const m=f(g);if(!t&&!g.isSuccess){d.addError(m);continue}return Promise.reject(m)}h[p]=g.getData().result}}return d.setData(h),Promise.resolve(d)})}async call(e,t,n=0){let s=this.#t.getAuthData();return s===!1&&(s=await this.#t.refreshAuth()),await this.#r.check(),this.#o&&!this.isServerSide()&&R.isStringFilled(this.#i)&&this.getSystemLogger().warn(this.#i),this.#e.post(this.#c(e),this.#a(s,t,n)).then(i=>{const o=i.data;return Promise.resolve({status:i.status,payload:o})},async i=>{let o={error:i?.code||0,errorDescription:i?.message||""};if(i instanceof uo&&i.response&&i.response.data){const a=i.response.data;o={error:a.error,errorDescription:a.error_description}}const c=new Qt({status:i.response?.status||0,answerError:o,cause:i});return c.status===401&&["expired_token","invalid_token"].includes(c.answerError.error)?(this.getLogger().info(`refreshAuth >> ${c.answerError.error} >>>`),s=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#c(e),this.#a(s,t,n)).then(async a=>{const u=a.data;return Promise.resolve({status:a.status,payload:u})},async a=>{let u={error:a?.code||0,errorDescription:a?.message||""};if(a instanceof uo&&a.response&&a.response.data){const h=a.response.data;u={error:h.error,errorDescription:h.error_description}}const l=new Qt({status:a.response?.status||0,answerError:u,cause:a});return Promise.reject(l)})):Promise.reject(c)}).then(i=>{const o=new fn(i.payload,{method:e,params:t,start:n},i.status);return Promise.resolve(o)})}#a(e,t,n=0){const s=Object.assign({},t);return this.#s.length>0&&(s.logTag=this.#s),s[this.#n.getQueryStringParameterName()]=this.#n.getRequestId(),s[this.#n.getQueryStringSdkParameterName()]="0.1.5",s.data&&s.data.start&&delete s.data.start,e.refresh_token!=="hook"&&(s.auth=e.access_token),s.start=n,s}#c(e){return`${encodeURIComponent(e)}.json`}setClientSideWarning(e,t){this.#o=e,this.#i=t}isServerSide(){return R.isUndefined(window)}}class Dt{static batchSize=50;_isInit=!1;_http=null;_logger=null;constructor(){this._isInit=!1}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}setLogger(e){this._logger=e,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,s=null){const i=new Pt;return R.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let c=[],a;if(s===null?a=o.getData().result:a=o.getData().result[s],c=[...c,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let l;if(s===null?l=u.getData().result:l=u.getData().result[s],c=[...c,...l],n){const h=u.getTotal();n(h>0?Math.round(100*c.length/h):100)}}}return i.setData(c),n&&n(100),i})}async*fetchListMethod(e,t={},n="ID",s=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const i=`>${n}`;t.order[n]="ASC",t.filter[i]=0;do{const o=await this.callMethod(e,t,t.start);let c;if(!R.isNull(s)&&s!==null?c=o.getData().result[s]:c=o.getData().result,c.length===0||(yield c,c.length<Dt.batchSize))break;const a=c.at(-1);a&&n in a&&(t.filter[i]=a[n])}while(!0)}async callBatch(e,t=!0){return this.getHttpClient().batch(e,t)}chunkArray(e,t=50){const n=[];for(let s=0;s<e.length;s+=t){const i=e.slice(s,s+t);n.push(i)}return n}async callBatchByChunk(e,t=!0){const n=new Pt,s=[],i=this.chunkArray(e,Dt.batchSize);for(const o of i){const c=await this.callBatch(o,t);s.push(...c.getData())}return n.setData(s)}getHttpClient(){if(!this.isInit||this._http===null)throw new Error("Http not init");return this._http}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new Error("B24 not initialized")}}var Pn=(r=>(r.en="en",r.de="de",r.la="la",r.br="br",r.fr="fr",r.it="it",r.pl="pl",r.ru="ru",r.ua="ua",r.tr="tr",r.sc="sc",r.tc="tc",r.ja="ja",r.vn="vn",r.id="id",r.ms="ms",r.th="th",r.ar="ar",r))(Pn||{});const ch=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let lh=class lt{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!lt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");lt.isInternalConstructing=!1}static getInstance(){return lt.instance||(lt.isInternalConstructing=!0,lt.instance=new lt),lt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!R.isStringFilled(t))&&(t=R.isStringFilled(this._defLocale)?this._defLocale||"en":navigator?.language),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let s=n.format(e);return t.includes("ru")&&(s=s.replace(",",".")),s}};class T{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,s){this.countryCode=e,this.length=t,this.structure=n,this.example=s}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(n=>{let s;const i=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(i){case"A":s="0-9A-Za-z";break;case"B":s="0-9A-Z";break;case"C":s="A-Za-z";break;case"F":s="0-9";break;case"L":s="a-z";break;case"U":s="A-Z";break;case"W":s="0-9a-z";break}return"(["+s+"]{"+o+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?(n-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,n;for(;t.length>2;)n=t.slice(0,9),t=Number.parseInt(n,10)%97+t.slice(n.length);return Number.parseInt(t,10)%97}}class Ke{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!Ke.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");Ke.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return Ke.instance||(Ke.isInternalConstructing=!0,Ke.instance=new Ke),Ke.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!this._isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const s=this._countries.get(n);if(!s)throw new Error(`No country with code ${n}`);return s.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);if(!n)throw new Error(`No country with code ${e}`);return n.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!this._isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}_isString(e){return typeof e=="string"||e instanceof String}}const uh=()=>{const r=lh.getInstance(),e=Ke.getInstance();return e.addSpecification(new T("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new T("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new T("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new T("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new T("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new T("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new T("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new T("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new T("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new T("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new T("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new T("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new T("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new T("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new T("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new T("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new T("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new T("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new T("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new T("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new T("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new T("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new T("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new T("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new T("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new T("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new T("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new T("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new T("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new T("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new T("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new T("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new T("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new T("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new T("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new T("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new T("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new T("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new T("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new T("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new T("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new T("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new T("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new T("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new T("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new T("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new T("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new T("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new T("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new T("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new T("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new T("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new T("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new T("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new T("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new T("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new T("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new T("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new T("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new T("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new T("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new T("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new T("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new T("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new T("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new T("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new T("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new T("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new T("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new T("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new T("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new T("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new T("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new T("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new T("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new T("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new T("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new T("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new T("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new T("BI",16,"F12","BI41123456789012")),e.addSpecification(new T("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new T("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new T("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new T("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new T("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new T("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new T("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new T("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new T("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new T("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new T("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new T("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new T("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new T("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new T("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new T("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new T("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new T("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new T("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new T("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new T("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new T("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class _o{#e;constructor(e){this.#e=Object.freeze(Object.assign({},e))}getAuthData(){const e=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,"");return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:e,member_id:e}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#e.b24Url}`}getTargetOriginWithPath(){return`${this.#e.b24Url}/rest/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class hh extends Dt{#e;constructor(e){super(),this.#e=new _o(e),this._http=new So(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._http.setClientSideWarning(!0,"It is not safe to use hook requests on the client side"),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}offClientSideWarning(){this.getHttpClient().setClientSideWarning(!1,"")}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var X=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r))(X||{});class vo{#e;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((n,s)=>{let i;const o={resolve:n,reject:s,timeoutId:null},c=this.#r(o);if(e.toString().includes(":"))i={method:e.toString(),params:t??"",callback:c,appSid:this.#e.getAppSid()};else{i=e.toString();const a=[t?JSON.stringify(t):null,c,this.#e.getAppSid()];i+=":"+a.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:i}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely&&(this.#t.get(c).timeoutId=window.setTimeout(()=>{this.#t.has(c)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#t.delete(c),n({isSafely:!0}))},Number.parseInt(String(t?.safelyTime||900))))})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().log(`get from ${e.origin}`,{data:e.data});const t=e.data.split(":"),n={id:t[0],args:t.slice(1).join(":")};if(n.args&&(n.args=JSON.parse(n.args)),this.#t.has(n.id)){const s=this.#t.get(n.id);s.timeoutId&&clearTimeout(s.timeoutId),this.#t.delete(n.id),s.resolve(n.args)}}}#r(e){const t=W.getUniqId();return this.#t.set(t,e),t}}class ko{#e="";#t=!0;#r=null;#n=null;#s=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=e.PROTOCOL===!0,e.LANG&&(this.#s=e.LANG),e.APP_SID&&(this.#r=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#s||(this.#s=e.LANG),this.#t=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#r===null)throw new Error("Not init appSid");return this.#r}getTargetOrigin(){return`${this.#t?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#s||Pn.en}}class Eo{#e=null;#t=null;#r=0;#n=null;#s=!1;#o;#i;constructor(e,t){this.#o=e,this.#i=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#s=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires_in:this.#r,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#i.send(X.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#n||""].join("_")}get isAdmin(){return this.#s}}class To{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(X.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(X.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(X.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,n=0){const s=document.body;let i=Math.max(s.scrollWidth,s.offsetWidth);n>0&&(i=Math.max(n,i));let o=Math.max(s.scrollHeight,s.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(i,o)}getScrollSize(){return ch()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(X.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(X.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(X.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(X.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(X.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(X.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(X.imOpenHistory,{dialogId:e,isSafely:!0})}}let Oo=class{#e;#t=null;#r=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#t=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#r=e.USER_OPTIONS),this}appGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#t||(this.#t=[]),this.#t[e]=t,this.#n(X.setAppOption,e,this.#t[e])}userGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#t||(this.#t=[]),this.#t[e]||(this.#t[e]=null),this.#r[e]=t,this.#n(X.setUserOption,e,this.#r[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Ao{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(X.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(X.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(X.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(X.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Io{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#t.send(X.openApplication,e)}async closeSliderAppPage(){return this.#t.send(X.closeApplication,{isSafely:!1})}#r(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#t.send(X.openPath,{path:[this.#r(t),n.pathname,n.search].join("")}).then(s=>s?.result==="error"?s?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,o)=>{const c=window.open(e,"_blank");if(!c){o(new Error("Error open window"));return}let a=0;const u=1e3*60*5,l=window.setInterval(()=>{a=a+1,c.closed?(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(s?.errorCode)):s?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(e){return console.warn("@deprecated showAppForm"),this.#t.send(X.showAppForm,{params:e,isSafely:!0})}}class Co{#e="";#t={};constructor(){}initData(e){this.#e=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#e}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}}class No extends Dt{#e=!1;#t=!1;#r;#n;#s;#o;#i;#a;#c;#l;constructor(e){super(),this.#r=new ko(e),this.#n=new vo(this.#r),this.#n.subscribe(),this.#s=new Eo(this.#r,this.#n),this.#o=new To(this.#n),this.#i=new Oo(this.#n),this.#a=new Ao(this.#n),this.#c=new Io(this.#r,this.#n),this.#l=new Co,this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#t}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#o}get auth(){return this._ensureInitialized(),this.#s}get slider(){return this._ensureInitialized(),this.#c}get placement(){return this._ensureInitialized(),this.#l}get options(){return this._ensureInitialized(),this.#i}get dialog(){return this._ensureInitialized(),this.#a}async init(){return this.#n.send(X.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#r.initData(e),this.#s.initData(e),this.#l.initData(e),this.#i.initData(e),this.#e=e.INSTALL,this.#t=e.FIRST_RUN,this._http=new So(this.#r.getTargetOriginWithPath(),this.#s,this._getHttpOptions()),this._isInit=!0,this.#t?this.#n.send(X.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(X.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#r.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#r.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#r.getAppSid()}getLang(){return this._ensureInitialized(),this.#r.getLang()}}class Mn extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class jt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class fh extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class dh extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return Ti[this.data.status]||"Unknown status"}}class ph extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class gh extends jt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,ln),this._b24.getHttpClient().setRestrictionManagerParams(ln))}}class mh extends jt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,s=this.data.currencyList.get(n);if(!(typeof s>"u"))for(const[i,o]of Object.entries(t.LANG))switch(s.lang[i]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},s.lang[i].thousandsVariant){case"N":s.lang[i].thousandsSep="";break;case"D":s.lang[i].thousandsSep=".";break;case"C":s.lang[i].thousandsSep=",";break;case"S":s.lang[i].thousandsSep=" ";break;case"B":s.lang[i].thousandsSep=" ";break;default:R.isStringFilled(s.lang[i].thousandsSep)||(s.lang[i].thousandsSep=" ");break}})}catch(t){console.error(t)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:W.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Mn(e);let s=n.fullName;if(!(typeof t>"u")){const i=n.lang[t];R.isUndefined(i)||(s=i.fullName)}return s}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Mn(e);let s=n.formatString;if(!(typeof t>"u")){const i=n.lang[t];R.isUndefined(i)||(s=i.formatString)}return s.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const s=this.data.currencyList.get(t);if(typeof s>"u")throw new Mn(t);const i={formatString:s.formatString,decimals:s.decimals,decPoint:s.decPoint,thousandsSep:s.thousandsSep};R.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const o=s.lang[n];return R.isUndefined(o)||(i.formatString=o.formatString,i.decimals=o.decimals,i.decPoint=o.decPoint,i.thousandsSep=o.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",W.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}class xn extends jt{_data;_type;static getSupportTypes(){return[Ye.NotSet,Ye.JsonArray,Ye.JsonObject,Ye.FloatVal,Ye.IntegerVal,Ye.BoolYN,Ye.StringVal]}static prepareArrayList(e){return R.isArray(e)?e:R.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),R.isObject(e))for(const[t,n]of Object.entries(e))this.data.set(t,n)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n),!R.isArray(n)&&!R.isObject(n)&&(n=t)}catch(s){this.getLogger().error(s),n=t}return xn.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(s){this.getLogger().error(s),n=t}return R.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?W.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?W.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?W.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?W.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const n=W.toDateTime(this.data.get(e).toString());return n.isValid?n:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(n){this.getLogger().warn(n,e)}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),R.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(n,!0)}}class Ro{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?W.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const n=window.localStorage.getItem(this._getKey(e));return n===null?t||null:JSON.parse(n)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}class yh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class wh extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Mr="2.0";class bh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,R.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((s,i)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||i(new yh("websocket is not connected"));const c=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),i(new wh("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:s,reject:i,timeout:c})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:s,params:i,id:o})=>{const c=this.createRequest(s,i,o);t.push(c),n.push(new Promise((a,u)=>this._rpcResponseAwaiters.set(c.id,{resolve:a,reject:u})))}),this._connector.send(JSON.stringify(t)),n}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Received rpc response with unknown id`),e)}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(n){this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(R.isArray(t))return this.executeIncomingRpcBatch(t);if(R.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(R.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:Mr,error:hn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const s=this.executeIncomingRpcCommand(n);s&&(s.jsonrpc=Mr,s.id=n.id,t.push(s))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:Mr,error:hn.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,n){return n||(n=this.nextId()),{jsonrpc:Mr,method:e,params:t,id:n}}}class Sh{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Ro,this._callbacks={onWebSocketBlockChanged:R.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Re.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Re.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Re.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Re.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Re.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Re.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Re.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class _h{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},s=[];for(const i of e){const o=this._publicIds.get(i);o&&o.end>t?n[o.userId]=o:s.push(i)}return s.length===0?Promise.resolve(n):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:s}).then(o=>{const c=o.getData().result;this.setPublicIds(Object.values(c));for(const a of s){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}i(n)}).catch(o=>(this.getLogger().error(o),i({})))})}setPublicIds(e){e.forEach(t=>{const n=Number(t.user_id);this._publicIds.set(n,{userId:n,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Dn={exports:{}};/*!
|
|
6
|
+
`+i):n.stack=i}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=yt(this.defaults,t);const{transitional:n,paramsSerializer:s,headers:i}=t;n!==void 0&&On.assertOptions(n,{silentJSONParsing:it.transitional(it.boolean),forcedJSONParsing:it.transitional(it.boolean),clarifyTimeoutError:it.transitional(it.boolean)},!1),s!=null&&(v.isFunction(s)?t.paramsSerializer={serialize:s}:On.assertOptions(s,{encode:it.function,serialize:it.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&v.merge(i.common,i[t.method]);i&&v.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),t.headers=Ae.concat(o,i);const c=[];let a=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(t)===!1||(a=a&&g.synchronous,c.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let l,h=0,f;if(!a){const p=[oo.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,u),f=p.length,l=Promise.resolve(t);h<f;)l=l.then(p[h++],p[h++]);return l}f=c.length;let d=t;for(h=0;h<f;){const p=c[h++],g=c[h++];try{d=p(d)}catch(m){g.call(this,m);break}}try{l=oo.call(this,d)}catch(p){return Promise.reject(p)}for(h=0,f=u.length;h<f;)l=l.then(u[h++],u[h++]);return l}getUri(e){e=yt(this.defaults,e);const t=Ki(e.baseURL,e.url);return Wi(t,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){wt.prototype[e]=function(t,n){return this.request(yt(n||{},{method:e,url:t,data:(n||{}).data}))}}),v.forEach(["post","put","patch"],function(e){function t(n){return function(i,o,c){return this.request(yt(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}wt.prototype[e]=t(),wt.prototype[e+"Form"]=t(!0)});let Fu=class Jo{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{n.subscribe(c),i=c}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,c){n.reason||(n.reason=new xt(i,o,c),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Jo(function(s){e=s}),cancel:e}}};function Pu(r){return function(t){return r.apply(null,t)}}function Mu(r){return v.isObject(r)&&r.isAxiosError===!0}const An={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(An).forEach(([r,e])=>{An[e]=r});function lo(r){const e=new wt(r),t=Oi(wt.prototype.request,e);return v.extend(t,wt.prototype,e,{allOwnKeys:!0}),v.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return lo(yt(r,s))},t}const ae=lo(tr);ae.Axios=wt,ae.CanceledError=xt,ae.CancelToken=Fu,ae.isCancel=Ji,ae.VERSION=ao,ae.toFormData=Nr,ae.AxiosError=H,ae.Cancel=ae.CanceledError,ae.all=function(e){return Promise.all(e)},ae.spread=Pu,ae.isAxiosError=Mu,ae.mergeConfig=yt,ae.AxiosHeaders=Ae,ae.formToJSON=r=>qi(v.isHTMLForm(r)?new FormData(r):r),ae.getAdapter=io.getAdapter,ae.HttpStatusCode=An,ae.default=ae;const{Axios:af,AxiosError:uo,CanceledError:cf,isCancel:lf,CancelToken:uf,VERSION:hf,all:ff,Cancel:df,isAxiosError:pf,spread:gf,toFormData:mf,AxiosHeaders:yf,HttpStatusCode:wf,formToJSON:bf,getAdapter:Sf,mergeConfig:_f}=ae,xu=String.prototype.replace,Du=/%20/g,ho={RFC1738:"RFC1738",RFC3986:"RFC3986"},In={RFC1738:function(r){return xu.call(r,Du,"+")},RFC3986:function(r){return String(r)}},ju=ho.RFC1738,fo=ho.RFC3986,Cn=Object.prototype.hasOwnProperty,bt=Array.isArray,qe=function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Uu=function(e){for(;e.length>1;){const t=e.pop(),n=t.obj[t.prop];if(bt(n)){const s=[];for(let i=0;i<n.length;++i)typeof n[i]<"u"&&s.push(n[i]);t.obj[t.prop]=s}}},Bu=function(e,t){const n=t&&t.plainObjects?Object.create(null):{};for(let s=0;s<e.length;++s)typeof e[s]<"u"&&(n[s]=e[s]);return n},$u=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(bt(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!Cn.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);let s=e;return bt(e)&&!bt(t)&&(s=Bu(e,n)),bt(e)&&bt(t)?(t.forEach(function(i,o){if(Cn.call(e,o)){const c=e[o];c&&typeof c=="object"&&i&&typeof i=="object"?e[o]=r(c,i,n):e.push(i)}else e[o]=i}),e):Object.keys(t).reduce(function(i,o){const c=t[o];return Cn.call(i,o)?i[o]=r(i[o],c,n):i[o]=c,i},s)},Wu=function(r,e,t){const n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Nn=1024,Vu=function(e,t,n,s,i){if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let c="";for(let a=0;a<o.length;a+=Nn){const u=o.length>=Nn?o.slice(a,a+Nn):o,l=[];for(let h=0;h<u.length;++h){let f=u.charCodeAt(h);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||i===ju&&(f===40||f===41)){l[l.length]=u.charAt(h);continue}if(f<128){l[l.length]=qe[f];continue}if(f<2048){l[l.length]=qe[192|f>>6]+qe[128|f&63];continue}if(f<55296||f>=57344){l[l.length]=qe[224|f>>12]+qe[128|f>>6&63]+qe[128|f&63];continue}h+=1,f=65536+((f&1023)<<10|u.charCodeAt(h)&1023),l[l.length]=qe[240|f>>18]+qe[128|f>>12&63]+qe[128|f>>6&63]+qe[128|f&63]}c+=l.join("")}return c},Hu=function(e){const t=[{obj:{o:e},prop:"o"}],n=[];for(let s=0;s<t.length;++s){const i=t[s],o=i.obj[i.prop],c=Object.keys(o);for(let a=0;a<c.length;++a){const u=c[a],l=o[u];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(t.push({obj:o,prop:u}),n.push(l))}}return Uu(t),e},qu=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},zu=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Ju=function(e,t){return[].concat(e,t)},Rn=function(e,t){if(bt(e)){const n=[];for(let s=0;s<e.length;s+=1)n.push(t(e[s]));return n}return t(e)},Zu=Object.prototype.hasOwnProperty,po={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ze=Array.isArray,Gu=Array.prototype.push,go=function(r,e){Gu.apply(r,ze(e)?e:[e])},Yu=Date.prototype.toISOString,mo=fo,fe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Vu,encodeValuesOnly:!1,format:mo,formatter:In[mo],indices:!1,serializeDate:function(e){return Yu.call(e)},skipNulls:!1,strictNullHandling:!1},Ku=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Ln={},yo=function(e,t,n,s,i,o,c,a,u,l,h,f,d,p,g,m,y,w){let _=e,b=w,k=0,S=!1;for(;(b=b.get(Ln))!==void 0&&!S;){const J=b.get(e);if(k+=1,typeof J<"u"){if(J===k)throw new RangeError("Cyclic object value");S=!0}typeof b.get(Ln)>"u"&&(k=0)}if(typeof l=="function"?_=l(t,_):_ instanceof Date?_=d(_):n==="comma"&&ze(_)&&(_=Rn(_,function(J){return J instanceof Date?d(J):J})),_===null){if(o)return u&&!m?u(t,fe.encoder,y,"key",p):t;_=""}if(Ku(_)||zu(_)){if(u){const J=m?t:u(t,fe.encoder,y,"key",p);return[g(J)+"="+g(u(_,fe.encoder,y,"value",p))]}return[g(t)+"="+g(String(_))]}const E=[];if(typeof _>"u")return E;let N;if(n==="comma"&&ze(_))m&&u&&(_=Rn(_,u)),N=[{value:_.length>0?_.join(",")||null:void 0}];else if(ze(l))N=l;else{const J=Object.keys(_);N=h?J.sort(h):J}const x=a?t.replace(/\./g,"%2E"):t,M=s&&ze(_)&&_.length===1?x+"[]":x;if(i&&ze(_)&&_.length===0)return M+"[]";for(let J=0;J<N.length;++J){const we=N[J],q=typeof we=="object"&&typeof we.value<"u"?we.value:_[we];if(c&&q===null)continue;const Q=f&&a?we.replace(/\./g,"%2E"):we,B=ze(_)?typeof n=="function"?n(M,Q):M:M+(f?"."+Q:"["+Q+"]");w.set(e,k);const de=new WeakMap;de.set(Ln,w),go(E,yo(q,B,n,s,i,o,c,a,n==="comma"&&m&&ze(_)?null:u,l,h,f,d,p,g,m,y,de))}return E},Qu=function(e){if(!e)return fe;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");const t=e.charset||fe.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=fo;if(typeof e.format<"u"){if(!Zu.call(In,e.format))throw new TypeError("Unknown format option provided.");n=e.format}const s=In[n];let i=fe.filter;(typeof e.filter=="function"||ze(e.filter))&&(i=e.filter);let o;if(e.arrayFormat in po?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=fe.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const c=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:fe.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:fe.addQueryPrefix,allowDots:c,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:fe.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:fe.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?fe.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:fe.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:fe.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:fe.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:fe.encodeValuesOnly,filter:i,format:n,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:fe.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:fe.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:fe.strictNullHandling}};function wo(r,e){let t=r;const n=Qu(e);let s,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):ze(n.filter)&&(i=n.filter,s=i);const o=[];if(typeof t!="object"||t===null)return"";const c=po[n.arrayFormat],a=c==="comma"&&n.commaRoundTrip;s||(s=Object.keys(t)),n.sort&&s.sort(n.sort);const u=new WeakMap;for(let f=0;f<s.length;++f){const d=s[f];n.skipNulls&&t[d]===null||go(o,yo(t[d],d,c,a,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}const l=o.join(n.delimiter);let h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),l.length>0?h+l:""}const Fn=Object.prototype.hasOwnProperty,Xu=Array.isArray,ce={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Wu,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},eh=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},bo=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},th="utf8=%26%2310003%3B",rh="utf8=%E2%9C%93",nh=function(e,t){const n={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,o=s.split(t.delimiter,i);let c=-1,a,u=t.charset;if(t.charsetSentinel)for(a=0;a<o.length;++a)o[a].indexOf("utf8=")===0&&(o[a]===rh?u="utf-8":o[a]===th&&(u="iso-8859-1"),c=a,a=o.length);for(a=0;a<o.length;++a){if(a===c)continue;const l=o[a],h=l.indexOf("]="),f=h===-1?l.indexOf("="):h+1;let d,p;f===-1?(d=t.decoder(l,ce.decoder,u,"key"),p=t.strictNullHandling?null:""):(d=t.decoder(l.slice(0,f),ce.decoder,u,"key"),p=Rn(bo(l.slice(f+1),t),function(m){return t.decoder(m,ce.decoder,u,"value")})),p&&t.interpretNumericEntities&&u==="iso-8859-1"&&(p=eh(p)),l.indexOf("[]=")>-1&&(p=Xu(p)?[p]:p);const g=Fn.call(n,d);g&&t.duplicates==="combine"?n[d]=Ju(n[d],p):(!g||t.duplicates==="last")&&(n[d]=p)}return n},sh=function(r,e,t,n){let s=n?e:bo(e,t);for(let i=r.length-1;i>=0;--i){let o;const c=r[i];if(c==="[]"&&t.parseArrays)o=t.allowEmptyArrays&&s===""?[]:[].concat(s);else{o=t.plainObjects?Object.create(null):{};const a=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,u=t.decodeDotInKeys?a.replace(/%2E/g,"."):a,l=parseInt(u,10);!t.parseArrays&&u===""?o={0:s}:!isNaN(l)&&c!==u&&String(l)===u&&l>=0&&t.parseArrays&&l<=t.arrayLimit?(o=[],o[l]=s):u!=="__proto__"&&(o[u]=s)}s=o}return s},ih=function(e,t,n,s){if(!e)return;const i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,c=/(\[[^[\]]*])/g;let a=n.depth>0&&o.exec(i);const u=a?i.slice(0,a.index):i,l=[];if(u){if(!n.plainObjects&&Fn.call(Object.prototype,u)&&!n.allowPrototypes)return;l.push(u)}let h=0;for(;n.depth>0&&(a=c.exec(i))!==null&&h<n.depth;){if(h+=1,!n.plainObjects&&Fn.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;l.push(a[1])}return a&&l.push("["+i.slice(a.index)+"]"),sh(l,t,n,s)},oh=function(e){if(!e)return ce;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");const t=typeof e.charset>"u"?ce.charset:e.charset,n=typeof e.duplicates>"u"?ce.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:ce.allowDots:!!e.allowDots,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:ce.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:ce.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:ce.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:ce.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ce.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:ce.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:ce.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:ce.decoder,delimiter:typeof e.delimiter=="string"||qu(e.delimiter)?e.delimiter:ce.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:ce.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:ce.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:ce.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:ce.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ce.strictNullHandling}};function ah(r,e){const t=oh(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};const n=typeof r=="string"?nh(r,t):r;let s=t.plainObjects?Object.create(null):{};const i=Object.keys(n);for(let o=0;o<i.length;++o){const c=i[o],a=ih(c,n[c],t,typeof r=="string");s=$u(s,a,t)}return t.allowSparse===!0?s:Hu(s)}class So{#e;#t;#r;#n;_logger=null;_loggerSystem=null;#s="";#o=!1;#i="";constructor(e,t,n){this.#e=ae.create({baseURL:e,...n}),this.#t=t,this.#r=new al,this.#n=new hl}setLogger(e){this._logger=e,this.#r.setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}getSystemLogger(){return this._loggerSystem===null&&(this._loggerSystem=be.build("SystemLogger"),this._loggerSystem.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!0,[I.warn]:!0,[I.error]:!0,[I.trace]:!1})),this._loggerSystem}setRestrictionManagerParams(e){this.#r.params=e}getRestrictionManagerParams(){return this.#r.params}setLogTag(e){this.#s=e}clearLogTag(){this.#s=""}async batch(e,t=!0){const n=Array.isArray(e),s=n?[]:{};let i=0;const o=(c,a)=>{let u=null,l=null;if(Array.isArray(c)?(u=c[0],l=c[1]):c.method&&(u=c.method,l=c.params),u){i++;const h=u+"?"+wo(l);n||Array.isArray(s)?s.push(h):s[a]=h}};if(n)for(const[c,a]of e.entries())o(a,c);else for(const[c,a]of Object.entries(e))o(a,c);return i<1?Promise.resolve(new Pt):this.call("batch",{halt:t?1:0,cmd:s}).then(c=>{const a=c.getData().result,u=n?[]:{},l=(p,g)=>{if(typeof a.result[g]<"u"||typeof a.result_error[g]<"u"){const m=p.split("?"),y=new fn({result:R.isUndefined(a.result[g])?{}:a.result[g],error:a?.result_error[g]||void 0,total:a.result_total[g],next:a.result_next[g]},{method:m[0]||"",params:ah(m[1]||""),start:0},c.getStatus());n||Array.isArray(u)?u.push(y):u[g]=y}};if(Array.isArray(s))for(const[p,g]of s.entries())l(g,p);else for(const[p,g]of Object.entries(s))l(g,p);let h;const f=p=>new Qt({status:0,answerError:{error:p.getErrorMessages().join("; "),errorDescription:`batch ${p.getQuery().method}: ${wo(p.getQuery().params,{encode:!1})}`},cause:p.getErrors().next().value}),d=new Pt;if(n||Array.isArray(u)){h=[];for(const p of u){if(p.getStatus()!==200||!p.isSuccess){const g=f(p);if(!t&&!p.isSuccess){d.addError(g);continue}return Promise.reject(g)}h.push(p.getData().result)}}else{h={};for(const p of Object.keys(u)){const g=u[p];if(g.getStatus()!==200||!g.isSuccess){const m=f(g);if(!t&&!g.isSuccess){d.addError(m);continue}return Promise.reject(m)}h[p]=g.getData().result}}return d.setData(h),Promise.resolve(d)})}async call(e,t,n=0){let s=this.#t.getAuthData();return s===!1&&(s=await this.#t.refreshAuth()),await this.#r.check(),this.#o&&!this.isServerSide()&&R.isStringFilled(this.#i)&&this.getSystemLogger().warn(this.#i),this.#e.post(this.#c(e),this.#a(s,t,n)).then(i=>{const o=i.data;return Promise.resolve({status:i.status,payload:o})},async i=>{let o={error:i?.code||0,errorDescription:i?.message||""};if(i instanceof uo&&i.response&&i.response.data&&!R.isUndefined(i.response.data.error)){const a=i.response.data;o={error:a.error,errorDescription:a.error_description}}const c=new Qt({status:i.response?.status||0,answerError:o,cause:i});return c.status===401&&["expired_token","invalid_token"].includes(c.answerError.error)?(this.getLogger().info(`refreshAuth >> ${c.answerError.error} >>>`),s=await this.#t.refreshAuth(),await this.#r.check(),this.#e.post(this.#c(e),this.#a(s,t,n)).then(async a=>{const u=a.data;return Promise.resolve({status:a.status,payload:u})},async a=>{let u={error:a?.code||0,errorDescription:a?.message||""};if(a instanceof uo&&a.response&&a.response.data){const h=a.response.data;u={error:h.error,errorDescription:h.error_description}}const l=new Qt({status:a.response?.status||0,answerError:u,cause:a});return Promise.reject(l)})):Promise.reject(c)}).then(i=>{const o=new fn(i.payload,{method:e,params:t,start:n},i.status);return Promise.resolve(o)})}#a(e,t,n=0){const s=Object.assign({},t);return this.#s.length>0&&(s.logTag=this.#s),s[this.#n.getQueryStringParameterName()]=this.#n.getRequestId(),s[this.#n.getQueryStringSdkParameterName()]="0.1.6",s.data&&s.data.start&&delete s.data.start,e.refresh_token!=="hook"&&(s.auth=e.access_token),s.start=n,s}#c(e){return`${encodeURIComponent(e)}.json`}setClientSideWarning(e,t){this.#o=e,this.#i=t}isServerSide(){return typeof window>"u"}}class Dt{static batchSize=50;_isInit=!1;_http=null;_logger=null;constructor(){this._isInit=!1}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}setLogger(e){this._logger=e,this.getHttpClient().setLogger(this.getLogger())}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}callMethod(e,t,n){return this.getHttpClient().call(e,t||{},n||0)}async callListMethod(e,t={},n=null,s=null){const i=new Pt;return R.isFunction(n)&&n!==null&&n(0),this.callMethod(e,t,0).then(async o=>{let c=[],a;if(s===null?a=o.getData().result:a=o.getData().result[s],c=[...c,...a],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient()),u!==!1;){let l;if(s===null?l=u.getData().result:l=u.getData().result[s],c=[...c,...l],n){const h=u.getTotal();n(h>0?Math.round(100*c.length/h):100)}}}return i.setData(c),n&&n(100),i})}async*fetchListMethod(e,t={},n="ID",s=null){t.order=t.order||{},t.filter=t.filter||{},t.start=-1;const i=`>${n}`;t.order[n]="ASC",t.filter[i]=0;do{const o=await this.callMethod(e,t,t.start);let c;if(!R.isNull(s)&&s!==null?c=o.getData().result[s]:c=o.getData().result,c.length===0||(yield c,c.length<Dt.batchSize))break;const a=c.at(-1);a&&n in a&&(t.filter[i]=a[n])}while(!0)}async callBatch(e,t=!0){return this.getHttpClient().batch(e,t)}chunkArray(e,t=50){const n=[];for(let s=0;s<e.length;s+=t){const i=e.slice(s,s+t);n.push(i)}return n}async callBatchByChunk(e,t=!0){const n=new Pt,s=[],i=this.chunkArray(e,Dt.batchSize);for(const o of i){const c=await this.callBatch(o,t);s.push(...c.getData())}return n.setData(s)}getHttpClient(){if(!this.isInit||this._http===null)throw new Error("Http not init");return this._http}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new Error("B24 not initialized")}}var Pn=(r=>(r.en="en",r.de="de",r.la="la",r.br="br",r.fr="fr",r.it="it",r.pl="pl",r.ru="ru",r.ua="ua",r.tr="tr",r.sc="sc",r.tc="tc",r.ja="ja",r.vn="vn",r.id="id",r.ms="ms",r.th="th",r.ar="ar",r))(Pn||{});const ch=()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)});let lh=class lt{static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!lt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");lt.isInternalConstructing=!1}static getInstance(){return lt.instance||(lt.isInternalConstructing=!0,lt.instance=new lt),lt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let n;(typeof t>"u"||!R.isStringFilled(t))&&(t=R.isStringFilled(this._defLocale)?this._defLocale||"en":typeof navigator>"u"?"en":navigator?.language||"en"),Number.isInteger(e)?n=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):n=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let s=n.format(e);return t.includes("ru")&&(s=s.replace(",",".")),s}};class T{countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,n,s){this.countryCode=e,this.length=t,this.structure=n,this.example=s}isValid(e){return this.length===e.length&&this.countryCode===e.slice(0,2)&&this._regex().test(e.slice(4))&&this._iso7064Mod9710(this._iso13616Prepare(e))==1}toBBAN(e,t){return(this._regex().exec(e.slice(4)||"")||[]).slice(1).join(t)}fromBBAN(e){if(!this.isValidBBAN(e))throw new Error("Invalid BBAN");const t=("0"+(98-this._iso7064Mod9710(this._iso13616Prepare(this.countryCode+"00"+e)))).slice(-2);return this.countryCode+t+e}isValidBBAN(e){return this.length-4===e.length&&this._regex().test(e)}_regex(){return this._cachedRegex===null&&(this._cachedRegex=this._parseStructure(this.structure)),this._cachedRegex}_parseStructure(e){const t=(e.match(/(.{3})/g)||[]).map(n=>{let s;const i=n.slice(0,1),o=Number.parseInt(n.slice(1),10);switch(i){case"A":s="0-9A-Za-z";break;case"B":s="0-9A-Z";break;case"C":s="A-Za-z";break;case"F":s="0-9";break;case"L":s="a-z";break;case"U":s="A-Z";break;case"W":s="0-9a-z";break}return"(["+s+"]{"+o+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?(n-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,n;for(;t.length>2;)n=t.slice(0,9),t=Number.parseInt(n,10)%97+t.slice(n.length);return Number.parseInt(t,10)%97}}class Ke{static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!Ke.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");Ke.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return Ke.instance||(Ke.isInternalConstructing=!0,Ke.instance=new Ke),Ke.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!this._isString(e))return!1;e=this.electronicFormat(e);const t=e.slice(0,2);if(!this._countries.has(t))throw new Error(`No country with code ${t}`);const n=this._countries.get(t);return!!n&&n.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const n=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(n,"$1"+t)}electronicFormat(e){const t=/[^a-zA-Z0-9]/g;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const n=e.slice(0,2);if(!this._countries.has(n))throw new Error(`No country with code ${n}`);const s=this._countries.get(n);if(!s)throw new Error(`No country with code ${n}`);return s.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);if(!n)throw new Error(`No country with code ${e}`);return n.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!this._isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const n=this._countries.get(e);return!!n&&n.isValidBBAN(this.electronicFormat(t))}_isString(e){return typeof e=="string"||e instanceof String}}const uh=()=>{const r=lh.getInstance(),e=Ke.getInstance();return e.addSpecification(new T("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new T("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new T("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new T("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new T("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new T("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new T("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new T("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new T("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new T("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new T("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new T("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new T("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new T("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new T("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new T("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new T("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new T("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new T("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new T("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new T("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new T("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new T("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new T("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new T("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new T("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new T("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new T("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new T("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new T("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new T("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new T("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new T("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new T("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new T("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new T("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new T("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new T("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new T("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new T("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new T("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new T("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new T("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new T("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new T("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new T("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new T("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new T("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new T("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new T("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new T("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new T("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new T("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new T("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new T("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new T("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new T("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new T("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new T("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new T("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new T("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new T("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new T("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new T("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new T("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new T("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new T("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new T("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new T("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new T("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new T("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new T("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new T("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new T("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new T("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new T("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new T("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new T("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new T("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new T("BI",16,"F12","BI41123456789012")),e.addSpecification(new T("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new T("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new T("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new T("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new T("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new T("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new T("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new T("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new T("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new T("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new T("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new T("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new T("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new T("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new T("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new T("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new T("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new T("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new T("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new T("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new T("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new T("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}};class _o{#e;constructor(e){this.#e=Object.freeze(Object.assign({},e))}getAuthData(){const e=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,"");return{access_token:this.#e.secret,refresh_token:"hook",expires_in:0,domain:e,member_id:e}}refreshAuth(){return Promise.resolve(this.getAuthData())}getUniq(e){const t=this.getAuthData();if(t===!1)throw new Error("AuthData not init");return[e,t.member_id].join("_")}getTargetOrigin(){return`${this.#e.b24Url}`}getTargetOriginWithPath(){return`${this.#e.b24Url}/rest/${this.#e.userId}/${this.#e.secret}`}get isAdmin(){return!0}}class hh extends Dt{#e;constructor(e){super(),this.#e=new _o(e),this._http=new So(this.#e.getTargetOriginWithPath(),this.#e,this._getHttpOptions()),this._http.setClientSideWarning(!0,"It is not safe to use hook requests on the client side"),this._isInit=!0}setLogger(e){super.setLogger(e)}get auth(){return this.#e}offClientSideWarning(){this.getHttpClient().setClientSideWarning(!1,"")}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var X=(r=>(r.getInitData="getInitData",r.setInstallFinish="setInstallFinish",r.setInstall="setInstall",r.refreshAuth="refreshAuth",r.setAppOption="setAppOption",r.setUserOption="setUserOption",r.resizeWindow="resizeWindow",r.reloadWindow="reloadWindow",r.setTitle="setTitle",r.setScroll="setScroll",r.openApplication="openApplication",r.closeApplication="closeApplication",r.openPath="openPath",r.imCallTo="imCallTo",r.imPhoneTo="imPhoneTo",r.imOpenMessenger="imOpenMessenger",r.imOpenHistory="imOpenHistory",r.selectUser="selectUser",r.selectAccess="selectAccess",r.selectCRM="selectCRM",r.showAppForm="showAppForm",r))(X||{});class vo{#e;#t;_logger=null;runCallbackHandler;constructor(e){this.#e=e,this.#t=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler)}async send(e,t=null){return new Promise((n,s)=>{let i;const o={resolve:n,reject:s,timeoutId:null},c=this.#r(o);if(e.toString().includes(":"))i={method:e.toString(),params:t??"",callback:c,appSid:this.#e.getAppSid()};else{i=e.toString();const a=[t?JSON.stringify(t):null,c,this.#e.getAppSid()];i+=":"+a.filter(Boolean).join(":")}this.getLogger().log(`send to ${this.#e.getTargetOrigin()}`,{cmd:i}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely&&(this.#t.get(c).timeoutId=window.setTimeout(()=>{this.#t.has(c)&&(this.getLogger().warn(`Action ${e.toString()} stop by timeout`),this.#t.delete(c),n({isSafely:!0}))},Number.parseInt(String(t?.safelyTime||900))))})}_runCallback(e){if(e.origin===this.#e.getTargetOrigin()&&e.data){this.getLogger().log(`get from ${e.origin}`,{data:e.data});const t=e.data.split(":"),n={id:t[0],args:t.slice(1).join(":")};if(n.args&&(n.args=JSON.parse(n.args)),this.#t.has(n.id)){const s=this.#t.get(n.id);s.timeoutId&&clearTimeout(s.timeoutId),this.#t.delete(n.id),s.resolve(n.args)}}}#r(e){const t=W.getUniqId();return this.#t.set(t,e),t}}class ko{#e="";#t=!0;#r=null;#n=null;#s=null;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#t=e.PROTOCOL===!0,e.LANG&&(this.#s=e.LANG),e.APP_SID&&(this.#r=e.APP_SID)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#n||(this.#n=e.PATH),this.#s||(this.#s=e.LANG),this.#t=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this}getAppSid(){if(this.#r===null)throw new Error("Not init appSid");return this.#r}getTargetOrigin(){return`${this.#t?"https":"http"}://${this.#e}`}getTargetOriginWithPath(){return this.getTargetOrigin()+(this.#n??"")}getLang(){return this.#s||Pn.en}}class Eo{#e=null;#t=null;#r=0;#n=null;#s=!1;#o;#i;constructor(e,t){this.#o=e,this.#i=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,this.#s=e.IS_ADMIN,this.#n=e.MEMBER_ID||""),this}getAuthData(){return this.#r>Date.now()?{access_token:this.#e,refresh_token:this.#t,expires_in:this.#r,domain:this.#o.getTargetOrigin(),member_id:this.#n}:!1}async refreshAuth(){return this.#i.send(X.refreshAuth,{}).then(e=>(this.#e=e.AUTH_ID,this.#t=e.REFRESH_ID,this.#r=Date.now()+Number.parseInt(e.AUTH_EXPIRES)*1e3,Promise.resolve(this.getAuthData())))}getUniq(e){return[e,this.#n||""].join("_")}get isAdmin(){return this.#s}}class To{#e;constructor(e){this.#e=e}async closeApplication(){return this.#e.send(X.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(X.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(X.resizeWindow,{width:e,height:t,isSafely:!0}):Promise.reject(new Error(`Wrong width:number = ${e} or height:number = ${t}`))}async resizeWindowAuto(e=null,t=0,n=0){const s=document.body;let i=Math.max(s.scrollWidth,s.offsetWidth);n>0&&(i=Math.max(n,i));let o=Math.max(s.scrollHeight,s.offsetHeight);return e&&(o=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(o=Math.max(t,o)),this.resizeWindow(i,o)}getScrollSize(){return ch()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(X.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(X.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(X.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(X.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e){return this.#e.send(X.imPhoneTo,{phone:e,isSafely:!0})}async imOpenMessenger(e){return this.#e.send(X.imOpenMessenger,{dialogId:e,isSafely:!0})}async imOpenHistory(e){return this.#e.send(X.imOpenHistory,{dialogId:e,isSafely:!0})}}let Oo=class{#e;#t=null;#r=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#t=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#r=e.USER_OPTIONS),this}appGet(e){if(this.#t&&this.#t[e])return this.#t[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#t||(this.#t=[]),this.#t[e]=t,this.#n(X.setAppOption,e,this.#t[e])}userGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#t||(this.#t=[]),this.#t[e]||(this.#t[e]=null),this.#r[e]=t,this.#n(X.setUserOption,e,this.#r[e])}async#n(e,t,n){return this.#e.send(e,{name:t,value:n,isSafely:!0}).then(()=>Promise.resolve())}};class Ao{#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(X.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(X.selectUser,{mult:!0})}async selectAccess(e=[]){return console.warn("@deprecated selectAccess"),this.#e.send(X.selectAccess,{value:e})}async selectCRM(e){return console.warn("@deprecated selectCRM"),this.#e.send(X.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value})}}class Io{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#t.send(X.openApplication,e)}async closeSliderAppPage(){return this.#t.send(X.closeApplication,{isSafely:!1})}#r(e=1640){return e>0?e>1200&&e<=1640?"/crm/type/0/details/0/../../../../..":e>950&&e<=1200?"/company/personal/user/0/groups/create/../../../../../..":e>900&&e<=950?"/crm/company/requisite/0/../../../..":e<=900?"/workgroups/group/0/card/../../../..":"/crm/deal/../..":"/crm/deal/../.."}async openPath(e,t=1640){const n=new URL(e);return n.searchParams.set("IFRAME","Y"),n.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#t.send(X.openPath,{path:[this.#r(t),n.pathname,n.search].join("")}).then(s=>s?.result==="error"?s?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,o)=>{const c=window.open(e,"_blank");if(!c){o(new Error("Error open window"));return}let a=0;const u=1e3*60*5,l=window.setInterval(()=>{a=a+1,c.closed?(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!0})):a>u&&(clearInterval(l),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(s?.errorCode)):s?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}async showAppForm(e){return console.warn("@deprecated showAppForm"),this.#t.send(X.showAppForm,{params:e,isSafely:!0})}}class Co{#e="";#t={};constructor(){}initData(e){this.#e=e.PLACEMENT||"DEFAULT";const t=e.PLACEMENT_OPTIONS;return this.#t=Object.freeze(t),this}get title(){return this.#e}get isDefault(){return this.title==="DEFAULT"}get options(){return this.#t}get isSliderMode(){return this.options?.IFRAME==="Y"}}class No extends Dt{#e=!1;#t=!1;#r;#n;#s;#o;#i;#a;#c;#l;constructor(e){super(),this.#r=new ko(e),this.#n=new vo(this.#r),this.#n.subscribe(),this.#s=new Eo(this.#r,this.#n),this.#o=new To(this.#n),this.#i=new Oo(this.#n),this.#a=new Ao(this.#n),this.#c=new Io(this.#r,this.#n),this.#l=new Co,this._isInit=!1}setLogger(e){super.setLogger(e),this.#n.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#t}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#o}get auth(){return this._ensureInitialized(),this.#s}get slider(){return this._ensureInitialized(),this.#c}get placement(){return this._ensureInitialized(),this.#l}get options(){return this._ensureInitialized(),this.#i}get dialog(){return this._ensureInitialized(),this.#a}async init(){return this.#n.send(X.getInitData,{}).then(e=>(this.getLogger().log("init data:",e),this.#r.initData(e),this.#s.initData(e),this.#l.initData(e),this.#i.initData(e),this.#e=e.INSTALL,this.#t=e.FIRST_RUN,this._http=new So(this.#r.getTargetOriginWithPath(),this.#s,this._getHttpOptions()),this._isInit=!0,this.#t?this.#n.send(X.setInstall,{install:!0}):Promise.resolve()))}destroy(){this.#n.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#n.send(X.setInstallFinish,{}):Promise.reject(new Error("Application was previously installed. You cannot call installFinish"))}getTargetOrigin(){return this._ensureInitialized(),this.#r.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#r.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#r.getAppSid()}getLang(){return this._ensureInitialized(),this.#r.getLang()}}class Mn extends Error{constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=new Error("for stack").stack}}class jt{_b24;_logger=null;_data=null;constructor(e){this._b24=e}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async initData(e){return this.getLogger().log(e),Promise.reject(new Error("Rewrite this function"))}}class fh extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}class dh extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("AppManager.data not initialized");return this._data}get statusCode(){return Ti[this.data.status]||"Unknown status"}}class ph extends jt{_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}class gh extends jt{_data=null;async initData(e){this._data=e,this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}makeRestrictionManagerParams(){this.data?.license&&this.data.license.includes("ent")&&(this.getLogger().log(`LICENSE ${this.data.license} => up restriction manager params`,ln),this._b24.getHttpClient().setRestrictionManagerParams(ln))}}class mh extends jt{async initData(e){this._data={currencyBase:"?",currencyList:new Map},this.setBaseCurrency(e.currencyBase),this.setCurrencyList(e.currencyList);try{await this.loadData()}catch(t){throw t instanceof Error?t:(console.error(t),new Error("Failed to load data"))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{(await this._b24.callBatchByChunk(e,!0)).getData().forEach(t=>{if(typeof t.LANG>"u")return;const n=t.CURRENCY,s=this.data.currencyList.get(n);if(!(typeof s>"u"))for(const[i,o]of Object.entries(t.LANG))switch(s.lang[i]={decimals:Number.parseInt(o.DECIMALS),decPoint:o.DEC_POINT,formatString:o.FORMAT_STRING,fullName:o.FULL_NAME,isHideZero:o.HIDE_ZERO==="Y",thousandsSep:o.THOUSANDS_SEP,thousandsVariant:o.THOUSANDS_VARIANT},s.lang[i].thousandsVariant){case"N":s.lang[i].thousandsSep="";break;case"D":s.lang[i].thousandsSep=".";break;case"C":s.lang[i].thousandsSep=",";break;case"S":s.lang[i].thousandsSep=" ";break;case"B":s.lang[i].thousandsSep=" ";break;default:R.isStringFilled(s.lang[i].thousandsSep)||(s.lang[i].thousandsSep=" ");break}})}catch(t){console.error(t)}}get data(){if(this._data===null)throw new Error("CurrencyManager.data not initialized");return this._data}setBaseCurrency(e){this._data.currencyBase=e}get baseCurrency(){return this.data.currencyBase}setCurrencyList(e=[]){this.data.currencyList.clear();for(const t of e)this.data.currencyList.set(t.CURRENCY,{amount:Number.parseFloat(t.CURRENCY),amountCnt:Number.parseInt(t.AMOUNT_CNT),isBase:t.BASE==="Y",currencyCode:t.CURRENCY,dateUpdate:W.toDateTime(t.DATE_UPDATE),decimals:Number.parseInt(t.DECIMALS),decPoint:t.DEC_POINT,formatString:t.FORMAT_STRING,fullName:t.FULL_NAME,lid:t.LID,sort:Number.parseInt(t.SORT),thousandsSep:t?.THOUSANDS_SEP||null,lang:{}})}getCurrencyFullName(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Mn(e);let s=n.fullName;if(!(typeof t>"u")){const i=n.lang[t];R.isUndefined(i)||(s=i.fullName)}return s}getCurrencyLiteral(e,t){const n=this.data.currencyList.get(e);if(typeof n>"u")throw new Mn(e);let s=n.formatString;if(!(typeof t>"u")){const i=n.lang[t];R.isUndefined(i)||(s=i.formatString)}return s.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,n){const s=this.data.currencyList.get(t);if(typeof s>"u")throw new Mn(t);const i={formatString:s.formatString,decimals:s.decimals,decPoint:s.decPoint,thousandsSep:s.thousandsSep};R.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const o=s.lang[n];return R.isUndefined(o)||(i.formatString=o.formatString,i.decimals=o.decimals,i.decPoint=o.decPoint,i.thousandsSep=o.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",W.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}class xn extends jt{_data;_type;static getSupportTypes(){return[Ye.NotSet,Ye.JsonArray,Ye.JsonObject,Ye.FloatVal,Ye.IntegerVal,Ye.BoolYN,Ye.StringVal]}static prepareArrayList(e){return R.isArray(e)?e:R.isObject(e)?Object.values(e):[]}constructor(e,t){super(e),this._type=t,this._data=new Map}get data(){return this._data}reset(){this.data.clear()}async initData(e){if(this.reset(),R.isObject(e))for(const[t,n]of Object.entries(e))this.data.set(t,n)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n),!R.isArray(n)&&!R.isObject(n)&&(n=t)}catch(s){this.getLogger().error(s),n=t}return xn.prepareArrayList(n)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let n=this.data.get(e);try{n=JSON.parse(n)}catch(s){this.getLogger().error(s),n=t}return R.isObject(n)||(n=t),n}getFloat(e,t=0){return this.data.has(e)?W.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?W.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?W.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?W.toBoolean(this.data.get(e)):t}getString(e,t=""){return this.data.has(e)?this.data.get(e).toString():t}getDate(e,t=null){if(!this.data.has(e))return t;try{const n=W.toDateTime(this.data.get(e).toString());return n.isValid?n:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(n){this.getLogger().warn(n,e)}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),R.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.callBatch(n,!0)}}class Ro{_logger=null;userId;siteId;constructor(e={}){this.userId=e.userId?W.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}set(e,t){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window.localStorage>"u")return t||null;const n=window.localStorage.getItem(this._getKey(e));return n===null?t||null:JSON.parse(n)}remove(e){if(typeof window.localStorage>"u"){this.getLogger().error(new Error("undefined window.localStorage"));return}return window.localStorage.removeItem(this._getKey(e))}_getKey(e){return`@bitrix24/b24jssdk-pull-${this.userId}-${this.siteId}-${e}`}compareKey(e,t){return e===this._getKey(t)}}class yh extends Error{constructor(e){super(e),this.name="ErrorNotConnected"}}class wh extends Error{constructor(e){super(e),this.name="ErrorTimeout"}}const Mr="2.0";class bh{_logger=null;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._connector=e.connector,R.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,n=5){return new Promise((s,i)=>{const o=this.createRequest(e,t);this._connector.send(JSON.stringify(o))||i(new yh("websocket is not connected"));const c=setTimeout(()=>{this._rpcResponseAwaiters.delete(o.id),i(new wh("no response"))},n*1e3);this._rpcResponseAwaiters.set(o.id,{resolve:s,reject:i,timeout:c})})}executeOutgoingRpcBatch(e){const t=[],n=[];return e.forEach(({method:s,params:i,id:o})=>{const c=this.createRequest(s,i,o);t.push(c),n.push(new Promise((a,u)=>this._rpcResponseAwaiters.set(c.id,{resolve:a,reject:u})))}),this._connector.send(JSON.stringify(t)),n}processRpcResponse(e){if("id"in e&&this._rpcResponseAwaiters.has(Number(e.id))){const t=this._rpcResponseAwaiters.get(Number(e.id));t&&("result"in e?t.resolve(e.result):"error"in e?t.reject(e?.error||"error"):t.reject("wrong response structure"),clearTimeout(t.timeout),this._rpcResponseAwaiters.delete(Number(e.id)));return}this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Received rpc response with unknown id`),e)}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(n){this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not decode json rpc message`),n);return}if(R.isArray(t))return this.executeIncomingRpcBatch(t);if(R.isJsonRpcRequest(t))return this.executeIncomingRpcCommand(t);if(R.isJsonRpcResponse(t))return this.processRpcResponse(t);this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: unknown rpc packet`),t)}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:Mr,error:hn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const n of e)if("jsonrpc"in n)if("method"in n){const s=this.executeIncomingRpcCommand(n);s&&(s.jsonrpc=Mr,s.id=n.id,t.push(s))}else this.processRpcResponse(n);else this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: unknown rpc command in batch`),n),t.push({jsonrpc:Mr,error:hn.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,n){return n||(n=this.nextId()),{jsonrpc:Mr,method:e,params:t,id:n}}}class Sh{_logger=null;_storage;_ttl=24*60*60;_callbacks;constructor(e={}){e=e||{},this._storage=e.storage||new Ro,this._callbacks={onWebSocketBlockChanged:R.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",Re.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(Re.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(Re.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage. Error: `),t),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(Re.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(Re.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage. Error: `),t),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(Re.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(Re.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(new Error(`${W.getDateForLog()}: LocalStorage error: `),t),!1}return!0}getTimestamp(){return Date.now()}}class _h{_logger=null;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger===null&&(this._logger=be.build("NullLogger"),this._logger.setConfig({[I.desktop]:!1,[I.log]:!1,[I.info]:!1,[I.warn]:!1,[I.error]:!0,[I.trace]:!1})),this._logger}async getPublicIds(e){const t=new Date,n={},s=[];for(const i of e){const o=this._publicIds.get(i);o&&o.end>t?n[o.userId]=o:s.push(i)}return s.length===0?Promise.resolve(n):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:s}).then(o=>{const c=o.getData().result;this.setPublicIds(Object.values(c));for(const a of s){const u=this._publicIds.get(a);u&&(n[u.userId]=u)}i(n)}).catch(o=>(this.getLogger().error(o),i({})))})}setPublicIds(e){e.forEach(t=>{const n=Number(t.user_id);this._publicIds.set(n,{userId:n,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Dn={exports:{}};/*!
|
|
7
7
|
* protobuf.js v6.8.6 (c) 2016, daniel wirtz
|
|
8
8
|
* compiled mon, 26 feb 2018 11:35:34 utc
|
|
9
9
|
* licensed under the bsd-3-clause license
|