UNPKG

@bitrix24/b24jssdk

Version:

Bitrix24 REST API JavaScript SDK

71 lines 440 kB
var gb=Object.defineProperty;var a=(I,J)=>gb(I,"name",{value:J,configurable:!0});/**
 * @package @bitrix24/b24jssdk
 * @version 2.2.0
 * @copyright (c) 2026 Bitrix24
 * @license MIT
 * @see https://github.com/bitrix24/b24jssdk
 * @see https://bitrix24.github.io/b24jssdk/
 */(function(I,J){typeof exports=="object"&&typeof module<"u"?J(exports):typeof define=="function"&&define.amd?define(["exports"],J):(I=typeof globalThis<"u"?globalThis:I||self,J(I.B24Js={}))})(this,(function(I){"use strict";var J=(r=>(r[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.NOTICE=2]="NOTICE",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR",r[r.CRITICAL=5]="CRITICAL",r[r.ALERT=6]="ALERT",r[r.EMERGENCY=7]="EMERGENCY",r))(J||{});class Rt extends Error{static{a(this,"LuxonError")}}class _l extends Rt{static{a(this,"InvalidDateTimeError")}constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class wl extends Rt{static{a(this,"InvalidIntervalError")}constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Sl extends Rt{static{a(this,"InvalidDurationError")}constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Vt extends Rt{static{a(this,"ConflictingSpecificationError")}}class bi extends Rt{static{a(this,"InvalidUnitError")}constructor(e){super(`Invalid unit ${e}`)}}class De extends Rt{static{a(this,"InvalidArgumentError")}}class Et extends Rt{static{a(this,"ZoneIsAbstractError")}constructor(){super("Zone is an abstract class")}}const L="numeric",it="short",Ke="long",Fr={year:L,month:L,day:L},_i={year:L,month:it,day:L},vl={year:L,month:it,day:L,weekday:it},wi={year:L,month:Ke,day:L},Si={year:L,month:Ke,day:L,weekday:Ke},vi={hour:L,minute:L},Ei={hour:L,minute:L,second:L},Oi={hour:L,minute:L,second:L,timeZoneName:it},Ti={hour:L,minute:L,second:L,timeZoneName:Ke},Ai={hour:L,minute:L,hourCycle:"h23"},Ii={hour:L,minute:L,second:L,hourCycle:"h23"},ki={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:it},Ri={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:Ke},Ci={year:L,month:L,day:L,hour:L,minute:L},Ni={year:L,month:L,day:L,hour:L,minute:L,second:L},Di={year:L,month:it,day:L,hour:L,minute:L},Li={year:L,month:it,day:L,hour:L,minute:L,second:L},El={year:L,month:it,day:L,weekday:it,hour:L,minute:L},Pi={year:L,month:Ke,day:L,hour:L,minute:L,timeZoneName:it},Mi={year:L,month:Ke,day:L,hour:L,minute:L,second:L,timeZoneName:it},Fi={year:L,month:Ke,day:L,weekday:Ke,hour:L,minute:L,timeZoneName:Ke},xi={year:L,month:Ke,day:L,weekday:Ke,hour:L,minute:L,second:L,timeZoneName:Ke};class cr{static{a(this,"Zone")}get type(){throw new Et}get name(){throw new Et}get ianaName(){return this.name}get isUniversal(){throw new Et}offsetName(e,t){throw new Et}formatOffset(e,t){throw new Et}offset(e){throw new Et}equals(e){throw new Et}get isValid(){throw new Et}}let As=null;class xr extends cr{static{a(this,"SystemZone")}static get instance(){return As===null&&(As=new xr),As}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return lo(e,t,s)}formatOffset(e,t){return dr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Is=new Map;function Ol(r){let e=Is.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Is.set(r,e)),e}a(Ol,"makeDTF");const Tl={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Al(r,e){const t=r.format(e).replace(/\u200E/g,""),s=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,n,i,c,o,l,h,u]=s;return[c,n,i,o,l,h,u]}a(Al,"hackyOffset");function Il(r,e){const t=r.formatToParts(e),s=[];for(let n=0;n<t.length;n++){const{type:i,value:c}=t[n],o=Tl[i];i==="era"?s[o]=c:Y(o)||(s[o]=parseInt(c,10))}return s}a(Il,"partsOffset");const ks=new Map;class gt extends cr{static{a(this,"IANAZone")}static create(e){let t=ks.get(e);return t===void 0&&ks.set(e,t=new gt(e)),t}static resetCache(){ks.clear(),Is.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=gt.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return lo(e,t,s,this.name)}formatOffset(e,t){return dr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const s=Ol(this.name);let[n,i,c,o,l,h,u]=s.formatToParts?Il(s,t):Al(s,t);o==="BC"&&(n=-Math.abs(n)+1);const p=Vr({year:n,month:i,day:c,hour:l===24?0:l,minute:h,second:u,millisecond:0});let d=+t;const f=d%1e3;return d-=f>=0?f:1e3+f,(p-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let $i={};function kl(r,e={}){const t=JSON.stringify([r,e]);let s=$i[t];return s||(s=new Intl.ListFormat(r,e),$i[t]=s),s}a(kl,"getCachedLF");const Rs=new Map;function Cs(r,e={}){const t=JSON.stringify([r,e]);let s=Rs.get(t);return s===void 0&&(s=new Intl.DateTimeFormat(r,e),Rs.set(t,s)),s}a(Cs,"getCachedDTF");const Ns=new Map;function Rl(r,e={}){const t=JSON.stringify([r,e]);let s=Ns.get(t);return s===void 0&&(s=new Intl.NumberFormat(r,e),Ns.set(t,s)),s}a(Rl,"getCachedINF");const Ds=new Map;function Cl(r,e={}){const{base:t,...s}=e,n=JSON.stringify([r,s]);let i=Ds.get(n);return i===void 0&&(i=new Intl.RelativeTimeFormat(r,e),Ds.set(n,i)),i}a(Cl,"getCachedRTF");let lr=null;function Nl(){return lr||(lr=new Intl.DateTimeFormat().resolvedOptions().locale,lr)}a(Nl,"systemLocale");const Ls=new Map;function ji(r){let e=Ls.get(r);return e===void 0&&(e=new Intl.DateTimeFormat(r).resolvedOptions(),Ls.set(r,e)),e}a(ji,"getCachedIntResolvedOptions");const Ps=new Map;function Dl(r){let e=Ps.get(r);if(!e){const t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...Bi,...e}),Ps.set(r,e)}return e}a(Dl,"getCachedWeekInfo");function Ll(r){const e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));const t=r.indexOf("-u-");if(t===-1)return[r];{let s,n;try{s=Cs(r).resolvedOptions(),n=r}catch{const l=r.substring(0,t);s=Cs(l).resolvedOptions(),n=l}const{numberingSystem:i,calendar:c}=s;return[n,i,c]}}a(Ll,"parseLocaleString");function Pl(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}a(Pl,"intlConfigString");function Ml(r){const e=[];for(let t=1;t<=12;t++){const s=H.utc(2009,t,1);e.push(r(s))}return e}a(Ml,"mapMonths");function Fl(r){const e=[];for(let t=1;t<=7;t++){const s=H.utc(2016,11,13+t);e.push(r(s))}return e}a(Fl,"mapWeekdays");function $r(r,e,t,s){const n=r.listingMode();return n==="error"?null:n==="en"?t(e):s(e)}a($r,"listStuff");function xl(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||ji(r.locale).numberingSystem==="latn"}a(xl,"supportsFastNumbers");class $l{static{a(this,"PolyNumberFormatter")}constructor(e,t,s){this.padTo=s.padTo||0,this.floor=s.floor||!1;const{padTo:n,floor:i,...c}=s;if(!t||Object.keys(c).length>0){const o={useGrouping:!1,...s};s.padTo>0&&(o.minimumIntegerDigits=s.padTo),this.inf=Rl(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):qs(e,3);return ve(t,this.padTo)}}}class jl{static{a(this,"PolyDateFormatter")}constructor(e,t,s){this.opts=s,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const c=-1*(e.offset/60),o=c>=0?`Etc/GMT+${c}`:`Etc/GMT${c}`;e.offset!==0&&gt.create(o).valid?(n=o,this.dt=e):(n="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=Cs(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const s=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:s}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Bl{static{a(this,"PolyRelFormatter")}constructor(e,t,s){this.opts={style:"long",...s},!t&&io()&&(this.rtf=Cl(e,s))}format(e,t){return this.rtf?this.rtf.format(e,t):cu(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Bi={firstDay:1,minimalDays:4,weekend:[6,7]};class ae{static{a(this,"Locale")}static fromOpts(e){return ae.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,s,n,i=!1){const c=e||me.defaultLocale,o=c||(i?"en-US":Nl()),l=t||me.defaultNumberingSystem,h=s||me.defaultOutputCalendar,u=Us(n)||me.defaultWeekSettings;return new ae(o,l,h,u,c)}static resetCache(){lr=null,Rs.clear(),Ns.clear(),Ds.clear(),Ls.clear(),Ps.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:s,weekSettings:n}={}){return ae.create(e,t,s,n)}constructor(e,t,s,n,i){const[c,o,l]=Ll(e);this.locale=c,this.numberingSystem=t||o||null,this.outputCalendar=s||l||null,this.weekSettings=n,this.intl=Pl(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=xl(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:ae.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Us(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return $r(this,e,fo,()=>{const s=this.intl==="ja"||this.intl.startsWith("ja-");t&=!s;const n=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const c=s?o=>this.dtFormatter(o,n).format():o=>this.extract(o,n,"month");this.monthsCache[i][e]=Ml(c)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return $r(this,e,mo,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=Fl(i=>this.extract(i,s,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return $r(this,void 0,()=>yo,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[H.utc(2016,11,13,9),H.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return $r(this,e,bo,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[H.utc(-40,1,1),H.utc(2017,1,1)].map(s=>this.extract(s,t,"era"))),this.eraCache[e]})}extract(e,t,s){const n=this.dtFormatter(e,t),i=n.formatToParts(),c=i.find(o=>o.type.toLowerCase()===s);return c?c.value:null}numberFormatter(e={}){return new $l(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new jl(e,this.intl,t)}relFormatter(e={}){return new Bl(this.intl,this.isEnglish(),e)}listFormatter(e={}){return kl(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||ji(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:oo()?Dl(this.locale):Bi}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Ms=null;class Ve extends cr{static{a(this,"FixedOffsetZone")}static get utcInstance(){return Ms===null&&(Ms=new Ve(0)),Ms}static instance(e){return e===0?Ve.utcInstance:new Ve(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Ve(qr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${dr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${dr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return dr(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Ul extends cr{static{a(this,"InvalidZone")}constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Ot(r,e){if(Y(r)||r===null)return e;if(r instanceof cr)return r;if(Jl(r)){const t=r.toLowerCase();return t==="default"?e:t==="local"||t==="system"?xr.instance:t==="utc"||t==="gmt"?Ve.utcInstance:Ve.parseSpecifier(t)||gt.create(r)}else return Tt(r)?Ve.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new Ul(r)}a(Ot,"normalizeZone");const Fs={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Ui={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Vl=Fs.hanidec.replace(/[\[|\]]/g,"").split("");function ql(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){const s=r.charCodeAt(t);if(r[t].search(Fs.hanidec)!==-1)e+=Vl.indexOf(r[t]);else for(const n in Ui){const[i,c]=Ui[n];s>=i&&s<=c&&(e+=s-i)}}return parseInt(e,10)}else return e}a(ql,"parseDigits");const xs=new Map;function Hl(){xs.clear()}a(Hl,"resetDigitRegexCache");function ot({numberingSystem:r},e=""){const t=r||"latn";let s=xs.get(t);s===void 0&&(s=new Map,xs.set(t,s));let n=s.get(e);return n===void 0&&(n=new RegExp(`${Fs[t]}${e}`),s.set(e,n)),n}a(ot,"digitRegex");let Vi=a(()=>Date.now(),"now"),qi="system",Hi=null,Wi=null,zi=null,Ji=60,Ki,Gi=null;class me{static{a(this,"Settings")}static get now(){return Vi}static set now(e){Vi=e}static set defaultZone(e){qi=e}static get defaultZone(){return Ot(qi,xr.instance)}static get defaultLocale(){return Hi}static set defaultLocale(e){Hi=e}static get defaultNumberingSystem(){return Wi}static set defaultNumberingSystem(e){Wi=e}static get defaultOutputCalendar(){return zi}static set defaultOutputCalendar(e){zi=e}static get defaultWeekSettings(){return Gi}static set defaultWeekSettings(e){Gi=Us(e)}static get twoDigitCutoffYear(){return Ji}static set twoDigitCutoffYear(e){Ji=e%100}static get throwOnInvalid(){return Ki}static set throwOnInvalid(e){Ki=e}static resetCaches(){ae.resetCache(),gt.resetCache(),H.resetCache(),Hl()}}class at{static{a(this,"Invalid")}constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Yi=[0,31,59,90,120,151,181,212,243,273,304,334],Zi=[0,31,60,91,121,152,182,213,244,274,305,335];function et(r,e){return new at("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}a(et,"unitOutOfRange");function $s(r,e,t){const s=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&s.setUTCFullYear(s.getUTCFullYear()-1900);const n=s.getUTCDay();return n===0?7:n}a($s,"dayOfWeek");function Xi(r,e,t){return t+(ur(r)?Zi:Yi)[e-1]}a(Xi,"computeOrdinal");function Qi(r,e){const t=ur(r)?Zi:Yi,s=t.findIndex(i=>i<e),n=e-t[s];return{month:s+1,day:n}}a(Qi,"uncomputeOrdinal");function js(r,e){return(r-e+7)%7+1}a(js,"isoWeekdayToLocal");function jr(r,e=4,t=1){const{year:s,month:n,day:i}=r,c=Xi(s,n,i),o=js($s(s,n,i),t);let l=Math.floor((c-o+14-e)/7),h;return l<1?(h=s-1,l=hr(h,e,t)):l>hr(s,e,t)?(h=s+1,l=1):h=s,{weekYear:h,weekNumber:l,weekday:o,...Wr(r)}}a(jr,"gregorianToWeek");function eo(r,e=4,t=1){const{weekYear:s,weekNumber:n,weekday:i}=r,c=js($s(s,1,e),t),o=Ht(s);let l=n*7+i-c-7+e,h;l<1?(h=s-1,l+=Ht(h)):l>o?(h=s+1,l-=Ht(s)):h=s;const{month:u,day:g}=Qi(h,l);return{year:h,month:u,day:g,...Wr(r)}}a(eo,"weekToGregorian");function Bs(r){const{year:e,month:t,day:s}=r,n=Xi(e,t,s);return{year:e,ordinal:n,...Wr(r)}}a(Bs,"gregorianToOrdinal");function to(r){const{year:e,ordinal:t}=r,{month:s,day:n}=Qi(e,t);return{year:e,month:s,day:n,...Wr(r)}}a(to,"ordinalToGregorian");function ro(r,e){if(!Y(r.localWeekday)||!Y(r.localWeekNumber)||!Y(r.localWeekYear)){if(!Y(r.weekday)||!Y(r.weekNumber)||!Y(r.weekYear))throw new Vt("Cannot mix locale-based week fields with ISO-based week fields");return Y(r.localWeekday)||(r.weekday=r.localWeekday),Y(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),Y(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}a(ro,"usesLocalWeekValues");function Wl(r,e=4,t=1){const s=Br(r.weekYear),n=tt(r.weekNumber,1,hr(r.weekYear,e,t)),i=tt(r.weekday,1,7);return s?n?i?!1:et("weekday",r.weekday):et("week",r.weekNumber):et("weekYear",r.weekYear)}a(Wl,"hasInvalidWeekData");function zl(r){const e=Br(r.year),t=tt(r.ordinal,1,Ht(r.year));return e?t?!1:et("ordinal",r.ordinal):et("year",r.year)}a(zl,"hasInvalidOrdinalData");function so(r){const e=Br(r.year),t=tt(r.month,1,12),s=tt(r.day,1,Ur(r.year,r.month));return e?t?s?!1:et("day",r.day):et("month",r.month):et("year",r.year)}a(so,"hasInvalidGregorianData");function no(r){const{hour:e,minute:t,second:s,millisecond:n}=r,i=tt(e,0,23)||e===24&&t===0&&s===0&&n===0,c=tt(t,0,59),o=tt(s,0,59),l=tt(n,0,999);return i?c?o?l?!1:et("millisecond",n):et("second",s):et("minute",t):et("hour",e)}a(no,"hasInvalidTimeData");function Y(r){return typeof r>"u"}a(Y,"isUndefined$1");function Tt(r){return typeof r=="number"}a(Tt,"isNumber$1");function Br(r){return typeof r=="number"&&r%1===0}a(Br,"isInteger");function Jl(r){return typeof r=="string"}a(Jl,"isString$1");function Kl(r){return Object.prototype.toString.call(r)==="[object Date]"}a(Kl,"isDate$1");function io(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}a(io,"hasRelative");function oo(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}a(oo,"hasLocaleWeekInfo");function Gl(r){return Array.isArray(r)?r:[r]}a(Gl,"maybeArray");function ao(r,e,t){if(r.length!==0)return r.reduce((s,n)=>{const i=[e(n),n];return s&&t(s[0],i[0])===s[0]?s:i},null)[1]}a(ao,"bestBy");function Yl(r,e){return e.reduce((t,s)=>(t[s]=r[s],t),{})}a(Yl,"pick$1");function qt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}a(qt,"hasOwnProperty$1");function Us(r){if(r==null)return null;if(typeof r!="object")throw new De("Week settings must be an object");if(!tt(r.firstDay,1,7)||!tt(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!tt(e,1,7)))throw new De("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}a(Us,"validateWeekSettings");function tt(r,e,t){return Br(r)&&r>=e&&r<=t}a(tt,"integerBetween");function Zl(r,e){return r-e*Math.floor(r/e)}a(Zl,"floorMod");function ve(r,e=2){const t=r<0;let s;return t?s="-"+(""+-r).padStart(e,"0"):s=(""+r).padStart(e,"0"),s}a(ve,"padStart");function At(r){if(!(Y(r)||r===null||r===""))return parseInt(r,10)}a(At,"parseInteger");function Ct(r){if(!(Y(r)||r===null||r===""))return parseFloat(r)}a(Ct,"parseFloating");function Vs(r){if(!(Y(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}a(Vs,"parseMillis");function qs(r,e,t="round"){const s=10**e;switch(t){case"expand":return r>0?Math.ceil(r*s)/s:Math.floor(r*s)/s;case"trunc":return Math.trunc(r*s)/s;case"round":return Math.round(r*s)/s;case"floor":return Math.floor(r*s)/s;case"ceil":return Math.ceil(r*s)/s;default:throw new RangeError(`Value rounding ${t} is out of range`)}}a(qs,"roundTo");function ur(r){return r%4===0&&(r%100!==0||r%400===0)}a(ur,"isLeapYear");function Ht(r){return ur(r)?366:365}a(Ht,"daysInYear");function Ur(r,e){const t=Zl(e-1,12)+1,s=r+(e-t)/12;return t===2?ur(s)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}a(Ur,"daysInMonth");function Vr(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}a(Vr,"objToLocalTS");function co(r,e,t){return-js($s(r,1,e),t)+e-1}a(co,"firstWeekOffset");function hr(r,e=4,t=1){const s=co(r,e,t),n=co(r+1,e,t);return(Ht(r)-s+n)/7}a(hr,"weeksInWeekYear");function Hs(r){return r>99?r:r>me.twoDigitCutoffYear?1900+r:2e3+r}a(Hs,"untruncateYear");function lo(r,e,t,s=null){const n=new Date(r),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};s&&(i.timeZone=s);const c={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,c).formatToParts(n).find(l=>l.type.toLowerCase()==="timezonename");return o?o.value:null}a(lo,"parseZoneInfo");function qr(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const s=parseInt(e,10)||0,n=t<0||Object.is(t,-0)?-s:s;return t*60+n}a(qr,"signedOffset");function uo(r){const e=Number(r);if(typeof r=="boolean"||r===""||!Number.isFinite(e))throw new De(`Invalid unit value ${r}`);return e}a(uo,"asNumber");function Hr(r,e){const t={};for(const s in r)if(qt(r,s)){const n=r[s];if(n==null)continue;t[e(s)]=uo(n)}return t}a(Hr,"normalizeObject");function dr(r,e){const t=Math.trunc(Math.abs(r/60)),s=Math.trunc(Math.abs(r%60)),n=r>=0?"+":"-";switch(e){case"short":return`${n}${ve(t,2)}:${ve(s,2)}`;case"narrow":return`${n}${t}${s>0?`:${s}`:""}`;case"techie":return`${n}${ve(t,2)}${ve(s,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}a(dr,"formatOffset");function Wr(r){return Yl(r,["hour","minute","second","millisecond"])}a(Wr,"timeObject");const Xl=["January","February","March","April","May","June","July","August","September","October","November","December"],ho=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ql=["J","F","M","A","M","J","J","A","S","O","N","D"];function fo(r){switch(r){case"narrow":return[...Ql];case"short":return[...ho];case"long":return[...Xl];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}a(fo,"months");const po=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],go=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],eu=["M","T","W","T","F","S","S"];function mo(r){switch(r){case"narrow":return[...eu];case"short":return[...go];case"long":return[...po];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}a(mo,"weekdays");const yo=["AM","PM"],tu=["Before Christ","Anno Domini"],ru=["BC","AD"],su=["B","A"];function bo(r){switch(r){case"narrow":return[...su];case"short":return[...ru];case"long":return[...tu];default:return null}}a(bo,"eras");function nu(r){return yo[r.hour<12?0:1]}a(nu,"meridiemForDateTime");function iu(r,e){return mo(e)[r.weekday-1]}a(iu,"weekdayForDateTime");function ou(r,e){return fo(e)[r.month-1]}a(ou,"monthForDateTime");function au(r,e){return bo(e)[r.year<0?0:1]}a(au,"eraForDateTime");function cu(r,e,t="always",s=!1){const n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&i){const g=r==="days";switch(e){case 1:return g?"tomorrow":`next ${n[r][0]}`;case-1:return g?"yesterday":`last ${n[r][0]}`;case 0:return g?"today":`this ${n[r][0]}`}}const c=Object.is(e,-0)||e<0,o=Math.abs(e),l=o===1,h=n[r],u=s?l?h[1]:h[2]||h[1]:l?n[r][0]:r;return c?`${o} ${u} ago`:`in ${o} ${u}`}a(cu,"formatRelativeTime");function _o(r,e){let t="";for(const s of r)s.literal?t+=s.val:t+=e(s.val);return t}a(_o,"stringifyTokens");const lu={D:Fr,DD:_i,DDD:wi,DDDD:Si,t:vi,tt:Ei,ttt:Oi,tttt:Ti,T:Ai,TT:Ii,TTT:ki,TTTT:Ri,f:Ci,ff:Di,fff:Pi,ffff:Fi,F:Ni,FF:Li,FFF:Mi,FFFF:xi};class Le{static{a(this,"Formatter")}static create(e,t={}){return new Le(e,t)}static parseFormat(e){let t=null,s="",n=!1;const i=[];for(let c=0;c<e.length;c++){const o=e.charAt(c);o==="'"?((s.length>0||n)&&i.push({literal:n||/^\s+$/.test(s),val:s===""?"'":s}),t=null,s="",n=!n):n||o===t?s+=o:(s.length>0&&i.push({literal:/^\s+$/.test(s),val:s}),s=o,t=o)}return s.length>0&&i.push({literal:n||/^\s+$/.test(s),val:s}),i}static macroTokenToFormatOpts(e){return lu[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,s=void 0){if(this.opts.forceSimple)return ve(e,t);const n={...this.opts};return t>0&&(n.padTo=t),s&&(n.signDisplay=s),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const s=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=a((d,f)=>this.loc.extract(e,d,f),"string"),c=a(d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"","formatOffset"),o=a(()=>s?nu(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),"meridiem"),l=a((d,f)=>s?ou(e,d):i(f?{month:d}:{month:d,day:"numeric"},"month"),"month"),h=a((d,f)=>s?iu(e,d):i(f?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),"weekday"),u=a(d=>{const f=Le.macroTokenToFormatOpts(d);return f?this.formatWithSystemDefault(e,f):d},"maybeMacro"),g=a(d=>s?au(e,d):i({era:d},"era"),"era"),p=a(d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return c({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return c({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return c({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return n?i({day:"numeric"},"day"):this.num(e.day);case"dd":return n?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return h("short",!0);case"cccc":return h("long",!0);case"ccccc":return h("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return h("short",!1);case"EEEE":return h("long",!1);case"EEEEE":return h("narrow",!1);case"L":return n?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return n?i({month:"numeric"},"month"):this.num(e.month);case"MM":return n?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return n?i({year:"numeric"},"year"):this.num(e.year);case"yy":return n?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(d)}},"tokenToString");return _o(Le.parseFormat(t),p)}formatDurationFromString(e,t){const s=this.opts.signMode==="negativeLargestOnly"?-1:1,n=a(u=>{switch(u[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},"tokenToField"),i=a((u,g)=>p=>{const d=n(p);if(d){const f=g.isNegativeDuration&&d!==g.largestUnit?s:1;let y;return this.opts.signMode==="negativeLargestOnly"&&d!==g.largestUnit?y="never":this.opts.signMode==="all"?y="always":y="auto",this.num(u.get(d)*f,p.length,y)}else return p},"tokenToString"),c=Le.parseFormat(t),o=c.reduce((u,{literal:g,val:p})=>g?u:u.concat(p),[]),l=e.shiftTo(...o.map(n).filter(u=>u)),h={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return _o(c,i(l,h))}}const wo=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Wt(...r){const e=r.reduce((t,s)=>t+s.source,"");return RegExp(`^${e}$`)}a(Wt,"combineRegexes");function zt(...r){return e=>r.reduce(([t,s,n],i)=>{const[c,o,l]=i(e,n);return[{...t,...c},o||s,l]},[{},null,1]).slice(0,2)}a(zt,"combineExtractors");function Jt(r,...e){if(r==null)return[null,null];for(const[t,s]of e){const n=t.exec(r);if(n)return s(n)}return[null,null]}a(Jt,"parse");function So(...r){return(e,t)=>{const s={};let n;for(n=0;n<r.length;n++)s[r[n]]=At(e[t+n]);return[s,null,t+n]}}a(So,"simpleParse");const vo=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,uu=`(?:${vo.source}?(?:\\[(${wo.source})\\])?)?`,Ws=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Eo=RegExp(`${Ws.source}${uu}`),zs=RegExp(`(?:[Tt]${Eo.source})?`),hu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,du=/(\d{4})-?W(\d\d)(?:-?(\d))?/,fu=/(\d{4})-?(\d{3})/,pu=So("weekYear","weekNumber","weekDay"),gu=So("year","ordinal"),mu=/(\d{4})-(\d\d)-(\d\d)/,Oo=RegExp(`${Ws.source} ?(?:${vo.source}|(${wo.source}))?`),yu=RegExp(`(?: ${Oo.source})?`);function Kt(r,e,t){const s=r[e];return Y(s)?t:At(s)}a(Kt,"int");function bu(r,e){return[{year:Kt(r,e),month:Kt(r,e+1,1),day:Kt(r,e+2,1)},null,e+3]}a(bu,"extractISOYmd");function Gt(r,e){return[{hours:Kt(r,e,0),minutes:Kt(r,e+1,0),seconds:Kt(r,e+2,0),milliseconds:Vs(r[e+3])},null,e+4]}a(Gt,"extractISOTime");function fr(r,e){const t=!r[e]&&!r[e+1],s=qr(r[e+1],r[e+2]),n=t?null:Ve.instance(s);return[{},n,e+3]}a(fr,"extractISOOffset");function pr(r,e){const t=r[e]?gt.create(r[e]):null;return[{},t,e+1]}a(pr,"extractIANAZone");const _u=RegExp(`^T?${Ws.source}$`),wu=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Su(r){const[e,t,s,n,i,c,o,l,h]=r,u=e[0]==="-",g=l&&l[0]==="-",p=a((d,f=!1)=>d!==void 0&&(f||d&&u)?-d:d,"maybeNegate");return[{years:p(Ct(t)),months:p(Ct(s)),weeks:p(Ct(n)),days:p(Ct(i)),hours:p(Ct(c)),minutes:p(Ct(o)),seconds:p(Ct(l),l==="-0"),milliseconds:p(Vs(h),g)}]}a(Su,"extractISODuration");const vu={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Js(r,e,t,s,n,i,c){const o={year:e.length===2?Hs(At(e)):At(e),month:ho.indexOf(t)+1,day:At(s),hour:At(n),minute:At(i)};return c&&(o.second=At(c)),r&&(o.weekday=r.length>3?po.indexOf(r)+1:go.indexOf(r)+1),o}a(Js,"fromStrings");const Eu=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Ou(r){const[,e,t,s,n,i,c,o,l,h,u,g]=r,p=Js(e,n,s,t,i,c,o);let d;return l?d=vu[l]:h?d=0:d=qr(u,g),[p,new Ve(d)]}a(Ou,"extractRFC2822");function Tu(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}a(Tu,"preprocessRFC2822");const Au=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Iu=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,ku=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function To(r){const[,e,t,s,n,i,c,o]=r;return[Js(e,n,s,t,i,c,o),Ve.utcInstance]}a(To,"extractRFC1123Or850");function Ru(r){const[,e,t,s,n,i,c,o]=r;return[Js(e,o,t,s,n,i,c),Ve.utcInstance]}a(Ru,"extractASCII");const Cu=Wt(hu,zs),Nu=Wt(du,zs),Du=Wt(fu,zs),Lu=Wt(Eo),Ao=zt(bu,Gt,fr,pr),Pu=zt(pu,Gt,fr,pr),Mu=zt(gu,Gt,fr,pr),Fu=zt(Gt,fr,pr);function xu(r){return Jt(r,[Cu,Ao],[Nu,Pu],[Du,Mu],[Lu,Fu])}a(xu,"parseISODate");function $u(r){return Jt(Tu(r),[Eu,Ou])}a($u,"parseRFC2822Date");function ju(r){return Jt(r,[Au,To],[Iu,To],[ku,Ru])}a(ju,"parseHTTPDate");function Bu(r){return Jt(r,[wu,Su])}a(Bu,"parseISODuration");const Uu=zt(Gt);function Vu(r){return Jt(r,[_u,Uu])}a(Vu,"parseISOTimeOnly");const qu=Wt(mu,yu),Hu=Wt(Oo),Wu=zt(Gt,fr,pr);function zu(r){return Jt(r,[qu,Ao],[Hu,Wu])}a(zu,"parseSQL");const Io="Invalid Duration",ko={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Ju={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ko},rt=146097/400,Yt=146097/4800,Ku={years:{quarters:4,months:12,weeks:rt/7,days:rt,hours:rt*24,minutes:rt*24*60,seconds:rt*24*60*60,milliseconds:rt*24*60*60*1e3},quarters:{months:3,weeks:rt/28,days:rt/4,hours:rt*24/4,minutes:rt*24*60/4,seconds:rt*24*60*60/4,milliseconds:rt*24*60*60*1e3/4},months:{weeks:Yt/7,days:Yt,hours:Yt*24,minutes:Yt*24*60,seconds:Yt*24*60*60,milliseconds:Yt*24*60*60*1e3},...ko},Nt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Gu=Nt.slice(0).reverse();function mt(r,e,t=!1){const s={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new te(s)}a(mt,"clone$1");function Ro(r,e){let t=e.milliseconds??0;for(const s of Gu.slice(1))e[s]&&(t+=e[s]*r[s].milliseconds);return t}a(Ro,"durationToMillis");function Co(r,e){const t=Ro(r,e)<0?-1:1;Nt.reduceRight((s,n)=>{if(Y(e[n]))return s;if(s){const i=e[s]*t,c=r[n][s],o=Math.floor(i/c);e[n]+=o*t,e[s]-=o*c*t}return n},null),Nt.reduce((s,n)=>{if(Y(e[n]))return s;if(s){const i=e[s]%1;e[s]-=i,e[n]+=i*r[s][n]}return n},null)}a(Co,"normalizeValues");function No(r){const e={};for(const[t,s]of Object.entries(r))s!==0&&(e[t]=s);return e}a(No,"removeZeroes");class te{static{a(this,"Duration")}constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let s=t?Ku:Ju;e.matrix&&(s=e.matrix),this.values=e.values,this.loc=e.loc||ae.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=s,this.isLuxonDuration=!0}static fromMillis(e,t){return te.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new De(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new te({values:Hr(e,te.normalizeUnit),loc:ae.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Tt(e))return te.fromMillis(e);if(te.isDuration(e))return e;if(typeof e=="object")return te.fromObject(e);throw new De(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[s]=Bu(e);return s?te.fromObject(s,t):te.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[s]=Vu(e);return s?te.fromObject(s,t):te.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new De("need to specify a reason the Duration is invalid");const s=e instanceof at?e:new at(e,t);if(me.throwOnInvalid)throw new Sl(s);return new te({invalid:s})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new bi(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const s={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Le.create(this.loc,s).formatDurationFromString(this,e):Io}toHuman(e={}){if(!this.isValid)return Io;const t=e.showZeros!==!1,s=Nt.map(n=>{const i=this.values[n];return Y(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(i)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(s)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=qs(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},H.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Ro(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=te.fromDurationLike(e),s={};for(const n of Nt)(qt(t.values,n)||qt(this.values,n))&&(s[n]=t.get(n)+this.get(n));return mt(this,{values:s},!0)}minus(e){if(!this.isValid)return this;const t=te.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const s of Object.keys(this.values))t[s]=uo(e(this.values[s],s));return mt(this,{values:t},!0)}get(e){return this[te.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Hr(e,te.normalizeUnit)};return mt(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:s,matrix:n}={}){const c={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:s};return mt(this,c)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Co(this.matrix,e),mt(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=No(this.normalize().shiftToAll().toObject());return mt(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(c=>te.normalizeUnit(c));const t={},s={},n=this.toObject();let i;for(const c of Nt)if(e.indexOf(c)>=0){i=c;let o=0;for(const h in s)o+=this.matrix[h][c]*s[h],s[h]=0;Tt(n[c])&&(o+=n[c]);const l=Math.trunc(o);t[c]=l,s[c]=(o*1e3-l*1e3)/1e3}else Tt(n[c])&&(s[c]=n[c]);for(const c in s)s[c]!==0&&(t[i]+=c===i?s[c]:s[c]/this.matrix[i][c]);return Co(this.matrix,t),mt(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return mt(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=No(this.values);return mt(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(s,n){return s===void 0||s===0?n===void 0||n===0:s===n}a(t,"eq");for(const s of Nt)if(!t(this.values[s],e.values[s]))return!1;return!0}}const Zt="Invalid Interval";function Yu(r,e){return!r||!r.isValid?ye.invalid("missing or invalid start"):!e||!e.isValid?ye.invalid("missing or invalid end"):e<r?ye.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}a(Yu,"validateStartEnd");class ye{static{a(this,"Interval")}constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new De("need to specify a reason the Interval is invalid");const s=e instanceof at?e:new at(e,t);if(me.throwOnInvalid)throw new wl(s);return new ye({invalid:s})}static fromDateTimes(e,t){const s=yr(e),n=yr(t),i=Yu(s,n);return i??new ye({start:s,end:n})}static after(e,t){const s=te.fromDurationLike(t),n=yr(e);return ye.fromDateTimes(n,n.plus(s))}static before(e,t){const s=te.fromDurationLike(t),n=yr(e);return ye.fromDateTimes(n.minus(s),n)}static fromISO(e,t){const[s,n]=(e||"").split("/",2);if(s&&n){let i,c;try{i=H.fromISO(s,t),c=i.isValid}catch{c=!1}let o,l;try{o=H.fromISO(n,t),l=o.isValid}catch{l=!1}if(c&&l)return ye.fromDateTimes(i,o);if(c){const h=te.fromISO(n,t);if(h.isValid)return ye.after(i,h)}else if(l){const h=te.fromISO(s,t);if(h.isValid)return ye.before(o,h)}}return ye.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const s=this.start.startOf(e,t);let n;return t?.useLocaleWeeks?n=this.end.reconfigure({locale:s.locale}):n=this.end,n=n.startOf(e,t),Math.floor(n.diff(s,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?ye.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(yr).filter(c=>this.contains(c)).sort((c,o)=>c.toMillis()-o.toMillis()),s=[];let{s:n}=this,i=0;for(;n<this.e;){const c=t[i]||this.e,o=+c>+this.e?this.e:c;s.push(ye.fromDateTimes(n,o)),n=o,i+=1}return s}splitBy(e){const t=te.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s}=this,n=1,i;const c=[];for(;s<this.e;){const o=this.start.plus(t.mapUnits(l=>l*n));i=+o>+this.e?this.e:o,c.push(ye.fromDateTimes(s,i)),s=i,n+=1}return c}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,s=this.e<e.e?this.e:e.e;return t>=s?null:ye.fromDateTimes(t,s)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,s=this.e>e.e?this.e:e.e;return ye.fromDateTimes(t,s)}static merge(e){const[t,s]=e.sort((n,i)=>n.s-i.s).reduce(([n,i],c)=>i?i.overlaps(c)||i.abutsStart(c)?[n,i.union(c)]:[n.concat([i]),c]:[n,c],[[],null]);return s&&t.push(s),t}static xor(e){let t=null,s=0;const n=[],i=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),c=Array.prototype.concat(...i),o=c.sort((l,h)=>l.time-h.time);for(const l of o)s+=l.type==="s"?1:-1,s===1?t=l.time:(t&&+t!=+l.time&&n.push(ye.fromDateTimes(t,l.time)),t=null);return ye.merge(n)}difference(...e){return ye.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Zt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Fr,t={}){return this.isValid?Le.create(this.s.loc.clone(t),e).formatInterval(this):Zt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Zt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Zt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Zt}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Zt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):te.invalid(this.invalidReason)}mapEndpoints(e){return ye.fromDateTimes(e(this.s),e(this.e))}}class zr{static{a(this,"Info")}static hasDST(e=me.defaultZone){const t=H.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return gt.isValidZone(e)}static normalizeZone(e){return Ot(e,me.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||ae.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||ae.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||ae.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||ae.create(t,s,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||ae.create(t,s,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null}={}){return(n||ae.create(t,s,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:n=null}={}){return(n||ae.create(t,s,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return ae.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return ae.create(t,null,"gregory").eras(e)}static features(){return{relative:io(),localeWeek:oo()}}}function Do(r,e){const t=a(n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),"utcDayStart"),s=t(e)-t(r);return Math.floor(te.fromMillis(s).as("days"))}a(Do,"dayDiff");function Zu(r,e,t){const s=[["years",(l,h)=>h.year-l.year],["quarters",(l,h)=>h.quarter-l.quarter+(h.year-l.year)*4],["months",(l,h)=>h.month-l.month+(h.year-l.year)*12],["weeks",(l,h)=>{const u=Do(l,h);return(u-u%7)/7}],["days",Do]],n={},i=r;let c,o;for(const[l,h]of s)t.indexOf(l)>=0&&(c=l,n[l]=h(r,e),o=i.plus(n),o>e?(n[l]--,r=i.plus(n),r>e&&(o=r,n[l]--,r=i.plus(n))):r=o);return[r,n,o,c]}a(Zu,"highOrderDiffs");function Xu(r,e,t,s){let[n,i,c,o]=Zu(r,e,t);const l=e-n,h=t.filter(g=>["hours","minutes","seconds","milliseconds"].indexOf(g)>=0);h.length===0&&(c<e&&(c=n.plus({[o]:1})),c!==n&&(i[o]=(i[o]||0)+l/(c-n)));const u=te.fromObject(i,s);return h.length>0?te.fromMillis(l,s).shiftTo(...h).plus(u):u}a(Xu,"diff");const Qu="missing Intl.DateTimeFormat.formatToParts support";function ie(r,e=t=>t){return{regex:r,deser:a(([t])=>e(ql(t)),"deser")}}a(ie,"intUnit");const Lo="[ \xA0]",Po=new RegExp(Lo,"g");function eh(r){return r.replace(/\./g,"\\.?").replace(Po,Lo)}a(eh,"fixListRegex");function Mo(r){return r.replace(/\./g,"").replace(Po," ").toLowerCase()}a(Mo,"stripInsensitivities");function ct(r,e){return r===null?null:{regex:RegExp(r.map(eh).join("|")),deser:a(([t])=>r.findIndex(s=>Mo(t)===Mo(s))+e,"deser")}}a(ct,"oneOf");function Fo(r,e){return{regex:r,deser:a(([,t,s])=>qr(t,s),"deser"),groups:e}}a(Fo,"offset");function Jr(r){return{regex:r,deser:a(([e])=>e,"deser")}}a(Jr,"simple");function th(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}a(th,"escapeToken");function rh(r,e){const t=ot(e),s=ot(e,"{2}"),n=ot(e,"{3}"),i=ot(e,"{4}"),c=ot(e,"{6}"),o=ot(e,"{1,2}"),l=ot(e,"{1,3}"),h=ot(e,"{1,6}"),u=ot(e,"{1,9}"),g=ot(e,"{2,4}"),p=ot(e,"{4,6}"),d=a(b=>({regex:RegExp(th(b.val)),deser:a(([m])=>m,"deser"),literal:!0}),"literal"),y=a(b=>{if(r.literal)return d(b);switch(b.val){case"G":return ct(e.eras("short"),0);case"GG":return ct(e.eras("long"),0);case"y":return ie(h);case"yy":return ie(g,Hs);case"yyyy":return ie(i);case"yyyyy":return ie(p);case"yyyyyy":return ie(c);case"M":return ie(o);case"MM":return ie(s);case"MMM":return ct(e.months("short",!0),1);case"MMMM":return ct(e.months("long",!0),1);case"L":return ie(o);case"LL":return ie(s);case"LLL":return ct(e.months("short",!1),1);case"LLLL":return ct(e.months("long",!1),1);case"d":return ie(o);case"dd":return ie(s);case"o":return ie(l);case"ooo":return ie(n);case"HH":return ie(s);case"H":return ie(o);case"hh":return ie(s);case"h":return ie(o);case"mm":return ie(s);case"m":return ie(o);case"q":return ie(o);case"qq":return ie(s);case"s":return ie(o);case"ss":return ie(s);case"S":return ie(l);case"SSS":return ie(n);case"u":return Jr(u);case"uu":return Jr(o);case"uuu":return ie(t);case"a":return ct(e.meridiems(),0);case"kkkk":return ie(i);case"kk":return ie(g,Hs);case"W":return ie(o);case"WW":return ie(s);case"E":case"c":return ie(t);case"EEE":return ct(e.weekdays("short",!1),1);case"EEEE":return ct(e.weekdays("long",!1),1);case"ccc":return ct(e.weekdays("short",!0),1);case"cccc":return ct(e.weekdays("long",!0),1);case"Z":case"ZZ":return Fo(new RegExp(`([+-]${o.source})(?::(${s.source}))?`),2);case"ZZZ":return Fo(new RegExp(`([+-]${o.source})(${s.source})?`),2);case"z":return Jr(/[a-z_+-/]{1,256}?/i);case" ":return Jr(/[^\S\n\r]/);default:return d(b)}},"unitate")(r)||{invalidReason:Qu};return y.token=r,y}a(rh,"unitForToken");const sh={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function nh(r,e,t){const{type:s,value:n}=r;if(s==="literal"){const l=/^\s+$/.test(n);return{literal:!l,val:l?" ":n}}const i=e[s];let c=s;s==="hour"&&(e.hour12!=null?c=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?c="hour12":c="hour24":c=t.hour12?"hour12":"hour24");let o=sh[c];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}a(nh,"tokenForPart");function ih(r){return[`^${r.map(t=>t.regex).reduce((t,s)=>`${t}(${s.source})`,"")}$`,r]}a(ih,"buildRegex");function oh(r,e,t){const s=r.match(e);if(s){const n={};let i=1;for(const c in t)if(qt(t,c)){const o=t[c],l=o.groups?o.groups+1:1;!o.literal&&o.token&&(n[o.token.val[0]]=o.deser(s.slice(i,i+l))),i+=l}return[s,n]}else return[s,{}]}a(oh,"match");function ah(r){const e=a(i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},"toField");let t=null,s;return Y(r.z)||(t=gt.create(r.z)),Y(r.Z)||(t||(t=new Ve(r.Z)),s=r.Z),Y(r.q)||(r.M=(r.q-1)*3+1),Y(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),Y(r.u)||(r.S=Vs(r.u)),[Object.keys(r).reduce((i,c)=>{const o=e(c);return o&&(i[o]=r[c]),i},{}),t,s]}a(ah,"dateTimeFromMatches");let Ks=null;function ch(){return Ks||(Ks=H.fromMillis(1555555555555)),Ks}a(ch,"getDummyDateTime");function lh(r,e){if(r.literal)return r;const t=Le.macroTokenToFormatOpts(r.val),s=Bo(t,e);return s==null||s.includes(void 0)?r:s}a(lh,"maybeExpandMacroToken");function xo(r,e){return Array.prototype.concat(...r.map(t=>lh(t,e)))}a(xo,"expandMacroTokens");class $o{static{a(this,"TokenParser")}constructor(e,t){if(this.locale=e,this.format=t,this.tokens=xo(Le.parseFormat(t),e),this.units=this.tokens.map(s=>rh(s,e)),this.disqualifyingUnit=this.units.find(s=>s.invalidReason),!this.disqualifyingUnit){const[s,n]=ih(this.units);this.regex=RegExp(s,"i"),this.handlers=n}}explainFromTokens(e){if(this.isValid){const[t,s]=oh(e,this.regex,this.handlers),[n,i,c]=s?ah(s):[null,null,void 0];if(qt(s,"a")&&qt(s,"H"))throw new Vt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:s,result:n,zone:i,specificOffset:c}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function jo(r,e,t){return new $o(r,t).explainFromTokens(e)}a(jo,"explainFromTokens");function uh(r,e,t){const{result:s,zone:n,specificOffset:i,invalidReason:c}=jo(r,e,t);return[s,n,i,c]}a(uh,"parseFromTokens");function Bo(r,e){if(!r)return null;const s=Le.create(e,r).dtFormatter(ch()),n=s.formatToParts(),i=s.resolvedOptions();return n.map(c=>nh(c,r,i))}a(Bo,"formatOptsToTokens");const Gs="Invalid DateTime",Uo=864e13;function gr(r){return new at("unsupported zone",`the zone "${r.name}" is not supported`)}a(gr,"unsupportedZone");function Ys(r){return r.weekData===null&&(r.weekData=jr(r.c)),r.weekData}a(Ys,"possiblyCachedWeekData");function Zs(r){return r.localWeekData===null&&(r.localWeekData=jr(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}a(Zs,"possiblyCachedLocalWeekData");function Dt(r,e){const t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new H({...t,...e,old:t})}a(Dt,"clone");function Vo(r,e,t){let s=r-e*60*1e3;const n=t.offset(s);if(e===n)return[s,e];s-=(n-e)*60*1e3;const i=t.offset(s);return n===i?[s,n]:[r-Math.min(n,i)*60*1e3,Math.max(n,i)]}a(Vo,"fixOffset");function Kr(r,e){r+=e*60*1e3;const t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}a(Kr,"tsToObj");function Gr(r,e,t){return Vo(Vr(r),e,t)}a(Gr,"objToTS");function qo(r,e){const t=r.o,s=r.c.year+Math.trunc(e.years),n=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...r.c,year:s,month:n,day:Math.min(r.c.day,Ur(s,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},c=te.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Vr(i);let[l,h]=Vo(o,t,r.zone);return c!==0&&(l+=c,h=r.zone.offset(l)),{ts:l,o:h}}a(qo,"adjustTime");function Xt(r,e,t,s,n,i){const{setZone:c,zone:o}=t;if(r&&Object.keys(r).length!==0||e){const l=e||o,h=H.fromObject(r,{...t,zone:l,specificOffset:i});return c?h:h.setZone(o)}else return H.invalid(new at("unparsable",`the input "${n}" can't be parsed as ${s}`))}a(Xt,"parseDataToDateTime");function Yr(r,e,t=!0){return r.isValid?Le.create(ae.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}a(Yr,"toTechFormat");function Xs(r,e,t){const s=r.c.year>9999||r.c.year<0;let n="";if(s&&r.c.year>=0&&(n+="+"),n+=ve(r.c.year,s?6:4),t==="year")return n;if(e){if(n+="-",n+=ve(r.c.month),t==="month")return n;n+="-"}else if(n+=ve(r.c.month),t==="month")return n;return n+=ve(r.c.day),n}a(Xs,"toISODate");function Ho(r,e,t,s,n,i,c){let o=!t||r.c.millisecond!==0||r.c.second!==0,l="";switch(c){case"day":case"month":case"year":break;default:if(l+=ve(r.c.hour),c==="hour")break;if(e){if(l+=":",l+=ve(r.c.minute),c==="minute")break;o&&(l+=":",l+=ve(r.c.second))}else{if(l+=ve(r.c.minute),c==="minute")break;o&&(l+=ve(r.c.second))}if(c==="second")break;o&&(!s||r.c.millisecond!==0)&&(l+=".",l+=ve(r.c.millisecond,3))}return n&&(r.isOffsetFixed&&r.offset===0&&!i?l+="Z":r.o<0?(l+="-",l+=ve(Math.trunc(-r.o/60)),l+=":",l+=ve(Math.trunc(-r.o%60))):(l+="+",l+=ve(Math.trunc(r.o/60)),l+=":",l+=ve(Math.trunc(r.o%60)))),i&&(l+="["+r.zone.ianaName+"]"),l}a(Ho,"toISOTime");const Wo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},hh={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},dh={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Zr=["year","month","day","hour","minute","second","millisecond"],fh=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],ph=["year","ordinal","hour","minute","second","millisecond"];function Xr(r){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new bi(r);return e}a(Xr,"normalizeUnit");function zo(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Xr(r)}}a(zo,"normalizeUnitWithLocalWeeks");function gh(r){if(mr===void 0&&(mr=me.now()),r.type!=="iana")return r.offset(mr);const e=r.name;let t=Qs.get(e);return t===void 0&&(t=r.offset(mr),Qs.set(e,t)),t}a(gh,"guessOffsetForZone");function Jo(r,e){const t=Ot(e.zone,me.defaultZone);if(!t.isValid)return H.invalid(gr(t));const s=ae.fromObject(e);let n,i;if(Y(r.year))n=me.now();else{for(const l of Zr)Y(r[l])&&(r[l]=Wo[l]);const c=so(r)||no(r);if(c)return H.invalid(c);const o=gh(t);[n,i]=Gr(r,o,t)}return new H({ts:n,zone:t,loc:s,o:i})}a(Jo,"quickDT");function Ko(r,e,t){const s=Y(t.round)?!0:t.round,n=Y(t.rounding)?"trunc":t.rounding,i=a((o,l)=>(o=qs(o,s||t.calendary?0:2,t.calendary?"round":n),e.loc.clone(t).relFormatter(t).format(o,l)),"format"),c=a(o=>t.calendary?e.hasSame(r,o)?0:e.startOf(o).diff(r.startOf(o),o).get(o):e.diff(r,o).get(o),"differ");if(t.unit)return i(c(t.unit),t.unit);for(const o of t.units){const l=c(o);if(Math.abs(l)>=1)return i(l,o)}return i(r>e?-0:0,t.units[t.units.length-1])}a(Ko,"diffRelative");function Go(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}a(Go,"lastOpts");let mr;const Qs=new Map;class H{static{a(this,"DateTime")}constructor(e){const t=e.zone||me.defaultZone;let s=e.invalid||(Number.isNaN(e.ts)?new at("invalid input"):null)||(t.isValid?null:gr(t));this.ts=Y(e.ts)?me.now():e.ts;let n=null,i=null;if(!s)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{const o=Tt(e.o)&&!e.old?e.o:t.offset(this.ts);n=Kr(this.ts,o),s=Number.isNaN(n.year)?new at("invalid input"):null,n=s?null:n,i=s?null:o}this._zone=t,this.loc=e.loc||ae.create(),this.invalid=s,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new H({})}static local(){const[e,t]=Go(arguments),[s,n,i,c,o,l,h]=t;return Jo({year:s,month:n,day:i,hour:c,minute:o,second:l,millisecond:h},e)}static utc(){const[e,t]=Go(arguments),[s,n,i,c,o,l,h]=t;return e.zone=Ve.utcInstance,Jo({year:s,month:n,day:i,hour:c,minute:o,second:l,millisecond:h},e)}static fromJSDate(e,t={}){const s=Kl(e)?e.valueOf():NaN;if(Number.isNaN(s))return H.invalid("invalid input");const n=Ot(t.zone,me.defaultZone);return n.isValid?new H({ts:s,zone:n,loc:ae.fromObject(t)}):H.invalid(gr(n))}static fromMillis(e,t={}){if(Tt(e))return e<-Uo||e>Uo?H.invalid("Timestamp out of range"):new H({ts:e,zone:Ot(t.zone,me.defaultZone),loc:ae.fromObject(t)});throw new De(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Tt(e))return new H({ts:e*1e3,zone:Ot(t.zone,me.defaultZone),loc:ae.fromObject(t)});throw new De("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const s=Ot(t.zone,me.defaultZone);if(!s.isValid)return H.invalid(gr(s));const n=ae.fromObject(t),i=Hr(e,zo),{minDaysInFirstWeek:c,startOfWeek:o}=ro(i,n),l=me.now(),h=Y(t.specificOffset)?s.offset(l):t.specificOffset,u=!Y(i.ordinal),g=!Y(i.year),p=!Y(i.month)||!Y(i.day),d=g||p,f=i.weekYear||i.weekNumber;if((d||u)&&f)throw new Vt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&u)throw new Vt("Can't mix ordinal dates with month/day");const y=f||i.weekday&&!d;let b,m,_=Kr(l,h);y?(b=fh,m=hh,_=jr(_,c,o)):u?(b=ph,m=dh,_=Bs(_)):(b=Zr,m=Wo);let w=!1;for(const N of b){const B=i[N];Y(B)?w?i[N]=m[N]:i[N]=_[N]:w=!0}const S=y?Wl(i,c,o):u?zl(i):so(i),T=S||no(i);if(T)return H.invalid(T);const v=y?eo(i,c,o):u?to(i):i,[k,O]=Gr(v,h,s),A=new H({ts:k,zone:s,o:O,loc:n});return i.weekday&&d&&e.weekday!==A.weekday?H.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${A.toISO()}`):A.isValid?A:H.invalid(A.invalid)}static fromISO(e,t={}){const[s,n]=xu(e);return Xt(s,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[s,n]=$u(e);return Xt(s,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[s,n]=ju(e);return Xt(s,n,t,"HTTP",t)}static fromFormat(e,t,s={}){if(Y(e)||Y(t))throw new De("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:i=null}=s,c=ae.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,l,h,u]=uh(c,e,t);return u?H.invalid(u):Xt(o,l,s,`format ${t}`,e,h)}static fromString(e,t,s={}){return H.fromFormat(e,t,s)}static fromSQL(e,t={}){const[s,n]=zu(e);return Xt(s,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new De("need to specify a reason the DateTime is invalid");const s=e instanceof at?e:new at(e,t);if(me.throwOnInvalid)throw new _l(s);return new H({invalid:s})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const s=Bo(e,ae.fromObject(t));return s?s.map(n=>n?n.val:null).join(""):null}static expandFormat(e,t={}){return xo(Le.parseFormat(e),ae.fromObject(t)).map(n=>n.val).join("")}static resetCache(){mr=void 0,Qs.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ys(this).weekYear:NaN}get weekNumber(){return this.isValid?Ys(this).weekNumber:NaN}get weekday(){return this.isValid?Ys(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Zs(this).weekday:NaN}get localWeekNumber(){return this.isValid?Zs(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Zs(this).weekYear:NaN}get ordinal(){return this.isValid?Bs(this.c).ordinal:NaN}get monthShort(){return this.isValid?zr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?zr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?zr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?zr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,s=Vr(this.c),n=this.zone.offset(s-e),i=this.zone.offset(s+e),c=this.zone.offset(s-n*t),o=this.zone.offset(s-i*t);if(c===o)return[this];const l=s-c*t,h=s-o*t,u=Kr(l,c),g=Kr(h,o);return u.hour===g.hour&&u.minute===g.minute&&u.second===g.second&&u.millisecond===g.millisecond?[Dt(this,{ts:l}),Dt(this,{ts:h})]:[this]}get isInLeapYear(){return ur(this.year)}get daysInMonth(){return Ur(this.year,this.month)}get daysInYear(){return this.isValid?Ht(this.year):NaN}get weeksInWeekYear(){return this.isValid?hr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?hr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:s,calendar:n}=Le.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:s,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(Ve.instance(e),t)}toLocal(){return this.setZone(me.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:s=!1}={}){if(e=Ot(e,me.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||s){const i=e.offset(this.ts),c=this.toObject();[n]=Gr(c,i,e)}return Dt(this,{ts:n,zone:e})}else return H.invalid(gr(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:s}={}){const n=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:s});return Dt(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Hr(e,zo),{minDaysInFirstWeek:s,startOfWeek:n}=ro(t,this.loc),i=!Y(t.weekYear)||!Y(t.weekNumber)||!Y(t.weekday),c=!Y(t.ordinal),o=!Y(t.year),l=!Y(t.month)||!Y(t.day),h=o||l,u=t.weekYear||t.weekNumber;if((h||c)&&u)throw new Vt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&c)throw new Vt("Can't mix ordinal dates with month/day");let g;i?g=eo({...jr(this.c,s,n),...t},s,n):Y(t.ordinal)?(g={...this.toObject(),...t},Y(t.day)&&(g.day=Math.min(Ur(g.year,g.month),g.day))):g=to({...Bs(this.c),...t});const[p,d]=Gr(g,this.o,this.zone);return Dt(this,{ts:p,o:d})}plus(e){if(!this.isValid)return this;const t=te.fromDurationLike(e);return Dt(this,qo(this,t))}minus(e){if(!this.isValid)return this;const t=te.fromDurationLike(e).negate();return Dt(this,qo(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const s={},n=te.normalizeUnit(e);switch(n){case"years":s.month=1;case"quarters":case"months":s.day=1;case"weeks":case"days":s.hour=0;case"hours":s.minute=0;case"minutes":s.second=0;case"seconds":s.millisecond=0;break}if(n==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:c}=this;c<i&&(s.weekNumber=this.weekNumber-1),s.weekday=i}else s.weekday=1;if(n==="quarters"){const i=Math.ceil(this.month/3);s.month=(i-1)*3+1}return this.set(s)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Le.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Gs}toLocaleString(e=Fr,t={}){return this.isValid?Le.create(this.loc.clone(t),e).formatDateTime(this):Gs}toLocaleParts(e={}){return this.isValid?Le.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:s=!1,includeOffset:n=!0,extendedZone:i=!1,precision:c="milliseconds"}={}){if(!this.isValid)return null;c=Xr(c);const o=e==="extended";let l=Xs(this,o,c);return Zr.indexOf(c)>=3&&(l+="T"),l+=Ho(this,o,t,s,n,i,c),l}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Xs(this,e==="extended",Xr(t)):null}toISOWeekDate(){return Yr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:s=!0,includePrefix:n=!1,extendedZone:i=!1,format:c="extended",precision:o="milliseconds"}={}){return this.isValid?(o=Xr(o),(n&&Zr.indexOf(o)>=3?"T":"")+Ho(this,c==="extended",t,e,s,i,o)):null}toRFC2822(){return Yr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Yr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Xs(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:s=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(s&&(n+=" "),t?n+="z":e&&(n+="ZZ")),Yr(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Gs}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",s={}){if(!this.isValid||!e.isValid)return te.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...s},i=Gl(t).map(te.normalizeUnit),c=e.valueOf()>this.valueOf(),o=c?this:e,l=c?e:this,h=Xu(o,l,i,n);return c?h.negate():h}diffNow(e="milliseconds",t={}){return this.diff(H.now(),e,t)}until(e){return this.isValid?ye.fromDateTimes(this,e):this}hasSame(e,t,s){if(!this.isValid)return!1;const n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,s)<=n&&n<=i.endOf(t,s)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||H.fromObject({},{zone:this.zone}),s=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),Ko(t,this.plus(s),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?Ko(e.base||H.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(H.isDateTime))throw new De("min requires all arguments be DateTimes");return ao(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(H.isDateTime))throw new De("max requires all arguments be DateTimes");return ao(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,s={}){const{locale:n=null,numberingSystem:i=null}=s,c=ae.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return jo(c,e,t)}static fromStringExplain(e,t,s={}){return H.fromFormatExplain(e,t,s)}static buildFormatParser(e,t={}){const{locale:s=null,numberingSystem:n=null}=t,i=ae.fromOpts({locale:s,numberingSystem:n,defaultToEN:!0});return new $o(i,e)}static fromFormatParser(e,t,s={}){if(Y(e)||Y(t))throw new De("fromFormatParser requires an input string and a format parser");const{locale:n=null,numberingSystem:i=null}=s,c=ae.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});if(!c.equals(t.locale))throw new De(`fromFormatParser called with a locale of ${c}, but the format parser was created for ${t.locale}`);const{result:o,zone:l,specificOffset:h,invalidReason:u}=t.explainFromTokens(e);return u?H.invalid(u):Xt(o,l,s,`format ${t.format}`,e,h)}static get DATE_SHORT(){return Fr}static get DATE_MED(){return _i}static get DATE_MED_WITH_WEEKDAY(){return vl}static get DATE_FULL(){return wi}static get DATE_HUGE(){return Si}static get TIME_SIMPLE(){return vi}static get TIME_WITH_SECONDS(){return Ei}static get TIME_WITH_SHORT_OFFSET(){return Oi}static get TIME_WITH_LONG_OFFSET(){return Ti}static get TIME_24_SIMPLE(){return Ai}static get TIME_24_WITH_SECONDS(){return Ii}static get TIME_24_WITH_SHORT_OFFSET(){return ki}static get TIME_24_WITH_LONG_OFFSET(){return Ri}static get DATETIME_SHORT(){return Ci}static get DATETIME_SHORT_WITH_SECONDS(){return Ni}static get DATETIME_MED(){return Di}static get DATETIME_MED_WITH_SECONDS(){return Li}static get DATETIME_MED_WITH_WEEKDAY(){return El}static get DATETIME_FULL(){return Pi}static get DATETIME_FULL_WITH_SECONDS(){return Mi}static get DATETIME_HUGE(){return Fi}static get DATETIME_HUGE_WITH_SECONDS(){return xi}}function yr(r){if(H.isDateTime(r))return r;if(r&&r.valueOf&&Tt(r.valueOf()))return H.fromJSDate(r);if(r&&typeof r=="object")return H.fromObject(r);throw new De(`Unknown datetime argument: ${r}, of type ${typeof r}`)}a(yr,"friendlyDateTime");var mh=Object.defineProperty,yh=a((r,e)=>mh(r,"name",{value:e,configurable:!0}),"o$v");class en{static{a(this,"AbstractFormatter")}static{yh(this,"AbstractFormatter")}dateFormat;constructor(e="YYYY-MM-DD HH:mm:ss"){this.dateFormat=e}_formatTimestamp(e){const t=H.fromJSDate(e);return Math.floor(t.toSeconds()).toFixed(0)}_formatDate(e){return H.fromJSDate(e).toFormat(this.dateFormat.replace(/YYYY/g,"yyyy").replace(/YY/g,"yy").replace(/DD/g,"dd").replace(/D/g,"d"))}}var bh=Object.defineProperty,_h=a((r,e)=>bh(r,"name",{value:e,configurable:!0}),"m$9");class wh extends en{static{a(this,"JsonFormatter")}static{_h(this,"JsonFormatter")}constructor(e="YYYY-MM-DD HH:mm:ss"){super(e)}format(e){return JSON.stringify({channel:e.channel,levelName:e.levelName,message:e.message,context:e.context,extra:e.extra,timestamp:this._formatTimestamp(e.timestamp),date:this._formatDate(e.timestamp)})}}var Sh=Object.defineProperty,vh=a((r,e)=>Sh(r,"name",{value:e,configurable:!0}),"s$y");class Qr extends en{static{a(this,"LineFormatter")}static{vh(this,"LineFormatter")}formatString;constructor(e="[{channel}] {levelName}: {message} {context} {extra} {date}",t="YYYY-MM-DD HH:mm:ss"){super(t),this.formatString=e}format(e){let t=this.formatString;const s={"{channel}":e.channel,"{levelName}":e.levelName,"{message}":e.message,"{context}":JSON.stringify(e.context),"{extra}":JSON.stringify(e.extra),"{timestamp}":this._formatTimestamp(e.timestamp),"{date}":this._formatDate(e.timestamp)};for(const[n,i]of Object.entries(s))t=t.replace(n,i);return t}}var Eh=Object.defineProperty,Oh=a((r,e)=>Eh(r,"name",{value:e,configurable:!0}),"n$d");class Yo extends en{static{a(this,"TelegramFormatter")}static{Oh(this,"TelegramFormatter")}useHtml;maxMessageLength;constructor(e=!0,t="YYYY-MM-DD HH:mm:ss",s=4096){super(t),this.useHtml=e,this.maxMessageLength=s}format(e){let t=this._formatBaseMessage(e);const s=this._formatAdditionalInfo(e);return s&&(t+=`

${s}`),t.length>this.maxMessageLength&&(t=t.substring(0,this.maxMessageLength-3)+"..."),t}_formatBaseMessage(e){const t=this._formatDate(e.timestamp),s=e.levelName;return this.useHtml?`<b>${s}</b> | <code>${e.channel}</code>
<i>Time:</i> ${t}
<i>Message:</i>
${e.message}`:`*${s}* \`${e.channel}\`
_Time:_ \`${t}\`
_Message:_
${e.message}`}_formatAdditionalInfo(e){const t=[];if(e.context&&Object.keys(e.context).length>0){const s=JSON.stringify(e.context,null,2);this.useHtml?t.push(`<i>Context:</i>
<pre><code class="language-json">${this._escapeHtml(s)}</code></pre>`):t.push(`_Context:_
\`\`\`json
${s}
\`\`\``)}if(e.extra&&Object.keys(e.extra).length>0){const s=JSON.stringify(e.extra,null,2);this.useHtml?t.push(`<i>Extra:</i>
<pre><code class="language-json">${this._escapeHtml(s)}</code></pre>`):t.push(`_Extra:_
\`\`\`json
${s}
\`\`\``)}return t.join(`

`)}_escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}_escapeMarkdownV2(e){return e.replace(/_/g,"\\_").replace(/\*/g,"\\*").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/~/g,"\\~").replace(/`/g,"\\`").replace(/>/g,"\\>").replace(/#/g,"\\#").replace(/\+/g,"\\+").replace(/-/g,"\\-").replace(/=/g,"\\=").replace(/\|/g,"\\|").replace(/\{/g,"\\{").replace(/\}/g,"\\}").replace(/\./g,"\\.").replace(/!/g,"\\!")}setUseHtml(e){return this.useHtml=e,this}setMaxMessageLength(e){return this.maxMessageLength=e,this}}var Th=Object.defineProperty,Ah=a((r,e)=>Th(r,"name",{value:e,configurable:!0}),"e$e");const Ih=Ah(r=>(r.extra.pid="?",typeof process<"u"&&process.pid&&(r.extra.pid=process.pid),r),"pidProcessor");var kh=Object.defineProperty,Rh=a((r,e)=>kh(r,"name",{value:e,configurable:!0}),"o$u");const Ch=Rh(r=>(r.extra.memoryUsage="?",typeof process<"u"&&process.memoryUsage&&(r.extra.memoryUsage=Math.round(process.memoryUsage().heapUsed/1024/1024)+"MB"),r),"memoryUsageProcessor");var Nh=Object.defineProperty,Dh=a((r,e)=>Nh(r,"name",{value:e,configurable:!0}),"o$t");class Qt{static{a(this,"AbstractHandler")}static{Dh(this,"AbstractHandler")}level;formatter=null;bubble=!0;constructor(e=J.DEBUG,t){this.level=e,t!==void 0&&(this.bubble=t)}isHandling(e){return e>=this.level}shouldBubble(){return this.bubble}setFormatter(e){this.formatter=e}getFormatter(){return this.formatter}}var Lh=Object.defineProperty,Ph=a((r,e)=>Lh(r,"name",{value:e,configurable:!0}),"c$b");class Zo extends Qt{static{a(this,"ConsoleHandler")}static{Ph(this,"ConsoleHandler")}_styles=new Map;_useStyles;constructor(e=J.DEBUG,t){const s={useStyles:!0,...t};super(e,s.bubble),this._useStyles=s.useStyles,this._initStyles(),this.setFormatter(new Qr)}_initStyles(){const e="color: _color_; background: _bg_; padding: 2px 6px; border-radius: 3px; font-size: 11px;";this._styles.set(J.DEBUG,["%cDEBUG",e.replace("_color_","#666666").replace("_bg_","#F0F0F0")]),this._styles.set(J.INFO,["%cINFO",e.replace("_color_","white").replace("_bg_","#2196F3")]),this._styles.set(J.NOTICE,["%cNOTICE",e.replace("_color_","white").replace("_bg_","#213BF3")]),this._styles.set(J.WARNING,["%cWARN",e.replace("_color_","white").replace("_bg_","#FF9800")]),this._styles.set(J.ERROR,["%cERROR",e.replace("_color_","white").replace("_bg_","#F44336")]),this._styles.set(J.CRITICAL,["%cCRITICAL",e.replace("_color_","white").replace("_bg_","#9C27B0")])}async handle(e){const t=this.getFormatter().format(e);let s=this._getConsoleMethod(e.level);e.context.needTrace===!0&&(s="trace");const n=[];if(this._useStyles&&this._styles.has(e.level)){const i=this._styles.get(e.level);n.push(i[0],i[1])}return n.push(t),console[s](...n.filter(Boolean)),!0}_getConsoleMethod(e){switch(e){case J.INFO:case J.NOTICE:return"info";case J.WARNING:return"warn";case J.ERROR:case J.CRITICAL:case J.ALERT:case J.EMERGENCY:return"error";default:return"log"}}}var Mh=Object.defineProperty,Fh=a((r,e)=>Mh(r,"name",{value:e,configurable:!0}),"a$q");class tn extends Zo{static{a(this,"ConsoleV2Handler")}static{Fh(this,"ConsoleV2Handler")}constructor(e=J.DEBUG,t){super(e,t),this.setFormatter(new Qr("[{channel}]: {message}"))}async handle(e){const t=this.getFormatter().format(e);let s=this._getConsoleMethod(e.level);e.context.needTrace===!0&&(s="trace");const n=e.context&&Object.keys(e.context).length>0?e.context:void 0,i=e.extra&&Object.keys(e.extra).length>0?e.extra:void 0,c=[];if(this._useStyles&&this._styles.has(e.level)){const o=this._styles.get(e.level);c.push(o[0],o[1])}return c.push(t),c.push(n),c.push(i),console[s](...c.filter(Boolean)),!0}}var xh=Object.defineProperty,$h=a((r,e)=>xh(r,"name",{value:e,configurable:!0}),"t$b");class jh extends Qt{static{a(this,"MemoryHandler")}static{$h(this,"MemoryHandler")}records=[];limit;constructor(e=J.DEBUG,t){const s={bubble:!0,limit:1e3,...t};super(e,s.bubble),this.limit=s.limit}async handle(e){return this.records.push(e),this.records.length>this.limit&&this.records.shift(),!0}getRecords(){return[...this.records]}clear(){this.records=[]}}var Bh=Object.defineProperty,Uh=a((r,e)=>Bh(r,"name",{value:e,configurable:!0}),"s$u");class Vh extends Qt{static{a(this,"StreamHandler")}static{Uh(this,"StreamHandler")}stream;constructor(e=J.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.stream=s.stream,this.setFormatter(new Qr)}async handle(e){try{const t=this.getFormatter().format(e)+`
`;this.stream.write(t)}catch(t){return console.error(`StreamHandler write error: ${t}`),!1}return!0}async close(){if(typeof this.stream.end=="function")return new Promise((e,t)=>{this.stream.end(s=>{s?t(s):e()})})}}var qh=Object.defineProperty,Hh=a((r,e)=>qh(r,"name",{value:e,configurable:!0}),"o$s");class Wh extends Qt{static{a(this,"ConsolaAdapter")}static{Hh(this,"ConsolaAdapter")}consolaInstance;constructor(e=J.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.consolaInstance=s.consolaInstance}setFormatter(e){}getFormatter(){return null}async handle(e){const t=`[${e.channel}] ${e.levelName}: ${e.message}`,s={...e.context,...e.extra,timestamp:e.timestamp};switch(e.level){case J.DEBUG:this.consolaInstance.log(t,s);break;case J.INFO:this.consolaInstance.info(t,s);break;case J.NOTICE:this.consolaInstance.success(t,s);break;case J.WARNING:this.consolaInstance.warn(t,s);break;case J.ERROR:case J.CRITICAL:case J.ALERT:case J.EMERGENCY:this.consolaInstance.error(t,s);break;default:this.consolaInstance.log(t,s)}return!0}}var zh=Object.defineProperty,Jh=a((r,e)=>zh(r,"name",{value:e,configurable:!0}),"n$c");class Kh extends Qt{static{a(this,"WinstonAdapter")}static{Jh(this,"WinstonAdapter")}winstonLogger;constructor(e=J.DEBUG,t){const s={bubble:!0,...t};super(e,s.bubble),this.winstonLogger=s.winstonLogger}setFormatter(e){}getFormatter(){return null}async handle(e){const t={DEBUG:"debug",INFO:"info",NOTICE:"notice",WARNING:"warn",ERROR:"error",CRITICAL:"error",ALERT:"error",EMERGENCY:"error"},s=t[e.levelName]||t.INFO;return this.winstonLogger.log({level:s,channel:e.channel,message:e.message,context:e.context,extra:e.extra,timestamp:e.timestamp}),!0}}var Gh=Object.defineProperty,Yh=a((r,e)=>Gh(r,"name",{value:e,configurable:!0}),"e$d"),br=(r=>(r.UNKNOWN="unknown",r.BROWSE="browser",r.NODE="node",r))(br||{});function es(){return typeof window<"u"&&typeof window.document<"u"?"browser":typeof process<"u"&&process.versions&&process.versions.node?"node":"unknown"}a(es,"getEnvironment"),Yh(es,"getEnvironment");var Zh=Object.defineProperty,Xh=a((r,e)=>Zh(r,"name",{value:e,configurable:!0}),"s$s");class Qh extends Qt{static{a(this,"TelegramHandler")}static{Xh(this,"TelegramHandler")}botToken;chatId;parseMode;disableNotification;disableWebPagePreview;environment;warnInBrowser;constructor(e=J.ERROR,t){if(super(e,t.bubble),!t.botToken)throw new Error("botToken is required for TelegramHandler");if(!t.chatId)throw new Error("chatId is required for TelegramHandler");this.botToken=t.botToken,this.chatId=t.chatId,this.parseMode=t.parseMode||"HTML",this.disableNotification=t.disableNotification||!1,this.disableWebPagePreview=t.disableWebPagePreview||!0,this.environment=es(),this.warnInBrowser=t.warnInBrowser!==!1,this.setFormatter(new Yo(this.parseMode==="HTML"))}async handle(e){const t=this.getFormatter();if(!t)return console.error("TelegramHandler: No formatter set"),!1;const s=t.format(e);return this.environment===br.BROWSE?this._handleInBrowser(s,e):this.environment===br.NODE?this._handleInNode(s,e):(console.warn("TelegramHandler: Unknown environment, using fallback"),this._handleFallback(s))}async _handleInBrowser(e,t){if(this.warnInBrowser){const s=`\u26A0\uFE0F TelegramHandler: Cannot send logs to Telegram from browser environment.
This would expose your bot token. Consider disabling this handler in browser.
Log message: ${t.message}
If you need to send logs from browser, use a proxy server.`;console.warn(s),console.log("%cTelegram Handler Warning","color: #FF9800; background: #FFF3E0; padding: 8px; border: 1px solid #FFB74D; border-radius: 4px;",s)}return!1}async _handleInNode(e,t){try{const s=`https://api.telegram.org/bot${this.botToken}/sendMessage`,n=JSON.stringify({chat_id:this.chatId,text:e,parse_mode:this.parseMode,disable_notification:this.disableNotification,disable_web_page_preview:this.disableWebPagePreview}),i=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:n})).json();return i.ok?!0:(console.error("TelegramHandler: Failed to send message",i),!1)}catch(s){return console.error("TelegramHandler: Error sending message",s),!1}}async _handleFallback(e){return console.log("TelegramHandler (fallback):",e),!1}updateSettings(e){return e.botToken&&(this.botToken=e.botToken),e.chatId&&(this.chatId=e.chatId),e.parseMode&&(this.parseMode=e.parseMode),e.disableNotification!==void 0&&(this.disableNotification=e.disableNotification),e.disableWebPagePreview!==void 0&&(this.disableWebPagePreview=e.disableWebPagePreview),e.warnInBrowser!==void 0&&(this.warnInBrowser=e.warnInBrowser),this}getEnvironment(){return this.environment}async testConnection(){if(this.environment==="browser")return console.warn("TelegramHandler: Cannot test connection in browser environment"),!1;try{const e=`https://api.telegram.org/bot${this.botToken}/getMe`;return(await(await fetch(e)).json()).ok===!0}catch(e){return console.error("TelegramHandler: Test connection failed",e),!1}}}var ed=Object.defineProperty,td=a((r,e)=>ed(r,"name",{value:e,configurable:!0}),"n$b");class rn{static{a(this,"AbstractLogger")}static{td(this,"AbstractLogger")}async debug(e,t){return this.log(J.DEBUG,e,t)}async info(e,t){return this.log(J.INFO,e,t)}async notice(e,t){return this.log(J.NOTICE,e,t)}async warning(e,t){return this.log(J.WARNING,e,t)}async error(e,t){return this.log(J.ERROR,e,t)}async critical(e,t){return this.log(J.CRITICAL,e,t)}async alert(e,t){return this.log(J.ALERT,e,t)}async emergency(e,t){return this.log(J.EMERGENCY,e,t)}}var rd=Object.defineProperty,sd=a((r,e)=>rd(r,"name",{value:e,configurable:!0}),"r$i");class _r extends rn{static{a(this,"NullLogger")}static{sd(this,"NullLogger")}static create(){return new _r}async log(e,t,s){}}var nd=Object.defineProperty,id=a((r,e)=>nd(r,"name",{value:e,configurable:!0}),"a$o");class wr extends rn{static{a(this,"Logger")}static{id(this,"Logger")}channel;handlers=[];processors=[];constructor(e){super(),this.channel=e}static create(e){return new wr(e)}pushHandler(e){return this.handlers.push(e),this}popHandler(){return this.handlers.pop()||null}setHandlers(e){return this.handlers=e,this}pushProcessor(e){return this.processors.push(e),this}async log(e,t,s){let n={channel:this.channel,level:e,levelName:J[e],message:t,context:s??{},extra:{},timestamp:new Date};for(const i of this.processors)try{n=i(n)}catch(c){this.reportLoggingFailure(i,c)}for(const i of this.handlers)try{if(!i.isHandling(e))continue;if(await i.handle(n)&&!i.shouldBubble())break}catch(c){this.reportLoggingFailure(i,c)}}reportLoggingFailure(e,t){const s=e?.constructor?.name??"processor";console.warn(`[b24jssdk] logger channel "${this.channel}": ${s} failed; the record was skipped. Logging continues through the remaining handlers, and the operation being logged is unaffected.`,t)}}var od=Object.defineProperty,ad=a((r,e)=>od(r,"name",{value:e,configurable:!0}),"t$9");class oe{static{a(this,"LoggerFactory")}static{ad(this,"LoggerFactory")}static createNullLogger(){return _r.create()}static createForBrowser(e,t=!1){return t?oe.createForBrowserDevelopment(e):oe.createForBrowserProduction(e)}static createForBrowserDevelopment(e,t=J.DEBUG){const s=new wr(e),n=new tn(t);return s.pushHandler(n),s}static createForBrowserProduction(e,t=J.ERROR){const s=new wr(e),n=new tn(t);return s.pushHandler(n),s}static async forcedLog(e,t,s,n){if(!(typeof globalThis<"u"&&"vitest"in globalThis)){if(e instanceof _r)switch(t){case"debug":console.log(s,n);return;case"info":case"notice":console.info(s,n);return;case"warning":console.warn(s,n);return;default:console.error(s,n);return}return e[t](s,n)}}}var cd=Object.defineProperty,ld=a((r,e)=>cd(r,"name",{value:e,configurable:!0}),"t$8");const Ie="@deprecated: use Logger. https://bitrix24.github.io/b24jssdk/docs/working-with-the-rest-api/logger/";var Xo=(r=>(r.desktop="desktop",r.log="log",r.info="info",r.warn="warn",r.error="error",r.trace="trace",r))(Xo||{});class sn{static{a(this,"LoggerBrowser")}static{ld(this,"LoggerBrowser")}#e;static build(e,t=!1){return new sn(e,t)}constructor(e,t=!1){console.warn(Ie),t?this.#e=oe.createForBrowserDevelopment(e):this.#e=oe.createForBrowserProduction(e)}setConfig(e){console.warn(Ie)}enable(e){return console.warn(Ie),!0}disable(e){return console.warn(Ie),!0}isEnabled(e){return console.warn(Ie),!1}async desktop(...e){console.warn(Ie);const t={needDesktop:!0,params:{...e}};return this.#e.debug("desktop",t)}async log(...e){console.warn(Ie);const t={params:{...e}};return this.#e.debug("log",t)}async info(...e){console.warn(Ie);const t={params:{...e}};return this.#e.info("info",t)}async warn(...e){console.warn(Ie);const t={params:{...e}};return this.#e.warning("warn",t)}async error(...e){console.warn(Ie);const t={params:{...e}};return this.#e.error("error",t)}async trace(...e){console.warn(Ie);const t={needTrace:!0,params:{...e}};return this.#e.debug("trace",t)}async debug(...e){console.warn(Ie);const t={params:{...e}};return this.#e.debug("debug",t)}async notice(...e){console.warn(Ie);const t={params:{...e}};return this.#e.info("notice",t)}async warning(...e){console.warn(Ie);const t={params:{...e}};return this.#e.warning("warning",t)}async critical(...e){console.warn(Ie);const t={params:{...e}};return this.#e.critical("critical",t)}async alert(...e){console.warn(Ie);const t={params:{...e}};return this.#e.alert("alert",t)}async emergency(...e){console.warn(Ie);const t={params:{...e}};return this.#e.emergency("alert",t)}}var Qo=(r=>(r.undefined="undefined",r.any="any",r.integer="integer",r.boolean="boolean",r.double="double",r.date="date",r.datetime="datetime",r.string="string",r.text="text",r.file="file",r.array="array",r.object="object",r.user="user",r.location="location",r.crmCategory="crm_category",r.crmStatus="crm_status",r.crmCurrency="crm_currency",r))(Qo||{}),ud=Object.defineProperty,hd=a((r,e)=>ud(r,"name",{value:e,configurable:!0}),"o$p");const dd=Function.prototype.toString.call(Object);let fd=class{static{a(this,"y")}static{hd(this,"TypeManager")}getTag(e){return Object.prototype.toString.call(e)}isString(e){return typeof e=="string"||e instanceof String}isStringFilled(e){return this.isString(e)&&e!==""}isFunction(e){return e===null?!1:typeof e=="function"||e instanceof Function}isObject(e){return!!e&&(typeof e=="object"||typeof e=="function")}isObjectLike(e){return!!e&&typeof e=="object"}isPlainObject(e){if(!this.isObjectLike(e)||this.getTag(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const s=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof s=="function"&&Function.prototype.toString.call(s)===dd}isJsonRpcRequest(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"method"in e&&this.isStringFilled(e.method)}isJsonRpcResponse(e){return typeof e=="object"&&e&&"jsonrpc"in e&&this.isStringFilled(e.jsonrpc)&&"id"in e&&("result"in e||"error"in e)}isBoolean(e){return e===!0||e===!1}isNumber(e){return typeof e=="number"&&!Number.isNaN(e)}isInteger(e){return Number.isInteger(e)}isFloat(e){return this.isNumber(e)&&!this.isInteger(e)}isNil(e){return e==null}isArray(e){return!this.isNil(e)&&Array.isArray(e)}isArrayFilled(e){return this.isArray(e)&&e.length>0}isArrayLike(e){return!this.isNil(e)&&!this.isFunction(e)&&e.length>-1&&e.length<=Number.MAX_SAFE_INTEGER}isDate(e){return e instanceof Date}isDomNode(e){return this.isObjectLike(e)&&!this.isPlainObject(e)&&"nodeType"in e}isElementNode(e){return this.isDomNode(e)&&e.nodeType===Node.ELEMENT_NODE}isTextNode(e){return this.isDomNode(e)&&e.nodeType===Node.TEXT_NODE}isMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Map]"}isSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object Set]"}isWeakMap(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakMap]"}isWeakSet(e){return this.isObjectLike(e)&&this.getTag(e)==="[object WeakSet]"}isPrototype(e){return(typeof(e&&e.constructor)=="function"&&e.constructor.prototype||Object.prototype)===e}isRegExp(e){return this.isObjectLike(e)&&this.getTag(e)==="[object RegExp]"}isNull(e){return e===null}isUndefined(e){return typeof e>"u"}isArrayBuffer(e){return this.isObjectLike(e)&&this.getTag(e)==="[object ArrayBuffer]"}isTypedArray(e){const t=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/;return this.isObjectLike(e)&&t.test(this.getTag(e))}isBlob(e){return this.isObjectLike(e)&&this.isNumber(e.size)&&this.isString(e.type)&&this.isFunction(e.slice)}isFile(e){return this.isBlob(e)&&this.isString(e.name)&&(this.isNumber(e.lastModified)||this.isObjectLike(e.lastModifiedDate))}isFormData(e){return typeof FormData<"u"&&e instanceof FormData?!0:this.isObjectLike(e)&&this.getTag(e)==="[object FormData]"}clone(e,t=!0){let s,n,i;if(this.isNil(e)||typeof e!="object")return e;if(this.isDomNode(e))s=e.cloneNode(t);else if(typeof e=="object")if(this.isArray(e))for(s=[],n=0,i=e.length;n<i;n++)typeof e[n]=="object"&&t?s[n]=this.clone(e[n],t):s[n]=e[n];else{s={},e.constructor&&(this.isDate(e)?s=new Date(e):s=new e.constructor);for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t?s[n]=this.clone(e[n],t):s[n]=e[n])}else s=e;return s}};const M=new fd;var pd=Object.defineProperty,ts=a((r,e)=>pd(r,"name",{value:e,configurable:!0}),"r$h");function ea(r,e){const t={};for(const s of e)t[s]=r[s];return t}a(ea,"pick"),ts(ea,"pick");function nn(r,e){const t={...r};for(const s of e)delete t[s];return t}a(nn,"omit"),ts(nn,"omit");function ta(r){return Array.isArray(r[0])}a(ta,"isArrayOfArray"),ts(ta,"isArrayOfArray");function ra(r,e){return Object.values(r).includes(e)?e:void 0}a(ra,"getEnumValue"),ts(ra,"getEnumValue");var gd=Object.defineProperty,sa=a((r,e)=>gd(r,"name",{value:e,configurable:!0}),"i$j");const ke=[];for(let r=0;r<256;++r)ke.push((r+256).toString(16).slice(1));function na(r,e,t,s){return()=>{r|=0,e|=0,t|=0,s|=0;const n=(r+e|0)+s|0;return s=s+1|0,r=e^e>>>9,e=t+(t<<3)|0,t=(t<<21|t>>>11)+n|0,n>>>0}}a(na,"m$8"),sa(na,"sfc32");function ia(){const r=new Uint8Array(16),e=BigInt(Date.now()),t=BigInt(Math.floor(performance.now()*1e3)%65535),s=e<<16n|t;r[0]=Number(s>>40n&0xFFn),r[1]=Number(s>>32n&0xFFn),r[2]=Number(s>>24n&0xFFn),r[3]=Number(s>>16n&0xFFn),r[4]=Number(s>>8n&0xFFn),r[5]=Number(s&0xFFn);const n=(Math.random()*4294967295^Date.now()^performance.now())>>>0,i=na(2654435769,608135816,3084996962,n),c=new DataView(r.buffer);return c.setUint32(6,i()),c.setUint32(10,i()),c.setUint16(14,i()),r[6]=112|r[6]&15,r[8]=128|r[8]&63,(ke[r[0]]+ke[r[1]]+ke[r[2]]+ke[r[3]]+"-"+ke[r[4]]+ke[r[5]]+"-"+ke[r[6]]+ke[r[7]]+"-"+ke[r[8]]+ke[r[9]]+"-"+ke[r[10]]+ke[r[11]]+ke[r[12]]+ke[r[13]]+ke[r[14]]+ke[r[15]]).toLowerCase()}a(ia,"a$l"),sa(ia,"uuidv7");var md=Object.defineProperty,oa=a((r,e)=>md(r,"name",{value:e,configurable:!0}),"g$b");const yd=/[&<>'"]/g,bd=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g,_d={"&":"&amp","<":"&lt",">":"&gt","'":"&#39",'"':"&quot"},wd={"&amp":"&","&#38":"&","&lt":"<","&#60":"<","&gt":">","&#62":">","&apos":"'","&#39":"'","&quot":'"',"&#34":'"'};let Sd=class{static{a(this,"C")}static{oa(this,"TextManager")}getRandom(e=8){return Array.from({length:e}).map(()=>Math.trunc(Math.random()*36).toString(36)).join("")}getUniqId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}getUuidRfc4122(){return ia()}encode(e){return M.isString(e)?e.replace(yd,t=>_d[t]):e}decode(e){return M.isString(e)?e.replace(bd,t=>wd[t]):e}toNumber(e){const t=Number.parseFloat(e);return M.isNumber(t)?t:0}toInteger(e){return this.toNumber(Number.parseInt(e,10))}toBoolean(e,t=[]){const s=M.isString(e)?e.toLowerCase():e;return["true","y","1",1,!0,...t].includes(s)}toCamelCase(e){if(!M.isStringFilled(e))return e;const t=/[-_\s]+(.)?/g;if(!t.test(e))return/^[A-Z]+$/.test(e)?e.toLowerCase():e[0].toLowerCase()+e.slice(1);const s=e.toLowerCase().replace(t,(n,i)=>i?i.toUpperCase():"");return s[0].toLowerCase()+s.slice(1)}toPascalCase(e){return M.isStringFilled(e)?this.capitalize(this.toCamelCase(e)):e}toKebabCase(e){if(!M.isStringFilled(e))return e;const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+\d*|\b)|[A-Z]?[a-z]+\d*|[A-Z]|\d+/g);return t?t.map(s=>s.toLowerCase()).join("-"):e}capitalize(e){return M.isStringFilled(e)?e[0].toUpperCase()+e.slice(1):e}numberFormat(e,t=0,s=".",n=","){const i=Number.isFinite(e)?e:0,c=Number.isFinite(t)?Math.abs(t):0,o=(c?oa((l,h)=>{const u=10**h;return Math.round(l*u)/u},"roundTo")(i,c):Math.round(i)).toString().split(".");return o[0]&&o[0].length>3&&(o[0]=o[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,n)),(o[1]||"").length<c&&(o[1]=(o[1]||"").padEnd(c,"0")),o.join(s)}toDateTime(e,t,s){return M.isStringFilled(t)?H.fromFormat(e,t,s):H.fromISO(e,s)}toB24Format(e){return typeof e=="string"?e:e instanceof Date?this.toB24Format(H.fromJSDate(e)):e.toFormat("yyyy-MM-dd'T'HH:mm:ssZZ")}getDateForLog(){return H.now().toFormat("yyyy-MM-dd HH:mm:ss")}buildQueryString(e){if(M.isNil(e))return"";const t=[];for(const[s,n]of Object.entries(e))M.isArray(n)?n.forEach((i,c)=>{t.push(`${encodeURIComponent(`${s}[${c}]`)}=${encodeURIComponent(i)}`)}):t.push(`${encodeURIComponent(s)}=${encodeURIComponent(n)}`);return t.join("&")}};const K=new Sd;var vd=Object.defineProperty,Ed=a((r,e)=>vd(r,"name",{value:e,configurable:!0}),"s$q");let Te="";try{Te=navigator?.userAgent.toLowerCase()}catch{Te="?"}let Od=class{static{a(this,"u")}static{Ed(this,"BrowserManager")}isOpera(){return Te.includes("opera")}isIE(){return"attachEvent"in document&&!this.isOpera()}isIE6(){return Te.includes("msie 6")}isIE7(){return Te.includes("msie 7")}isIE8(){return Te.includes("msie 8")}isIE9(){return"documentMode"in document&&document?.documentMode>=9}isIE10(){return"documentMode"in document&&document?.documentMode>=10}isSafari(){return Te.includes("safari")&&!Te.includes("chrome")}isFirefox(){return Te.includes("firefox")}isChrome(){return Te.includes("chrome")}detectIEVersion(){if(this.isOpera()||this.isSafari()||this.isFirefox()||this.isChrome())return-1;let e=-1;if(window.MSStream&&!window.ActiveXObject&&"ActiveXObject"in window?e=11:this.isIE10()?e=10:this.isIE9()?e=9:this.isIE()&&(e=8),e===-1||e===8){if(navigator.appName==="Microsoft Internet Explorer"){const t=/MSIE (\d[.0-9]*)/,s=navigator.userAgent.match(t);M.isArrayLike(s)&&s.length>0&&(e=Number.parseFloat(s[1]))}if(navigator.appName==="Netscape"){e=11;const t=/Trident\/.*rv:(\d[.0-9]*)/;if(t.exec(navigator.userAgent)!=null){const s=navigator.userAgent.match(t);M.isArrayLike(s)&&s.length>0&&(e=Number.parseFloat(s[1]))}}}return e}isIE11(){return this.detectIEVersion()>=11}isMac(){return Te.includes("macintosh")}isWin(){return Te.includes("windows")}isLinux(){return Te.includes("linux")&&!this.isAndroid()}isAndroid(){return Te.includes("android")}isIPad(){return Te.includes("ipad;")||this.isMac()&&this.isTouchDevice()}isIPhone(){return Te.includes("iphone;")}isIOS(){return this.isIPad()||this.isIPhone()}isMobile(){return this.isIPhone()||this.isIPad()||this.isAndroid()||Te.includes("mobile")||Te.includes("touch")}isRetina(){return(window.devicePixelRatio&&window.devicePixelRatio>=2)===!0}isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0}isDoctype(e){const t=e||document;return t.compatMode?t.compatMode==="CSS1Compat":t.documentElement&&t.documentElement.clientHeight}isLocalStorageSupported(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch{return!1}}detectAndroidVersion(){const e=/Android (\d[.0-9]*)/;if(e.exec(navigator.userAgent)!=null){const t=navigator.userAgent.match(e);if(M.isArrayLike(t)&&t.length>0)return Number.parseFloat(t[1])}return 0}};const aa=new Od;var ee=(r=>(r.v3="v3",r.v2="v2",r))(ee||{}),Td=Object.defineProperty,Ad=a((r,e)=>Td(r,"name",{value:e,configurable:!0}),"R$2"),ca=(r=>(r.undefined="UNDEFINED",r.lead="CRM_LEAD",r.deal="CRM_DEAL",r.contact="CRM_CONTACT",r.company="CRM_COMPANY",r.oldInvoice="CRM_INVOICE",r.invoice="CRM_SMART_INVOICE",r.quote="CRM_QUOTE",r.requisite="CRM_REQUISITE",r.order="ORDER",r))(ca||{}),lt=(r=>(r[r.undefined=0]="undefined",r[r.lead=1]="lead",r[r.deal=2]="deal",r[r.contact=3]="contact",r[r.company=4]="company",r[r.oldInvoice=5]="oldInvoice",r[r.invoice=31]="invoice",r[r.quote=7]="quote",r[r.requisite=8]="requisite",r[r.order=14]="order",r))(lt||{}),on=(r=>(r.undefined="?",r.lead="L",r.deal="D",r.contact="C",r.company="CO",r.oldInvoice="I",r.invoice="SI",r.quote="Q",r.requisite="RQ",r.order="O",r))(on||{});function la(r){const e=lt[r];return on[e]||"?"}a(la,"getEnumCrmEntityTypeShort"),Ad(la,"getEnumCrmEntityTypeShort");var ua=(r=>(r[r.undefined=0]="undefined",r[r.absolute=1]="absolute",r[r.percentage=2]="percentage",r))(ua||{}),ha=(r=>(r[r.undefined=0]="undefined",r[r.product=1]="product",r[r.service=7]="service",r[r.sku=3]="sku",r[r.skuEmpty=6]="skuEmpty",r[r.offer=4]="offer",r[r.offerEmpty=5]="offerEmpty",r))(ha||{}),da=(r=>(r.undefined="UNDEFINED",r.detail="DETAIL_PICTURE",r.preview="PREVIEW_PICTURE",r.morePhoto="MORE_PHOTO",r))(da||{}),fa=(r=>(r[r.undefined=0]="undefined",r[r.mathematical=1]="mathematical",r[r.roundingUp=2]="roundingUp",r[r.roundingDown=4]="roundingDown",r))(fa||{}),Id=Object.defineProperty,rs=a((r,e)=>Id(r,"name",{value:e,configurable:!0}),"u$6"),pa=(r=>(r.undefined="undefined",r.b24="b24",r.box="box",r))(pa||{}),ga=(r=>(r.undefined="undefined",r.crm="crm",r.disk="disk",r.lists="lists",r))(ga||{}),ma=(r=>(r.undefined="undefined",r.lead="CCrmDocumentLead",r.company="CCrmDocumentCompany",r.contact="CCrmDocumentContact",r.deal="CCrmDocumentDeal",r.invoice="Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice",r.quote="Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote",r.order="Bitrix\\Crm\\Integration\\BizProc\\Document\\Order",r.dynamic="Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic",r.disk="Bitrix\\Disk\\BizProcDocument",r.lists="BizprocDocument",r.listsList="Bitrix\\Lists\\BizprocDocumentLists",r))(ma||{});function ya(r){switch(r){case"CCrmDocumentLead":return lt.lead;case"CCrmDocumentCompany":return lt.company;case"CCrmDocumentContact":return lt.contact;case"CCrmDocumentDeal":return lt.deal;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":return lt.invoice;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":return lt.quote;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":return lt.order}return lt.undefined}a(ya,"convertBizprocDocumentTypeToCrmEntityTypeId"),rs(ya,"convertBizprocDocumentTypeToCrmEntityTypeId");function ss(r,e){let t="",s="undefined";switch(r){case"CCrmDocumentLead":s="crm",t="LEAD";break;case"CCrmDocumentCompany":s="crm",t="COMPANY";break;case"CCrmDocumentContact":s="crm",t="CONTACT";break;case"CCrmDocumentDeal":s="crm",t="DEAL";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":s="crm",t="SMART_INVOICE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":s="crm",t="QUOTE";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":s="crm",t="ORDER";break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(s="crm",t=`DYNAMIC_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Disk\\BizProcDocument":if(s="disk",t=`STORAGE_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"BizprocDocument":if(s="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break;case"Bitrix\\Lists\\BizprocDocumentLists":if(s="lists",t=`iblock_${e||0}`,(e||0)<1)throw new Error("Need set entityId");break}return[s,r,t]}a(ss,"getDocumentType"),rs(ss,"getDocumentType");function ba(r,e,t){let s="";const n=ss(r,1);switch(r){case"CCrmDocumentLead":s=`LEAD_${e}`;break;case"CCrmDocumentCompany":s=`COMPANY_${e}`;break;case"CCrmDocumentContact":s=`CONTACT_${e}`;break;case"CCrmDocumentDeal":s=`DEAL_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice":s=`SMART_INVOICE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote":s=`QUOTE_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Order":s=`ORDER_${e}`;break;case"Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic":if(s=`DYNAMIC_${t||0}_${e}`,(t||0)<1)throw new Error("Need set dynamicId");break;case"Bitrix\\Disk\\BizProcDocument":s=`${e}`;break;case"BizprocDocument":s=`${e}`;break;case"Bitrix\\Lists\\BizprocDocumentLists":s=`${e}`;break}return[n[0],n[1],s]}a(ba,"getDocumentId"),rs(ba,"getDocumentId");function _a(r){const e=ss(r,1);return[e[0],e[1]]}a(_a,"getDocumentTypeForFilter"),rs(_a,"getDocumentTypeForFilter");var he=(r=>(r.App="app",r.Profile="profile",r.Currency="currency",r.AppOptions="appOptions",r.UserOptions="userOptions",r))(he||{});const yt={Free:"F",Demo:"D",Trial:"T",Paid:"P",Local:"L",Subscription:"S"},wa={[yt.Free]:"Free",[yt.Demo]:"Demo",[yt.Trial]:"Trial",[yt.Paid]:"Paid",[yt.Local]:"Local",[yt.Subscription]:"Subscription"},Lt={MainSettings:"MainSettings",UfList:"UfList",UfPage:"UfPage"};var bt=(r=>(r.NotSet="notSet",r.JsonArray="jsonArray",r.JsonObject="jsonObject",r.FloatVal="float",r.IntegerVal="integer",r.BoolYN="boolYN",r.StringVal="string",r))(bt||{}),fe=(r=>(r.Undefined="undefined",r.WebSocket="webSocket",r.LongPolling="longPolling",r))(fe||{}),He=(r=>(r.PullConfig="bx-pull-config",r.WebsocketBlocked="bx-pull-websocket-blocked",r.LongPollingBlocked="bx-pull-longpolling-blocked",r.LoggingEnabled="bx-pull-logging-enabled",r))(He||{}),Ge=(r=>(r.Online="online",r.Offline="offline",r.Connecting="connect",r))(Ge||{}),ns=(r=>(r[r.Unknown=0]="Unknown",r[r.Client=1]="Client",r[r.Backend=2]="Backend",r))(ns||{}),Ye=(r=>(r.Server="server",r.Client="client",r.Online="online",r.Status="status",r.Revision="revision",r))(Ye||{}),Pe=(r=>(r[r.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",r[r.SERVER_DIE=1001]="SERVER_DIE",r[r.CONFIG_REPLACED=3e3]="CONFIG_REPLACED",r[r.CHANNEL_EXPIRED=3001]="CHANNEL_EXPIRED",r[r.SERVER_RESTARTED=3002]="SERVER_RESTARTED",r[r.CONFIG_EXPIRED=3003]="CONFIG_EXPIRED",r[r.MANUAL=3004]="MANUAL",r[r.STUCK=3005]="STUCK",r[r.WRONG_CHANNEL_ID=4010]="WRONG_CHANNEL_ID",r))(Pe||{}),Sr=(r=>(r.CHANNEL_EXPIRE="CHANNEL_EXPIRE",r.CONFIG_EXPIRE="CONFIG_EXPIRE",r.SERVER_RESTART="SERVER_RESTART",r))(Sr||{}),an=(r=>(r.Shared="shared",r.Personal="personal",r))(an||{});const cn={Parse:{code:-32700,message:"Parse error"},InvalidRequest:{code:-32600,message:"Invalid Request"},MethodNotFound:{code:-32601,message:"Method not found"},InvalidParams:{code:-32602,message:"Invalid params"},Internal:{code:-32603,message:"Internal error"}};var dt=(r=>(r.Publish="publish",r.GetUsersLastSeen="getUsersLastSeen",r.Ping="ping",r.ListChannels="listChannels",r.SubscribeStatusChange="subscribeStatusChange",r.UnsubscribeStatusChange="unsubscribeStatusChange",r))(dt||{}),ln=(r=>(r.ru="ru",r.id="id",r.ms="ms",r.de="de",r.en="en",r.la="la",r.fr="fr",r.in="in",r.it="it",r.pl="pl",r.br="br",r.vn="vn",r.tr="tr",r.kz="kz",r.ua="ua",r.ar="ar",r.th="th",r.sc="sc",r.tc="tc",r.ja="ja",r))(ln||{});const kd={ru:"ru-RU",id:"id-ID",ms:"ms-MY",de:"de-DE",en:"en-EN",la:"es-ES",fr:"fr-FR",in:"hi-IN",it:"it-IT",pl:"pl-PL",br:"pt-BR",vn:"vi-VN",tr:"tr-TR",kz:"kk",ua:"uk-UA",ar:"ar-SA",th:"th-TH",sc:"zh-CN",tc:"zh-TW",ja:"ja-JP"};var Rd=Object.defineProperty,Cd=a((r,e)=>Rd(r,"name",{value:e,configurable:!0}),"s$p");class Me{static{a(this,"Result")}static{Cd(this,"Result")}_errors;_data;constructor(e){this._errors=new Map,this._data=e??null}get isSuccess(){return this._errors.size===0}get errors(){return this._errors}setData(e){return this._data=e,this}getData(){return this._data}addError(e,t){const s=t??K.getUuidRfc4122(),n=typeof e=="string"?new Error(e):e;return this._errors.set(s,n),this}addErrors(e){for(const t of e)this.addError(t);return this}getErrors(){return this._errors.values()}hasError(e){return this._errors.has(e)}getErrorMessages(){return Array.from(this._errors.values(),e=>e.message)}getErrorsByKey(){return Object.fromEntries(this._errors)}getErrorMessagesByKey(){return Object.fromEntries(Array.from(this._errors,([e,t])=>[e,t.message]))}toString(){const e=this.isSuccess?"success":"failure",t=this.safeStringify(this._data);return this.isSuccess?`Result(${e}): ${t}`:`Result(${e}): ${t}
Errors: ${this.getErrorMessages().join(", ")}`}safeStringify(e){try{return JSON.stringify(e,this.replacer,2)}catch{return"[Unable to serialize data]"}}replacer(e,t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t}static ok(e){return new Me(e)}static fail(e,t){return new Me().addError(e,t)}}var Nd=Object.defineProperty,Dd=a((r,e)=>Nd(r,"name",{value:e,configurable:!0}),"e$a");class U extends Error{static{a(this,"SdkError")}static{Dd(this,"SdkError")}code;_status;timestamp;constructor(e){const t=U.formatErrorMessage(e);super(t),this.name="SdkError",this.code=e.code,this._status=e.status,Object.defineProperty(this,"originalError",{value:e.originalError,enumerable:!1,writable:!1,configurable:!0}),this.timestamp=new Date,this.cleanErrorStack()}get status(){return this._status}static fromException(e,t){return e instanceof U?e:new U({code:t?.code||"JSSDK_INTERNAL_ERROR",status:t?.status||500,description:e instanceof Error?e.message:`${e}`,originalError:e})}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this._status,timestamp:this.timestamp.toISOString(),stack:this.stack}}toString(){let e=`[${this.name}] ${this.code} (${this._status}): ${this.message}`;return this.stack&&(e+=`
Stack trace:
${this.stack}`),e}static formatErrorMessage(e){return e?.description?`${e.description}`:"Internal error"}cleanErrorStack(){typeof this.stack=="string"&&(this.stack=this.stack.split(`
`).filter(e=>!e.includes("SdkError.constructor")).join(`
`))}}var Ld=Object.defineProperty,er=a((r,e)=>Ld(r,"name",{value:e,configurable:!0}),"i$f");const un=["auth","password","token","secret","access_token","refresh_token","client_secret","application_token","sessid","key","signature"],is="***REDACTED***",Pd=new RegExp(`([?&]|^)(${un.join("|")})=[^&#;]*`,"gi");function hn(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}a(hn,"s$o"),er(hn,"isPlainObject");function dn(r){return r.includes("=")?r.replace(Pd,(e,t,s)=>`${t}${s}=${is}`):r}a(dn,"c$7"),er(dn,"redactQueryString");function fn(r,e){return typeof r=="string"?dn(r):e<=0?r:hn(r)?pn(r,e-1):Array.isArray(r)?r.map(t=>fn(t,e)):r}a(fn,"u$5"),er(fn,"redactValue");function pn(r,e){const t={...r};for(const s of Object.keys(t)){if(un.includes(s.toLowerCase())){t[s]=is;continue}t[s]=fn(t[s],e)}return t}a(pn,"a$j"),er(pn,"redactObject");const Md=2;function qe(r){return hn(r)?pn(r,Md):r}a(qe,"redactSensitiveParams"),er(qe,"redactSensitiveParams");function Sa(r,e=[]){if(typeof r!="string"||!r.includes("="))return r;if(e.length===0)return dn(r);const t=e.map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=new RegExp(`([?&]|^)(${[...un,...t].join("|")})=[^&#;]*`,"gi");return r.replace(s,(n,i,c)=>`${i}${c}=${is}`)}a(Sa,"redactSensitiveUrl"),er(Sa,"redactSensitiveUrl");var Fd=Object.defineProperty,xd=a((r,e)=>Fd(r,"name",{value:e,configurable:!0}),"r$g");class we extends U{static{a(this,"AjaxError")}static{xd(this,"AjaxError")}requestInfo;validation;constructor(e){(e.code==="AUTHORIZE_ERROR"||e.code==="WRONG_AUTH_TYPE")&&(e.status=403),e.description=we.formatErrorMessage(e),super(e),this.name="AjaxError",this.validation=e.validation?.length?Object.freeze(e.validation.map(t=>qe(t))):void 0,this.requestInfo=e.requestInfo?{...e.requestInfo,...e.requestInfo.params!==void 0?{params:qe(e.requestInfo.params)}:{}}:void 0,this.cleanErrorStack()}static fromResponse(e){return new we({code:e.data?.error||"JSSDK_INTERNAL_AJAX_ERROR",description:e.data?.error_description,status:e.status,requestInfo:e.config})}static fromException(e,t){return e instanceof we?e:new we({code:t?.code||"JSSDK_INTERNAL_AJAX_ERROR",status:t?.status||500,description:e instanceof Error?e.message:String(e),requestInfo:t?.requestInfo,originalError:e})}toJSON(){return{name:this.name,code:this.code,message:this.message,status:this._status,timestamp:this.timestamp.toISOString(),requestInfo:this.requestInfo,...this.validation?{validation:this.validation}:{},stack:this.stack}}toString(){let e=`[${this.name}] ${this.code} (${this._status}): ${this.message}`;return this.requestInfo&&(e+=`
Request: ${this.requestInfo?.requestId?`[${this.requestInfo.requestId}] `:""}${this.requestInfo.method}`),this.stack&&(e+=`
Stack trace:
${this.stack}`),e}static formatErrorMessage(e){return e?.description?`${e.description}`:e.requestInfo?.method?`${e.code} (on ${e.requestInfo.method})`:"Internal ajax error"}cleanErrorStack(){typeof this.stack=="string"&&(this.stack=this.stack.split(`
`).filter(e=>!e.includes("AjaxError.constructor")).join(`
`))}}var $d=Object.defineProperty,jd=a((r,e)=>$d(r,"name",{value:e,configurable:!0}),"d$6");function gn(r,e,t){if(!r||typeof r!="object"||!("error"in r))return;const s=r;if(s.error&&typeof s.error=="object"&&"code"in s.error){const n=s.error;let i=String(n.message??"").trimEnd();if(n.validation&&n.validation.length>0){const c=n.validation.map(o=>o?.message||JSON.stringify(o)).filter(o=>o!==void 0&&o!=="");c.length>0&&(i.length>0&&(i.endsWith(".")||(i+="."),i+=" "),i+=c.join(" "))}return{code:n.code,description:i,...n.validation?{validation:Object.freeze([...n.validation])}:{}}}if(s.error&&typeof s.error=="string")return{code:s.error!=="0"?s.error:e,description:s?.error_description??t}}a(gn,"parseErrorPayload"),jd(gn,"parseErrorPayload");var Bd=Object.defineProperty,Ud=a((r,e)=>Bd(r,"name",{value:e,configurable:!0}),"s$n");class vr extends Me{static{a(this,"AjaxResult")}static{Ud(this,"AjaxResult")}_status;_query;_data;constructor(e){super(),this._data=e.answer?Object.freeze(e.answer):void 0,this._query=Object.freeze(structuredClone(e.query)),this._status=e.status,e.error?this.addError(e.error,"base-error"):this.#r()}get isSuccess(){return this.#e()}#e(){return this._errors.size===0}getData(){if(!this.isSuccess)return;const e=this._data;return Object.freeze({result:e.result,time:e.time})}#r(){const e=gn(this._data,"JSSDK_RESPONSE_ERROR","Some error in response");e!==void 0&&this.addError(this.#s({code:e.code,description:e.description,status:this._status,validation:e.validation}),"base-error")}#s(e){return new we({code:e.code,description:e.description,status:e.status,validation:e.validation,requestInfo:{method:this._query.method,params:this._query.params,requestId:this._query.requestId}})}hasMore(){return this.isMore()}isMore(){if(!this.isSuccess)return!1;const e=this._data,t="next"in e?e.next:void 0;return M.isNumber(t)}getTotal(){if(!this.isSuccess)return 0;const e=this._data,t="total"in e?e.total:void 0;return K.toInteger(t)}getStatus(){return this._status}getQuery(){return this._query}async fetchNext(e){const t=await this.getNext(e);return t===!1?null:t}async getNext(e){if(e.apiVersion===ee.v3)throw new U({code:"JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",description:"restApi:v3 not support method getNext",status:500});if(!this.isSuccess||!this.isMore())return!1;const t=this.#t();return e.call(t.method,t.params)}#t(){const e=this._data,t="next"in e?e.next:void 0;return{...this._query,params:{...this._query.params,start:K.toInteger(t)}}}setData(){throw new ReferenceError("AjaxResult does not allow data modification")}}var Vd=Object.defineProperty,qd=a((r,e)=>Vd(r,"name",{value:e,configurable:!0}),"a$i");class mn{static{a(this,"ParamsFactory")}static{qd(this,"ParamsFactory")}static getDefault(){return{rateLimit:{burstLimit:50,drainRate:2,adaptiveEnabled:!0},operatingLimit:{windowMs:6e5,limitMs:48e4,heavyPercent:80},adaptiveConfig:{enabled:!0,thresholdPercent:80,coefficient:.01,maxDelay:7e3},maxRetries:3,retryDelay:1e3,retryOnNetworkError:!0}}static getEnterprise(){return{...this.getDefault(),rateLimit:{burstLimit:250,drainRate:5,adaptiveEnabled:!0}}}static getBatchProcessing(){return{...this.getDefault(),rateLimit:{burstLimit:30,drainRate:1,adaptiveEnabled:!0},operatingLimit:{windowMs:6e5,limitMs:48e4,heavyPercent:50},adaptiveConfig:{enabled:!0,thresholdPercent:50,coefficient:.015,maxDelay:1e4},maxRetries:5}}static getRealtime(){return{...this.getDefault(),adaptiveConfig:{enabled:!1,thresholdPercent:100,coefficient:.001,maxDelay:48e4},maxRetries:1}}static fromTariffPlan(e){return e.toLowerCase()==="enterprise"?this.getEnterprise():this.getDefault()}}var Hd=Object.defineProperty,Wd=a((r,e)=>Hd(r,"name",{value:e,configurable:!0}),"g$a");class va{static{a(this,"RateLimiter")}static{Wd(this,"RateLimiter")}#e;#r;#s;#t;#i=[];#n;#o=5;#c=20;#h=.5;#f=5;#a=[];#l=[];_logger;constructor(e){this._logger=oe.createNullLogger(),this.#t=e,this.#n={...e},this.#e=e.burstLimit,this.#r=Date.now(),this.#s=1e3/e.drainRate}getTitle(){return"rateLimiter"}setLogger(e){this._logger=e}getLogger(){return this._logger}async canProceed(e,t,s){await this.#u(e);try{const n=Date.now(),i=(n-this.#r)*this.#t.drainRate/1e3;return this.#e=Math.min(this.#t.burstLimit,this.#e+i),this.#r=n,this.#e>=1}finally{this.#d()}}async waitIfNeeded(e,t,s){await this.#u(e);try{const n=Date.now(),i=(n-this.#r)*this.#t.drainRate/1e3;if(this.#e=Math.min(this.#t.burstLimit,this.#e+i),this.#r=n,this.#e>=1)return this.#e-=1,0;const c=1-this.#e;return Math.ceil(c*this.#s)}finally{this.#d()}}async handleExceeded(e){await this.#u(e);try{return this.#b(),this.#t.adaptiveEnabled&&this.#p()&&this.#g(e),this.#e=0,this.#s+1e3}finally{this.#d()}}async updateStats(e,t,s){if(!t.startsWith("batch::")){await this.#u(e);try{this.#w(),this.#t.adaptiveEnabled&&this.#T(e),this.#t.adaptiveEnabled&&this.#m()&&this.#y(e)}finally{this.#d()}}}async reset(){await this.#u("reset");try{this.#e=this.#t.burstLimit,this.#r=Date.now(),this.#a=[],this.#l=[],this.#t.drainRate=this.#n.drainRate,this.#t.burstLimit=this.#n.burstLimit,this.#s=1e3/this.#t.drainRate}finally{this.#d()}}getStats(){return{tokens:this.#e,burstLimit:this.#t.burstLimit,originalBurstLimit:this.#n.burstLimit,drainRate:this.#t.drainRate,originalDrainRate:this.#n.drainRate,refillIntervalMs:this.#s,lastRefill:this.#r,pendingRequests:this.#i.length,recentErrors:this.#a.length,recentSuccesses:this.#l.length}}async setConfig(e){await this.#u("setConfig");try{this.#t=e,this.#n={...e},this.#s=1e3/this.#t.drainRate,e.burstLimit>this.#e&&(this.#e=Math.min(e.burstLimit,this.#e)),this.#a=[],this.#l=[]}finally{this.#d()}}async#u(e){return new Promise(t=>{const s=this.#i.push(t);s>1&&this.#O(e,s),this.#i.length===1&&t()})}#d(){if(this.#i.shift(),this.#i.length>0){const e=this.#i[0];e()}}#p(){return this.#a.length>=this.#o}#m(){return this.#l.length>=this.#c&&this.#a.length<this.#o/2&&(this.#t.drainRate<this.#n.drainRate||this.#t.burstLimit<this.#n.burstLimit)}#g(e){const t=Math.max(this.#h,Number.parseFloat((this.#t.drainRate*.8).toFixed(2))),s=Math.max(this.#f,Number.parseFloat((this.#t.burstLimit*.8).toFixed(2)));this.#t.drainRate=t,this.#t.burstLimit=s,this.#s=1e3/t,this.#v(e,t,s),this.#a=[],this.#l=[]}#y(e){if(this.#t.drainRate===this.#n.drainRate&&this.#t.burstLimit===this.#n.burstLimit)return;const t=Math.min(this.#n.drainRate,Number.parseFloat((this.#t.drainRate*1.1).toFixed(2))),s=Math.min(this.#n.burstLimit,Number.parseFloat((this.#t.burstLimit*1.1).toFixed(2)));this.#t.drainRate=t,this.#t.burstLimit=s,this.#s=1e3/t,this.#E(e,t,s),this.#a=[],this.#l=[]}#b(){const e=Date.now();this.#a.push(e),this.#l=[],this.#_(e)}#_(e){const t=e-6e4;this.#a=this.#a.filter(s=>s>t)}#w(){const e=Date.now();this.#l.push(e),this.#S(),this.#_(e)}#S(){this.#l=this.#l.slice(-1*this.#c)}#v(e,t,s){const n=this.#n.drainRate,i=t<n,c=this.#n.burstLimit,o=s<c;this.getLogger().warning(`${this.getTitle()} is lowering limits due to frequent errors`,{requestId:e,drainRate:{current:t,original:n,condition:i,formatted:`(${t} < ${n}) ${i}`},burstLimit:{current:s,original:c,condition:o,formatted:`(${s} < ${c}) ${o}`}}).catch(()=>{})}#E(e,t,s){const n=this.#n.drainRate,i=t<n,c=this.#n.burstLimit,o=s<c;this.getLogger().warning(`${this.getTitle()} increases limits during stable operation`,{requestId:e,drainRate:{current:t,original:n,condition:i,formatted:`(${t} < ${n}) ${i}`},burstLimit:{current:s,original:c,condition:o,formatted:`(${s} < ${c}) ${o}`}}).catch(()=>{})}#O(e,t){this.getLogger().debug(`${this.getTitle()} request in queue`,{requestId:e,queueLength:t}).catch(()=>{})}#T(e){const t=this.#l.length,s=this.#c,n=t>=s,i=this.#a.length,c=this.#o,o=i<c/2,l=this.#t.drainRate,h=this.#n.drainRate,u=l<h,g=this.#t.burstLimit,p=this.#n.burstLimit,d=g<p;this.getLogger().debug(`${this.getTitle()} state`,{requestId:e,success:{count:t,threshold:s,condition:n,formatted:`(${t} >= ${s}) ${n}`},fail:{count:i,threshold:c/2,condition:o,formatted:`(${i} < ${c/2}) ${o}`},drainRate:{current:l,original:h,condition:u,formatted:`(${l} < ${h}) ${u}`},burstLimit:{current:g,original:p,condition:d,formatted:`(${g} < ${p}) ${d}`}}).catch(()=>{})}}var zd=Object.defineProperty,Jd=a((r,e)=>zd(r,"name",{value:e,configurable:!0}),"g$9");class Ea{static{a(this,"OperatingLimiter")}static{Jd(this,"OperatingLimiter")}#e;#r=new Map;#s={heavyRequestCount:0};_logger;getTitle(){return"operatingLimiter"}constructor(e){this._logger=oe.createNullLogger(),this.#e=e}setLogger(e){this._logger=e}getLogger(){return this._logger}get limitMs(){return this.#e.limitMs}getMethodStat(e){const t=this.#r.get(e);if(t)return t}async canProceed(e,t,s){return await this.getTimeToFree(e,t,s)===0}async waitIfNeeded(e,t,s){return this.getTimeToFree(e,t,s)}async getTimeToFree(e,t,s,n){if(this.#i(),t==="batch")return this.#t(e,s);const i=this.#r.get(t);if(!i)return 0;const c=Math.max(1e3,this.#e.limitMs-5e3);if(i.operating>=c){const o=Date.now();return i.operating_reset_at>o?i.operating_reset_at-o+1e3:5e3}return 0}async#t(e,t){let s=0;if(!t?.cmd||!Array.isArray(t.cmd))return s;const n=t.cmd.map(i=>i.split("?")[0]).filter(Boolean);for(const i of n){const c=await this.getTimeToFree(e,`batch::${i}`,{});s=Math.max(s,c)}return s}async updateStats(e,t,s){this.#i();const{operating:n,operating_reset_at:i}=s;if(n==null)return;this.#r.has(t)||this.#r.set(t,{operating:0,operating_reset_at:0,lastUpdated:Date.now()});const c=this.#r.get(t);c.operating=n*1e3,c.operating_reset_at=i*1e3,c.lastUpdated=Date.now();const o=c.operating/this.#e.limitMs*100;o>this.#e.heavyPercent&&(this.#s.heavyRequestCount++,this.#n(e,t,o,c.operating))}#i(){const e=Date.now(),t=this.#e.windowMs+1e4;for(const[s,n]of this.#r.entries())e-n.lastUpdated>t&&this.#r.delete(s)}async reset(){this.#r.clear(),this.#s={heavyRequestCount:0}}getStats(){const e={};for(const[t,s]of this.#r.entries())e[t]=Number.parseFloat((s.operating/1e3).toFixed(2));return{...this.#s,operatingStats:e}}async setConfig(e){this.#e=e}#n(e,t,s,n){this.getLogger().debug(`${this.getTitle()} detected limit for method ${t}`,{requestId:e,method:t,operating:{percent:Number.parseFloat(s.toFixed(2)),current:Number.parseFloat((n/1e3).toFixed(0)),max:Number.parseFloat((this.#e.limitMs/1e3).toFixed(0))}}).catch(()=>{})}}var Kd=Object.defineProperty,Gd=a((r,e)=>Kd(r,"name",{value:e,configurable:!0}),"l$d");class Oa{static{a(this,"AdaptiveDelayer")}static{Gd(this,"AdaptiveDelayer")}#e;#r;#s={adaptiveDelays:0,totalAdaptiveDelay:0};_logger;getTitle(){return"adaptiveDelayer"}constructor(e,t){this._logger=oe.createNullLogger(),this.#e=e,this.#r=t}setLogger(e){this._logger=e}getLogger(){return this._logger}async canProceed(e,t,s){return!0}async waitIfNeeded(e,t,s){if(!this.#e.enabled)return 0;const n=this.#t(e,t,s);return n>0&&(this.incrementAdaptiveDelays(),this.#s.totalAdaptiveDelay+=n),n}#t(e,t,s){if(t==="batch")return this.#i(e,s);const n=this.#r.getMethodStat(t);if(typeof n>"u")return 0;const i=n.operating/this.#r.limitMs*100;if(i>this.#e.thresholdPercent){let c=0;const o=Date.now();n.operating_reset_at>o?c+=(n.operating_reset_at-o)*this.#e.coefficient:c+=7e3;const l=Number.parseInt(Math.min(c,this.#e.maxDelay).toFixed(0));return this.#n(e,t,i,c,l),l}return 0}#i(e,t){let s=0;if(!t?.cmd||!Array.isArray(t.cmd))return s;const n=t.cmd.map(c=>c.split("?")[0]).filter(Boolean),i=[...new Set(n)];for(const c of i){const o=this.#t(e,`batch::${c}`,{});s=Math.max(s,o)}return s}async updateStats(e,t,s){}async reset(){this.#s={adaptiveDelays:0,totalAdaptiveDelay:0}}getStats(){return{...this.#s,adaptiveDelayAvg:this.#s.adaptiveDelays>0?this.#s.totalAdaptiveDelay/this.#s.adaptiveDelays:0}}async setConfig(e){this.#e=e}incrementAdaptiveDelays(){this.#s.adaptiveDelays++}#n(e,t,s,n,i){this.getLogger().debug(`${this.getTitle()} state for method ${t}`,{requestId:e,method:t,percent:Number.parseFloat(s.toFixed(2)),delays:{calculated:n,actual:i}}).catch(()=>{})}}var Yd=Object.defineProperty,Zd=a((r,e)=>Yd(r,"name",{value:e,configurable:!0}),"E$2");class Er{static{a(this,"RestrictionManager")}static{Zd(this,"RestrictionManager")}#e;#r;#s;#t;#i={retries:0,consecutiveErrors:0,limitHits:0};#n=new Map;_logger;constructor(e){this._logger=oe.createNullLogger(),this.#t=e,this.#e=new va(e.rateLimit),this.#r=new Ea(e.operatingLimit),this.#s=new Oa(e.adaptiveConfig,this.#r)}setLogger(e){this._logger=e,this.#e.setLogger(this._logger),this.#r.setLogger(this._logger),this.#s.setLogger(this._logger)}getLogger(){return this._logger}async applyOperatingLimits(e,t,s){const n=await this.#r.waitIfNeeded(e,t,s);if(n>0)this.incrementStats("limitHits"),this.#p(this.#r.getTitle(),e,t,n),await this.#d(n);else{const i=await this.#s.waitIfNeeded(e,t,s);i>0&&(this.incrementStats("limitHits"),this.#p(this.#s.getTitle(),e,t,i),await this.#d(i))}}async checkRateLimit(e,t){let s,n=1;do s=await this.#e.waitIfNeeded(e,t),s>0&&(this.incrementStats("limitHits"),this.#m(this.#e.getTitle(),e,t,s,n),await this.#d(s),n++);while(s>0)}async updateStats(e,t,s){await this.#r.updateStats(e,t,s),await this.#s.updateStats(e,t,s),await this.#e.updateStats(e,t,s)}async handleError(e,t,s,n,i){if(this.#o(n)){const c=await this.#c(e)*Math.pow(1.5,i);return this.#g(this.#e.getTitle(),e,"QUERY_LIMIT_EXCEEDED",n.message,t,c),c}if(this.#h(n)){const c=Math.max(1e4,await this.#f(e,t,s,n));return this.#g(this.#r.getTitle(),e,"OPERATION_TIME_LIMIT",n.message,t,c),c}if(this.#a(n))return this.#b(e,n?.code?`${n.code}`:"?",n?.message??"",t,Number(n?.status??0)),0;if(!this.#l(n)){const c=await this.#u(e),o=Math.max(3e4,c),l=Math.min(o,c*Math.pow(2,i)),h=l*.1*(Math.random()*2-1),u=Math.max(100,l+h);return this.#y(e,n?.code?`${n.code}`:"?",n.message,t,u),u}return 0}#o(e){return e.status===503||e.code==="QUERY_LIMIT_EXCEEDED"}async#c(e){return this.#e.handleExceeded(e)}#h(e){return e.status===429||e.code==="OPERATION_TIME_LIMIT"}async#f(e,t,s,n){return this.#r.getTimeToFree(e,t,s,n)}#a(e){const t=Number(e?.status??0);return Number.isNaN(t)?!1:t>=400&&t<500&&t!==408&&t!==429}#l(e){const t={code:e?.code??"-1",description:e?.message??""};return[...this.exceptionCodeForHard,...this.exceptionCodeForSoft].includes(t.code)||(t.description??"").includes("Could not find value for parameter")}static BUILT_IN_HARD_ERROR_CODES=["ERR_BAD_REQUEST","JSSDK_UNKNOWN_ERROR","100","INTERNAL_SERVER_ERROR","ERROR_UNEXPECTED_ANSWER","PORTAL_DELETED","ERROR_BATCH_METHOD_NOT_ALLOWED","ERROR_BATCH_LENGTH_EXCEEDED","NO_AUTH_FOUND","INVALID_REQUEST","OVERLOAD_LIMIT","expired_token","invalid_token","ACCESS_DENIED","INVALID_CREDENTIALS","user_access_error","insufficient_scope","ERROR_MANIFEST_IS_NOT_AVAILABLE","allowed_only_intranet_user","NOT_FOUND","INVALID_ARG_VALUE"];static BUILT_IN_SOFT_ERROR_CODES=["ERROR_ENTITY_NOT_FOUND","BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDJSONEXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDFILTEREXCEPTION","BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION","BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION","BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION","BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION","BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION","BITRIX_REST_V3_EXCEPTION_VALIDATION_DTOVALIDATIONEXCEPTION"];get exceptionCodeForHard(){const e=[...Er.BUILT_IN_HARD_ERROR_CODES];return this.#t.retryOnNetworkError===!1&&e.push("NETWORK_ERROR","REQUEST_TIMEOUT"),this.#t.hardErrorCodes&&this.#t.hardErrorCodes.length>0&&e.push(...this.#t.hardErrorCodes),e}get exceptionCodeForSoft(){const e=[...Er.BUILT_IN_SOFT_ERROR_CODES];return this.#t.softErrorCodes&&this.#t.softErrorCodes.length>0&&e.push(...this.#t.softErrorCodes),e}async#u(e){return this.#t.retryDelay}incrementError(e){const t=this.#n.get(e)||0;this.#n.set(e,t+1),this.incrementStats("consecutiveErrors")}resetErrors(e){this.#n.delete(e),this.#i.consecutiveErrors=0}incrementStats(e){this.#i[e]++}getStats(){return{...this.#i,...this.#e.getStats(),...this.#s.getStats(),...this.#r.getStats(),errorCounts:Object.fromEntries(this.#n)}}async reset(){await this.#e.reset(),await this.#r.reset(),await this.#s.reset(),this.#n.clear(),this.#i={retries:0,consecutiveErrors:0,limitHits:0}}async setConfig(e){this.#t=e,await this.#e.setConfig(e.rateLimit),await this.#r.setConfig(e.operatingLimit),await this.#s.setConfig(e.adaptiveConfig)}getParams(){return{...this.#t}}async#d(e){return new Promise(t=>setTimeout(t,e))}async waiteDelay(e){return this.#d(e)}#p(e,t,s,n){this.getLogger().notice(`${e} blocked method ${s}`,{requestId:t,method:s,wait:n,limiter:e}).catch(()=>{})}#m(e,t,s,n,i){this.getLogger().notice(`${e} blocked method ${s} | ${i} times`,{requestId:t,method:s,times:i,wait:n,limiter:e}).catch(()=>{})}#g(e,t,s,n,i,c){this.getLogger().error(`${e} recognized the ${s} error for the ${i} method`,{requestId:t,method:i,wait:c,limiter:e,error:{code:s,message:n}}).catch(()=>{})}#y(e,t,s,n,i){this.getLogger().error(`recognized the ${t} error for the ${n} method`,{requestId:e,method:n,wait:i,error:{code:t,message:s}}).catch(()=>{})}#b(e,t,s,n,i){this.getLogger().error(`client error ${i} (${t}) for the ${n} method is not retryable`,{requestId:e,method:n,status:i,error:{code:t,message:s}}).catch(()=>{})}}var Xd=Object.defineProperty,Qd=a((r,e)=>Xd(r,"name",{value:e,configurable:!0}),"i$d");const tr=class ml{static{a(this,"e")}static{Qd(this,"VersionManager")}static create(){return new ml}getAllApiVersions(){return[ee.v3,ee.v2]}isSupport(e,t){return!0}automaticallyObtainApiVersion(e){return ee.v2}automaticallyObtainApiVersionForBatch(e){return ee.v2}}.create();var ef=Object.defineProperty,tf=a((r,e)=>ef(r,"name",{value:e,configurable:!0}),"r$f");const rf=["log","debug","info","notice","warning","error","critical","alert","emergency"];function Ta(r,e){if(r===null||typeof r!="object"){console.warn(`[b24jssdk] ${e}: the value passed to setLogger() is not an object. Expected an implementation of LoggerInterface.`);return}const t=rf.filter(s=>typeof r[s]!="function");t.length>0&&console.warn(`[b24jssdk] ${e}: the logger passed to setLogger() is missing ${t.join(", ")}. LoggerInterface declares every level as Promise<void>; the SDK calls them fire-and-forget, so a missing or non-promise method raises a TypeError at the callsite.`)}a(Ta,"warnOnNonPromiseLogger"),tf(Ta,"warnOnNonPromiseLogger");var sf=Object.defineProperty,nf=a((r,e)=>sf(r,"name",{value:e,configurable:!0}),"i$b");class ft{static{a(this,"AbstractAction")}static{nf(this,"AbstractAction")}_b24;_logger;constructor(e,t){this._b24=e,this._logger=t}_warnMisplacedOptions(e,t,s){if(!e)return;const n=t.filter(i=>Object.hasOwn(e,i));n.length!==0&&this._logger.warning(`[b24jssdk] ${n.join(", ")} passed at the top level ${n.length===1?"is":"are"} ignored \u2014 ${n.length===1?"it belongs":"they belong"} in \`${s}\`. Write \`${s}: { ${n.join(", ")} }\`.`).catch(()=>{})}}var of=Object.defineProperty,af=a((r,e)=>of(r,"name",{value:e,configurable:!0}),"r$e");class cf extends ft{static{a(this,"CallV2")}static{af(this,"CallV2")}async make(e){const t=e.params||{};return this._b24.getHttpClient(ee.v2).call(e.method,t,e.requestId)}}var lf=Object.defineProperty,uf=a((r,e)=>lf(r,"name",{value:e,configurable:!0}),"h$8");class hf extends ft{static{a(this,"CallListV2")}static{uf(this,"CallListV2")}async make(e){const t=new Me,s=e?.idKey??"ID",n=e?.cursorIdKey??s,i=e?.customKeyForResult??null,c=e?.params??{};"order"in c&&c.order&&this._logger.warning("callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.").catch(()=>{});const o=`>${n}`,{order:l,...h}=c,u={...h,order:{[n]:"ASC"},filter:{...c.filter||{},[o]:0},start:-1};let g=[];for(;;){const p=await this._b24.actions.v2.call.make({method:e.method,params:u,requestId:e.requestId});if(!p.isSuccess){this._logger.error("callFastListMethod",{method:e.method,requestId:e.requestId,messages:p.getErrorMessages()}).catch(()=>{});for(const[m,_]of p.errors)t.addError(_,m);break}const d=p.getData();if(!d)break;const f=i===null?d.result:d.result[i];if(f.length===0||(g=[...g,...f],f.length<50))break;const y=f[f.length-1],b=y?Number.parseInt(y[s],10):Number.NaN;if(Number.isFinite(b))u.filter[o]=b;else{this._logger.warning(`callList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${s}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`).catch(()=>{});break}}return t.setData(g)}}var df=Object.defineProperty,ff=a((r,e)=>df(r,"name",{value:e,configurable:!0}),"h$7");class pf extends ft{static{a(this,"FetchListV2")}static{ff(this,"FetchListV2")}async*make(e){const t=e?.idKey??"ID",s=e?.cursorIdKey??t,n=e?.customKeyForResult??null,i=e?.params??{};"order"in i&&i.order&&this._logger.warning("fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.").catch(()=>{});const c=`>${s}`,{order:o,...l}=i,h={...l,order:{[s]:"ASC"},filter:{...i.filter||{},[c]:0},start:-1};for(;;){const u=await this._b24.actions.v2.call.make({method:e.method,params:h,requestId:e.requestId});if(!u.isSuccess)throw this._logger.error("fetchListMethod",{method:e.method,requestId:e.requestId,messages:u.getErrorMessages()}).catch(()=>{}),new U({code:"JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V2",description:`API Error: ${u.getErrorMessages().join("; ")}`,status:500});const g=u.getData();if(!g)break;const p=n===null?g.result:g.result[n];if(p.length===0||(yield p,p.length<50))break;const d=p[p.length-1],f=d?Number.parseInt(d[t],10):Number.NaN;if(Number.isFinite(f))h.filter[c]=f;else{this._logger.warning(`fetchList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${t}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`).catch(()=>{});break}}}}var gf=Object.defineProperty,mf=a((r,e)=>gf(r,"name",{value:e,configurable:!0}),"u$4");class os extends ft{static{a(this,"AbstractBatch")}static{mf(this,"AbstractBatch")}_addBatchErrorsIfAny(e,t){if(!e.isSuccess)for(const[s,n]of e.errors)t.addError(n,s)}_processBatchResponse(e,t,s){const n=Array.isArray(t);return s.returnAjaxResult?this._createBatchResultWithAjax(e,n):this._createBatchResultSimple(e,n)}_createBatchResultWithAjax(e,t){return t?this._createBatchArrayResult(e):this._createBatchObjectResult(e)}_createBatchArrayResult(e){const t=new Me;this._addBatchErrorsIfAny(e,t);const s=[];for(const[n,i]of e.getData().result)s.push(i);return t.setData(s)}_createBatchObjectResult(e){const t=new Me;this._addBatchErrorsIfAny(e,t);const s={};for(const[n,i]of e.getData().result)s[n]=i;return t.setData(s)}_createBatchResultSimple(e,t){const s=new Me;return this._addBatchErrorsIfAny(e,s),s.setData(this._extractBatchSimpleData(e,t))}_extractBatchSimpleData(e,t){if(t){const s=[];for(const[n,i]of e.getData().result)i.isSuccess&&s.push(i.getData().result);return s}else{const s={};for(const[n,i]of e.getData().result)i.isSuccess&&(s[n]=i.getData().result);return s}}chunkArray(e,t=50){const s=[];for(let n=0;n<e.length;n+=t){const i=e.slice(n,n+t);s.push(i)}return s}}var yf=Object.defineProperty,bf=a((r,e)=>yf(r,"name",{value:e,configurable:!0}),"e$8");class _f extends os{static{a(this,"BatchV2")}static{bf(this,"BatchV2")}async make(e){this._warnMisplacedOptions(e,["isHaltOnError","returnAjaxResult","requestId"],"options");const t={...e.options,apiVersion:ee.v2},s=await this._b24.getHttpClient(ee.v2).batch(e.calls,t);return this._processBatchResponse(s,e.calls,t)}}var wf=Object.defineProperty,Sf=a((r,e)=>wf(r,"name",{value:e,configurable:!0}),"o$l");class vf extends os{static{a(this,"BatchByChunkV2")}static{Sf(this,"BatchByChunkV2")}async make(e){this._warnMisplacedOptions(e,["isHaltOnError","requestId"],"options");const t=50,s={...e.options,returnAjaxResult:!1,apiVersion:ee.v2},n=new Me,i=[],c=this.chunkArray(e.calls,t);for(const o of c){const l=await this._b24.getHttpClient(ee.v2).batch(o,s);l.isSuccess||this._addBatchErrorsIfAny(l,n);for(const[h,u]of l.getData().result)u.isSuccess&&i.push(u.getData().result)}return n.setData(i)}}var Ef=Object.defineProperty,Of=a((r,e)=>Ef(r,"name",{value:e,configurable:!0}),"r$d");const yn=Symbol("call_V2"),bn=Symbol("callList_V2"),_n=Symbol("fetchList_V2"),wn=Symbol("batch_V2"),Sn=Symbol("batchByChunk_V2");class Tf{static{a(this,"ActionsManagerV2")}static{Of(this,"ActionsManagerV2")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=oe.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get call(){return this._mapActions.has(yn)||this._mapActions.set(yn,new cf(this._b24,this._logger)),this._mapActions.get(yn)}get callList(){return this._mapActions.has(bn)||this._mapActions.set(bn,new hf(this._b24,this._logger)),this._mapActions.get(bn)}get fetchList(){return this._mapActions.has(_n)||this._mapActions.set(_n,new pf(this._b24,this._logger)),this._mapActions.get(_n)}get batch(){return this._mapActions.has(wn)||this._mapActions.set(wn,new _f(this._b24,this._logger)),this._mapActions.get(wn)}get batchByChunk(){return this._mapActions.has(Sn)||this._mapActions.set(Sn,new vf(this._b24,this._logger)),this._mapActions.get(Sn)}}var Af=Object.defineProperty,If=a((r,e)=>Af(r,"name",{value:e,configurable:!0}),"r$c");class kf extends ft{static{a(this,"CallV3")}static{If(this,"CallV3")}async make(e){const t=e.params||{};return this._b24.getHttpClient(ee.v3).call(e.method,t,e.requestId)}}var Rf=Object.defineProperty,vn=a((r,e)=>Rf(r,"name",{value:e,configurable:!0}),"a$g");function En(r,e){if(!(r===void 0||Array.isArray(r)))throw new U({code:"JSSDK_ACTION_V3_LIST_FILTER_NOT_ARRAY",description:`${e}: \`filter\` must be the restApi:v3 array form, e.g. [['id', '>', 100]] or FilterV3.build(...). The restApi:v2 object dialect ({ '>id': 100 }) cannot be used here, because keyset pagination extends the filter with a cursor condition.`,status:500})}a(En,"assertArrayFilter"),vn(En,"assertArrayFilter");class Or extends Error{static{a(this,"KeysetPaginationError")}static{vn(this,"KeysetPaginationError")}errors;messages;constructor(e,t){super(t.join("; ")),this.name="KeysetPaginationError",this.errors=e,this.messages=t}}async function*Tr(r,e,t){let s=t.initialCursor,n=0;for(;;){const i=await r.actions.v3.call.make({method:t.method,params:t.buildParams(s),requestId:t.requestId});if(!i.isSuccess)throw e.error(t.errorLabel,{method:t.method,requestId:t.requestId,messages:i.getErrorMessages()}).catch(()=>{}),new Or(i.errors,i.getErrorMessages());const c=i.getData();if(!c)break;const o=c.result[t.customKeyForResult];if(!Array.isArray(o)||o.length===0||(yield o,n=Math.max(n,o.length),o.length<n))break;const l=o[o.length-1],h=l?t.readNextCursor(l):null;if(h==null){e.warning(t.noCursorWarning).catch(()=>{});break}s=h}}a(Tr,"keysetPaginate"),vn(Tr,"keysetPaginate");var Cf=Object.defineProperty,On=a((r,e)=>Cf(r,"name",{value:e,configurable:!0}),"a$f");class Nf extends ft{static{a(this,"CallListV3")}static{On(this,"CallListV3")}async make(e){const t=e?.limit??50,s=new Me,n=e?.idKey??"id",i=e?.cursorIdKey??n,c=e?.customKeyForResult??null,o=e?.params??{};"order"in o&&o.order&&this._logger.warning("callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.").catch(()=>{}),En(o.filter,"callList.make");const{order:l,...h}=o,u={...h,order:{[i]:"ASC"},filter:[...o.filter??[]],pagination:{page:0,limit:t}},g=[];try{for await(const p of Tr(this._b24,this._logger,{method:e.method,requestId:e.requestId,customKeyForResult:c,initialCursor:0,buildParams:On(d=>({...u,filter:[...u.filter,[i,">",d]]}),"buildParams"),readNextCursor:On(d=>{const f=Number.parseInt(d[n],10);return Number.isFinite(f)?f:null},"readNextCursor"),noCursorWarning:`callList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${n}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`,errorLabel:"callFastListMethod"}))for(const d of p)g.push(d)}catch(p){if(p instanceof Or)for(const[d,f]of p.errors)s.addError(f,d);else throw p}return s.setData(g)}}var Df=Object.defineProperty,Tn=a((r,e)=>Df(r,"name",{value:e,configurable:!0}),"i$9");class Lf extends ft{static{a(this,"FetchListV3")}static{Tn(this,"FetchListV3")}async*make(e){const t=e?.limit??50,s=e?.idKey??"id",n=e?.cursorIdKey??s,i=e?.customKeyForResult??null,c=e?.params??{};"order"in c&&c.order&&this._logger.warning("fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.").catch(()=>{}),En(c.filter,"fetchList.make");const{order:o,...l}=c,h={...l,order:{[n]:"ASC"},filter:[...c.filter??[]],pagination:{page:0,limit:t}};try{yield*Tr(this._b24,this._logger,{method:e.method,requestId:e.requestId,customKeyForResult:i,initialCursor:0,buildParams:Tn(u=>({...h,filter:[...h.filter,[n,">",u]]}),"buildParams"),readNextCursor:Tn(u=>{const g=Number.parseInt(u[s],10);return Number.isFinite(g)?g:null},"readNextCursor"),noCursorWarning:`fetchList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${s}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`,errorLabel:"fetchListMethod"})}catch(u){throw u instanceof Or?new U({code:"JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V3",description:`API Error: ${u.messages.join("; ")}`,status:500}):u}}}var Pf=Object.defineProperty,An=a((r,e)=>Pf(r,"name",{value:e,configurable:!0}),"l$c");class Mf extends ft{static{a(this,"CallTailV3")}static{An(this,"CallTailV3")}async make(e){const t=e?.limit??50,s=new Me,n=e?.cursorField??"id",i=e?.order??"ASC",c=e?.customKeyForResult??"items",o=e?.params??{};if(/desc/i.test(i)&&e?.initialValue===void 0)throw new U({code:"JSSDK_CORE_B24_CALL_TAIL_DESC_REQUIRES_INITIAL_VALUE",description:'callTail.make: order "DESC" requires an explicit `initialValue` (the server pages by `field < value`, so the default 0 returns nothing). Pass `initialValue` set to the type maximum / newest value.',status:500});Array.isArray(o.filter)&&o.filter.some(p=>Array.isArray(p)&&p[0]===n)&&this._logger.warning(`callTail.make: the cursor field "${n}" must not appear in \`filter\` \u2014 the server orders and pages by it and will reject a filter on the same field (INVALIDFILTEREXCEPTION). Remove it from \`filter\`.`).catch(()=>{});let l=o.select;Array.isArray(l)?l.includes(n)||(l=[...l,n]):n!=="id"&&this._logger.warning(`callTail.make: no \`select\` provided with a non-default cursorField "${n}" \u2014 make sure it is in the server's default field set, otherwise pass \`select\` including "${n}" so the cursor can advance.`).catch(()=>{});const{select:h,...u}=o,g=[];try{for await(const p of Tr(this._b24,this._logger,{method:e.method,requestId:e.requestId,customKeyForResult:c,initialCursor:e?.initialValue??0,buildParams:An(d=>({...u,...l?{select:l}:{},cursor:{field:n,value:d,order:i,limit:t}}),"buildParams"),readNextCursor:An(d=>d[n]??null,"readNextCursor"),noCursorWarning:`callTail.make: pagination stops here \u2014 no value could be read from the returned items via cursorField "${n}". Make sure cursorField matches a field present in the response (and in \`select\`).`,errorLabel:"callTailMethod"}))for(const d of p)g.push(d)}catch(p){if(p instanceof Or)for(const[d,f]of p.errors)s.addError(f,d);else throw p}return s.setData(g)}}var Ff=Object.defineProperty,In=a((r,e)=>Ff(r,"name",{value:e,configurable:!0}),"s$i");class xf extends ft{static{a(this,"FetchTailV3")}static{In(this,"FetchTailV3")}async*make(e){const t=e?.limit??50,s=e?.cursorField??"id",n=e?.order??"ASC",i=e?.customKeyForResult??"items",c=e?.params??{};if(/desc/i.test(n)&&e?.initialValue===void 0)throw new U({code:"JSSDK_CORE_B24_FETCH_TAIL_DESC_REQUIRES_INITIAL_VALUE",description:'fetchTail.make: order "DESC" requires an explicit `initialValue` (the server pages by `field < value`, so the default 0 returns nothing). Pass `initialValue` set to the type maximum / newest value.',status:500});Array.isArray(c.filter)&&c.filter.some(u=>Array.isArray(u)&&u[0]===s)&&this._logger.warning(`fetchTail.make: the cursor field "${s}" must not appear in \`filter\` \u2014 the server orders and pages by it and will reject a filter on the same field (INVALIDFILTEREXCEPTION). Remove it from \`filter\`.`).catch(()=>{});let o=c.select;Array.isArray(o)?o.includes(s)||(o=[...o,s]):s!=="id"&&this._logger.warning(`fetchTail.make: no \`select\` provided with a non-default cursorField "${s}" \u2014 make sure it is in the server's default field set, otherwise pass \`select\` including "${s}" so the cursor can advance.`).catch(()=>{});const{select:l,...h}=c;try{yield*Tr(this._b24,this._logger,{method:e.method,requestId:e.requestId,customKeyForResult:i,initialCursor:e?.initialValue??0,buildParams:In(u=>({...h,...o?{select:o}:{},cursor:{field:s,value:u,order:n,limit:t}}),"buildParams"),readNextCursor:In(u=>u[s]??null,"readNextCursor"),noCursorWarning:`fetchTail.make: pagination stops here \u2014 no value could be read from the returned items via cursorField "${s}". Make sure cursorField matches a field present in the response (and in \`select\`).`,errorLabel:"fetchTailMethod"})}catch(u){throw u instanceof Or?new U({code:"JSSDK_CORE_B24_FETCH_TAIL_METHOD_API_V3",description:`API Error: ${u.messages.join("; ")}`,status:500}):u}}}var $f=Object.defineProperty,jf=a((r,e)=>$f(r,"name",{value:e,configurable:!0}),"i$8");const Aa=["sum","avg","min","max","count","countDistinct"];class Bf extends ft{static{a(this,"AggregateV3")}static{jf(this,"AggregateV3")}async make(e){const t=new Me,s=e?.select??{};for(const l of Object.keys(s)){if(!Aa.includes(l))throw new U({code:"JSSDK_AGGREGATE_V3_INVALID_FUNCTION",description:`AggregateV3: "${l}" is not an aggregate function \u2014 use one of ${Aa.join(" ")}.`,status:400});const h=s[l];if(!Array.isArray(h)&&(typeof h!="object"||h===null))throw new U({code:"JSSDK_AGGREGATE_V3_INVALID_SELECT",description:`AggregateV3: select.${l} must be a string[] (default alias) or a { field: alias } map.`,status:400})}const n={select:s};e?.params?.filter&&(n.filter=e.params.filter);const i=await this._b24.actions.v3.call.make({method:e.method,params:n,requestId:e.requestId});if(!i.isSuccess){this._logger.error("aggregateMethod",{method:e.method,requestId:e.requestId,messages:i.getErrorMessages()}).catch(()=>{});for(const[l,h]of i.errors)t.addError(h,l);return t}const c=i.getData()?.result;let o;return c&&typeof c=="object"&&"result"in c?o=c.result??{}:c&&typeof c=="object"?(this._logger.warning(`aggregate.make: response has no nested 'result.result' envelope (the v3 reference \xA77 specifies double nesting); falling back to the top-level 'result'. method=${e.method}`).catch(()=>{}),o=c):o={},t.setData(o)}}var Uf=Object.defineProperty,Vf=a((r,e)=>Uf(r,"name",{value:e,configurable:!0}),"e$6");class qf extends os{static{a(this,"BatchV3")}static{Vf(this,"BatchV3")}async make(e){this._warnMisplacedOptions(e,["isHaltOnError","returnAjaxResult","requestId"],"options");const t={...e.options,apiVersion:ee.v3},s=await this._b24.getHttpClient(ee.v3).batch(e.calls,t);return this._processBatchResponse(s,e.calls,t)}}var Hf=Object.defineProperty,Wf=a((r,e)=>Hf(r,"name",{value:e,configurable:!0}),"o$i");class zf extends os{static{a(this,"BatchByChunkV3")}static{Wf(this,"BatchByChunkV3")}async make(e){this._warnMisplacedOptions(e,["isHaltOnError","requestId"],"options");const t=50,s={...e.options,returnAjaxResult:!1,apiVersion:ee.v3},n=new Me,i=[],c=this.chunkArray(e.calls,t);for(const o of c){const l=await this._b24.getHttpClient(ee.v3).batch(o,s);l.isSuccess||this._addBatchErrorsIfAny(l,n);for(const[h,u]of l.getData().result)u.isSuccess&&i.push(u.getData().result)}return n.setData(i)}}var Jf=Object.defineProperty,Kf=a((r,e)=>Jf(r,"name",{value:e,configurable:!0}),"l$b");const kn=Symbol("call_V3"),Rn=Symbol("callList_V3"),Cn=Symbol("fetchList_V3"),Nn=Symbol("callTail_V3"),Dn=Symbol("fetchTail_V3"),Ln=Symbol("aggregate_V3"),Pn=Symbol("batch_V3"),Mn=Symbol("batchByChunk_V3");class Gf{static{a(this,"ActionsManagerV3")}static{Kf(this,"ActionsManagerV3")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=oe.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get call(){return this._mapActions.has(kn)||this._mapActions.set(kn,new kf(this._b24,this._logger)),this._mapActions.get(kn)}get callList(){return this._mapActions.has(Rn)||this._mapActions.set(Rn,new Nf(this._b24,this._logger)),this._mapActions.get(Rn)}get fetchList(){return this._mapActions.has(Cn)||this._mapActions.set(Cn,new Lf(this._b24,this._logger)),this._mapActions.get(Cn)}get callTail(){return this._mapActions.has(Nn)||this._mapActions.set(Nn,new Mf(this._b24,this._logger)),this._mapActions.get(Nn)}get fetchTail(){return this._mapActions.has(Dn)||this._mapActions.set(Dn,new xf(this._b24,this._logger)),this._mapActions.get(Dn)}get aggregate(){return this._mapActions.has(Ln)||this._mapActions.set(Ln,new Bf(this._b24,this._logger)),this._mapActions.get(Ln)}get batch(){return this._mapActions.has(Pn)||this._mapActions.set(Pn,new qf(this._b24,this._logger)),this._mapActions.get(Pn)}get batchByChunk(){return this._mapActions.has(Mn)||this._mapActions.set(Mn,new zf(this._b24,this._logger)),this._mapActions.get(Mn)}}var Yf=Object.defineProperty,Zf=a((r,e)=>Yf(r,"name",{value:e,configurable:!0}),"s$g");const Fn=Symbol(ee.v2),xn=Symbol(ee.v3);class Xf{static{a(this,"ActionsManager")}static{Zf(this,"ActionsManager")}_b24;_logger;_mapActions;constructor(e){this._b24=e,this._logger=oe.createNullLogger(),this._mapActions=new Map}setLogger(e){this._logger=e,this.v2.setLogger(this._logger),this.v3.setLogger(this._logger)}getLogger(){return this._logger}get v2(){return this._mapActions.has(Fn)||this._mapActions.set(Fn,new Tf(this._b24)),this._mapActions.get(Fn)}get v3(){return this._mapActions.has(xn)||this._mapActions.set(xn,new Gf(this._b24)),this._mapActions.get(xn)}}var Qf=Object.defineProperty,ep=a((r,e)=>Qf(r,"name",{value:e,configurable:!0}),"o$f");class Ia{static{a(this,"AbstractTool")}static{ep(this,"AbstractTool")}_b24;_logger;constructor(e,t){this._b24=e,this._logger=t}}var tp=Object.defineProperty,rp=a((r,e)=>tp(r,"name",{value:e,configurable:!0}),"r$a");class sp extends Ia{static{a(this,"Ping")}static{rp(this,"Ping")}async make(e){const t=Date.now();try{return await this._b24.actions.v2.call.make({method:"server.time",params:{},requestId:e?.requestId}),Date.now()-t}catch{return-1}}}var np=Object.defineProperty,ip=a((r,e)=>np(r,"name",{value:e,configurable:!0}),"s$e");class op extends Ia{static{a(this,"HealthCheck")}static{ip(this,"HealthCheck")}async make(e){try{return(await this._b24.actions.v2.call.make({method:"server.time",params:{},requestId:e?.requestId})).isSuccess}catch{return!1}}}var ap=Object.defineProperty,cp=a((r,e)=>ap(r,"name",{value:e,configurable:!0}),"g$6");const $n=Symbol("ping"),jn=Symbol("healthCheck");class lp{static{a(this,"ToolsManager")}static{cp(this,"ToolsManager")}_b24;_logger;_mapTools;constructor(e){this._b24=e,this._logger=oe.createNullLogger(),this._mapTools=new Map}setLogger(e){this._logger=e}getLogger(){return this._logger}get ping(){return this._mapTools.has($n)||this._mapTools.set($n,new sp(this._b24,this._logger)),this._mapTools.get($n)}get healthCheck(){return this._mapTools.has(jn)||this._mapTools.set(jn,new op(this._b24,this._logger)),this._mapTools.get(jn)}}var up=Object.defineProperty,hp=a((r,e)=>up(r,"name",{value:e,configurable:!0}),"g$5");class as{static{a(this,"AbstractB24")}static{hp(this,"AbstractB24")}static batchSize=50;_isInit=!1;_httpV2=null;_httpV3=null;_logger;_actionsManager;_toolsManager;constructor(){this._isInit=!1,this._logger=oe.createNullLogger(),this._actionsManager=new Xf(this),this._toolsManager=new lp(this)}get isInit(){return this._isInit}async init(){this._isInit=!0}destroy(){}get actions(){return this._ensureInitialized(),this._actionsManager}get tools(){return this._ensureInitialized(),this._toolsManager}async callMethod(e,t,s){return oe.forcedLog(this._logger,"warning","The AbstractB24.callMethod() method is deprecated and will be removed in version 3.0.0. Use b24.actions.v3.call.make(options) or b24.actions.v2.call.make(options)",{class:"AbstractB24",method:"callMethod",replacement:"b24.actions.v3.call.make(options) | b24.actions.v2.call.make(options)",removalVersion:"3.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"}),t={...t},!("start"in t&&Number.isInteger(t.start))&&Number.isInteger(s)&&(t.start=s),this._actionsManager.v2.call.make({method:e,params:t})}async callListMethod(e,t,s,n){oe.forcedLog(this._logger,"warning","The AbstractB24.callListMethod() method is deprecated and will be removed in version 3.0.0. Use b24.actions.v3.callList.make(options) or b24.actions.v2.callList.make(options)",{class:"AbstractB24",method:"callListMethod",replacement:"b24.actions.v3.callList.make(options) | b24.actions.v2.callList.make(options)",removalVersion:"3.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const i=new Me;M.isFunction(s)&&s!==null&&s(0);const c={...t,start:0};return this.actions.v2.call.make({method:e,params:c}).then(async o=>{let l=[];const h=n?o.getData().result[n]:o.getData().result;if(l=[...l,...h],o.isMore()){let u=o;for(;u=await u.getNext(this.getHttpClient(ee.v2)),u!==!1;){const g=n?u.getData().result[n]:u.getData().result;if(l=[...l,...g],s){const p=u.getTotal();s(p>0?Math.round(100*l.length/p):100)}}}return i.setData(l),s&&s(100),i})}async*fetchListMethod(e,t,s,n){oe.forcedLog(this._logger,"warning","The AbstractB24.fetchListMethod() method is deprecated and will be removed in version 3.0.0. Use b24.actions.v3.fetchList.make(options) or b24.actions.v2.fetchList.make(options)",{class:"AbstractB24",method:"fetchListMethod",replacement:"b24.actions.v3.fetchList.make(options) | b24.actions.v2.fetchList.make(options)",removalVersion:"3.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const i={method:e,params:t,idKey:s,customKeyForResult:n===null?void 0:n};yield*this.actions.v2.fetchList.make(i)}async callBatch(e,t,s){oe.forcedLog(this._logger,"warning","The AbstractB24.callBatch() method is deprecated and will be removed in version 3.0.0. Use b24.actions.v3.batch.make(options) or b24.actions.v2.batch.make(options)",{class:"AbstractB24",method:"callBatch",replacement:"b24.actions.v3.batch.make(options) | b24.actions.v2.batch.make(options)",removalVersion:"3.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const n=e,i={isHaltOnError:t??!0,returnAjaxResult:s??!1};return this.actions.v2.batch.make({calls:n,options:i})}async callBatchByChunk(e,t){oe.forcedLog(this._logger,"warning","The AbstractB24.callBatchByChunk() method is deprecated and will be removed in version 3.0.0. Use b24.actions.v3.batchByChunk.make(options) or b24.actions.v2.batchByChunk.make(options)",{class:"AbstractB24",method:"callBatchByChunk",replacement:"b24.actions.v3.batchByChunk.make(options) | b24.actions.v2.batchByChunk.make(options)",removalVersion:"3.0.0",code:"JSSDK_CORE_DEPRECATED_METHOD"});const s=e,n={isHaltOnError:t,returnAjaxResult:!1};return this.actions.v2.batchByChunk.make({calls:s,options:n})}getHttpClient(e){switch(this._ensureInitialized(),e){case ee.v3:if(this._httpV3===null)throw new U({code:"JSSDK_CORE_B24_HTTP_V3_NOT_INIT",description:"HttpV3 not init",status:500});return this._httpV3;case ee.v2:if(this._httpV2===null)throw new U({code:"JSSDK_CORE_B24_HTTP_V2_NOT_INIT",description:"HttpV2 not init",status:500});return this._httpV2}throw new U({code:"JSSDK_CORE_B24_API_WRONG",description:`Wrong Api Version ${e}`,status:500})}setHttpClient(e,t){switch(e){case ee.v3:this._httpV3=t;return;case ee.v2:this._httpV2=t;return}throw new U({code:"JSSDK_CORE_B24_API_WRONG",description:`Wrong Api Version ${e}`,status:500})}setLogger(e){Ta(e,"B24 client"),this._logger=e,this._actionsManager.setLogger(this._logger),this._toolsManager.setLogger(this._logger),tr.getAllApiVersions().forEach(t=>{this.getHttpClient(t).setLogger(this._logger)})}getLogger(){return this._logger}async setRestrictionManagerParams(e){const t=tr.getAllApiVersions().map(s=>this.getHttpClient(s).setRestrictionManagerParams(e));await Promise.allSettled(t)}_getHttpOptions(){return null}_ensureInitialized(){if(!this._isInit)throw new U({code:"JSSDK_CORE_B24_NOT_INIT",description:"B24 not initialized",status:500})}}function ka(r,e){return a(function(){return r.apply(e,arguments)},"wrap")}a(ka,"bind");const{toString:dp}=Object.prototype,{getPrototypeOf:rr}=Object,{iterator:Ar,toStringTag:Ra}=Symbol,cs=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Ir=a((r,e)=>{let t=r;const s=[];for(;t!=null&&t!==Object.prototype;){if(s.indexOf(t)!==-1)return!1;if(s.push(t),cs(t,e))return!0;t=rr(t)}return!1},"hasOwnInPrototypeChain"),fp=a((r,e)=>r!=null&&Ir(r,e)?r[e]:void 0,"getSafeProp"),Bn=(r=>e=>{const t=dp.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),st=a(r=>(r=r.toLowerCase(),e=>Bn(e)===r),"kindOfTest"),ls=a(r=>e=>typeof e===r,"typeOfTest"),{isArray:Pt}=Array,Mt=ls("undefined");function sr(r){return r!==null&&!Mt(r)&&r.constructor!==null&&!Mt(r.constructor)&&We(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}a(sr,"isBuffer$1");const Ca=st("ArrayBuffer");function pp(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Ca(r.buffer),e}a(pp,"isArrayBufferView");const gp=ls("string"),We=ls("function"),Na=ls("number"),nr=a(r=>r!==null&&typeof r=="object","isObject"),mp=a(r=>r===!0||r===!1,"isBoolean"),us=a(r=>{if(!nr(r))return!1;const e=rr(r);return(e===null||e===Object.prototype||rr(e)===null)&&!Ir(r,Ra)&&!Ir(r,Ar)},"isPlainObject"),yp=a(r=>{if(!nr(r)||sr(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},"isEmptyObject"),bp=st("Date"),_p=st("File"),wp=a(r=>!!(r&&typeof r.uri<"u"),"isReactNativeBlob"),Sp=a(r=>r&&typeof r.getParts<"u","isReactNative"),vp=st("Blob"),Ep=st("FileList"),Op=st("Set"),Tp=a(r=>nr(r)&&We(r.pipe),"isStream");function Ap(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}a(Ap,"getGlobal");const Da=Ap(),La=typeof Da.FormData<"u"?Da.FormData:void 0,Ip=a(r=>{if(!r)return!1;if(La&&r instanceof La)return!0;const e=rr(r);if(!e||e===Object.prototype||!We(r.append))return!1;const t=Bn(r);return t==="formdata"||t==="object"&&We(r.toString)&&r.toString()==="[object FormData]"},"isFormData"),kp=st("URLSearchParams"),[Rp,Cp,Np,Dp]=["ReadableStream","Request","Response","Headers"].map(st),Lp=a(r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function kr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let s,n;if(typeof r!="object"&&(r=[r]),Pt(r))for(s=0,n=r.length;s<n;s++)e.call(null,r[s],s,r);else{if(sr(r))return;const i=t?Object.getOwnPropertyNames(r):Object.keys(r),c=i.length;let o;for(s=0;s<c;s++)o=i[s],e.call(null,r[o],o,r)}}a(kr,"forEach");function Pa(r,e){if(sr(r))return null;e=e.toLowerCase();const t=Object.keys(r);let s=t.length,n;for(;s-- >0;)if(n=t[s],e===n.toLowerCase())return n;return null}a(Pa,"findKey");const Ft=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ma=a(r=>!Mt(r)&&r!==Ft,"isContextDefined");function Un(...r){const{caseless:e,skipUndefined:t}=Ma(this)&&this||{},s={},n=a((i,c)=>{if(c==="__proto__"||c==="constructor"||c==="prototype")return;const o=e&&typeof c=="string"&&Pa(s,c)||c,l=cs(s,o)?s[o]:void 0;us(l)&&us(i)?s[o]=Un(l,i):us(i)?s[o]=Un({},i):Pt(i)?s[o]=i.slice():(!t||!Mt(i))&&(s[o]=i)},"assignValue");for(let i=0,c=r.length;i<c;i++){const o=r[i];if(!o||sr(o)||(kr(o,n),typeof o!="object"||Pt(o)))continue;const l=Object.getOwnPropertySymbols(o);for(let h=0;h<l.length;h++){const u=l[h];Wp.call(o,u)&&n(o[u],u)}}return s}a(Un,"merge");const Pp=a((r,e,t,{allOwnKeys:s}={})=>(kr(e,(n,i)=>{t&&We(n)?Object.defineProperty(r,i,{__proto__:null,value:ka(n,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,i,{__proto__:null,value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),r),"extend"),Mp=a(r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),"stripBOM"),Fp=a((r,e,t,s)=>{r.prototype=Object.create(e.prototype,s),Object.defineProperty(r.prototype,"constructor",{__proto__:null,value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{__proto__:null,value:e.prototype}),t&&Object.assign(r.prototype,t)},"inherits"),xp=a((r,e,t,s)=>{let n,i,c;const o={};if(e=e||{},r==null)return e;do{for(n=Object.getOwnPropertyNames(r),i=n.length;i-- >0;)c=n[i],(!s||s(c,r,e))&&!o[c]&&(e[c]=r[c],o[c]=!0);r=t!==!1&&rr(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},"toFlatObject"),$p=a((r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const s=r.indexOf(e,t);return s!==-1&&s===t},"endsWith"),jp=a(r=>{if(!r)return null;if(Pt(r))return r;let e=r.length;if(!Na(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},"toArray"),Bp=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&rr(Uint8Array)),Up=a((r,e)=>{const s=(r&&r[Ar]).call(r);let n;for(;(n=s.next())&&!n.done;){const i=n.value;e.call(r,i[0],i[1])}},"forEachEntry"),Vp=a((r,e)=>{let t;const s=[];for(;(t=r.exec(e))!==null;)s.push(t);return s},"matchAll"),qp=st("HTMLFormElement"),Hp=a(r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,a(function(t,s,n){return s.toUpperCase()+n},"replacer")),"toCamelCase"),{propertyIsEnumerable:Wp}=Object.prototype,zp=st("RegExp"),Fa=a((r,e)=>{const t=Object.getOwnPropertyDescriptors(r),s={};kr(t,(n,i)=>{let c;(c=e(n,i,r))!==!1&&(s[i]=c||n)}),Object.defineProperties(r,s)},"reduceDescriptors"),Jp=a(r=>{Fa(r,(e,t)=>{if(We(r)&&["arguments","caller","callee"].includes(t))return!1;const s=r[t];if(We(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),Kp=a((r,e)=>{const t={},s=a(n=>{n.forEach(i=>{t[i]=!0})},"define");return Pt(r)?s(r):s(String(r).split(e)),t},"toObjectSet"),Gp=a(()=>{},"noop"),Yp=a((r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,"toFiniteNumber");function Zp(r){return!!(r&&We(r.append)&&r[Ra]==="FormData"&&r[Ar])}a(Zp,"isSpecCompliantForm");const Xp=a(r=>{const e=new WeakSet,t=a(s=>{if(nr(s)){if(e.has(s))return;if(sr(s))return s;if(!("toJSON"in s)){e.add(s);let n;if(Op(s)){n=[];for(const i of s){const c=t(i);!Mt(c)&&n.push(c)}}else n=Pt(s)?[]:{},kr(s,(i,c)=>{const o=t(i);!Mt(o)&&(n[c]=o)});return e.delete(s),n}}return s},"visit");return t(r)},"toJSONObject"),Qp=st("AsyncFunction"),eg=a(r=>r&&(nr(r)||We(r))&&We(r.then)&&We(r.catch),"isThenable"),xa=((r,e)=>r?setImmediate:e?((t,s)=>(Ft.addEventListener("message",({source:n,data:i})=>{n===Ft&&i===t&&s.length&&s.shift()()},!1),n=>{s.push(n),Ft.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",We(Ft.postMessage)),tg=typeof queueMicrotask<"u"?queueMicrotask.bind(Ft):typeof process<"u"&&process.nextTick||xa,$a=a(r=>r!=null&&We(r[Ar]),"isIterable"),E={isArray:Pt,isArrayBuffer:Ca,isBuffer:sr,isFormData:Ip,isArrayBufferView:pp,isString:gp,isNumber:Na,isBoolean:mp,isObject:nr,isPlainObject:us,isEmptyObject:yp,isReadableStream:Rp,isRequest:Cp,isResponse:Np,isHeaders:Dp,isUndefined:Mt,isDate:bp,isFile:_p,isReactNativeBlob:wp,isReactNative:Sp,isBlob:vp,isRegExp:zp,isFunction:We,isStream:Tp,isURLSearchParams:kp,isTypedArray:Bp,isFileList:Ep,forEach:kr,merge:Un,extend:Pp,trim:Lp,stripBOM:Mp,inherits:Fp,toFlatObject:xp,kindOf:Bn,kindOfTest:st,endsWith:$p,toArray:jp,forEachEntry:Up,matchAll:Vp,isHTMLForm:qp,hasOwnProperty:cs,hasOwnProp:cs,hasOwnInPrototypeChain:Ir,getSafeProp:fp,reduceDescriptors:Fa,freezeMethods:Jp,toObjectSet:Kp,toCamelCase:Hp,noop:Gp,toFiniteNumber:Yp,findKey:Pa,global:Ft,isContextDefined:Ma,isSpecCompliantForm:Zp,toJSONObject:Xp,isAsyncFn:Qp,isThenable:eg,setImmediate:xa,asap:tg,isIterable:$a,isSafeIterable:a(r=>r!=null&&Ir(r,Ar)&&$a(r),"isSafeIterable")},rg=E.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sg=a(r=>{const e={};let t,s,n;return r&&r.split(`
`).forEach(a(function(c){n=c.indexOf(":"),t=c.substring(0,n).trim().toLowerCase(),s=c.substring(n+1).trim();const o=E.hasOwnProp(e,t);!t||o&&E.hasOwnProp(rg,t)||(t==="set-cookie"?o?e[t].push(s):e[t]=[s]:e[t]=o?e[t]+", "+s:s)},"parser")),e},"parseHeaders");function ng(r){let e=0,t=r.length;for(;e<t;){const s=r.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;t>e;){const s=r.charCodeAt(t-1);if(s!==9&&s!==32)break;t-=1}return e===0&&t===r.length?r:r.slice(e,t)}a(ng,"trimSPorHTAB");const ig=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),og=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Vn(r,e){return E.isArray(r)?r.map(t=>Vn(t,e)):ng(String(r).replace(e,""))}a(Vn,"sanitizeValue");const ag=a(r=>Vn(r,ig),"sanitizeHeaderValue"),cg=a(r=>Vn(r,og),"sanitizeByteStringHeaderValue");function ja(r){const e=Object.create(null);return E.forEach(r.toJSON(),(t,s)=>{e[s]=cg(t)}),e}a(ja,"toByteStringHeaderObject");const Ba=Symbol("internals");function Rr(r){return r&&String(r).trim().toLowerCase()}a(Rr,"normalizeHeader");function hs(r){return r===!1||r==null?r:E.isArray(r)?r.map(hs):ag(String(r))}a(hs,"normalizeValue");function lg(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(r);)e[s[1]]=s[2];return e}a(lg,"parseTokens");const ug=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function qn(r){let e=0,t=r.length;for(;e<t;){const s=r.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;t>e;){const s=r.charCodeAt(t-1);if(s!==9&&s!==32)break;t-=1}return e===0&&t===r.length?r:r.slice(e,t)}a(qn,"trimOWS");function hg(r){const e=r.length-1;if(e<1||r.charCodeAt(0)!==34||r.charCodeAt(e)!==34)return r;let t="";for(let s=1;s<e;s++){const n=r.charCodeAt(s);if(n===34||n===92&&(s+=1,s>=e))return r;t+=r[s]}return t}a(hg,"decodeQuotedString");function dg(r){const e=Object.create(null),t=String(r);let s=0,n=!1,i=!1;function c(o){const l=qn(t.slice(s,o)),h=l.indexOf("=");if(h<1)return;const u=qn(l.slice(0,h));if(!ug.test(u))return;const g=u.toLowerCase();if(g==="__proto__"||g==="constructor"||g==="prototype")return;const p=qn(l.slice(h+1));e[g]=hg(p)}a(c,"parseParameter");for(let o=0;o<t.length;o++){const l=t.charCodeAt(o);n?i?i=!1:l===92?i=!0:l===34&&(n=!1):l===34?n=!0:(l===44||l===59)&&(c(o),s=o+1)}return c(t.length),e}a(dg,"parseParameters");const fg=a(r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim()),"isValidHeaderName");function Hn(r,e,t,s,n){if(E.isFunction(s))return s.call(this,e,t);if(n&&(e=t),!!E.isString(e)){if(E.isString(s))return e.indexOf(s)!==-1;if(E.isRegExp(s))return s.test(e)}}a(Hn,"matchHeaderValue");function pg(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}a(pg,"formatHeader");function gg(r,e){const t=E.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(r,s+t,{__proto__:null,value:a(function(n,i,c){return this[s].call(this,e,n,i,c)},"value"),configurable:!0})})}a(gg,"buildAccessors");let Fe=class{static{a(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,s){const n=this;function i(o,l,h){const u=Rr(l);if(!u)return;const g=E.findKey(n,u);(!g||n[g]===void 0||h===!0||h===void 0&&n[g]!==!1)&&(n[g||l]=hs(o))}a(i,"setHeader");const c=a((o,l)=>E.forEach(o,(h,u)=>i(h,u,l)),"setHeaders");if(E.isPlainObject(e)||e instanceof this.constructor)c(e,t);else if(E.isString(e)&&(e=e.trim())&&!fg(e))c(sg(e),t);else if(E.isObject(e)&&E.isSafeIterable(e)){let o=Object.create(null),l,h;for(const u of e){if(!E.isArray(u))throw new TypeError("Object iterator must return a key-value pair");h=u[0],E.hasOwnProp(o,h)?(l=o[h],o[h]=E.isArray(l)?[...l,u[1]]:[l,u[1]]):o[h]=u[1]}c(o,t)}else e!=null&&i(t,e,s);return this}get(e,t){if(e=Rr(e),e){const s=E.findKey(this,e);if(s){const n=this[s];if(!t)return n;if(t===!0)return lg(n);if(E.isFunction(t))return t.call(this,n,s);if(E.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Rr(e),e){const s=E.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||Hn(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let n=!1;function i(c){if(c=Rr(c),c){const o=E.findKey(s,c);o&&(!t||Hn(s,s[o],o,t))&&(delete s[o],n=!0)}}return a(i,"deleteHeader"),E.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let s=t.length,n=!1;for(;s--;){const i=t[s];(!e||Hn(this,this[i],i,e,!0))&&(delete this[i],n=!0)}return n}normalize(e){const t=this,s={};return E.forEach(this,(n,i)=>{const c=E.findKey(s,i);if(c){t[c]=hs(n),delete t[i];return}const o=e?pg(i):String(i).trim();o!==i&&delete t[i],t[o]=hs(n),s[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return E.forEach(this,(s,n)=>{s!=null&&s!==!1&&(t[n]=e&&E.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
`)}getSetCookie(){const e=this.get("set-cookie");return E.isArray(e)?e:e==null||e===!1?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return dg(e)}static concat(e,...t){const s=new this(e);return t.forEach(n=>s.set(n)),s}static accessor(e){const s=(this[Ba]=this[Ba]={accessors:{}}).accessors,n=this.prototype;function i(c){const o=Rr(c);s[o]||(gg(n,c),s[o]=!0)}return a(i,"defineAccessor"),E.isArray(e)?e.forEach(i):i(e),this}};Fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),E.reduceDescriptors(Fe.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:a(()=>r,"get"),set(s){this[t]=s}}}),E.freezeMethods(Fe);const ds="[REDACTED ****]";function mg(r){if(E.hasOwnProp(r,"toJSON"))return!0;let e=Object.getPrototypeOf(r);for(;e&&e!==Object.prototype;){if(E.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}a(mg,"hasOwnOrPrototypeToJSON");function yg(r,e){const t=new Set(e.map(i=>String(i).toLowerCase())),s=[],n=a(i=>{if(i===null||typeof i!="object"||E.isBuffer(i))return i;if(s.indexOf(i)!==-1)return;i instanceof Fe&&(i=i.toJSON()),s.push(i);let c;if(E.isArray(i))c=[],i.forEach((o,l)=>{const h=n(o);E.isUndefined(h)||(c[l]=h)});else{if(!E.isPlainObject(i)&&mg(i))return s.pop(),i;c=Object.create(null);for(const[o,l]of Object.entries(i)){const h=t.has(o.toLowerCase())?ds:n(l);E.isUndefined(h)||(c[o]=h)}}return s.pop(),c},"visit");return n(r)}a(yg,"redactConfig");function Ua(r){try{return String(r)}catch{return""}}a(Ua,"stringifySafely$1");function bg(r){return r.errors.map(t=>{try{return t&&t.message?Ua(t.message):Ua(t)}catch{return""}}).filter(Boolean).join("; ")||r.name||"AggregateError"}a(bg,"aggregateErrorMessage");let P=class yl extends Error{static{a(this,"AxiosError")}static from(e,t,s,n,i,c){let o=e.message;!o&&E.isArray(e.errors)&&e.errors.length&&(o=bg(e));const l=new yl(o,t||e.code,s,n,i);return Object.defineProperty(l,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),l.name=e.name,e.status!=null&&l.status==null&&(l.status=e.status),c&&Object.assign(l,c),l}constructor(e,t,s,n,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),s&&(this.config=s),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,t=e&&E.hasOwnProp(e,"redact")?e.redact:void 0,s=E.isArray(t)&&t.length>0?yg(e,t):E.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:s,code:this.code,status:this.status}}};P.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",P.ERR_BAD_OPTION="ERR_BAD_OPTION",P.ECONNABORTED="ECONNABORTED",P.ETIMEDOUT="ETIMEDOUT",P.ECONNREFUSED="ECONNREFUSED",P.ERR_NETWORK="ERR_NETWORK",P.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",P.ERR_DEPRECATED="ERR_DEPRECATED",P.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",P.ERR_BAD_REQUEST="ERR_BAD_REQUEST",P.ERR_CANCELED="ERR_CANCELED",P.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",P.ERR_INVALID_URL="ERR_INVALID_URL",P.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _g=null,Va=100;function Wn(r){return E.isPlainObject(r)||E.isArray(r)}a(Wn,"isVisitable");function qa(r){return E.endsWith(r,"[]")?r.slice(0,-2):r}a(qa,"removeBrackets");function zn(r,e,t){return r?r.concat(e).map(a(function(n,i){return n=qa(n),!t&&i?"["+n+"]":n},"each")).join(t?".":""):e}a(zn,"renderKey");function wg(r){return E.isArray(r)&&!r.some(Wn)}a(wg,"isFlatArray");const Sg=E.toFlatObject(E,{},null,a(function(e){return/^is[A-Z]/.test(e)},"filter"));function fs(r,e,t){if(!E.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=E.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,a(function(_,w){return!E.isUndefined(w[_])},"defined"));const s=t.metaTokens,n=t.visitor||f,i=t.dots,c=t.indexes,o=t.Blob||typeof Blob<"u"&&Blob,l=t.maxDepth===void 0?Va:t.maxDepth,h=o&&E.isSpecCompliantForm(e),u=[];if(!E.isFunction(n))throw new TypeError("visitor must be a function");function g(m){if(m===null)return"";if(E.isDate(m))return m.toISOString();if(E.isBoolean(m))return m.toString();if(!h&&E.isBlob(m))throw new P("Blob is not supported. Use a Buffer instead.");if(E.isArrayBuffer(m)||E.isTypedArray(m)){if(h&&typeof o=="function")return new o([m]);throw new P("Blob is not supported. Use a Buffer instead.",P.ERR_NOT_SUPPORT)}return m}a(g,"convertValue");function p(m){if(m>l)throw new P("Object is too deeply nested ("+m+" levels). Max depth: "+l,P.ERR_FORM_DATA_DEPTH_EXCEEDED)}a(p,"throwIfMaxDepthExceeded");function d(m,_){if(l===1/0)return JSON.stringify(m);const w=[];return JSON.stringify(m,a(function(T,v){if(!E.isObject(v))return v;for(;w.length&&w[w.length-1]!==this;)w.pop();return w.push(v),p(_+w.length-1),v},"limitDepth"))}a(d,"stringifyWithDepthLimit");function f(m,_,w){let S=m;if(E.isReactNative(e)&&E.isReactNativeBlob(m))return e.append(zn(w,_,i),g(m)),!1;if(m&&!w&&typeof m=="object"){if(E.endsWith(_,"{}"))_=s?_:_.slice(0,-2),m=d(m,1);else if(E.isArray(m)&&wg(m)||(E.isFileList(m)||E.endsWith(_,"[]"))&&(S=E.toArray(m)))return _=qa(_),S.forEach(a(function(v,k){!(E.isUndefined(v)||v===null)&&e.append(c===!0?zn([_],k,i):c===null?_:_+"[]",g(v))},"each")),!1}return Wn(m)?!0:(e.append(zn(w,_,i),g(m)),!1)}a(f,"defaultVisitor");const y=Object.assign(Sg,{defaultVisitor:f,convertValue:g,isVisitable:Wn});function b(m,_,w=0){if(!E.isUndefined(m)){if(p(w),u.indexOf(m)!==-1)throw new Error("Circular reference detected in "+_.join("."));u.push(m),E.forEach(m,a(function(T,v){(!(E.isUndefined(T)||T===null)&&n.call(e,T,E.isString(v)?v.trim():v,_,y))===!0&&b(T,_?_.concat(v):[v],w+1)},"each")),u.pop()}}if(a(b,"build"),!E.isObject(r))throw new TypeError("data must be an object");return b(r),e}a(fs,"toFormData$1");function Ha(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(r).replace(/[!'()~]|%20/g,a(function(s){return e[s]},"replacer"))}a(Ha,"encode$2");function Jn(r,e){this._pairs=[],r&&fs(r,this,e)}a(Jn,"AxiosURLSearchParams");const Wa=Jn.prototype;Wa.append=a(function(e,t){this._pairs.push([e,t])},"append"),Wa.toString=a(function(e){const t=e?s=>e.call(this,s,Ha):Ha;return this._pairs.map(a(function(n){return t(n[0])+"="+t(n[1])},"each"),"").join("&")},"toString");function vg(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}a(vg,"encode$1");function za(r,e,t){if(!e)return r;r=r||"";const s=E.isFunction(t)?{serialize:t}:t,n=E.getSafeProp(s,"encode")||vg,i=E.getSafeProp(s,"serialize");let c;if(i?c=i(e,s):c=E.isURLSearchParams(e)?e.toString():new Jn(e,s).toString(n),c){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+c}return r}a(za,"buildURL");class Ja{static{a(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){E.forEach(this.handlers,a(function(s){s!==null&&e(s)},"forEachHandler"))}}const Kn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Eg={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Jn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Gn=typeof window<"u"&&typeof document<"u",Yn=typeof navigator=="object"&&navigator||void 0,Og=Gn&&(!Yn||["ReactNative","NativeScript","NS"].indexOf(Yn.product)<0),Tg=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ag=Gn&&window.location.href||"http://localhost",Re={...{__proto__:null,hasBrowserEnv:Gn,hasStandardBrowserEnv:Og,hasStandardBrowserWebWorkerEnv:Tg,navigator:Yn,origin:Ag},...Eg};function Ig(r,e){return fs(r,new Re.classes.URLSearchParams,{visitor:a(function(t,s,n,i){return Re.isNode&&E.isBuffer(t)?(this.append(s,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},"visitor"),...e})}a(Ig,"toURLEncodedForm");const Ka=Va;function Ga(r){if(r>Ka)throw new P("FormData field is too deeply nested ("+r+" levels). Max depth: "+Ka,P.ERR_FORM_DATA_DEPTH_EXCEEDED)}a(Ga,"throwIfDepthExceeded");function kg(r){const e=[],t=/[^.[\]]+|\[([^.[\]]*)]/g;let s;for(;(s=t.exec(r))!==null;)Ga(e.length),e.push(s[0]==="[]"?"":s[1]||s[0]);return e}a(kg,"parsePropPath");function Rg(r){const e={},t=Object.keys(r);let s;const n=t.length;let i;for(s=0;s<n;s++)i=t[s],e[i]=r[i];return e}a(Rg,"arrayToObject");function Ya(r){function e(t,s,n,i){Ga(i);let c=t[i++];if(c==="__proto__")return!0;const o=Number.isFinite(+c),l=i>=t.length;return c=!c&&E.isArray(n)?n.length:c,l?(E.hasOwnProp(n,c)?n[c]=E.isArray(n[c])?n[c].concat(s):[n[c],s]:n[c]=s,!o):((!E.hasOwnProp(n,c)||!E.isObject(n[c]))&&(n[c]=[]),e(t,s,n[c],i)&&E.isArray(n[c])&&(n[c]=Rg(n[c])),!o)}if(a(e,"buildPath"),E.isFormData(r)&&E.isFunction(r.entries)){const t={};return E.forEachEntry(r,(s,n)=>{e(kg(s),n,t,0)}),t}return null}a(Ya,"formDataToJSON");const ir=a((r,e)=>r!=null&&E.hasOwnProp(r,e)?r[e]:void 0,"own");function Cg(r,e,t){if(E.isString(r))try{return(e||JSON.parse)(r),E.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(r)}a(Cg,"stringifySafely");const Cr={transitional:Kn,adapter:["xhr","http","fetch"],transformRequest:[a(function(e,t){const s=t.getContentType()||"",n=s.indexOf("application/json")>-1,i=E.isObject(e);if(i&&E.isHTMLForm(e)&&(e=new FormData(e)),E.isFormData(e))return n?JSON.stringify(Ya(e)):e;if(E.isArrayBuffer(e)||E.isBuffer(e)||E.isStream(e)||E.isFile(e)||E.isBlob(e)||E.isReadableStream(e))return e;if(E.isArrayBufferView(e))return e.buffer;if(E.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){const l=ir(this,"formSerializer");if(s.indexOf("application/x-www-form-urlencoded")>-1)return Ig(e,l).toString();if((o=E.isFileList(e))||s.indexOf("multipart/form-data")>-1){const h=ir(this,"env"),u=h&&h.FormData;return fs(o?{"files[]":e}:e,u&&new u,l)}}return i||n?(t.setContentType("application/json",!1),Cg(e)):e},"transformRequest")],transformResponse:[a(function(e){const t=ir(this,"transitional")||Cr.transitional,s=t&&t.forcedJSONParsing,n=ir(this,"responseType"),i=n==="json";if(E.isResponse(e)||E.isReadableStream(e))return e;if(e&&E.isString(e)&&(s&&!n||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,ir(this,"parseReviver"))}catch(l){if(o)throw l.name==="SyntaxError"?P.from(l,P.ERR_BAD_RESPONSE,this,null,ir(this,"response")):l}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Re.classes.FormData,Blob:Re.classes.Blob},validateStatus:a(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};E.forEach(["delete","get","head","post","put","patch","query"],r=>{Cr.headers[r]={}});function Zn(r,e){const t=this||Cr,s=e||t,n=Fe.from(s.headers);let i=s.data;return E.forEach(r,a(function(o){i=o.call(t,i,n.normalize(),e?e.status:void 0)},"transform")),n.normalize(),i}a(Zn,"transformData");function Za(r){return!!(r&&r.__CANCEL__)}a(Za,"isCancel$1");let Nr=class extends P{static{a(this,"CanceledError")}constructor(e,t,s){super(e??"canceled",P.ERR_CANCELED,t,s),this.name="CanceledError",this.__CANCEL__=!0}};function Xa(r,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?r(t):e(new P("Request failed with status code "+t.status,t.status>=400&&t.status<500?P.ERR_BAD_REQUEST:P.ERR_BAD_RESPONSE,t.config,t.request,t))}a(Xa,"settle");function Ng(r){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(r);return e&&e[1]||""}a(Ng,"parseProtocol");function Dg(r,e){r=r||10;const t=new Array(r),s=new Array(r);let n=0,i=0,c;return e=e!==void 0?e:1e3,a(function(l){const h=Date.now(),u=s[i];c||(c=h),t[n]=l,s[n]=h;let g=i,p=0;for(;g!==n;)p+=t[g++],g=g%r;if(n=(n+1)%r,n===i&&(i=(i+1)%r),h-c<e)return;const d=u&&h-u;return d?Math.round(p*1e3/d):void 0},"push")}a(Dg,"speedometer");function Lg(r,e){let t=0,s=1e3/e,n,i;const c=a((h,u=Date.now())=>{t=u,n=null,i&&(clearTimeout(i),i=null),r(...h)},"invoke");return[a((...h)=>{const u=Date.now(),g=u-t;g>=s?c(h,u):(n=h,i||(i=setTimeout(()=>{i=null,c(n)},s-g)))},"throttled"),a(()=>n&&c(n),"flush")]}a(Lg,"throttle");const ps=a((r,e,t=3)=>{let s=0;const n=Dg(50,250);return Lg(i=>{if(!i||typeof i.loaded!="number")return;const c=i.loaded,o=i.lengthComputable?i.total:void 0,l=Math.max(0,o!=null?Math.min(c,o):c),h=Math.max(0,l-s),u=n(h);s=Math.max(s,l);const g={loaded:l,total:o,progress:o?l/o:void 0,bytes:h,rate:u||void 0,estimated:u&&o?(o-l)/u:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(g)},t)},"progressEventReducer"),Qa=a((r,e)=>{const t=r!=null;return[s=>e[0]({lengthComputable:t,total:r,loaded:s}),e[1]]},"progressEventDecorator"),ec=a((r,e=E.asap)=>(...t)=>e(()=>r(...t)),"asyncDecorator"),Pg=Re.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,Re.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(Re.origin),Re.navigator&&/(msie|trident)/i.test(Re.navigator.userAgent)):()=>!0,Mg=Re.hasStandardBrowserEnv?{write(r,e,t,s,n,i,c){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(e)}`];E.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),E.isString(s)&&o.push(`path=${s}`),E.isString(n)&&o.push(`domain=${n}`),i===!0&&o.push("secure"),E.isString(c)&&o.push(`SameSite=${c}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let t=0;t<e.length;t++){const s=e[t].replace(/^\s+/,""),n=s.indexOf("=");if(n!==-1&&s.slice(0,n)===r)try{return decodeURIComponent(s.slice(n+1))}catch{return s.slice(n+1)}}return null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Fg(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}a(Fg,"isAbsoluteURL");function xg(r,e){if(!e)return r;let t=r.length;for(;t>0&&r.charCodeAt(t-1)===47;)t--;return r.slice(0,t)+"/"+e.replace(/^\/+/,"")}a(xg,"combineURLs");const $g=/^https?:(?!\/\/)/i,jg=/[\t\n\r]/g;function Bg(r){let e=0;for(;e<r.length&&r.charCodeAt(e)<=32;)e++;return r.slice(e)}a(Bg,"stripLeadingC0ControlOrSpace");function Ug(r){return Bg(r).replace(jg,"")}a(Ug,"normalizeURLForProtocolCheck");function Vg(r){return r&&r.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,s="")=>`${t}${s}${ds}`)}a(Vg,"redactFragment");function qg(r){const e=r.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${ds}@`),t=e.indexOf("#"),n=(t===-1?e:e.slice(0,t)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${ds}`);return t===-1?n:`${n}#${Vg(e.slice(t+1))}`}a(qg,"redactSensitiveURLParts");function tc(r,e){if(typeof r=="string"){const t=Ug(r);if($g.test(t))throw new P(`Invalid URL ${JSON.stringify(qg(t))}: missing "//" after protocol`,P.ERR_INVALID_URL,e)}}a(tc,"assertValidHttpProtocolURL");function rc(r,e,t,s){tc(e,s);let n=!Fg(e);return r&&(n||t===!1)?(tc(r,s),xg(r,e)):e}a(rc,"buildFullPath");const sc=a(r=>r instanceof Fe?{...r}:r,"headersToObject"),Hg=a(r=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(r).concat(Object.getOwnPropertySymbols(r).filter(e=>Object.getOwnPropertyDescriptor(r,e).enumerable)):Object.keys(r),"ownEnumerableKeys");function xt(r,e){r=r||{},e=e||{};const t=Object.create(null);Object.defineProperty(t,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function s(u,g,p,d){return E.isPlainObject(u)&&E.isPlainObject(g)?E.merge.call({caseless:d},u,g):E.isPlainObject(g)?E.merge({},g):E.isArray(g)?g.slice():g}a(s,"getMergedValue");function n(u,g,p,d){if(E.isUndefined(g)){if(!E.isUndefined(u))return s(void 0,u,p,d)}else return s(u,g,p,d)}a(n,"mergeDeepProperties");function i(u,g){if(!E.isUndefined(g))return s(void 0,g)}a(i,"valueFromConfig2");function c(u,g){if(E.isUndefined(g)){if(!E.isUndefined(u))return s(void 0,u)}else return s(void 0,g)}a(c,"defaultToConfig2");function o(u){const g=E.hasOwnProp(e,"transitional")?e.transitional:void 0;if(!E.isUndefined(g))if(E.isPlainObject(g)){if(E.hasOwnProp(g,u))return g[u]}else return;const p=E.hasOwnProp(r,"transitional")?r.transitional:void 0;if(E.isPlainObject(p)&&E.hasOwnProp(p,u))return p[u]}a(o,"getMergedTransitionalOption");function l(u,g,p){if(E.hasOwnProp(e,p))return s(u,g);if(E.hasOwnProp(r,p))return s(void 0,u)}a(l,"mergeDirectKeys");const h={url:i,method:i,data:i,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,allowedSocketPaths:c,responseEncoding:c,validateStatus:l,headers:a((u,g,p)=>n(sc(u),sc(g),p,!0),"headers")};return E.forEach(Hg({...r,...e}),a(function(g){if(g==="__proto__"||g==="constructor"||g==="prototype")return;const p=E.hasOwnProp(h,g)?h[g]:n,d=E.hasOwnProp(r,g)?r[g]:void 0,f=E.hasOwnProp(e,g)?e[g]:void 0,y=p(d,f,g);E.isUndefined(y)&&p!==l||(t[g]=y)},"computeConfigValue")),E.hasOwnProp(e,"validateStatus")&&E.isUndefined(e.validateStatus)&&o("validateStatusUndefinedResolves")===!1&&(E.hasOwnProp(r,"validateStatus")?t.validateStatus=s(void 0,r.validateStatus):delete t.validateStatus),t}a(xt,"mergeConfig$1");const Wg=["content-type","content-length"];function zg(r,e,t){if(t!=="content-only"){r.set(e);return}Object.entries(e||{}).forEach(([s,n])=>{Wg.includes(s.toLowerCase())&&r.set(s,n)})}a(zg,"setFormDataHeaders");const Jg=a(r=>encodeURIComponent(r).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),"encodeUTF8$1");function nc(r){const e=xt({},r),t=a(p=>E.hasOwnProp(e,p)?e[p]:void 0,"own"),s=t("data");let n=t("withXSRFToken");const i=t("xsrfHeaderName"),c=t("xsrfCookieName");let o=t("headers");const l=t("auth"),h=t("baseURL"),u=t("allowAbsoluteUrls"),g=t("url");if(e.headers=o=Fe.from(o),e.url=za(rc(h,g,u,e),t("params"),t("paramsSerializer")),l){const p=E.getSafeProp(l,"username")||"",d=E.getSafeProp(l,"password")||"";try{o.set("Authorization","Basic "+btoa(p+":"+(d?Jg(d):"")))}catch(f){throw P.from(f,P.ERR_BAD_OPTION_VALUE,r)}}if(E.isFormData(s)&&(Re.hasStandardBrowserEnv||Re.hasStandardBrowserWebWorkerEnv||E.isReactNative(s)?o.setContentType(void 0):E.isFunction(s.getHeaders)&&zg(o,s.getHeaders(),t("formDataHeaderPolicy"))),Re.hasStandardBrowserEnv&&(E.isFunction(n)&&(n=n(e)),n===!0||n==null&&Pg(e.url))){const d=i&&c&&Mg.read(c);d&&o.set(i,d)}return e}a(nc,"resolveConfig");const Kg=typeof XMLHttpRequest<"u"&&function(r){return new Promise(a(function(t,s){const n=nc(r);let i=n.data;const c=Fe.from(n.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:h}=n,u,g,p,d,f;function y(){d&&d(),f&&f(),n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}a(y,"done");let b=new XMLHttpRequest;b.open(n.method.toUpperCase(),n.url,!0),b.timeout=n.timeout;function m(){if(!b)return;const w=Fe.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),T={data:!o||o==="text"||o==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:r,request:b};Xa(a(function(k){t(k),y()},"_resolve"),a(function(k){s(k),y()},"_reject"),T),b=null}a(m,"onloadend"),"onloadend"in b?b.onloadend=m:b.onreadystatechange=a(function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.startsWith("file:"))||setTimeout(m)},"handleLoad"),b.onabort=a(function(){b&&(s(new P("Request aborted",P.ECONNABORTED,r,b)),y(),b=null)},"handleAbort"),b.onerror=a(function(S){const T=S&&S.message?S.message:"Network Error",v=new P(T,P.ERR_NETWORK,r,b);v.event=S||null,s(v),y(),b=null},"handleError"),b.ontimeout=a(function(){let S=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const T=n.transitional||Kn;n.timeoutErrorMessage&&(S=n.timeoutErrorMessage),s(new P(S,T.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,r,b)),y(),b=null},"handleTimeout"),i===void 0&&c.setContentType(null),"setRequestHeader"in b&&E.forEach(ja(c),a(function(S,T){b.setRequestHeader(T,S)},"setRequestHeader")),E.isUndefined(n.withCredentials)||(b.withCredentials=!!n.withCredentials),o&&o!=="json"&&(b.responseType=n.responseType),h&&([p,f]=ps(h,!0),b.addEventListener("progress",p)),l&&b.upload&&([g,d]=ps(l),b.upload.addEventListener("progress",g),b.upload.addEventListener("loadend",d)),(n.cancelToken||n.signal)&&(u=a(w=>{b&&(s(!w||w.type?new Nr(null,r,b):w),b.abort(),y(),b=null)},"onCanceled"),n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));const _=Ng(n.url);if(_&&!Re.protocols.includes(_)){s(new P("Unsupported protocol "+_+":",P.ERR_BAD_REQUEST,r)),y();return}b.send(i||null)},"dispatchXhrRequest"))},Gg=a((r,e)=>{if(r=r?r.filter(Boolean):[],!e&&!r.length)return;const t=new AbortController;let s=!1;const n=a(function(l){if(!s){s=!0,c();const h=l instanceof Error?l:this.reason;t.abort(h instanceof P?h:new Nr(h instanceof Error?h.message:h))}},"onabort");let i=e&&setTimeout(()=>{i=null,n(new P(`timeout of ${e}ms exceeded`,P.ETIMEDOUT))},e);const c=a(()=>{r&&(i&&clearTimeout(i),i=null,r.forEach(l=>{l.unsubscribe?l.unsubscribe(n):l.removeEventListener("abort",n)}),r=null)},"unsubscribe");r.forEach(l=>{if(!s){if(l.aborted){n.call(l);return}l.addEventListener("abort",n,{once:!0})}});const{signal:o}=t;return o.unsubscribe=()=>E.asap(c),o},"composeSignals"),Yg=a(function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let s=0,n;for(;s<t;)n=s+e,yield r.slice(s,n),s=n},"streamChunk"),Zg=a(async function*(r,e){for await(const t of Xg(r))yield*Yg(t,e)},"readBytes"),Xg=a(async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:s}=await e.read();if(t)break;yield s}}finally{await e.cancel()}},"readStream"),ic=a((r,e,t,s)=>{const n=Zg(r,e);let i=0,c,o=a(l=>{c||(c=!0,s&&s(l))},"_onFinish");return new ReadableStream({async pull(l){try{const{done:h,value:u}=await n.next();if(h){o(),l.close();return}let g=u.byteLength;if(t){let p=i+=g;t(p)}l.enqueue(new Uint8Array(u))}catch(h){throw o(h),h}},cancel(l){return o(l),n.return()}},{highWaterMark:2})},"trackStream"),oc=a(r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,"isHexDigit"),ac=a((r,e,t)=>e+2<t&&oc(r.charCodeAt(e+1))&&oc(r.charCodeAt(e+2)),"isPercentEncodedByte"),cc=a(r=>r<=57?r-48:(r&223)-55,"hexValue"),Qg=a(r=>r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57||r===43||r===47||r===45||r===95,"isBase64Char"),em=a(r=>r===9||r===10||r===12||r===13||r===32,"isBase64Whitespace"),tm=a(r=>{const e=Math.floor(r/4),t=r%4;return e*3+(t===2?1:t===3?2:0)},"base64Bytes"),rm=a(r=>{const e=r.length;let t=0;return e>0&&r.charCodeAt(e-1)===61&&(t++,e>1&&r.charCodeAt(e-2)===61&&t++),Math.floor((e-t)*3/4)},"estimateBase64BufferAllocation"),sm=a(r=>{const e=r.length;let t=0,s=0,n=!1;for(let i=0;i<e;i++){let c=r.charCodeAt(i);if(c===37&&ac(r,i,e)&&(c=cc(r.charCodeAt(i+1))*16+cc(r.charCodeAt(i+2)),i+=2),!em(c)){if(c===61){s++;continue}if(!Qg(c)||s>0){n=!0;continue}t++}}return n||s>2||s>0&&(t+s)%4!==0||t%4===1?rm(r):tm(t)},"estimatePercentDecodedBase64Bytes"),nm=a((r,e)=>{if(!r||typeof r!="string"||!r.startsWith("data:"))return 0;const t=r.indexOf(",");if(t<0)return 0;const s=r.slice(5,t),n=r.slice(t+1);if(/;base64/i.test(s))return e(n);let c=0;for(let o=0,l=n.length;o<l;o++){const h=n.charCodeAt(o);if(h===37&&ac(n,o,l))c+=1,o+=2;else if(h<128)c+=1;else if(h<2048)c+=2;else if(h>=55296&&h<=56319&&o+1<l){const u=n.charCodeAt(o+1);u>=56320&&u<=57343?(c+=4,o++):c+=3}else c+=3}return c},"estimateDataURLBytes");function im(r){const e=typeof r=="string"?r.indexOf("#"):-1;return nm(e===-1?r:r.slice(0,e),sm)}a(im,"estimateDataURLDecodedBytes");const Xn="1.19.0",lc=64*1024,{isFunction:gs}=E,om=a(r=>encodeURIComponent(r).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),"encodeUTF8"),uc=a(r=>{if(!E.isString(r))return r;try{return decodeURIComponent(r)}catch{return r}},"decodeURIComponentSafe"),hc=a((r,...e)=>{try{return!!r(...e)}catch{return!1}},"test"),am=a(r=>{const e=r.indexOf("://");let t=r;return e!==-1&&(t=t.slice(e+3)),t.includes("@")||t.includes(":")},"maybeWithAuthCredentials"),cm=a(r=>{const e=E.global!==void 0&&E.global!==null?E.global:globalThis,{ReadableStream:t,TextEncoder:s}=e;r=E.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},r);const{fetch:n,Request:i,Response:c}=r,o=n?gs(n):typeof fetch=="function",l=gs(i),h=gs(c);if(!o)return!1;const u=o&&gs(t),g=o&&(typeof s=="function"?(m=>_=>m.encode(_))(new s):async m=>new Uint8Array(await new i(m).arrayBuffer())),p=l&&u&&hc(()=>{let m=!1;const _=new i(Re.origin,{body:new t,method:"POST",get duplex(){return m=!0,"half"}}),w=_.headers.has("Content-Type");return _.body!=null&&_.body.cancel(),m&&!w}),d=h&&u&&hc(()=>E.isReadableStream(new c("").body)),f={stream:d&&(m=>m.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(_,w)=>{let S=_&&_[m];if(S)return S.call(_);throw new P(`Response type '${m}' is not supported`,P.ERR_NOT_SUPPORT,w)})});const y=a(async m=>{if(m==null)return 0;if(E.isBlob(m))return m.size;if(E.isSpecCompliantForm(m))return(await new i(Re.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(E.isArrayBufferView(m)||E.isArrayBuffer(m))return m.byteLength;if(E.isURLSearchParams(m)&&(m=m+""),E.isString(m))return(await g(m)).byteLength},"getBodyLength"),b=a(async(m,_)=>{const w=E.toFiniteNumber(m.getContentLength());return w??y(_)},"resolveBodyLength");return async m=>{let{url:_,method:w,data:S,signal:T,cancelToken:v,timeout:k,onDownloadProgress:O,onUploadProgress:A,responseType:N,headers:B,withCredentials:q="same-origin",fetchOptions:pe,maxContentLength:ge,maxBodyLength:G}=nc(m);const ne=E.isNumber(ge)&&ge>-1,W=E.isNumber(G)&&G>-1,Ee=a(z=>E.hasOwnProp(m,z)?m[z]:void 0,"own");let de=n||fetch;N=N?(N+"").toLowerCase():"text";let j=Gg([T,v&&v.toAbortSignal()],k),le=null;const je=j&&j.unsubscribe&&(()=>{j.unsubscribe()});let Be,X=null;const ue=a(()=>new P("Request body larger than maxBodyLength limit",P.ERR_BAD_REQUEST,m,le),"maxBodyLengthError");try{let z;const re=Ee("auth");if(re){const Q=E.getSafeProp(re,"username")||"",Ue=E.getSafeProp(re,"password")||"";z={username:Q,password:Ue}}if(am(_)){const Q=new URL(_,Re.origin);if(!z&&(Q.username||Q.password)){const Ue=uc(Q.username),ut=uc(Q.password);z={username:Ue,password:ut}}(Q.username||Q.password)&&(Q.username="",Q.password="",_=Q.href)}if(z&&(B.delete("authorization"),B.set("Authorization","Basic "+btoa(om((z.username||"")+":"+(z.password||""))))),ne&&typeof _=="string"&&_.startsWith("data:")&&im(_)>ge)throw new P("maxContentLength size of "+ge+" exceeded",P.ERR_BAD_RESPONSE,m,le);if(W&&w!=="get"&&w!=="head"){const Q=await y(S);if(typeof Q=="number"&&isFinite(Q)&&(Be=Q,Q>G))throw ue()}const Se=W&&(E.isReadableStream(S)||E.isStream(S)),Ce=a((Q,Ue,ut)=>ic(Q,lc,nt=>{if(W&&nt>G)throw X=ue();Ue&&Ue(nt)},ut),"trackRequestStream");if(p&&w!=="get"&&w!=="head"&&(A||Se)){if(Be=Be??await b(B,S),Be!==0||Se){let Q=new i(_,{method:"POST",body:S,duplex:"half"}),Ue;if(E.isFormData(S)&&(Ue=Q.headers.get("content-type"))&&B.setContentType(Ue),Q.body){const[ut,nt]=A&&Qa(Be,ps(ec(A)))||[];S=Ce(Q.body,ut,nt)}}}else if(Se&&!l&&u&&w!=="get"&&w!=="head")S=Ce(S);else if(Se&&l&&!p&&w!=="get"&&w!=="head")throw new P("Stream request bodies are not supported by the current fetch implementation",P.ERR_NOT_SUPPORT,m,le);E.isString(q)||(q=q?"include":"omit");const Z=l&&"credentials"in i.prototype;if(E.isFormData(S)){const Q=B.getContentType();Q&&/^multipart\/form-data/i.test(Q)&&!/boundary=/i.test(Q)&&B.delete("content-type")}B.set("User-Agent","axios/"+Xn,!1);const Ze={...pe,signal:j,method:w.toUpperCase(),headers:ja(B.normalize()),body:S,duplex:"half",credentials:Z?q:void 0};le=l&&new i(_,Ze);let Xe=await(l?de(le,pe):de(_,Ze));const Bt=Fe.from(Xe.headers);if(ne){const Q=E.toFiniteNumber(Bt.getContentLength());if(Q!=null&&Q>ge)throw new P("maxContentLength size of "+ge+" exceeded",P.ERR_BAD_RESPONSE,m,le)}const ar=d&&(N==="stream"||N==="response");if(d&&Xe.body&&(O||ne||ar&&je)){const Q={};["status","statusText","headers"].forEach(Qe=>{Q[Qe]=Xe[Qe]});const Ue=E.toFiniteNumber(Bt.getContentLength()),[ut,nt]=O&&Qa(Ue,ps(ec(O),!0))||[];let ze=0;const Es=a(Qe=>{if(ne&&(ze=Qe,ze>ge))throw new P("maxContentLength size of "+ge+" exceeded",P.ERR_BAD_RESPONSE,m,le);ut&&ut(Qe)},"onChunkProgress");Xe=new c(ic(Xe.body,lc,Es,()=>{nt&&nt(),je&&je()}),Q)}N=N||"text";let Ne=await f[E.findKey(f,N)||"text"](Xe,m);if(ne&&!d&&!ar){let Q;if(Ne!=null&&(typeof Ne.byteLength=="number"?Q=Ne.byteLength:typeof Ne.size=="number"?Q=Ne.size:typeof Ne=="string"&&(Q=typeof s=="function"?new s().encode(Ne).byteLength:Ne.length)),typeof Q=="number"&&Q>ge)throw new P("maxContentLength size of "+ge+" exceeded",P.ERR_BAD_RESPONSE,m,le)}return!ar&&je&&je(),await new Promise((Q,Ue)=>{Xa(Q,Ue,{data:Ne,headers:Fe.from(Xe.headers),status:Xe.status,statusText:Xe.statusText,config:m,request:le})})}catch(z){if(je&&je(),j&&j.aborted&&j.reason instanceof P){const re=j.reason;throw re.config=m,le&&(re.request=le),z!==re&&Object.defineProperty(re,"cause",{__proto__:null,value:z,writable:!0,enumerable:!1,configurable:!0}),re}if(X)throw le&&!X.request&&(X.request=le),X;if(z instanceof P)throw le&&!z.request&&(z.request=le),z;if(z&&z.name==="TypeError"&&/Load failed|fetch/i.test(z.message)){const re=new P("Network Error",P.ERR_NETWORK,m,le,z&&z.response);throw Object.defineProperty(re,"cause",{__proto__:null,value:z.cause||z,writable:!0,enumerable:!1,configurable:!0}),re}throw P.from(z,z&&z.code,m,le,z&&z.response)}}},"factory"),lm=new Map,dc=a(r=>{let e=r&&r.env||{};const{fetch:t,Request:s,Response:n}=e,i=[s,n,t];let c=i.length,o=c,l,h,u=lm;for(;o--;)l=i[o],h=u.get(l),h===void 0&&u.set(l,h=o?new Map:cm(e)),u=h;return h},"getFetch");dc();const Qn={http:_g,xhr:Kg,fetch:{get:dc}};E.forEach(Qn,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(r,"adapterName",{__proto__:null,value:e})}});const fc=a(r=>`- ${r}`,"renderReason"),um=a(r=>E.isFunction(r)||r===null||r===!1,"isResolvedHandle");function hm(r,e){r=E.isArray(r)?r:[r];const{length:t}=r;let s,n;const i={};for(let c=0;c<t;c++){s=r[c];let o;if(n=s,!um(s)&&(n=Qn[(o=String(s)).toLowerCase()],n===void 0))throw new P(`Unknown adapter '${o}'`);if(n&&(E.isFunction(n)||(n=n.get(e))))break;i[o||"#"+c]=n}if(!n){const c=Object.entries(i).map(([l,h])=>`adapter ${l} `+(h===!1?"is not supported by the environment":"is not available in the build"));let o=t?c.length>1?`since :
`+c.map(fc).join(`
`):" "+fc(c[0]):"as no adapter specified";throw new P("There is no suitable adapter to dispatch the request "+o,P.ERR_NOT_SUPPORT)}return n}a(hm,"getAdapter$1");const pc={getAdapter:hm,adapters:Qn};function ei(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Nr(null,r)}a(ei,"throwIfCancellationRequested");function ti(r){return ei(r),r.headers=Fe.from(r.headers),r.data=Zn.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),pc.getAdapter(r.adapter||Cr.adapter,r)(r).then(a(function(s){ei(r),r.response=s;try{s.data=Zn.call(r,r.transformResponse,s)}finally{delete r.response}return s.headers=Fe.from(s.headers),s},"onAdapterResolution"),a(function(s){if(!Za(s)&&(ei(r),s&&s.response)){r.response=s.response;try{s.response.data=Zn.call(r,r.transformResponse,s.response)}finally{delete r.response}s.response.headers=Fe.from(s.response.headers)}return Promise.reject(s)},"onAdapterRejection"))}a(ti,"dispatchRequest");const ms={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{ms[r]=a(function(s){return typeof s===r||"a"+(e<1?"n ":" ")+r},"validator")});const gc={};ms.transitional=a(function(e,t,s){function n(i,c){return"[Axios v"+Xn+"] Transitional option '"+i+"'"+c+(s?". "+s:"")}return a(n,"formatMessage"),(i,c,o)=>{if(e===!1)throw new P(n(c," has been removed"+(t?" in "+t:"")),P.ERR_DEPRECATED);return t&&!gc[c]&&(gc[c]=!0,console.warn(n(c," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,c,o):!0}},"transitional"),ms.spelling=a(function(e){return(t,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)},"spelling");function dm(r,e,t){if(typeof r!="object"||r===null)throw new P("options must be an object",P.ERR_BAD_OPTION_VALUE);const s=Object.keys(r);let n=s.length;for(;n-- >0;){const i=s[n],c=Object.prototype.hasOwnProperty.call(e,i)?e[i]:void 0;if(c){const o=r[i],l=o===void 0||c(o,i,r);if(l!==!0)throw new P("option "+i+" must be "+l,P.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new P("Unknown option "+i,P.ERR_BAD_OPTION)}}a(dm,"assertOptions");const ys={assertOptions:dm,validators:ms},xe=ys.validators;let $t=class{static{a(this,"Axios")}constructor(e){this.defaults=e||{},this.interceptors={request:new Ja,response:new Ja}}async request(e,t){try{return await this._request(e,t)}catch(s){if(s instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const i=(()=>{if(!n.stack)return"";const c=n.stack.indexOf(`
`);return c===-1?"":n.stack.slice(c+1)})();try{if(!s.stack)s.stack=i;else if(i){const c=i.indexOf(`
`),o=c===-1?-1:i.indexOf(`
`,c+1),l=o===-1?"":i.slice(o+1);String(s.stack).endsWith(l)||(s.stack+=`
`+i)}}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=xt(this.defaults,t);const{transitional:s,paramsSerializer:n,headers:i}=t;s!==void 0&&ys.assertOptions(s,{silentJSONParsing:xe.transitional(xe.boolean),forcedJSONParsing:xe.transitional(xe.boolean),clarifyTimeoutError:xe.transitional(xe.boolean),legacyInterceptorReqResOrdering:xe.transitional(xe.boolean),advertiseZstdAcceptEncoding:xe.transitional(xe.boolean),validateStatusUndefinedResolves:xe.transitional(xe.boolean)},!1),n!=null&&(E.isFunction(n)?t.paramsSerializer={serialize:n}:ys.assertOptions(n,{encode:xe.function,serialize:xe.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ys.assertOptions(t,{baseUrl:xe.spelling("baseURL"),withXsrfToken:xe.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let c=i&&E.merge(i.common,i[t.method]);i&&E.forEach(["delete","get","head","post","put","patch","query","common"],f=>{delete i[f]}),t.headers=Fe.concat(c,i);const o=[];let l=!0;this.interceptors.request.forEach(a(function(y){if(typeof y.runWhen=="function"&&y.runWhen(t)===!1)return;l=l&&y.synchronous;const b=t.transitional||Kn;b&&b.legacyInterceptorReqResOrdering?o.unshift(y.fulfilled,y.rejected):o.push(y.fulfilled,y.rejected)},"unshiftRequestInterceptors"));const h=[];this.interceptors.response.forEach(a(function(y){h.push(y.fulfilled,y.rejected)},"pushResponseInterceptors"));let u,g=0,p;if(!l){const f=[ti.bind(this),void 0];for(f.unshift(...o),f.push(...h),p=f.length,u=Promise.resolve(t);g<p;)u=u.then(f[g++],f[g++]);return u}p=o.length;let d=t;for(;g<p;){const f=o[g++],y=o[g++];try{d=f?f(d):d}catch(b){if(!y){u=Promise.reject(b);break}try{const m=y.call(this,b);E.isThenable(m)&&(u=Promise.resolve(m).then(()=>ti.call(this,d)))}catch(m){u=Promise.reject(m)}break}}if(!u)try{u=ti.call(this,d)}catch(f){u=Promise.reject(f)}for(g=0,p=h.length;g<p;)u=u.then(h[g++],h[g++]);return u}getUri(e){e=xt(this.defaults,e);const t=rc(e.baseURL,e.url,e.allowAbsoluteUrls,e);return za(t,e.params,e.paramsSerializer)}};E.forEach(["delete","get","head","options"],a(function(e){$t.prototype[e]=function(t,s){return this.request(xt(s||{},{method:e,url:t,data:s&&E.hasOwnProp(s,"data")?s.data:void 0}))}},"forEachMethodNoData")),E.forEach(["post","put","patch","query"],a(function(e){function t(s){return a(function(i,c,o){return this.request(xt(o||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:c}))},"httpMethod")}a(t,"generateHTTPMethod"),$t.prototype[e]=t(),e!=="query"&&($t.prototype[e+"Form"]=t(!0))},"forEachMethodWithData"));let fm=class bl{static{a(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(a(function(i){t=i},"promiseExecutor"));const s=this;this.promise.then(n=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](n);s._listeners=null}),this.promise.then=n=>{let i;const c=new Promise(o=>{s.subscribe(o),i=o}).then(n);return c.cancel=a(function(){s.unsubscribe(i)},"reject"),c},e(a(function(i,c,o){s.reason||(s.reason=new Nr(i,c,o),t(s.reason))},"cancel"))}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=a(s=>{e.abort(s)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new bl(a(function(n){e=n},"executor")),cancel:e}}};function pm(r){return a(function(t){return r.apply(null,t)},"wrap")}a(pm,"spread$1");function gm(r){return E.isObject(r)&&r.isAxiosError===!0}a(gm,"isAxiosError$1");const ri={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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ri).forEach(([r,e])=>{ri[e]=r});function mc(r){const e=new $t(r),t=ka($t.prototype.request,e);return E.extend(t,$t.prototype,e,{allOwnKeys:!0}),E.extend(t,e,null,{allOwnKeys:!0}),t.create=a(function(n){return mc(xt(r,n))},"create"),t}a(mc,"createInstance");const be=mc(Cr);be.Axios=$t,be.CanceledError=Nr,be.CancelToken=fm,be.isCancel=Za,be.VERSION=Xn,be.toFormData=fs,be.AxiosError=P,be.Cancel=be.CanceledError,be.all=a(function(e){return Promise.all(e)},"all"),be.spread=pm,be.isAxiosError=gm,be.mergeConfig=xt,be.AxiosHeaders=Fe,be.formToJSON=r=>Ya(E.isHTMLForm(r)?new FormData(r):r),be.getAdapter=pc.getAdapter,be.HttpStatusCode=ri,be.default=be;const{Axios:Ob,AxiosError:si,CanceledError:Tb,isCancel:Ab,CancelToken:Ib,VERSION:kb,all:Rb,Cancel:Cb,isAxiosError:Nb,spread:Db,toFormData:Lb,AxiosHeaders:Pb,HttpStatusCode:Mb,formToJSON:Fb,getAdapter:xb,mergeConfig:$b,create:jb}=be;var mm=Object.defineProperty,ym=a((r,e)=>mm(r,"name",{value:e,configurable:!0}),"t$6");const bm="X-Request-ID",_m="bx24_request_id",wm="bx24_sdk_ver",Sm="bx24_sdk_type";class vm{static{a(this,"RequestIdGenerator")}static{ym(this,"RequestIdGenerator")}getQueryStringParameterName(){return _m}getQueryStringSdkParameterName(){return wm}getQueryStringSdkTypeParameterName(){return Sm}generate(){return K.getUuidRfc4122()}getRequestId(){return this.generate()}getHeaderFieldName(){return bm}}var Em=Object.defineProperty,yc=a((r,e)=>Em(r,"name",{value:e,configurable:!0}),"p$7");const Om=300,Tm=100;function bs(r){const e=typeof r=="string"?r:String(r);return e.length>Om?e.slice(0,Tm)+"...":e}a(bs,"truncateForLog"),yc(bs,"truncateForLog");class bc{static{a(this,"AbstractHttp")}static{yc(this,"AbstractHttp")}_clientAxios;_authActions;_requestIdGenerator;_restrictionManager;_pendingRefresh=null;_logger;_isClientSideWarning=!1;_clientSideWarningMessage="";_version;_metrics={totalRequests:0,successfulRequests:0,failedRequests:0,totalDuration:0,byMethod:new Map,lastErrors:[]};constructor(e,t,s){this._version=ee.v2,this._logger=oe.createNullLogger();const n={};this.isServerSide()&&(n["User-Agent"]="b24-js-sdk/2.2.0"),this._authActions=e,this._requestIdGenerator=new vm,this._clientAxios=be.create({timeout:3e4,timeoutErrorMessage:"Request timeout exceeded",...t??{},headers:{...n,...t?.headers??{}}});const i={...mn.getDefault(),...s};this._restrictionManager=new Er(i)}get apiVersion(){return this._version}get ajaxClient(){return this._clientAxios}setLogger(e){this._logger=e,this._restrictionManager.setLogger(this._logger)}getLogger(){return this._logger}async setRestrictionManagerParams(e){await this._restrictionManager.setConfig(e)}getRestrictionManagerParams(){return this._restrictionManager.getParams()}getStats(){return{...this._restrictionManager.getStats(),totalRequests:this._metrics.totalRequests,successfulRequests:this._metrics.successfulRequests,failedRequests:this._metrics.failedRequests,totalDuration:this._metrics.totalDuration,byMethod:this._metrics.byMethod,lastErrors:this._metrics.lastErrors}}async reset(){return this._metrics.totalRequests=0,this._metrics.successfulRequests=0,this._metrics.failedRequests=0,this._metrics.totalDuration=0,this._metrics.byMethod.clear(),this._metrics.lastErrors=[],this._restrictionManager.reset()}_updateMetrics(e,t,s,n){this._metrics.totalRequests++,t?this._metrics.successfulRequests++:(this._metrics.failedRequests++,n instanceof we&&(this._metrics.lastErrors.push({method:e,error:n.message,timestamp:Date.now()}),this._metrics.lastErrors.length>100&&(this._metrics.lastErrors=this._metrics.lastErrors.slice(-100)))),this._metrics.byMethod.has(e)||this._metrics.byMethod.set(e,{count:0,totalDuration:0});const i=this._metrics.byMethod.get(e);i.count++,i.totalDuration+=s}_validateParams(e,t,s){try{JSON.stringify(s)}catch(n){throw new we({code:"JSSDK_INVALID_PARAMS",description:"Parameters contain circular references",status:400,requestInfo:{method:t,params:s,requestId:e},originalError:n})}}async call(e,t,s){s=s??this._requestIdGenerator.getRequestId();const n=this._restrictionManager.getParams().maxRetries;this._validateParams(s,e,t),this._logRequest(s,e,t);let i=null;const c=Date.now();for(let o=0;o<n;o++)try{this._logAttempt(s,e,o+1,n),await this._restrictionManager.applyOperatingLimits(s,e,t);const l=await this._executeSingleCall(s,e,t),h=Date.now()-c;return this._restrictionManager.resetErrors(e),this._updateMetrics(e,!0,h),this._logSuccessfulRequest(s,e,h),l}catch(l){i=this._convertToAjaxError(s,l,e,t);const h=Date.now()-c;if(this._restrictionManager.incrementError(e),this._updateMetrics(e,!1,h,i),this._logFailedRequest(s,e,o+1,n,i),o+1<n){const u=await this._restrictionManager.handleError(s,e,t,i,o);if(u>0){this._restrictionManager.incrementStats("limitHits"),this._logAttemptRetryWaiteDelay(s,e,u,o+1,n),await this._restrictionManager.waiteDelay(u),this._restrictionManager.incrementStats("retries");continue}}if(o+1===n&&this._logAllAttemptsExhausted(s,e,o+1,n),this._restrictionManager.exceptionCodeForSoft.includes(i.code))return this._createAjaxResultWithErrorFromResponse(i,s,e,t);throw i}throw new we({code:"JSSDK_CALL_ALL_ATTEMPTS_EXHAUSTED",description:"All attempts exhausted",status:i?.status||500,requestInfo:{method:e,params:t,requestId:s},originalError:i?.originalError||null})}_convertToAjaxError(e,t,s,n){return t instanceof we?t:t instanceof si?this._convertAxiosErrorToAjaxError(e,t,s,n):this._convertUnknownErrorToAjaxError(e,t,s,n)}_convertAxiosErrorToAjaxError(e,t,s,n){const i=`${t.code||"JSSDK_AXIOS_ERROR"}`,c=t.message,o=t.response?.status||0;if(i==="ERR_NETWORK")return new we({code:"NETWORK_ERROR",description:"Network connection failed",status:0,requestInfo:{method:s,params:n,requestId:e},originalError:t});if(i==="ECONNABORTED"||t.message.includes("timeout"))return new we({code:"REQUEST_TIMEOUT",description:"Request timeout exceeded",status:408,requestInfo:{method:s,params:n,requestId:e},originalError:t});const l=gn(t.response?.data,i,c);return new we({code:l?.code??i,description:l?.description??c,status:o,validation:l?.validation,requestInfo:{method:s,params:n,requestId:e},originalError:t})}_convertUnknownErrorToAjaxError(e,t,s,n){return new we({code:"JSSDK_UNKNOWN_ERROR",description:t instanceof Error?t.message:String(t),status:0,requestInfo:{method:s,params:n,requestId:e},originalError:t})}async _executeSingleCall(e,t,s){this._checkClientSideWarning(e);const n=await this._ensureAuth(e),i=await this._makeRequestWithAuthRetry(e,t,s,n);return this._createAjaxResultFromResponse(i,e,t,s)}async _ensureAuth(e){let t=this._authActions.getAuthData();return t===!1&&(this._logRefreshingAuthToken(e),t=await this._refreshAuth()),t}_refreshAuth(){if(this._pendingRefresh)return this._pendingRefresh;const e=this._authActions.refreshAuth();return this._pendingRefresh=e,e.finally(()=>{this._pendingRefresh=null}).catch(()=>{}),e}async _makeRequestWithAuthRetry(e,t,s,n){try{return await this._restrictionManager.checkRateLimit(e,t),await this._makeAxiosRequest(e,t,s,n)}catch(i){i instanceof si&&this.getLogger().info("post/catchError",{requestId:e,status:i.status,responseData:bs(JSON.stringify(qe(i?.response?.data),null,0))}).catch(()=>{});const c=this._convertToAjaxError(e,i,t,s);if(this._isAuthError(c)){this._logAuthErrorDetected(e),this._logRefreshingAuthToken(e);const o=await this._refreshAuth();return await this._restrictionManager.checkRateLimit(e,t),await this._makeAxiosRequest(e,t,s,o)}throw c}}async _makeAxiosRequest(e,t,s,n){const i=this._prepareMethod(e,t,this.getBaseUrl()),c=this._prepareParams(n,s),o=JSON.stringify(qe(c),null,0);this.getLogger().info("post/send",{requestId:e,method:t,params:bs(o)}).catch(()=>{});const l=await this._clientAxios.post(i,c),h=JSON.stringify(qe(l.data.result),null,0);return this.getLogger().info("post/response",{requestId:e,result:bs(h),time:JSON.stringify(l.data.time,null,0)}).catch(()=>{}),{status:l.status,payload:l.data}}_isAuthError(e){return e instanceof we?e.status===401&&["expired_token","invalid_token"].includes(e.code):!1}async _createAjaxResultFromResponse(e,t,s,n){const i=new vr({answer:e.payload,query:{method:s,params:n,requestId:t},status:e.status});if(i.isSuccess){const c=i.getData()?.time;await this._restrictionManager.updateStats(t,s,c)}return i}_createAjaxResultWithErrorFromResponse(e,t,s,n){return new vr({answer:{error:{code:e.code,message:e.message}},query:{method:s,params:n,requestId:t},status:e.status,error:e})}_prepareMethod(e,t,s){const n=`/${encodeURIComponent(t)}`;if(/^task\./.test(t))return`${s}${n}`;const i=new URLSearchParams({[this._requestIdGenerator.getQueryStringParameterName()]:e,[this._requestIdGenerator.getQueryStringSdkParameterName()]:"2.2.0",[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]:"b24-js-sdk"});return`${s}${n}?${i.toString()}`}_prepareParams(e,t){const s={...t};if(e.refresh_token!=="hook"&&(s.auth=e.access_token),s?.data&&"start"in s.data){const{start:n,...i}=s.data;s.data=i}return s}setClientSideWarning(e,t){this._isClientSideWarning=e,this._clientSideWarningMessage=t}isServerSide(){return es()!==br.BROWSE}getBaseUrl(){return this._authActions.getTargetOriginWithPath().get(this._version)}_sanitizeParams(e){return qe(e)}_logRequest(e,t,s){this.getLogger().debug("http request starting",{requestId:e,method:t,params:this._sanitizeParams(s),api:this.apiVersion,timestamp:Date.now()}).catch(()=>{})}_logAttempt(e,t,s,n){this.getLogger().info("http request attempt",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n}}).catch(()=>{})}_logRefreshingAuthToken(e){this.getLogger().info("http refreshing auth token",{requestId:e,api:this.apiVersion}).catch(()=>{})}_logAuthErrorDetected(e){this.getLogger().info("http auth error detected",{requestId:e,api:this.apiVersion}).catch(()=>{})}_logSuccessfulRequest(e,t,s){this.getLogger().debug("http request successful",{requestId:e,method:t,api:this.apiVersion,duration:{ms:s,sec:Number.parseFloat((s/1e3).toFixed(2))}}).catch(()=>{})}_logFailedRequest(e,t,s,n,i){this.getLogger().debug("http request failed",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n},error:{code:i.code,message:i.message,status:i.status}}).catch(()=>{})}_logAttemptRetryWaiteDelay(e,t,s,n,i){this.getLogger().debug(`http wait ${(s/1e3).toFixed(2)} sec.`,{requestId:e,method:t,api:this.apiVersion,wait:s,attempt:{current:n,max:i}}).catch(()=>{})}_logAllAttemptsExhausted(e,t,s,n){this.getLogger().warning("http all retry attempts exhausted",{requestId:e,method:t,api:this.apiVersion,attempt:{current:s,max:n}}).catch(()=>{})}_logBatchStart(e,t,s){const n=Array.isArray(t)?t.length:Object.keys(t).length;this.getLogger().debug("http batch request starting ",{requestId:e,callCount:n,api:this.apiVersion,isHaltOnError:s.isHaltOnError,timestamp:Date.now()}).catch(()=>{})}_logBatchCompletion(e,t,s){this.getLogger().debug("http batch request completed",{requestId:e,api:this.apiVersion,totalCalls:t,successful:t-s,failed:s,successRate:t>0?((t-s)/t*100).toFixed(1)+"%":"??"}).catch(()=>{})}_checkClientSideWarning(e){this._isClientSideWarning&&!this.isServerSide()&&M.isStringFilled(this._clientSideWarningMessage)&&oe.forcedLog(this.getLogger(),"warning",this._clientSideWarningMessage,{requestId:e,code:"JSSDK_CLIENT_SIDE_WARNING"})}}var Am=Object.defineProperty,Im=a((r,e)=>Am(r,"name",{value:e,configurable:!0}),"r$9");class _c{static{a(this,"AbstractInteractionBatch")}static{Im(this,"AbstractInteractionBatch")}parallelDefaultValue;requestId;restrictionManager;processingStrategy;_commands=[];constructor(e){this.parallelDefaultValue=e.parallelDefaultValue,this.requestId=e.requestId,this.restrictionManager=e.restrictionManager,this.processingStrategy=e.processingStrategy}setProcessingStrategy(e){this.processingStrategy=e}get size(){return this._commands.length}get maxSize(){return 0}addCommands(e){if(!this.processingStrategy)throw new U({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});this._commands=this.processingStrategy.prepareCommands(e,{parallelDefaultValue:this.parallelDefaultValue})}getCommandsForCall(){if(!this.processingStrategy)throw new U({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});return this.processingStrategy.buildCommands(this._commands)}}var km=Object.defineProperty,Rm=a((r,e)=>km(r,"name",{value:e,configurable:!0}),"s$a");const Cm=50;class Nm extends _c{static{a(this,"InteractionBatchV2")}static{Rm(this,"InteractionBatchV2")}get maxSize(){return Cm}async prepareResponse(e){if(!this.processingStrategy)throw new U({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});const t={requestId:e.getQuery().requestId,parallelDefaultValue:this.parallelDefaultValue,restrictionManager:this.restrictionManager,response:e},s=await this.processingStrategy.prepareItems(this._commands,t);return this.processingStrategy.handleResults(this._commands,s,t)}}const Dm=String.prototype.replace,Lm=/%20/g,wc={RFC1738:"RFC1738",RFC3986:"RFC3986"},Pm={RFC1738:a(function(r){return Dm.call(r,Lm,"+")},"RFC1738"),RFC3986:a(function(r){return String(r)},"RFC3986")},Mm=wc.RFC1738,Fm=wc.RFC3986,xm=Array.isArray,pt=(function(){const r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})(),ni=1024,$m=a(function(e,t,s,n){if(e.length===0)return e;let i=e;typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e));let c="";for(let o=0;o<i.length;o+=ni){const l=i.length>=ni?i.slice(o,o+ni):i,h=[];for(let u=0;u<l.length;++u){let g=l.charCodeAt(u);if(g===45||g===46||g===95||g===126||g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122||n===Mm&&(g===40||g===41)){h[h.length]=l.charAt(u);continue}if(g<128){h[h.length]=pt[g];continue}if(g<2048){h[h.length]=pt[192|g>>6]+pt[128|g&63];continue}if(g<55296||g>=57344){h[h.length]=pt[224|g>>12]+pt[128|g>>6&63]+pt[128|g&63];continue}u+=1,g=65536+((g&1023)<<10|l.charCodeAt(u)&1023),h[h.length]=pt[240|g>>18]+pt[128|g>>12&63]+pt[128|g>>6&63]+pt[128|g&63]}c+=h.join("")}return c},"encode"),jm=a(function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},"isBuffer"),Sc=a(function(e,t){if(xm(e)){const s=[];for(let n=0;n<e.length;n+=1)s.push(t(e[n]));return s}return t(e)},"maybeMap"),Bm={brackets:a(function(e){return e+"[]"},"brackets"),comma:"comma",indices:a(function(e,t){return e+"["+t+"]"},"indices"),repeat:a(function(e){return e},"repeat")},_t=Array.isArray,Um=Array.prototype.push,vc=a(function(r,e){Um.apply(r,_t(e)?e:[e])},"pushToArray"),Vm=Date.prototype.toISOString,Ec=Fm,_s={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:$m,encodeValuesOnly:!1,format:Ec,formatter:Pm[Ec],indices:!1,serializeDate:a(function(e){return Vm.call(e)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},qm=a(function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},"isNonNullishPrimitive"),ii={},Oc=a(function(e,t,s,n,i,c,o,l,h,u,g,p,d,f,y,b,m){let _=e,w=m,S=0,T=!1;for(;(w=w.get(ii))!==void 0&&!T;){const N=w.get(e);if(S+=1,typeof N<"u"){if(N===S)throw new RangeError("Cyclic object value");T=!0}typeof w.get(ii)>"u"&&(S=0)}if(typeof u=="function"?_=u(t,_):_ instanceof Date?_=d(_):s==="comma"&&_t(_)&&(_=Sc(_,function(N){return N instanceof Date?d(N):N})),_===null){if(c)return h&&!b?h(t,_s.encoder,"key",f):t;_=""}if(qm(_)||jm(_)){if(h){const N=b?t:h(t,_s.encoder,"key",f);return[y(N)+"="+y(h(_,_s.encoder,"value",f))]}return[y(t)+"="+y(String(_))]}const v=[];if(typeof _>"u")return v;let k;if(s==="comma"&&_t(_))b&&h&&(_=Sc(_,h)),k=[{value:_.length>0?_.join(",")||null:void 0}];else if(_t(u))k=u;else{const N=Object.keys(_);k=g?N.sort(g):N}const O=l?t.replace(/\./g,"%2E"):t,A=n&&_t(_)&&_.length===1?O+"[]":O;if(i&&_t(_)&&_.length===0)return A+"[]";for(let N=0;N<k.length;++N){const B=k[N],q=typeof B=="object"&&typeof B.value<"u"?B.value:_[B];if(o&&q===null)continue;const pe=p&&l?B.replace(/\./g,"%2E"):B,ge=_t(_)?typeof s=="function"?s(A,pe):A:A+(p?"."+pe:"["+pe+"]");m.set(e,S);const G=new WeakMap;G.set(ii,m),vc(v,Oc(q,ge,s,n,i,c,o,l,s==="comma"&&b&&_t(_)?null:h,u,g,p,d,f,y,b,G))}return v},"stringify"),Hm=a(function(e){return _s},"normalizeStringifyOptions");function Wm(r,e){let t=r;const s=Hm();let n,i;typeof s.filter=="function"?(i=s.filter,t=i("",t)):_t(s.filter)&&(i=s.filter,n=i);const c=[];if(typeof t!="object"||t===null)return"";const o=Bm[s.arrayFormat],l=o==="comma"&&s.commaRoundTrip;n||(n=Object.keys(t)),s.sort&&n.sort(s.sort);const h=new WeakMap;for(let p=0;p<n.length;++p){const d=n[p];s.skipNulls&&t[d]===null||vc(c,Oc(t[d],d,o,l,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,h))}const u=c.join(s.delimiter),g=s.addQueryPrefix===!0?"?":"";return u.length>0?g+u:""}a(Wm,"stringify");var zm=Object.defineProperty,Jm=a((r,e)=>zm(r,"name",{value:e,configurable:!0}),"o$b");class Tc{static{a(this,"AbstractProcessing")}static{Jm(this,"AbstractProcessing")}async prepareItems(e,t){const s=new Map;return t.response.isSuccess?this._prepareItemsSuccess(e,t,s):s}async handleResults(e,t,s){const n=new Me;if(!s.response.isSuccess){for(const[i,c]of s.response.errors)n.addError(c,i);return n.setData({result:new Map,time:void 0}),n}return this._handleResultsSuccess(e,t,s,n)}_getBatchResultByIndex(e,t){if(e)return e[t]}_createErrorFromAjaxResult(e){return e.hasError("base-error")?e.errors.get("base-error"):new we({code:"JSSDK_BATCH_SUB_ERROR",description:e.getErrorMessages().join("; "),status:e.getStatus(),requestInfo:{...e.getQuery()},originalError:e.getErrors().next().value})}}var Km=Object.defineProperty,Gm=a((r,e)=>Km(r,"name",{value:e,configurable:!0}),"m$4");class Ac extends Tc{static{a(this,"AbstractProcessingV2")}static{Gm(this,"AbstractProcessingV2")}_buildRow(e){return`${e.method}?${Wm(e.query||{})}`}buildCommands(e){if(e.length<1)throw new U({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V2_EMPTY_COMMANDS",description:"commands not set",status:500});const t=e[0];if(typeof t.as=="string"&&t.as.length>0){const n={};for(const i of e)n[i.as]=this._buildRow(i);return n}const s=[];for(const n of e)s.push(this._buildRow(n));return s}async _prepareItemsSuccess(e,t,s){for(const[n,i]of e.entries())await this._processResponseItem(i,i.as??n,t,s);return s}async _processResponseItem(e,t,s,n){const i=s.response.getData().result,c=this._getBatchResultByIndex(i.result,t),o=this._getBatchResultByIndex(i.result_error,t);if(typeof c<"u"||typeof o<"u"){const l=e.method,h=this._getBatchResultByIndex(i.result_time,t);typeof h<"u"&&await s.restrictionManager.updateStats(s.requestId,`batch::${l}`,h);const u=new vr({answer:{error:o?typeof o=="string"?o:o.error:void 0,error_description:o?typeof o=="string"?void 0:o.error_description:void 0,result:c,total:Number.parseInt(this._getBatchResultByIndex(i.result_total,t)||"0"),next:Number.parseInt(this._getBatchResultByIndex(i.result_next,t)||"0"),time:h},query:{method:l,params:e.query||{},requestId:s.requestId},status:s.response.getStatus()});n.set(t,u);return}if(s.parallelDefaultValue)throw new U({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V2_EMPTY_COMMAND_RESPONSE",description:`There were difficulties parsing the response for batch { index: ${t}, method: ${e.method} }`,status:500})}async _handleResultsSuccess(e,t,s,n){const i=new Map;for(const[c,o]of t){if(o.getStatus()!==200||!o.isSuccess){const l=this._createErrorFromAjaxResult(o);this._processResponseError(n,l,`${c}`),i.set(c,o)}i.set(c,o)}return n.setData({result:i,time:s.response.getData().time}),n}}var Ym=Object.defineProperty,Zm=a((r,e)=>Ym(r,"name",{value:e,configurable:!0}),"r$8");class jt{static{a(this,"ParseRow")}static{Zm(this,"ParseRow")}static getBatchCommand(e,t){if(e){if(typeof e=="object"&&"method"in e&&typeof e.method=="string")return{method:e.method,query:e.params,as:e.as??t.asDefaultValue,parallel:e.parallel??t.parallelDefaultValue};if(Array.isArray(e)&&e.length>0&&typeof e[0]=="string")return{method:e[0],query:e[1],as:t.asDefaultValue,parallel:t.parallelDefaultValue}}throw new U({code:"JSSDK_INTERACTION_BATCH_ROW_FAIL",description:`There were difficulties parsing the command for batch.
${JSON.stringify({row:e,options:t})}`,status:500})}static getMethodsFromCommands(e){const t=[],s={parallelDefaultValue:!1};return Array.isArray(e)?e.forEach(n=>{const i=jt.getBatchCommand(n,s);t.push(i.method)}):Object.entries(e).forEach(([n,i])=>{const c=jt.getBatchCommand(i,{...s,asDefaultValue:n});t.push(c.method)}),t}}var Xm=Object.defineProperty,Qm=a((r,e)=>Xm(r,"name",{value:e,configurable:!0}),"o$a");class ey extends Ac{static{a(this,"ProcessingAsArrayV2")}static{Qm(this,"ProcessingAsArrayV2")}prepareCommands(e,t){const s=[];return e.forEach(n=>{const i=jt.getBatchCommand(n,t);s.push(i)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var ty=Object.defineProperty,ry=a((r,e)=>ty(r,"name",{value:e,configurable:!0}),"s$9");class sy extends Ac{static{a(this,"ProcessingAsObjectV2")}static{ry(this,"ProcessingAsObjectV2")}prepareCommands(e,t){const s=[];return Object.entries(e).forEach(([n,i])=>{const c=jt.getBatchCommand(i,{...t,asDefaultValue:n});s.push(c)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var ny=Object.defineProperty,iy=a((r,e)=>ny(r,"name",{value:e,configurable:!0}),"i$5");class ws extends bc{static{a(this,"HttpV2")}static{iy(this,"HttpV2")}constructor(e,t,s){super(e,t,s),this._version=ee.v2}async batch(e,t){const s={isHaltOnError:!0,...t},n=s.requestId??this._requestIdGenerator.getRequestId();this._logBatchStart(n,e,s);const i=new Nm({requestId:n,parallelDefaultValue:!s.isHaltOnError,restrictionManager:this._restrictionManager});if(Array.isArray(e)?i.setProcessingStrategy(new ey):i.setProcessingStrategy(new sy),i.addCommands(e),i.size>i.maxSize)throw new we({code:"JSSDK_BATCH_TOO_LARGE",description:`Batch too large: ${i.size} commands (max: ${i.maxSize})`,status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});if(i.size===0)throw new we({code:"JSSDK_BATCH_EMPTY",description:"Batch must contain at least one command",status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});const c={halt:s.isHaltOnError?1:0,cmd:i.getCommandsForCall()},o=await this.call("batch",c,n),l=await i.prepareResponse(o);return this._logBatchCompletion(n,l.getData()?.result?.size??0,l.getErrorMessages().length),l}}var oy=Object.defineProperty,ay=a((r,e)=>oy(r,"name",{value:e,configurable:!0}),"s$8");const cy=50;class ly extends _c{static{a(this,"InteractionBatchV3")}static{ay(this,"InteractionBatchV3")}get maxSize(){return cy}async prepareResponse(e){if(!this.processingStrategy)throw new U({code:"JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",description:"ProcessingStrategy not set",status:500});const t={requestId:e.getQuery().requestId,parallelDefaultValue:this.parallelDefaultValue,restrictionManager:this.restrictionManager,response:e},s=await this.processingStrategy.prepareItems(this._commands,t);return this.processingStrategy.handleResults(this._commands,s,t)}}var uy=Object.defineProperty,hy=a((r,e)=>uy(r,"name",{value:e,configurable:!0}),"p$4");class Ic extends Tc{static{a(this,"AbstractProcessingV3")}static{hy(this,"AbstractProcessingV3")}buildCommands(e){if(e.length<1)throw new U({code:"JSSDK_INTERACTION_BATCH_BUILD_STRATEGY_V3_EMPTY_COMMANDS",description:"commands not set",status:500});return e}async _prepareItemsSuccess(e,t,s){for(const[n,i]of e.entries())await this._processResponseItem(i,n,t,s);return s}async _processResponseItem(e,t,s,n){const i=s.response.getData().result,c=this._getBatchResultByIndex(i,t);if(typeof c>"u")throw new U({code:"JSSDK_INTERACTION_BATCH_STRATEGY_V3_EMPTY_COMMAND_RESPONSE",description:`There were difficulties parsing the response for batch { index: ${t}, method: ${e.method} }`,status:500});const o=s.response.getData().time,l=new vr({answer:{result:c,error:void 0,time:o},query:{method:e.method,params:e.query||{},requestId:s.requestId},status:s.response.getStatus()});n.set(t,l)}async _handleResultsSuccess(e,t,s,n){const i=new Map;for(const[c,o]of t){const l=Number.parseInt(`${c}`),h=e[l];if(typeof h>"u")throw new U({code:"JSSDK_INTERACTION_BATCH_BUILD_STRATEGY_V3_EMPTY_COMMAND",description:`command for index ${c} not set`,status:500});const u=h.as??c;if(o.getStatus()!==200||!o.isSuccess){const g=this._createErrorFromAjaxResult(o);this._processResponseError(n,g,`${u}`),i.set(u,o)}i.set(u,o)}return n.setData({result:i,time:s.response.getData().time}),n}}var dy=Object.defineProperty,fy=a((r,e)=>dy(r,"name",{value:e,configurable:!0}),"o$8");class py extends Ic{static{a(this,"ProcessingAsArrayV3")}static{fy(this,"ProcessingAsArrayV3")}prepareCommands(e,t){const s=[];return e.forEach(n=>{const i=jt.getBatchCommand(n,t);s.push(i)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var gy=Object.defineProperty,my=a((r,e)=>gy(r,"name",{value:e,configurable:!0}),"s$7");class yy extends Ic{static{a(this,"ProcessingAsObjectV3")}static{my(this,"ProcessingAsObjectV3")}prepareCommands(e,t){const s=[];return Object.entries(e).forEach(([n,i])=>{const c=jt.getBatchCommand(i,{...t,asDefaultValue:n});s.push(c)}),s}_processResponseError(e,t,s){e.addError(t,s)}}var by=Object.defineProperty,_y=a((r,e)=>by(r,"name",{value:e,configurable:!0}),"i$4");class Ss extends bc{static{a(this,"HttpV3")}static{_y(this,"HttpV3")}constructor(e,t,s){super(e,t,s),this._version=ee.v3}async batch(e,t){const s={isHaltOnError:!0,...t},n=s.requestId??this._requestIdGenerator.getRequestId();this._logBatchStart(n,e,s);const i=new ly({requestId:n,parallelDefaultValue:!s.isHaltOnError,restrictionManager:this._restrictionManager});if(Array.isArray(e)?i.setProcessingStrategy(new py):i.setProcessingStrategy(new yy),i.addCommands(e),i.size>i.maxSize)throw new we({code:"JSSDK_BATCH_TOO_LARGE",description:`Batch too large: ${i.size} commands (max: ${i.maxSize})`,status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});if(i.size===0)throw new we({code:"JSSDK_BATCH_EMPTY",description:"Batch must contain at least one command",status:400,requestInfo:{method:"batch",params:{cmd:e},requestId:n},originalError:null});const c=await this.call("batch",i.getCommandsForCall(),n),o=await i.prepareResponse(c);return this._logBatchCompletion(n,o.getData()?.result?.size??0,o.getErrorMessages().length),o}}var wy=Object.defineProperty,Sy=a((r,e)=>wy(r,"name",{value:e,configurable:!0}),"e$3");const vy=Sy(()=>({scrollWidth:Math.max(document.documentElement.scrollWidth,document.documentElement.offsetWidth),scrollHeight:Math.max(document.documentElement.scrollHeight,document.documentElement.offsetHeight)}),"useScrollSize");var Ey=Object.defineProperty,Oy=a((r,e)=>Ey(r,"name",{value:e,configurable:!0}),"s$6");let Ty=class kt{static{a(this,"t")}static{Oy(this,"FormatterNumbers")}static isInternalConstructing=!1;static instance=null;_defLocale=null;constructor(){if(!kt.isInternalConstructing)throw new TypeError("FormatterNumber is not constructable");kt.isInternalConstructing=!1}static getInstance(){return kt.instance||(kt.isInternalConstructing=!0,kt.instance=new kt),kt.instance}setDefLocale(e){this._defLocale=e}format(e,t){let s;(typeof t>"u"||!M.isStringFilled(t))&&(t=M.isStringFilled(this._defLocale)?this._defLocale||"en":typeof navigator>"u"?"en":navigator?.language||"en"),Number.isInteger(e)?s=new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0}):s=new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2});let n=s.format(e);return t.includes("ru")&&(n=n.replace(",",".")),n}};var Ay=Object.defineProperty,kc=a((r,e)=>Ay(r,"name",{value:e,configurable:!0}),"n$5");class R{static{a(this,"IbanSpecification")}static{kc(this,"IbanSpecification")}countryCode;length;structure;example;_cachedRegex=null;constructor(e,t,s,n){this.countryCode=e,this.length=t,this.structure=s,this.example=n}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(s=>{let n;const i=s.slice(0,1),c=Number.parseInt(s.slice(1),10);switch(i){case"A":n="0-9A-Za-z";break;case"B":n="0-9A-Z";break;case"C":n="A-Za-z";break;case"F":n="0-9";break;case"L":n="a-z";break;case"U":n="A-Z";break;case"W":n="0-9a-z";break}return"(["+n+"]{"+c+"})"});return new RegExp("^"+t.join("")+"$")}_iso13616Prepare(e){return e=e.toUpperCase(),e=e.substring(4)+e.substring(0,4),e.split("").map(t=>{const s=t.charCodeAt(0);return s>=65&&s<=90?(s-65+10).toString():t}).join("")}_iso7064Mod9710(e){let t=e,s;for(;t.length>2;)s=t.slice(0,9),t=Number.parseInt(s,10)%97+t.slice(s.length);return Number.parseInt(t,10)%97}}class wt{static{a(this,"FormatterIban")}static{kc(this,"FormatterIban")}static isInternalConstructing=!1;static instance=null;_countries;constructor(){if(!wt.isInternalConstructing)throw new TypeError("FormatterIban is not constructable");wt.isInternalConstructing=!1,this._countries=new Map}static getInstance(){return wt.instance||(wt.isInternalConstructing=!0,wt.instance=new wt),wt.instance}addSpecification(e){this._countries.set(e.countryCode,e)}isValid(e){if(!M.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 s=this._countries.get(t);return!!s&&s.isValid(e)}printFormat(e,t){typeof t>"u"&&(t=" ");const s=/(.{4})(?!$)/g;return this.electronicFormat(e).replace(s,"$1"+t)}electronicFormat(e){const t=/[^a-z0-9]/gi;return e.replace(t,"").toUpperCase()}toBBAN(e,t){typeof t>"u"&&(t=" "),e=this.electronicFormat(e);const s=e.slice(0,2);if(!this._countries.has(s))throw new Error(`No country with code ${s}`);const n=this._countries.get(s);if(!n)throw new Error(`No country with code ${s}`);return n.toBBAN(e,t)}fromBBAN(e,t){if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const s=this._countries.get(e);if(!s)throw new Error(`No country with code ${e}`);return s.fromBBAN(this.electronicFormat(t))}isValidBBAN(e,t){if(!M.isString(t))return!1;if(!this._countries.has(e))throw new Error(`No country with code ${e}`);const s=this._countries.get(e);return!!s&&s.isValidBBAN(this.electronicFormat(t))}}var Iy=Object.defineProperty,ky=a((r,e)=>Iy(r,"name",{value:e,configurable:!0}),"n$4");const Ry=ky(()=>{const r=Ty.getInstance(),e=wt.getInstance();return e.addSpecification(new R("AD",24,"F04F04A12","AD1200012030200359100100")),e.addSpecification(new R("AE",23,"F03F16","AE070331234567890123456")),e.addSpecification(new R("AL",28,"F08A16","AL47212110090000000235698741")),e.addSpecification(new R("AT",20,"F05F11","AT611904300234573201")),e.addSpecification(new R("AZ",28,"U04A20","AZ21NABZ00000000137010001944")),e.addSpecification(new R("BA",20,"F03F03F08F02","BA391290079401028494")),e.addSpecification(new R("BE",16,"F03F07F02","BE68539007547034")),e.addSpecification(new R("BG",22,"U04F04F02A08","BG80BNBG96611020345678")),e.addSpecification(new R("BH",22,"U04A14","BH67BMAG00001299123456")),e.addSpecification(new R("BR",29,"F08F05F10U01A01","BR9700360305000010009795493P1")),e.addSpecification(new R("BY",28,"A04F04A16","BY13NBRB3600900000002Z00AB00")),e.addSpecification(new R("CH",21,"F05A12","CH9300762011623852957")),e.addSpecification(new R("CR",22,"F04F14","CR72012300000171549015")),e.addSpecification(new R("CY",28,"F03F05A16","CY17002001280000001200527600")),e.addSpecification(new R("CZ",24,"F04F06F10","CZ6508000000192000145399")),e.addSpecification(new R("DE",22,"F08F10","DE89370400440532013000")),e.addSpecification(new R("DK",18,"F04F09F01","DK5000400440116243")),e.addSpecification(new R("DO",28,"U04F20","DO28BAGR00000001212453611324")),e.addSpecification(new R("EE",20,"F02F02F11F01","EE382200221020145685")),e.addSpecification(new R("EG",29,"F04F04F17","EG800002000156789012345180002")),e.addSpecification(new R("ES",24,"F04F04F01F01F10","ES9121000418450200051332")),e.addSpecification(new R("FI",18,"F06F07F01","FI2112345600000785")),e.addSpecification(new R("FO",18,"F04F09F01","FO6264600001631634")),e.addSpecification(new R("FR",27,"F05F05A11F02","FR1420041010050500013M02606")),e.addSpecification(new R("GB",22,"U04F06F08","GB29NWBK60161331926819")),e.addSpecification(new R("GE",22,"U02F16","GE29NB0000000101904917")),e.addSpecification(new R("GI",23,"U04A15","GI75NWBK000000007099453")),e.addSpecification(new R("GL",18,"F04F09F01","GL8964710001000206")),e.addSpecification(new R("GR",27,"F03F04A16","GR1601101250000000012300695")),e.addSpecification(new R("GT",28,"A04A20","GT82TRAJ01020000001210029690")),e.addSpecification(new R("HR",21,"F07F10","HR1210010051863000160")),e.addSpecification(new R("HU",28,"F03F04F01F15F01","HU42117730161111101800000000")),e.addSpecification(new R("IE",22,"U04F06F08","IE29AIBK93115212345678")),e.addSpecification(new R("IL",23,"F03F03F13","IL620108000000099999999")),e.addSpecification(new R("IS",26,"F04F02F06F10","IS140159260076545510730339")),e.addSpecification(new R("IT",27,"U01F05F05A12","IT60X0542811101000000123456")),e.addSpecification(new R("IQ",23,"U04F03A12","IQ98NBIQ850123456789012")),e.addSpecification(new R("JO",30,"A04F22","JO15AAAA1234567890123456789012")),e.addSpecification(new R("KW",30,"U04A22","KW81CBKU0000000000001234560101")),e.addSpecification(new R("KZ",20,"F03A13","KZ86125KZT5004100100")),e.addSpecification(new R("LB",28,"F04A20","LB62099900000001001901229114")),e.addSpecification(new R("LC",32,"U04F24","LC07HEMM000100010012001200013015")),e.addSpecification(new R("LI",21,"F05A12","LI21088100002324013AA")),e.addSpecification(new R("LT",20,"F05F11","LT121000011101001000")),e.addSpecification(new R("LU",20,"F03A13","LU280019400644750000")),e.addSpecification(new R("LV",21,"U04A13","LV80BANK0000435195001")),e.addSpecification(new R("MC",27,"F05F05A11F02","MC5811222000010123456789030")),e.addSpecification(new R("MD",24,"U02A18","MD24AG000225100013104168")),e.addSpecification(new R("ME",22,"F03F13F02","ME25505000012345678951")),e.addSpecification(new R("MK",19,"F03A10F02","MK07250120000058984")),e.addSpecification(new R("MR",27,"F05F05F11F02","MR1300020001010000123456753")),e.addSpecification(new R("MT",31,"U04F05A18","MT84MALT011000012345MTLCAST001S")),e.addSpecification(new R("MU",30,"U04F02F02F12F03U03","MU17BOMM0101101030300200000MUR")),e.addSpecification(new R("NL",18,"U04F10","NL91ABNA0417164300")),e.addSpecification(new R("NO",15,"F04F06F01","NO9386011117947")),e.addSpecification(new R("PK",24,"U04A16","PK36SCBL0000001123456702")),e.addSpecification(new R("PL",28,"F08F16","PL61109010140000071219812874")),e.addSpecification(new R("PS",29,"U04A21","PS92PALS000000000400123456702")),e.addSpecification(new R("PT",25,"F04F04F11F02","PT50000201231234567890154")),e.addSpecification(new R("QA",29,"U04A21","QA30AAAA123456789012345678901")),e.addSpecification(new R("RO",24,"U04A16","RO49AAAA1B31007593840000")),e.addSpecification(new R("RS",22,"F03F13F02","RS35260005601001611379")),e.addSpecification(new R("SA",24,"F02A18","SA0380000000608010167519")),e.addSpecification(new R("SC",31,"U04F04F16U03","SC18SSCB11010000000000001497USD")),e.addSpecification(new R("SE",24,"F03F16F01","SE4550000000058398257466")),e.addSpecification(new R("SI",19,"F05F08F02","SI56263300012039086")),e.addSpecification(new R("SK",24,"F04F06F10","SK3112000000198742637541")),e.addSpecification(new R("SM",27,"U01F05F05A12","SM86U0322509800000000270100")),e.addSpecification(new R("ST",25,"F08F11F02","ST68000100010051845310112")),e.addSpecification(new R("SV",28,"U04F20","SV62CENR00000000000000700025")),e.addSpecification(new R("TL",23,"F03F14F02","TL380080012345678910157")),e.addSpecification(new R("TN",24,"F02F03F13F02","TN5910006035183598478831")),e.addSpecification(new R("TR",26,"F05F01A16","TR330006100519786457841326")),e.addSpecification(new R("UA",29,"F25","UA511234567890123456789012345")),e.addSpecification(new R("VA",22,"F18","VA59001123000012345678")),e.addSpecification(new R("VG",24,"U04F16","VG96VPVG0000012345678901")),e.addSpecification(new R("XK",20,"F04F10F02","XK051212012345678906")),e.addSpecification(new R("AO",25,"F21","AO69123456789012345678901")),e.addSpecification(new R("BF",27,"F23","BF2312345678901234567890123")),e.addSpecification(new R("BI",16,"F12","BI41123456789012")),e.addSpecification(new R("BJ",28,"F24","BJ39123456789012345678901234")),e.addSpecification(new R("CI",28,"U02F22","CI70CI1234567890123456789012")),e.addSpecification(new R("CM",27,"F23","CM9012345678901234567890123")),e.addSpecification(new R("CV",25,"F21","CV30123456789012345678901")),e.addSpecification(new R("DZ",24,"F20","DZ8612345678901234567890")),e.addSpecification(new R("IR",26,"F22","IR861234568790123456789012")),e.addSpecification(new R("MG",27,"F23","MG1812345678901234567890123")),e.addSpecification(new R("ML",28,"U01F23","ML15A12345678901234567890123")),e.addSpecification(new R("MZ",25,"F21","MZ25123456789012345678901")),e.addSpecification(new R("SN",28,"U01F23","SN52A12345678901234567890123")),e.addSpecification(new R("GF",27,"F05F05A11F02","GF121234512345123456789AB13")),e.addSpecification(new R("GP",27,"F05F05A11F02","GP791234512345123456789AB13")),e.addSpecification(new R("MQ",27,"F05F05A11F02","MQ221234512345123456789AB13")),e.addSpecification(new R("RE",27,"F05F05A11F02","RE131234512345123456789AB13")),e.addSpecification(new R("PF",27,"F05F05A11F02","PF281234512345123456789AB13")),e.addSpecification(new R("TF",27,"F05F05A11F02","TF891234512345123456789AB13")),e.addSpecification(new R("YT",27,"F05F05A11F02","YT021234512345123456789AB13")),e.addSpecification(new R("NC",27,"F05F05A11F02","NC551234512345123456789AB13")),e.addSpecification(new R("BL",27,"F05F05A11F02","BL391234512345123456789AB13")),e.addSpecification(new R("MF",27,"F05F05A11F02","MF551234512345123456789AB13")),e.addSpecification(new R("PM",27,"F05F05A11F02","PM071234512345123456789AB13")),e.addSpecification(new R("WF",27,"F05F05A11F02","WF621234512345123456789AB13")),{formatterNumber:r,formatterIban:e}},"useFormatter");var Cy=Object.defineProperty,oi=a((r,e)=>Cy(r,"name",{value:e,configurable:!0}),"o$5");const ai=["=","!=",">",">=","<","<=","in","between"];function St(r,e,t){if(typeof r!="string"||r.length===0)throw new U({code:"JSSDK_FILTER_V3_INVALID_FIELD",description:`FilterV3: field name must be a non-empty string, got ${JSON.stringify(r)}.`,status:400});if(!ai.includes(e))throw new U({code:"JSSDK_FILTER_V3_INVALID_OPERATOR",description:`FilterV3: operator "${e}" is not one of ${ai.join(" ")}.`,status:400});return[r,e,t]}a(St,"e$2"),oi(St,"condition");const Ny=Object.freeze({eq(r,e){return St(r,"=",e)},ne(r,e){return St(r,"!=",e)},gt(r,e){return St(r,">",e)},ge(r,e){return St(r,">=",e)},lt(r,e){return St(r,"<",e)},le(r,e){return St(r,"<=",e)},in(r,e){if(!Array.isArray(e)||e.length===0)throw new U({code:"JSSDK_FILTER_V3_INVALID_IN",description:`FilterV3.in("${r}"): value must be a non-empty array.`,status:400});return St(r,"in",e)},between(r,e,t){if(e==null||t===void 0||t===null)throw new U({code:"JSSDK_FILTER_V3_INVALID_BETWEEN",description:`FilterV3.between("${r}"): both range operands must be defined (got [${String(e)}, ${String(t)}]).`,status:400});return St(r,"between",[e,t])},and(...r){return{logic:"and",conditions:r}},or(...r){return{logic:"or",conditions:r}},not(r){return ci(r)?{...r,conditions:[...r.conditions],negative:!0}:{logic:"and",negative:!0,conditions:[r]}},build(...r){const e=r.filter(Boolean);for(const t of e)Rc(t);return e}});function ci(r){return!Array.isArray(r)&&typeof r=="object"&&r!==null&&"conditions"in r}a(ci,"u$1"),oi(ci,"isGroup");function Rc(r){if(!ci(r)&&!(Array.isArray(r)&&r.length===3&&typeof r[0]=="string"&&ai.includes(r[1])))throw new U({code:"JSSDK_FILTER_V3_INVALID_NODE",description:`FilterV3.build: each node must be a [field, operator, value] condition or a group \u2014 got ${JSON.stringify(r)}. Did you forget to spread (build(...nodes)) or build a condition with FilterV3 helpers?`,status:400})}a(Rc,"d$2"),oi(Rc,"assertNode");var Dy=Object.defineProperty,Ly=a((r,e)=>Dy(r,"name",{value:e,configurable:!0}),"t$4");function li(r,e){if(typeof r!="string"||r.length===0)throw new U({code:"JSSDK_BATCH_REF_V3_INVALID_PATH",description:`${e}: path must be a non-empty dotted string (e.g. "tasks.id").`,status:400})}a(li,"a$b"),Ly(li,"assertPath");const Py=Object.freeze({ref(r){return li(r,"BatchRefV3.ref"),{$ref:r}},refArray(r){if(li(r,"BatchRefV3.refArray"),!r.includes("."))throw new U({code:"JSSDK_BATCH_REF_V3_INVALID_REF_ARRAY",description:`BatchRefV3.refArray: path "${r}" must contain a dot ("alias.field") \u2014 the server collects <field> across the alias's items[].`,status:400});return{$refArray:r}}});var My=Object.defineProperty,Fy=a((r,e)=>My(r,"name",{value:e,configurable:!0}),"r$7");class Cc{static{a(this,"AuthHookManager")}static{Fy(this,"AuthHookManager")}#e;#r;#s;#t;#i;constructor(e){this.#e=Object.freeze(Object.assign({},e)),this.#r=this.#e.b24Url.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#s=`https://${this.#r}/rest`,this.#t=`https://${this.#r}`,this.#i=new Map,this.#i.set(ee.v2,`${this.#s}/${this.#e.userId}/${this.#e.secret}`),this.#i.set(ee.v3,`${this.#s}/api/${this.#e.userId}/${this.#e.secret}`)}getAuthData(){return{access_token:this.#e.secret,refresh_token:"hook",expires:0,expires_in:0,domain:this.#r,member_id:this.#r}}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.#t}`}getTargetOriginWithPath(){return this.#i}get isAdmin(){return!0}}var xy=Object.defineProperty,$y=a((r,e)=>xy(r,"name",{value:e,configurable:!0}),"n$3");class ui extends as{static{a(this,"B24Hook")}static{$y(this,"B24Hook")}#e;constructor(e,t){super(),this.#e=new Cc(e);const s=`The B24Hook object is intended exclusively for use on the server.
A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).`;this._httpV2=new ws(this.#e,this._getHttpOptions(),t?.restrictionParams),this._httpV2.setClientSideWarning(!0,s),this._httpV3=new Ss(this.#e,this._getHttpOptions(),t?.restrictionParams),this._httpV3.setClientSideWarning(!0,s),this._isInit=!0}get auth(){return this.#e}offClientSideWarning(){tr.getAllApiVersions().forEach(e=>{this.getHttpClient(e).setClientSideWarning(!1,"")})}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}static fromWebhookUrl(e,t){if(!e.trim())throw new U({code:"JSSDK_HOOK_URL_EMPTY",description:"Webhook URL cannot be empty",status:0});let s;try{s=new URL(e.replace("/rest/api","/rest"))}catch{throw new U({code:"JSSDK_HOOK_URL_INVALID",description:"Invalid webhook URL format",status:0})}if(s.protocol!=="https:")throw new U({code:"JSSDK_HOOK_URL_NOT_HTTPS",description:"Webhook requires HTTPS protocol",status:0});const n=s.pathname.split("/").filter(Boolean);if(!(n.length===3&&n[0]==="rest"||n.length===4&&n[0]==="rest"&&n[1]==="api"))throw new U({code:"JSSDK_HOOK_URL_MALFORMED",description:"Webhook URL must follow format: /rest/<userId>/<secret> or /rest/api/<userId>/<secret>",status:0});const i=n[1]==="api"?2:1,c=n[1]==="api"?3:2,o=n[i],l=n[c];if(!/^\d+$/.test(o))throw new U({code:"JSSDK_HOOK_URL_USER_ID_NOT_NUMERIC",description:"User ID must be numeric in webhook URL",status:0});const h=Number.parseInt(o,10);return new ui({b24Url:s.origin,userId:h,secret:l},t)}}var ce=(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.getInterface="getInterface",r.placementBindEvent="placementBindEvent",r))(ce||{}),jy=Object.defineProperty,By=a((r,e)=>jy(r,"name",{value:e,configurable:!0}),"m$3");const Uy=50,Vy=64;class Nc{static{a(this,"MessageManager")}static{By(this,"MessageManager")}#e;#r;#s;#t=new Set;_logger;runCallbackHandler;constructor(e){this._logger=oe.createNullLogger(),this.#e=e,this.#r=new Map,this.#s=new Map,this.runCallbackHandler=this._runCallback.bind(this)}setLogger(e){this._logger=e}getLogger(){return this._logger}subscribe(){window.addEventListener("message",this.runCallbackHandler)}unsubscribe(){window.removeEventListener("message",this.runCallbackHandler);for(const[e,t]of this.#r)t.timeoutId&&clearTimeout(t.timeoutId),this.#r.delete(e),t.reject(new U({code:"JSSDK_FRAME_DISPOSED",description:"The B24Frame was destroyed before the parent window answered this command.",status:0}));this.#s.clear(),this.#t.clear()}async send(e,t=null){return new Promise((s,n)=>{let i;const c={resolve:s,reject:n,timeoutId:null},o=this.#n(c);let l=null;const h=nn(t||{},["singleOption","callBack","isSafely","safelyTime","requestId"]),{callBack:u,singleOption:g,requestId:p}=t||{};if(u&&this.#s.set(o,u),g?l=g:Object.keys(h).length>0&&(l={...h}),e.toString().includes(":"))i={method:e.toString(),params:l||"",callback:o,appSid:this.#e.getAppSid(),requestId:p};else{i=e.toString(),t?.isRawValue!==!0&&l?l=JSON.stringify(l):t?.isRawValue===!0&&l&&M.isPlainObject(l)&&l.value&&(l=l.value);const d=[l||"",o,this.#e.getAppSid()];i+=":"+d.filter(Boolean).join(":")}if(this.getLogger().debug(`send to ${this.#e.getTargetOrigin()}`,{command:e.toString(),callbackKey:o,origin:this.#e.getTargetOrigin()}).catch(()=>{}),parent.postMessage(i,this.#e.getTargetOrigin()),t?.isSafely){const d=Number.parseInt(String(t?.safelyTime||900));this.#r.get(o).timeoutId=window.setTimeout(()=>{this.#r.has(o)&&(this.getLogger().warning(`action ${e.toString()} stop by timeout`,{command:e.toString(),safelyTime:d}).catch(()=>{}),this.#r.delete(o),s({isSafely:!0}))},d)}})}_runCallback(e){if(e.origin!==this.#e.getTargetOrigin()){!this.#t.has(e.origin)&&this.#t.size<Uy&&(this.#t.add(e.origin),this.getLogger().warning("message rejected: unexpected origin",{origin:e.origin,expected:this.#e.getTargetOrigin()}).catch(()=>{}));return}if(typeof e.data=="string"&&e.data.length>0){const[t="",...s]=e.data.split(":"),n={id:t,args:s.join(":")};if(this.getLogger().debug(`get from ${e.origin}`,{id:n.id,origin:e.origin}).catch(()=>{}),n.args)try{n.args=JSON.parse(n.args)}catch{this.getLogger().warning("message dropped: payload is not valid JSON",{id:n.id,origin:e.origin}).catch(()=>{}),this.#i(n.id,new U({code:"JSSDK_FRAME_BAD_PAYLOAD",description:`The parent window answered command "${n.id.slice(0,Vy)}" with a payload that is not valid JSON.`,status:0}));return}if(this.#r.has(n.id)){const i=this.#r.get(n.id);i.timeoutId&&clearTimeout(i.timeoutId),this.#r.delete(n.id),i.resolve(n.args)}else if(this.#s.has(n.id)){const i=this.#s.get(n.id);i&&i.apply(globalThis,[n.args])}}}#i(e,t){const s=this.#r.get(e);s&&(s.timeoutId&&clearTimeout(s.timeoutId),this.#r.delete(e),s.reject(t))}#n(e){const t=K.getUniqId();return this.#r.set(t,e),t}}var qy=Object.defineProperty,Hy=a((r,e)=>qy(r,"name",{value:e,configurable:!0}),"r$6");class Dc{static{a(this,"AppFrame")}static{Hy(this,"AppFrame")}#e="";#r=!0;#s=null;#t=null;#i=null;#n;#o;#c;constructor(e){e.DOMAIN&&(this.#e=e.DOMAIN,this.#e=this.#e.replace(/:(80|443)$/,"")),this.#r=e.PROTOCOL===!0,e.LANG&&(this.#i=e.LANG),e.APP_SID&&(this.#s=e.APP_SID),this.#c=new Map,this.#o=`${this.#r?"https":"http"}://${this.#e}`,this.#n=`${this.#o}/rest`,this.#c.set(ee.v2,`${this.#n}`),this.#c.set(ee.v3,`${this.#n}/api`)}initData(e){return this.#e||(this.#e=e.DOMAIN),this.#t||(this.#t=e.PATH),this.#i||(this.#i=e.LANG),this.#r=Number.parseInt(e.PROTOCOL)===1,this.#e=this.#e.replace(/:(80|443)$/,""),this.#o=`${this.#r?"https":"http"}://${this.#e}`,this.#n=`${this.#o}/rest`,this.#c.set(ee.v2,`${this.#n}`),this.#c.set(ee.v3,`${this.#n}/api`),this}getAppSid(){if(this.#s===null)throw new U({code:"JSSDK_FRAME_APP_SID_NOT_INIT",description:"Not init appSid",status:0});return this.#s}getTargetOrigin(){return this.#o}getTargetOriginWithPath(){return this.#c}getLang(){return this.#i||ln.en}}var Wy=Object.defineProperty,zy=a((r,e)=>Wy(r,"name",{value:e,configurable:!0}),"r$5");const Lc=1e4;class Pc{static{a(this,"AuthManager")}static{zy(this,"AuthManager")}#e=null;#r=null;#s=0;#t=0;#i=null;#n=!1;#o;#c;constructor(e,t){this.#o=e,this.#c=t}initData(e){return e.AUTH_ID&&(this.#e=e.AUTH_ID,this.#r=e.REFRESH_ID,this.#t=Number.parseInt(e.AUTH_EXPIRES),this.#s=Date.now()+this.#t*1e3,this.#n=e.IS_ADMIN,this.#i=e.MEMBER_ID||""),this}getAuthData(){return this.#s>Date.now()?{access_token:this.#e,refresh_token:this.#r,expires:this.#s/1e3,expires_in:this.#t,domain:this.#o.getTargetOrigin(),member_id:this.#i}:!1}async refreshAuth(){let e;const t=new Promise((s,n)=>{e=setTimeout(()=>n(new U({code:"JSSDK_FRAME_REFRESH_AUTH_TIMEOUT",status:408,description:`refreshAuth: the parent window did not answer within ${Lc}ms`})),Lc)});try{const s=await Promise.race([this.#c.send(ce.refreshAuth,{}),t]);return this.#e=s.AUTH_ID,this.#r=s.REFRESH_ID,this.#s=Date.now()+Number.parseInt(s.AUTH_EXPIRES)*1e3,this.getAuthData()}finally{e&&clearTimeout(e)}}getUniq(e){return[e,this.#i||""].join("_")}get isAdmin(){return this.#n}getTargetOrigin(){return this.#o.getTargetOrigin()}getTargetOriginWithPath(){return this.#o.getTargetOriginWithPath()}}var Jy=Object.defineProperty,Ky=a((r,e)=>Jy(r,"name",{value:e,configurable:!0}),"m$2");class Mc{static{a(this,"ParentManager")}static{Ky(this,"ParentManager")}#e;constructor(e){this.#e=e}get message(){return this.#e}async closeApplication(){return this.#e.send(ce.closeApplication,{isSafely:!1})}async fitWindow(){const e="100%",t=this.getScrollSize().scrollHeight;return this.#e.send(ce.resizeWindow,{width:e,height:t,isSafely:!0})}async resizeWindow(e,t){return e>0&&t>0?this.#e.send(ce.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,s=0){const n=document.body;let i=Math.max(n.scrollWidth,n.offsetWidth);s>0&&(i=Math.max(s,i));let c=Math.max(n.scrollHeight,n.offsetHeight);return e&&(c=Math.max(e.scrollHeight,e.offsetHeight)),t>0&&(c=Math.max(t,c)),this.resizeWindow(i,c)}getScrollSize(){return vy()}async scrollParentWindow(e){return Number.isInteger(e)?(e<0&&(e=0),this.#e.send(ce.setScroll,{scroll:e,isSafely:!0})):Promise.reject(new Error("Wrong scroll number"))}async reloadWindow(){return this.#e.send(ce.reloadWindow,{isSafely:!0})}async setTitle(e){return this.#e.send(ce.setTitle,{title:e.toString(),isSafely:!0})}async imCallTo(e,t=!0){return this.#e.send(ce.imCallTo,{userId:e,video:t,isSafely:!0})}async imPhoneTo(e,t){return this.#e.send(ce.imPhoneTo,{phone:e,...t===void 0?{}:{params:t},isSafely:!0})}async imOpenMessenger(e,t){return this.#e.send(ce.imOpenMessenger,{dialogId:e,...t===void 0?{}:{messageId:t},isSafely:!0})}async imOpenHistory(e){return this.#e.send(ce.imOpenHistory,{dialogId:e,isSafely:!0})}}var Gy=Object.defineProperty,Yy=a((r,e)=>Gy(r,"name",{value:e,configurable:!0}),"r$4");let Fc=class{static{a(this,"OptionsManager")}static{Yy(this,"OptionsManager")}#e;#r=null;#s=null;constructor(e){this.#e=e}initData(e){return e.APP_OPTIONS&&(this.#r=e.APP_OPTIONS),e.USER_OPTIONS&&(this.#s=e.USER_OPTIONS),this}appGet(e){if(this.#r&&this.#r[e])return this.#r[e];throw new Error(`app.option.${e} not set`)}async appSet(e,t){return this.#r||(this.#r=[]),this.#r[e]=t,this.#t(ce.setAppOption,e,this.#r[e])}userGet(e){if(this.#s&&this.#s[e])return this.#s[e];throw new Error(`user.option.${e} not set`)}async userSet(e,t){return this.#r||(this.#r=[]),this.#r[e]||(this.#r[e]=null),this.#s[e]=t,this.#t(ce.setUserOption,e,this.#s[e])}async#t(e,t,s){return this.#e.send(e,{name:t,value:s,isSafely:!0}).then(()=>Promise.resolve())}};var Zy=Object.defineProperty,xc=a((r,e)=>Zy(r,"name",{value:e,configurable:!0}),"i$3");class $c{static{a(this,"DialogManager")}static{xc(this,"DialogManager")}#e;constructor(e){this.#e=e}async selectUser(){return this.#e.send(ce.selectUser,{mult:!1})}async selectUsers(){return this.#e.send(ce.selectUser,{mult:!0})}async selectAccess(e=[]){return this.#e.send(ce.selectAccess,{value:e})}async selectCRM(e){const t=await this.#e.send(ce.selectCRM,{entityType:e?.entityType,multiple:e?.multiple,value:e?.value}),s={};if(!t)return s;const n=xc(u=>{if(u!=null)return Array.isArray(u)?u:Object.values(u)},"toArray"),i=n(t.lead);i&&(s.lead=i);const c=n(t.contact);c&&(s.contact=c);const o=n(t.company);o&&(s.company=o);const l=n(t.deal);l&&(s.deal=l);const h=n(t.quote);return h&&(s.quote=h),s}}var Xy=Object.defineProperty,Qy=a((r,e)=>Xy(r,"name",{value:e,configurable:!0}),"m$1");class jc{static{a(this,"SliderManager")}static{Qy(this,"SliderManager")}#e;#r;constructor(e,t){this.#e=e,this.#r=t}getUrl(e="/"){return new URL(e,this.#e.getTargetOrigin())}getTargetOrigin(){return this.#e.getTargetOrigin()}async openSliderAppPage(e={}){return this.#r.send(ce.openApplication,e)}async closeSliderAppPage(){return this.#r.send(ce.closeApplication,{isSafely:!1})}#s(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 s=new URL(e);return s.searchParams.set("IFRAME","Y"),s.searchParams.set("IFRAME_TYPE","SIDE_SLIDER"),this.#r.send(ce.openPath,{path:[this.#s(t),s.pathname,s.search].join("")}).then(n=>n?.result==="error"?n?.errorCode==="METHOD_NOT_SUPPORTED_ON_DEVICE"?new Promise((i,c)=>{const o=window.open(e,"_blank");if(!o){c(new Error("Error open window"));return}let l=0;const h=1e3*60*5,u=window.setInterval(()=>{l=l+1,o.closed?(clearInterval(u),i({isOpenAtNewWindow:!0,isClose:!0})):l>h&&(clearInterval(u),i({isOpenAtNewWindow:!0,isClose:!1}))},1e3)}):Promise.reject(new Error(n?.errorCode)):n?.result==="close"?Promise.resolve({isOpenAtNewWindow:!1,isClose:!0}):Promise.resolve({isOpenAtNewWindow:!1,isClose:!1}))}}var e0=Object.defineProperty,t0=a((r,e)=>e0(r,"name",{value:e,configurable:!0}),"i$2");class Bc{static{a(this,"PlacementManager")}static{t0(this,"PlacementManager")}#e;#r="";#s={};constructor(e){this.#e=e}initData(e){return this.#r=e.PLACEMENT||"DEFAULT",this.#s=Object.freeze(e.PLACEMENT_OPTIONS),this}get title(){return this.#r}get placement(){return this.#r}get isDefault(){return this.placement==="DEFAULT"}get options(){return this.#s}get isSliderMode(){return this.options?.IFRAME==="Y"}async getInterface(){return this.#e.send(ce.getInterface,{isSafely:!0})}async bindEvent(e,t){return this.#e.send(ce.placementBindEvent,{event:e,callBack:t,isSafely:!0})}async call(e,t={}){if(e==="setValue"&&!M.isString(t?.value))throw new TypeError("placement.call('setValue', { value }) expects `value` to be a JSON-serialized string. Use placement.setValue(value) to serialize automatically, or call JSON.stringify yourself.");return this.#e.send(e,{...t,isSafely:!0,isRawValue:["setValue"].includes(e)})}async setValue(e){return this.#e.send("setValue",{value:JSON.stringify(e),isSafely:!0,isRawValue:!0})}async callCustomBind(e,t=null,s){let n={};return M.isString(t)?n.singleOption=t:M.isObjectLike(t)&&(n={...t}),this.#e.send(e,{...n,callBack:s,isSafely:!0})}}var r0=Object.defineProperty,s0=a((r,e)=>r0(r,"name",{value:e,configurable:!0}),"r$3");class Uc extends as{static{a(this,"B24Frame")}static{s0(this,"B24Frame")}#e=!1;#r=!1;#s;#t;#i;#n;#o;#c;#h;#f;#a;constructor(e,t){super(),this.#a=t?.restrictionParams,this.#s=new Dc(e),this.#t=new Nc(this.#s),this.#t.subscribe(),this.#i=new Pc(this.#s,this.#t),this.#n=new Mc(this.#t),this.#o=new Fc(this.#t),this.#c=new $c(this.#t),this.#h=new jc(this.#s,this.#t),this.#f=new Bc(this.#t),this._isInit=!1}setLogger(e){super.setLogger(e),this.#t.setLogger(this.getLogger())}get isFirstRun(){return this._ensureInitialized(),this.#r}get isInstallMode(){return this._ensureInitialized(),this.#e}get parent(){return this._ensureInitialized(),this.#n}get auth(){return this._ensureInitialized(),this.#i}get slider(){return this._ensureInitialized(),this.#h}get placement(){return this._ensureInitialized(),this.#f}get options(){return this._ensureInitialized(),this.#o}get dialog(){return this._ensureInitialized(),this.#c}async init(){const e=await this.#t.send(ce.getInitData,{});return this.getLogger().debug("init data",{PLACEMENT:e.PLACEMENT,LANG:e.LANG,INSTALL:e.INSTALL,IS_ADMIN:e.IS_ADMIN,FIRST_RUN:e.FIRST_RUN}).catch(()=>{}),this.#s.initData(e),this.#i.initData(e),this.#f.initData(e),this.#o.initData(e),this.#e=e.INSTALL,this.#r=e.FIRST_RUN,this._httpV2=new ws(this.#i,this._getHttpOptions(),this.#a),this._httpV3=new Ss(this.#i,this._getHttpOptions(),this.#a),this._isInit=!0,this.#r?this.#t.send(ce.setInstall,{install:!0}):Promise.resolve()}destroy(){this.#t.unsubscribe(),super.destroy()}async installFinish(){return this.isInstallMode?this.#t.send(ce.setInstallFinish,{}):Promise.reject(new U({code:"JSSDK_FRAME_INSTALL_ALREADY_FINISHED",description:"Application was previously installed. You cannot call installFinish",status:0}))}getTargetOrigin(){return this._ensureInitialized(),this.#i.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#i.getTargetOriginWithPath()}getAppSid(){return this._ensureInitialized(),this.#s.getAppSid()}getLang(){return this._ensureInitialized(),this.#s.getLang()}}var n0=Object.defineProperty,i0=a((r,e)=>n0(r,"name",{value:e,configurable:!0}),"e$1");class Vc extends U{static{a(this,"RefreshTokenError")}static{i0(this,"RefreshTokenError")}}var o0=Object.defineProperty,a0=a((r,e)=>o0(r,"name",{value:e,configurable:!0}),"h$2");class qc{static{a(this,"AuthOAuthManager")}static{a0(this,"AuthOAuthManager")}#e;#r=null;#s=null;#t;#i;#n=0;#o=0;#c;#h;#f;#a;#l;#u=null;constructor(e,t){this.#t=Object.assign({},e),this.#i=Object.freeze(Object.assign({},t)),this.#c=this.#t.domain.replaceAll("https://","").replaceAll("http://","").replace(/:(80|443)$/,""),this.#h=this.#t.clientEndpoint,this.#f=this.#h.replace("/rest/",""),this.#l=this.#t.serverEndpoint.replace("/rest/",""),this.#n=this.#t.expires*1e3,this.#o=this.#t.expiresIn,this.#e=be.create({baseURL:this.#l}),this.#a=new Map,this.#a.set(ee.v2,`${this.#h}`),this.#a.set(ee.v3,`${this.#h}/api`)}getAuthData(){return this.#n>Date.now()?{access_token:this.#t.accessToken,refresh_token:this.#t.refreshToken,expires:this.#n/1e3,expires_in:this.#o,domain:this.#c,member_id:this.#t.memberId}:!1}async refreshAuth(){try{let e;if(this.#s)e=await this.#s();else{const s=new URLSearchParams({grant_type:"refresh_token",client_id:this.#i.clientId,client_secret:this.#i.clientSecret,refresh_token:this.#t.refreshToken}),n=await this.#e.post("/oauth/token/",s,{headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(n.data.error)throw new U({code:"JSSDK_OAUTH_TOKEN_REFRESH_FAILED",description:`Token update error: ${n.data.error}`,status:0});if(n.status!==200)throw new U({code:"JSSDK_OAUTH_TOKEN_REFRESH_BAD_STATUS",description:`Token update error status code: ${n.status}`,status:n.status});e=n.data}if(!e)throw new U({code:"JSSDK_OAUTH_TOKEN_REFRESH_NO_DATA",description:"Unable to obtain authorization update data",status:0});this.#t.accessToken=e.access_token,this.#t.refreshToken=e.refresh_token,this.#t.expires=Number.parseInt(e.expires||"0"),this.#t.expiresIn=Number.parseInt(e.expires_in||"3600"),this.#t.clientEndpoint=e.client_endpoint,this.#t.serverEndpoint=e.server_endpoint,this.#t.scope=e.scope,this.#t.status=Object.values(yt).find(s=>s===e.status)||yt.Free,this.#n=this.#t.expires*1e3;const t=this.getAuthData();return this.#r&&await this.#r({authData:t,b24OAuthParams:this.#t}),t}catch(e){if(e instanceof si){const t={code:e?.code||0,description:e?.message||""};if(e.response&&e.response.data&&!M.isUndefined(e.response.data.error)){const s=e.response.data;s.error&&typeof s.error=="object"&&"code"in s.error?(t.code=s.error.code,t.description=s.error.message,s.error.validation&&s.error.validation.forEach(n=>{t.description+=`${n?.message||JSON.stringify(n)}`})):s.error&&typeof s.error=="string"&&(t.code=s.error,t.description=s?.error_description??t.description)}throw new Vc({code:String(t.code),description:t.description,status:e.response?.status||0})}else if(e instanceof Error)throw e;throw new Error(`Strange error: ${String(e)}`,{cause:e})}}setCallbackRefreshAuth(e){this.#r=e}removeCallbackRefreshAuth(){this.#r=null}setCustomRefreshAuth(e){this.#s=e}removeCustomRefreshAuth(){this.#s=null}getUniq(e){return[e,this.#t.memberId||""].join("_")}getTargetOrigin(){return`${this.#f}`}getTargetOriginWithPath(){return this.#a}get isAdmin(){if(this.#u===null)throw new U({code:"JSSDK_OAUTH_IS_ADMIN_NOT_INIT",description:"isAdmin not init. You need call B24OAuth::initIsAdmin().",status:0});return this.#u}async initIsAdmin(e,t){if(this.#u=!1,e.apiVersion===ee.v3){const n=await e.call("profile",{},t);if(!n.isSuccess)throw new U({code:"JSSDK_OAUTH_PROFILE_FAILED",description:n.getErrorMessages().join(";"),status:0});n.getData().result.profile?.admin&&(this.#u=!0);return}const s=await e.call("profile",{},t);if(!s.isSuccess)throw new U({code:"JSSDK_OAUTH_PROFILE_FAILED",description:s.getErrorMessages().join(";"),status:0});s.getData().result?.ADMIN&&(this.#u=!0)}}var c0=Object.defineProperty,l0=a((r,e)=>c0(r,"name",{value:e,configurable:!0}),"n$2");class u0 extends as{static{a(this,"B24OAuth")}static{l0(this,"B24OAuth")}#e;constructor(e,t,s){super(),this.#e=new qc(e,t);const n=`The B24OAuth object is intended exclusively for use on the server.
A webhook contains a secret access key, which MUST NOT be used in client-side code (browser, mobile app).`;this._httpV2=new ws(this.#e,this._getHttpOptions(),s?.restrictionParams),this._httpV2.setClientSideWarning(!0,n),this._httpV3=new Ss(this.#e,this._getHttpOptions(),s?.restrictionParams),this._httpV3.setClientSideWarning(!0,n),this._isInit=!0}async initIsAdmin(e){const t="profile";this._ensureInitialized();try{const s=tr.automaticallyObtainApiVersion(t),n=this.getHttpClient(s);return this.#e.initIsAdmin(n,e)}catch(s){this.getLogger().error("initIsAdmin: setup failed before the profile call; treating the user as non-admin",{code:s instanceof U?s.code:"JSSDK_OAUTH_IS_ADMIN_LOOKUP_FAILED"}).catch(()=>{});return}}setCallbackRefreshAuth(e){this._ensureInitialized(),this.#e.setCallbackRefreshAuth(e)}removeCallbackRefreshAuth(){this._ensureInitialized(),this.#e.removeCallbackRefreshAuth()}setCustomRefreshAuth(e){this._ensureInitialized(),this.#e.setCustomRefreshAuth(e)}removeCustomRefreshAuth(){this._ensureInitialized(),this.#e.removeCustomRefreshAuth()}offClientSideWarning(){tr.getAllApiVersions().forEach(e=>{this.getHttpClient(e).setClientSideWarning(!1,"")})}get auth(){return this.#e}getTargetOrigin(){return this._ensureInitialized(),this.#e.getTargetOrigin()}getTargetOriginWithPath(){return this._ensureInitialized(),this.#e.getTargetOriginWithPath()}}var h0=Object.defineProperty,Hc=a((r,e)=>h0(r,"name",{value:e,configurable:!0}),"t$3");class hi extends Error{static{a(this,"UnhandledMatchError")}static{Hc(this,"UnhandledMatchError")}constructor(e,...t){super(...t),this.name="UnhandledMatchError",this.message=`Unhandled match value of type ${e}`,this.stack=`${new Error("for stack").stack}`}}class or{static{a(this,"AbstractHelper")}static{Hc(this,"AbstractHelper")}_b24;_data=null;_logger;constructor(e){this._b24=e,this._logger=oe.createNullLogger()}setLogger(e){this._logger=e}getLogger(){return this._logger}async initData(e){return Promise.reject(new Error("Rewrite this function"))}}var d0=Object.defineProperty,f0=a((r,e)=>d0(r,"name",{value:e,configurable:!0}),"t$2");class p0 extends or{static{a(this,"ProfileManager")}static{f0(this,"ProfileManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("ProfileManager.data not initialized");return this._data}}var g0=Object.defineProperty,m0=a((r,e)=>g0(r,"name",{value:e,configurable:!0}),"a$4");class y0 extends or{static{a(this,"AppManager")}static{m0(this,"AppManager")}_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 wa[this.data.status]||"Unknown status"}}var b0=Object.defineProperty,_0=a((r,e)=>b0(r,"name",{value:e,configurable:!0}),"a$3");class w0 extends or{static{a(this,"PaymentManager")}static{_0(this,"PaymentManager")}_data=null;async initData(e){this._data=e}get data(){if(this._data===null)throw new Error("PaymentManager.data not initialized");return this._data}}var S0=Object.defineProperty,v0=a((r,e)=>S0(r,"name",{value:e,configurable:!0}),"t$1");class E0 extends or{static{a(this,"LicenseManager")}static{v0(this,"LicenseManager")}_data=null;async initData(e){this._data=e,await this.makeRestrictionManagerParams()}get data(){if(this._data===null)throw new Error("LicenseManager.data not initialized");return this._data}async makeRestrictionManagerParams(){if(!this.data?.license)return;const e=mn.fromTariffPlan(this.data.license);this.getLogger().debug("set restriction manager params",{license:this.data.license,restrictionParams:e}).catch(()=>{}),await this._b24.setRestrictionManagerParams(e)}}var O0=Object.defineProperty,T0=a((r,e)=>O0(r,"name",{value:e,configurable:!0}),"l$5");class A0 extends or{static{a(this,"CurrencyManager")}static{T0(this,"CurrencyManager")}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:(this.getLogger().error("Failed to load data",{error:t}).catch(()=>{}),new Error("Failed to load data",{cause:t}))}}async loadData(){const e=this.currencyList.map(t=>({method:"crm.currency.get",params:{id:t}}));if(e.length===0)return Promise.resolve();try{const t=(await this._b24.actions.v2.batchByChunk.make({calls:e,options:{isHaltOnError:!0}})).getData();if(!Array.isArray(t))return Promise.resolve();t.forEach(s=>{if(typeof s.LANG>"u")return;const n=s.CURRENCY,i=this.data.currencyList.get(n);if(!(typeof i>"u"))for(const[c,o]of Object.entries(s.LANG))switch(i.lang[c]={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},i.lang[c].thousandsVariant){case"N":i.lang[c].thousandsSep="";break;case"D":i.lang[c].thousandsSep=".";break;case"C":i.lang[c].thousandsSep=",";break;case"S":i.lang[c].thousandsSep=" ";break;case"B":i.lang[c].thousandsSep="&nbsp;";break;default:M.isStringFilled(i.lang[c].thousandsSep)||(i.lang[c].thousandsSep=" ");break}})}catch(t){this.getLogger().error("Failed to load data",{error:t}).catch(()=>{})}}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:K.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 s=this.data.currencyList.get(e);if(typeof s>"u")throw new hi(e);let n=s.fullName;if(!(typeof t>"u")){const i=s.lang[t];M.isUndefined(i)||(n=i.fullName)}return n}getCurrencyLiteral(e,t){const s=this.data.currencyList.get(e);if(typeof s>"u")throw new hi(e);let n=s.formatString;if(!(typeof t>"u")){const i=s.lang[t];M.isUndefined(i)||(n=i.formatString)}return n.replaceAll("&#","&%").replaceAll("#","").replaceAll("&%","&#").trim()||""}get currencyList(){return[...this.data.currencyList.keys()]}format(e,t,s){const n=this.data.currencyList.get(t);if(typeof n>"u")throw new hi(t);const i={formatString:n.formatString,decimals:n.decimals,decPoint:n.decPoint,thousandsSep:n.thousandsSep};M.isStringFilled(i.thousandsSep)||(i.thousandsSep="");const c=n.lang[s];return M.isUndefined(c)||(i.formatString=c.formatString,i.decimals=c.decimals,i.decPoint=c.decPoint,i.thousandsSep=c.thousandsSep),i.formatString.replaceAll("&#","&%").replace("#",K.numberFormat(e,i.decimals,i.decPoint,i.thousandsSep)).replaceAll("&%","&#")||""}}var I0=Object.defineProperty,k0=a((r,e)=>I0(r,"name",{value:e,configurable:!0}),"o$2");class di extends or{static{a(this,"OptionsManager")}static{k0(this,"OptionsManager")}_data;_type;static getSupportTypes(){return[bt.NotSet,bt.JsonArray,bt.JsonObject,bt.FloatVal,bt.IntegerVal,bt.BoolYN,bt.StringVal]}static prepareArrayList(e){return M.isArray(e)?e:M.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(),M.isObject(e))for(const[t,s]of Object.entries(e))this.data.set(t,s)}getJsonArray(e,t=[]){if(!this.data.has(e))return t;let s=this.data.get(e);try{s=JSON.parse(s),!M.isArray(s)&&!M.isObject(s)&&(s=t)}catch(n){this.getLogger().error("Failed JSON parse",{error:n}).catch(()=>{}),s=t}return di.prepareArrayList(s)}getJsonObject(e,t={}){if(!this.data.has(e))return t;let s=this.data.get(e);try{s=JSON.parse(s)}catch(n){this.getLogger().error("Failed JSON parse",{error:n}).catch(()=>{}),s=t}return M.isObject(s)||(s=t),s}getFloat(e,t=0){return this.data.has(e)?K.toNumber(this.data.get(e)):t}getInteger(e,t=0){return this.data.has(e)?K.toInteger(this.data.get(e)):t}getBoolYN(e,t=!0){return this.data.has(e)?K.toBoolean(this.data.get(e)):t}getBoolNY(e,t=!1){return this.data.has(e)?K.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 s=K.toDateTime(this.data.get(e).toString());return s.isValid?s:t}catch{return t}}encode(e){return JSON.stringify(e)}decode(e,t){try{return e.length>0?JSON.parse(e):t}catch(s){this.getLogger().error("Failed JSON parse",{error:s}).catch(()=>{})}return t}getMethodSave(){switch(this._type){case"app":return"app.option.set";case"user":return"user.option.set"}}async save(e,t,s){const n=[];return n.push({method:this.getMethodSave(),params:{options:e}}),M.isObject(t)&&n.push({method:"pull.application.event.add",params:{COMMAND:t?.command,PARAMS:t?.params,MODULE_ID:t?.moduleId}}),this._b24.actions.v2.batch.make({calls:n,options:{isHaltOnError:!0,returnAjaxResult:!1,requestId:s}})}}var R0=Object.defineProperty,C0=a((r,e)=>R0(r,"name",{value:e,configurable:!0}),"n$1");class Wc{static{a(this,"StorageManager")}static{C0(this,"StorageManager")}_logger;userId;siteId;constructor(e={}){this._logger=oe.createNullLogger(),this.userId=e.userId?K.toInteger(e.userId):0,this.siteId=e.siteId??"none"}setLogger(e){this._logger=e}getLogger(){return this._logger}set(e,t){if(typeof window>"u"||typeof window.localStorage>"u"){this.getLogger().error("localStorage undefined",{error:new Error("undefined window.localStorage")}).catch(()=>{});return}typeof t!="string"&&t&&(t=JSON.stringify(t)),window.localStorage.setItem(this._getKey(e),t)}get(e,t){if(typeof window>"u"||typeof window.localStorage>"u")return t||null;const s=window.localStorage.getItem(this._getKey(e));return s===null?t||null:JSON.parse(s)}remove(e){if(typeof window>"u"||typeof window.localStorage>"u"){this.getLogger().error("localStorage undefined",{error:new Error("undefined window.localStorage")}).catch(()=>{});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)}}var N0=Object.defineProperty,zc=a((r,e)=>N0(r,"name",{value:e,configurable:!0}),"t");class D0 extends Error{static{a(this,"ErrorNotConnected")}static{zc(this,"ErrorNotConnected")}constructor(e){super(e),this.name="ErrorNotConnected"}}class L0 extends Error{static{a(this,"ErrorTimeout")}static{zc(this,"ErrorTimeout")}constructor(e){super(e),this.name="ErrorTimeout"}}var P0=Object.defineProperty,M0=a((r,e)=>P0(r,"name",{value:e,configurable:!0}),"R$1");const vs="2.0";class F0{static{a(this,"JsonRpc")}static{M0(this,"JsonRpc")}_logger;_connector;_idCounter=0;_handlers={};_rpcResponseAwaiters=new Map;constructor(e){if(this._logger=oe.createNullLogger(),this._connector=e.connector,M.isPlainObject(e.handlers))for(const t in e.handlers)this.handle(t,e.handlers[t])}setLogger(e){this._logger=e}getLogger(){return this._logger}handle(e,t){this._handlers[e]=t}async executeOutgoingRpcCommand(e,t,s=5){return new Promise((n,i)=>{const c=this.createRequest(e,t);this._connector.send(JSON.stringify(c))||i(new D0("websocket is not connected"));const o=setTimeout(()=>{this._rpcResponseAwaiters.delete(c.id),i(new L0("no response"))},s*1e3);this._rpcResponseAwaiters.set(c.id,{resolve:n,reject:i,timeout:o})})}executeOutgoingRpcBatch(e){const t=[],s=[];return e.forEach(({method:n,params:i,id:c})=>{const o=this.createRequest(n,i,c);t.push(o),s.push(new Promise((l,h)=>this._rpcResponseAwaiters.set(o.id,{resolve:l,reject:h})))}),this._connector.send(JSON.stringify(t)),s}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(`${K.getDateForLog()}: Pull: Received rpc response with unknown id`,qe({response:e})).catch(()=>{})}parseJsonRpcMessage(e){let t;try{t=JSON.parse(e)}catch(s){return this.getLogger().error(`${K.getDateForLog()}: Pull: Could not decode json rpc message`,{error:s}).catch(()=>{}),[]}return M.isArray(t)?this.executeIncomingRpcBatch(t):M.isJsonRpcRequest(t)?this.executeIncomingRpcCommand(t):M.isJsonRpcResponse(t)?(this.processRpcResponse(t),[]):(this.getLogger().error(`${K.getDateForLog()}: Pull: unknown rpc packet`,qe({decoded:t})).catch(()=>{}),[])}executeIncomingRpcCommand({method:e,params:t}){return e in this._handlers?this._handlers[e].call(this,t||{}):{jsonrpc:vs,error:cn.MethodNotFound}}executeIncomingRpcBatch(e){const t=[];for(const s of e)if("jsonrpc"in s)if("method"in s){const n=this.executeIncomingRpcCommand(s);n&&(n.jsonrpc=vs,n.id=s.id,t.push(n))}else this.processRpcResponse(s);else this.getLogger().error(`${K.getDateForLog()}: Pull: unknown rpc command in batch`,qe({command:s})).catch(()=>{}),t.push({jsonrpc:vs,error:cn.InvalidRequest});return t}nextId(){return++this._idCounter}createPublishRequest(e){return e.map(t=>this.createRequest("publish",t))}createRequest(e,t,s){return s||(s=this.nextId()),{jsonrpc:vs,method:e,params:t,id:s}}}var x0=Object.defineProperty,$0=a((r,e)=>x0(r,"name",{value:e,configurable:!0}),"g$1");class j0{static{a(this,"SharedConfig")}static{$0(this,"SharedConfig")}_logger;_storage;_ttl=1440*60;_callbacks;constructor(e={}){this._logger=oe.createNullLogger(),e=e||{},this._storage=e.storage||new Wc,this._callbacks={onWebSocketBlockChanged:M.isFunction(e.onWebSocketBlockChanged)?e.onWebSocketBlockChanged:()=>{}},this._storage&&typeof window<"u"&&window.addEventListener("storage",this.onLocalStorageSet.bind(this))}setLogger(e){this._logger=e}getLogger(){return this._logger}onLocalStorageSet(e){this._storage.compareKey(e.key||"",He.WebsocketBlocked)&&e.newValue!==e.oldValue&&this._callbacks.onWebSocketBlockChanged({isWebSocketBlocked:this.isWebSocketBlocked()})}isWebSocketBlocked(){return this._storage?this._storage.get(He.WebsocketBlocked,0)>Date.now():!1}setWebSocketBlocked(e){if(!this._storage)return!1;try{this._storage.set(He.WebsocketBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(`${K.getDateForLog()}: Pull: Could not save WS_blocked flag in local storage`,{error:t}).catch(()=>{}),!1}return!0}isLongPollingBlocked(){return this._storage?this._storage.get(He.LongPollingBlocked,0)>Date.now():!1}setLongPollingBlocked(e){if(!this._storage)return!1;try{this._storage.set(He.LongPollingBlocked,e?Date.now()+this._ttl:0)}catch(t){return this.getLogger().error(`${K.getDateForLog()}: Pull: Could not save LP_blocked flag in local storage.`,{error:t}).catch(()=>{}),!1}return!0}isLoggingEnabled(){return this._storage?this._storage.get(He.LoggingEnabled,0)>this.getTimestamp():!1}setLoggingEnabled(e){if(!this._storage)return!1;try{this._storage.set(He.LoggingEnabled,e?this.getTimestamp()+this._ttl:0)}catch(t){return this.getLogger().error(`${K.getDateForLog()}: LocalStorage error.`,{error:t}).catch(()=>{}),!1}return!0}getTimestamp(){return Date.now()}}var B0=Object.defineProperty,U0=a((r,e)=>B0(r,"name",{value:e,configurable:!0}),"c");class V0{static{a(this,"ChannelManager")}static{U0(this,"ChannelManager")}_logger;_publicIds;_restClient;_getPublicListMethod;constructor(e){this._logger=oe.createNullLogger(),this._publicIds=new Map,this._restClient=e.b24,this._getPublicListMethod=e.getPublicListMethod}setLogger(e){this._logger=e}getLogger(){return this._logger}async getPublicIds(e){const t=new Date,s={},n=[];for(const i of e){const c=this._publicIds.get(i);c&&c.end>t?s[c.userId]=c:n.push(i)}return n.length===0?Promise.resolve(s):new Promise(i=>{this._restClient.callMethod(this._getPublicListMethod,{users:n}).then(c=>{const o=c.getData().result;this.setPublicIds(Object.values(o));for(const l of n){const h=this._publicIds.get(l);h&&(s[h.userId]=h)}i(s)}).catch(c=>(this.getLogger().error("some error in getPublicIds",{error:c}).catch(()=>{}),i({})))})}setPublicIds(e){e.forEach(t=>{const s=Number(t.user_id);this._publicIds.set(s,{userId:s,publicId:t.public_id,signature:t.signature,start:new Date(t.start),end:new Date(t.end)})})}}var Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function q0(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}a(q0,"getDefaultExportFromCjs");var fi={exports:{}},Jc;function H0(){return Jc||(Jc=1,(function(r){var e=Object.defineProperty,t=a((s,n)=>e(s,"name",{value:n,configurable:!0}),"i");/*!
* protobuf.js v6.8.6 (c) 2016, daniel wirtz
* compiled mon, 26 feb 2018 11:35:34 utc
* licensed under the bsd-3-clause license
* see: https://github.com/dcodeio/protobuf.js for details
*
* Modify a list for integration with Bitrix Framework:
* - removed integration with RequireJS and AMD package builders;
*/(function(s){t((function(n,i,c){function o(h){var u=i[h];return u||n[h][0].call(u=i[h]={exports:{}},o,u,u.exports),u.exports}a(o,"d"),t(o,"$require");var l=o(c[0]);r&&r.exports&&(r.exports=l)}),"prelude")({1:[function(n,i,c){i.exports=o;function o(l,h){for(var u=new Array(arguments.length-1),g=0,p=2,d=!0;p<arguments.length;)u[g++]=arguments[p++];return new Promise(t(function(f,y){u[g]=t(function(b){if(d)if(d=!1,b)y(b);else{for(var m=new Array(arguments.length-1),_=0;_<m.length;)m[_++]=arguments[_];f.apply(null,m)}},"callback");try{l.apply(h||null,u)}catch(b){d&&(d=!1,y(b))}},"executor"))}a(o,"l"),t(o,"asPromise")},{}],2:[function(n,i,c){var o=c;o.length=t(function(p){var d=p.length;if(!d)return 0;for(var f=0;--d%4>1&&p.charAt(d)==="=";)++f;return Math.ceil(p.length*3)/4-f},"length");for(var l=new Array(64),h=new Array(123),u=0;u<64;)h[l[u]=u<26?u+65:u<52?u+71:u<62?u-4:u-59|43]=u++;o.encode=t(function(p,d,f){for(var y=null,b=[],m=0,_=0,w;d<f;){var S=p[d++];switch(_){case 0:b[m++]=l[S>>2],w=(S&3)<<4,_=1;break;case 1:b[m++]=l[w|S>>4],w=(S&15)<<2,_=2;break;case 2:b[m++]=l[w|S>>6],b[m++]=l[S&63],_=0;break}m>8191&&((y||(y=[])).push(String.fromCharCode.apply(String,b)),m=0)}return _&&(b[m++]=l[w],b[m++]=61,_===1&&(b[m++]=61)),y?(m&&y.push(String.fromCharCode.apply(String,b.slice(0,m))),y.join("")):String.fromCharCode.apply(String,b.slice(0,m))},"encode");var g="invalid encoding";o.decode=t(function(p,d,f){for(var y=f,b=0,m,_=0;_<p.length;){var w=p.charCodeAt(_++);if(w===61&&b>1)break;if((w=h[w])===s)throw Error(g);switch(b){case 0:m=w,b=1;break;case 1:d[f++]=m<<2|(w&48)>>4,m=w,b=2;break;case 2:d[f++]=(m&15)<<4|(w&60)>>2,m=w,b=3;break;case 3:d[f++]=(m&3)<<6|w,b=0;break}}if(b===1)throw Error(g);return f-y},"decode"),o.test=t(function(p){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(p)},"test")},{}],3:[function(n,i,c){i.exports=o;function o(l,h){typeof l=="string"&&(h=l,l=s);var u=[];function g(d){if(typeof d!="string"){var f=p();if(o.verbose&&console.log("codegen: "+f),f="return "+f,d){for(var y=Object.keys(d),b=new Array(y.length+1),m=new Array(y.length),_=0;_<y.length;)b[_]=y[_],m[_]=d[y[_++]];return b[_]=f,Function.apply(null,b).apply(null,m)}return Function(f)()}for(var w=new Array(arguments.length-1),S=0;S<w.length;)w[S]=arguments[++S];if(S=0,d=d.replace(/%([%dfijs])/g,t(function(T,v){var k=w[S++];switch(v){case"d":case"f":return String(Number(k));case"i":return String(Math.floor(k));case"j":return JSON.stringify(k);case"s":return String(k)}return"%"},"replace")),S!==w.length)throw Error("parameter count mismatch");return u.push(d),g}a(g,"a"),t(g,"Codegen");function p(d){return"function "+(d||h||"")+"("+(l&&l.join(",")||"")+`){
  `+u.join(`
  `)+`
}`}return a(p,"s"),t(p,"toString"),g.toString=p,g}a(o,"l"),t(o,"codegen"),o.verbose=!1},{}],4:[function(n,i,c){i.exports=o;function o(){this._listeners={}}a(o,"l"),t(o,"EventEmitter"),o.prototype.on=t(function(l,h,u){return(this._listeners[l]||(this._listeners[l]=[])).push({fn:h,ctx:u||this}),this},"on"),o.prototype.off=t(function(l,h){if(l===s)this._listeners={};else if(h===s)this._listeners[l]=[];else for(var u=this._listeners[l],g=0;g<u.length;)u[g].fn===h?u.splice(g,1):++g;return this},"off"),o.prototype.emit=t(function(l){var h=this._listeners[l];if(h){for(var u=[],g=1;g<arguments.length;)u.push(arguments[g++]);for(g=0;g<h.length;)h[g].fn.apply(h[g++].ctx,u)}return this},"emit")},{}],5:[function(n,i,c){i.exports=u;var o=n(1),l=n(7),h=l("fs");function u(g,p,d){return typeof p=="function"?(d=p,p={}):p||(p={}),d?!p.xhr&&h&&h.readFile?h.readFile(g,t(function(f,y){return f&&typeof XMLHttpRequest<"u"?u.xhr(g,p,d):f?d(f):d(null,p.binary?y:y.toString("utf8"))},"fetchReadFileCallback")):u.xhr(g,p,d):o(u,this,g,p)}a(u,"u"),t(u,"fetch"),u.xhr=t(function(g,p,d){var f=new XMLHttpRequest;f.onreadystatechange=t(function(){if(f.readyState!==4)return s;if(f.status!==0&&f.status!==200)return d(Error("status "+f.status));if(p.binary){var y=f.response;if(!y){y=[];for(var b=0;b<f.responseText.length;++b)y.push(f.responseText.charCodeAt(b)&255)}return d(null,typeof Uint8Array<"u"?new Uint8Array(y):y)}return d(null,f.responseText)},"fetchOnReadyStateChange"),p.binary&&("overrideMimeType"in f&&f.overrideMimeType("text/plain; charset=x-user-defined"),f.responseType="arraybuffer"),f.open("GET",g),f.send()},"fetch_xhr")},{1:1,7:7}],6:[function(n,i,c){i.exports=o(o);function o(p){return typeof Float32Array<"u"?(function(){var d=new Float32Array([-0]),f=new Uint8Array(d.buffer),y=f[3]===128;function b(S,T,v){d[0]=S,T[v]=f[0],T[v+1]=f[1],T[v+2]=f[2],T[v+3]=f[3]}a(b,"f"),t(b,"writeFloat_f32_cpy");function m(S,T,v){d[0]=S,T[v]=f[3],T[v+1]=f[2],T[v+2]=f[1],T[v+3]=f[0]}a(m,"n"),t(m,"writeFloat_f32_rev"),p.writeFloatLE=y?b:m,p.writeFloatBE=y?m:b;function _(S,T){return f[0]=S[T],f[1]=S[T+1],f[2]=S[T+2],f[3]=S[T+3],d[0]}a(_,"o"),t(_,"readFloat_f32_cpy");function w(S,T){return f[3]=S[T],f[2]=S[T+1],f[1]=S[T+2],f[0]=S[T+3],d[0]}a(w,"p"),t(w,"readFloat_f32_rev"),p.readFloatLE=y?_:w,p.readFloatBE=y?w:_})():(function(){function d(y,b,m,_){var w=b<0?1:0;if(w&&(b=-b),b===0)y(1/b>0?0:2147483648,m,_);else if(isNaN(b))y(2143289344,m,_);else if(b>34028234663852886e22)y((w<<31|2139095040)>>>0,m,_);else if(b<11754943508222875e-54)y((w<<31|Math.round(b/1401298464324817e-60))>>>0,m,_);else{var S=Math.floor(Math.log(b)/Math.LN2),T=Math.round(b*Math.pow(2,-S)*8388608)&8388607;y((w<<31|S+127<<23|T)>>>0,m,_)}}a(d,"t"),t(d,"writeFloat_ieee754"),p.writeFloatLE=d.bind(null,l),p.writeFloatBE=d.bind(null,h);function f(y,b,m){var _=y(b,m),w=(_>>31)*2+1,S=_>>>23&255,T=_&8388607;return S===255?T?NaN:w*(1/0):S===0?w*1401298464324817e-60*T:w*Math.pow(2,S-150)*(T+8388608)}a(f,"r"),t(f,"readFloat_ieee754"),p.readFloatLE=f.bind(null,u),p.readFloatBE=f.bind(null,g)})(),typeof Float64Array<"u"?(function(){var d=new Float64Array([-0]),f=new Uint8Array(d.buffer),y=f[7]===128;function b(S,T,v){d[0]=S,T[v]=f[0],T[v+1]=f[1],T[v+2]=f[2],T[v+3]=f[3],T[v+4]=f[4],T[v+5]=f[5],T[v+6]=f[6],T[v+7]=f[7]}a(b,"f"),t(b,"writeDouble_f64_cpy");function m(S,T,v){d[0]=S,T[v]=f[7],T[v+1]=f[6],T[v+2]=f[5],T[v+3]=f[4],T[v+4]=f[3],T[v+5]=f[2],T[v+6]=f[1],T[v+7]=f[0]}a(m,"n"),t(m,"writeDouble_f64_rev"),p.writeDoubleLE=y?b:m,p.writeDoubleBE=y?m:b;function _(S,T){return f[0]=S[T],f[1]=S[T+1],f[2]=S[T+2],f[3]=S[T+3],f[4]=S[T+4],f[5]=S[T+5],f[6]=S[T+6],f[7]=S[T+7],d[0]}a(_,"o"),t(_,"readDouble_f64_cpy");function w(S,T){return f[7]=S[T],f[6]=S[T+1],f[5]=S[T+2],f[4]=S[T+3],f[3]=S[T+4],f[2]=S[T+5],f[1]=S[T+6],f[0]=S[T+7],d[0]}a(w,"p"),t(w,"readDouble_f64_rev"),p.readDoubleLE=y?_:w,p.readDoubleBE=y?w:_})():(function(){function d(y,b,m,_,w,S){var T=_<0?1:0;if(T&&(_=-_),_===0)y(0,w,S+b),y(1/_>0?0:2147483648,w,S+m);else if(isNaN(_))y(0,w,S+b),y(2146959360,w,S+m);else if(_>17976931348623157e292)y(0,w,S+b),y((T<<31|2146435072)>>>0,w,S+m);else{var v;if(_<22250738585072014e-324)v=_/5e-324,y(v>>>0,w,S+b),y((T<<31|v/4294967296)>>>0,w,S+m);else{var k=Math.floor(Math.log(_)/Math.LN2);k===1024&&(k=1023),v=_*Math.pow(2,-k),y(v*4503599627370496>>>0,w,S+b),y((T<<31|k+1023<<20|v*1048576&1048575)>>>0,w,S+m)}}}a(d,"t"),t(d,"writeDouble_ieee754"),p.writeDoubleLE=d.bind(null,l,0,4),p.writeDoubleBE=d.bind(null,h,4,0);function f(y,b,m,_,w){var S=y(_,w+b),T=y(_,w+m),v=(T>>31)*2+1,k=T>>>20&2047,O=4294967296*(T&1048575)+S;return k===2047?O?NaN:v*(1/0):k===0?v*5e-324*O:v*Math.pow(2,k-1075)*(O+4503599627370496)}a(f,"r"),t(f,"readDouble_ieee754"),p.readDoubleLE=f.bind(null,u,0,4),p.readDoubleBE=f.bind(null,g,4,0)})(),p}a(o,"l"),t(o,"factory");function l(p,d,f){d[f]=p&255,d[f+1]=p>>>8&255,d[f+2]=p>>>16&255,d[f+3]=p>>>24}a(l,"d"),t(l,"writeUintLE");function h(p,d,f){d[f]=p>>>24,d[f+1]=p>>>16&255,d[f+2]=p>>>8&255,d[f+3]=p&255}a(h,"c"),t(h,"writeUintBE");function u(p,d){return(p[d]|p[d+1]<<8|p[d+2]<<16|p[d+3]<<24)>>>0}a(u,"u"),t(u,"readUintLE");function g(p,d){return(p[d]<<24|p[d+1]<<16|p[d+2]<<8|p[d+3])>>>0}a(g,"a"),t(g,"readUintBE")},{}],7:[function(n,i,c){i.exports=o;function o(l){try{var h=n(l);if(h&&(h.length||Object.keys(h).length))return h}catch{}return null}a(o,"l"),t(o,"inquire")},{}],8:[function(n,i,c){var o=c,l=o.isAbsolute=t(function(u){return/^(?:\/|\w+:)/.test(u)},"isAbsolute"),h=o.normalize=t(function(u){u=u.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var g=u.split("/"),p=l(u),d="";p&&(d=g.shift()+"/");for(var f=0;f<g.length;)g[f]===".."?f>0&&g[f-1]!==".."?g.splice(--f,2):p?g.splice(f,1):++f:g[f]==="."?g.splice(f,1):++f;return d+g.join("/")},"normalize");o.resolve=t(function(u,g,p){return p||(g=h(g)),l(g)?g:(p||(u=h(u)),(u=u.replace(/(?:\/|^)[^/]+$/,"")).length?h(u+"/"+g):g)},"resolve")},{}],9:[function(n,i,c){i.exports=o;function o(l,h,u){var g=u||8192,p=g>>>1,d=null,f=g;return t(function(y){if(y<1||y>p)return l(y);f+y>g&&(d=l(g),f=0);var b=h.call(d,f,f+=y);return f&7&&(f=(f|7)+1),b},"pool_alloc")}a(o,"l"),t(o,"pool")},{}],10:[function(n,i,c){var o=c;o.length=t(function(l){for(var h=0,u=0,g=0;g<l.length;++g)u=l.charCodeAt(g),u<128?h+=1:u<2048?h+=2:(u&64512)===55296&&(l.charCodeAt(g+1)&64512)===56320?(++g,h+=4):h+=3;return h},"utf8_length"),o.read=t(function(l,h,u){var g=u-h;if(g<1)return"";for(var p=null,d=[],f=0,y;h<u;)y=l[h++],y<128?d[f++]=y:y>191&&y<224?d[f++]=(y&31)<<6|l[h++]&63:y>239&&y<365?(y=((y&7)<<18|(l[h++]&63)<<12|(l[h++]&63)<<6|l[h++]&63)-65536,d[f++]=55296+(y>>10),d[f++]=56320+(y&1023)):d[f++]=(y&15)<<12|(l[h++]&63)<<6|l[h++]&63,f>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,d)),f=0);return p?(f&&p.push(String.fromCharCode.apply(String,d.slice(0,f))),p.join("")):String.fromCharCode.apply(String,d.slice(0,f))},"utf8_read"),o.write=t(function(l,h,u){for(var g=u,p,d,f=0;f<l.length;++f)p=l.charCodeAt(f),p<128?h[u++]=p:p<2048?(h[u++]=p>>6|192,h[u++]=p&63|128):(p&64512)===55296&&((d=l.charCodeAt(f+1))&64512)===56320?(p=65536+((p&1023)<<10)+(d&1023),++f,h[u++]=p>>18|240,h[u++]=p>>12&63|128,h[u++]=p>>6&63|128,h[u++]=p&63|128):(h[u++]=p>>12|224,h[u++]=p>>6&63|128,h[u++]=p&63|128);return u-g},"utf8_write")},{}],11:[function(n,i,c){i.exports=l;var o=/\/|\./;function l(u,g){o.test(u)||(u="google/protobuf/"+u+".proto",g={nested:{google:{nested:{protobuf:{nested:g}}}}}),l[u]=g}a(l,"d"),t(l,"common"),l("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var h;l("duration",{Duration:h={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),l("timestamp",{Timestamp:h}),l("empty",{Empty:{fields:{}}}),l("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),l("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),l("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),l.get=t(function(u){return l[u]||null},"get")},{}],12:[function(n,i,c){var o=c,l=n(15),h=n(37);function u(p,d,f,y){if(d.resolvedType)if(d.resolvedType instanceof l){p("switch(d%s){",y);for(var b=d.resolvedType.values,m=Object.keys(b),_=0;_<m.length;++_)d.repeated&&b[m[_]]===d.typeDefault&&p("default:"),p("case%j:",m[_])("case %i:",b[m[_]])("m%s=%j",y,b[m[_]])("break");p("}")}else p('if(typeof d%s!=="object")',y)("throw TypeError(%j)",d.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",y,f,y);else{var w=!1;switch(d.type){case"double":case"float":p("m%s=Number(d%s)",y,y);break;case"uint32":case"fixed32":p("m%s=d%s>>>0",y,y);break;case"int32":case"sint32":case"sfixed32":p("m%s=d%s|0",y,y);break;case"uint64":w=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":p("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",y,y,w)('else if(typeof d%s==="string")',y)("m%s=parseInt(d%s,10)",y,y)('else if(typeof d%s==="number")',y)("m%s=d%s",y,y)('else if(typeof d%s==="object")',y)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",y,y,y,w?"true":"");break;case"bytes":p('if(typeof d%s==="string")',y)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",y,y,y)("else if(d%s.length)",y)("m%s=d%s",y,y);break;case"string":p("m%s=String(d%s)",y,y);break;case"bool":p("m%s=Boolean(d%s)",y,y);break}}return p}a(u,"u"),t(u,"genValuePartial_fromObject"),o.fromObject=t(function(p){var d=p.fieldsArray,f=h.codegen(["d"],p.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!d.length)return f("return new this.ctor");f("var m=new this.ctor");for(var y=0;y<d.length;++y){var b=d[y].resolve(),m=h.safeProp(b.name);b.map?(f("if(d%s){",m)('if(typeof d%s!=="object")',m)("throw TypeError(%j)",b.fullName+": object expected")("m%s={}",m)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",m),u(f,b,y,m+"[ks[i]]")("}")("}")):b.repeated?(f("if(d%s){",m)("if(!Array.isArray(d%s))",m)("throw TypeError(%j)",b.fullName+": array expected")("m%s=[]",m)("for(var i=0;i<d%s.length;++i){",m),u(f,b,y,m+"[i]")("}")("}")):(b.resolvedType instanceof l||f("if(d%s!=null){",m),u(f,b,y,m),b.resolvedType instanceof l||f("}"))}return f("return m")},"fromObject");function g(p,d,f,y){if(d.resolvedType)d.resolvedType instanceof l?p("d%s=o.enums===String?types[%i].values[m%s]:m%s",y,f,y,y):p("d%s=types[%i].toObject(m%s,o)",y,f,y);else{var b=!1;switch(d.type){case"double":case"float":p("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",y,y,y,y);break;case"uint64":b=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":p('if(typeof m%s==="number")',y)("d%s=o.longs===String?String(m%s):m%s",y,y,y)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",y,y,y,y,b?"true":"",y);break;case"bytes":p("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",y,y,y,y,y);break;default:p("d%s=m%s",y,y);break}}return p}a(g,"a"),t(g,"genValuePartial_toObject"),o.toObject=t(function(p){var d=p.fieldsArray.slice().sort(h.compareFieldsById);if(!d.length)return h.codegen()("return {}");for(var f=h.codegen(["m","o"],p.name+"$toObject")("if(!o)")("o={}")("var d={}"),y=[],b=[],m=[],_=0;_<d.length;++_)d[_].partOf||(d[_].resolve().repeated?y:d[_].map?b:m).push(d[_]);if(y.length){for(f("if(o.arrays||o.defaults){"),_=0;_<y.length;++_)f("d%s=[]",h.safeProp(y[_].name));f("}")}if(b.length){for(f("if(o.objects||o.defaults){"),_=0;_<b.length;++_)f("d%s={}",h.safeProp(b[_].name));f("}")}if(m.length){for(f("if(o.defaults){"),_=0;_<m.length;++_){var w=m[_],S=h.safeProp(w.name);w.resolvedType instanceof l?f("d%s=o.enums===String?%j:%j",S,w.resolvedType.valuesById[w.typeDefault],w.typeDefault):w.long?f("if(util.Long){")("var n=new util.Long(%i,%i,%j)",w.typeDefault.low,w.typeDefault.high,w.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",S)("}else")("d%s=o.longs===String?%j:%i",S,w.typeDefault.toString(),w.typeDefault.toNumber()):w.bytes?f("d%s=o.bytes===String?%j:%s",S,String.fromCharCode.apply(String,w.typeDefault),"["+Array.prototype.slice.call(w.typeDefault).join(",")+"]"):f("d%s=%j",S,w.typeDefault)}f("}")}var T=!1;for(_=0;_<d.length;++_){var w=d[_],v=p._fieldsArray.indexOf(w),S=h.safeProp(w.name);w.map?(T||(T=!0,f("var ks2")),f("if(m%s&&(ks2=Object.keys(m%s)).length){",S,S)("d%s={}",S)("for(var j=0;j<ks2.length;++j){"),g(f,w,v,S+"[ks2[j]]")("}")):w.repeated?(f("if(m%s&&m%s.length){",S,S)("d%s=[]",S)("for(var j=0;j<m%s.length;++j){",S),g(f,w,v,S+"[j]")("}")):(f("if(m%s!=null&&m.hasOwnProperty(%j)){",S,w.name),g(f,w,v,S),w.partOf&&f("if(o.oneofs)")("d%s=%j",h.safeProp(w.partOf.name),w.name)),f("}")}return f("return d")},"toObject")},{15:15,37:37}],13:[function(n,i,c){i.exports=g;var o=n(15),l=n(36),h=n(37);function u(p){return"missing required '"+p.name+"'"}a(u,"u"),t(u,"missing");function g(p){var d=h.codegen(["r","l"],p.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(p.fieldsArray.filter(function(w){return w.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");p.group&&d("if((t&7)===4)")("break"),d("switch(t>>>3){");for(var f=0;f<p.fieldsArray.length;++f){var y=p._fieldsArray[f].resolve(),b=y.resolvedType instanceof o?"int32":y.type,m="m"+h.safeProp(y.name);d("case %i:",y.id),y.map?(d("r.skip().pos++")("if(%s===util.emptyObject)",m)("%s={}",m)("k=r.%s()",y.keyType)("r.pos++"),l.long[y.keyType]!==s?l.basic[b]===s?d('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',m,f):d('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',m,b):l.basic[b]===s?d("%s[k]=types[%i].decode(r,r.uint32())",m,f):d("%s[k]=r.%s()",m,b)):y.repeated?(d("if(!(%s&&%s.length))",m,m)("%s=[]",m),l.packed[b]!==s&&d("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",m,b)("}else"),l.basic[b]===s?d(y.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",m,f):d("%s.push(r.%s())",m,b)):l.basic[b]===s?d(y.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",m,f):d("%s=r.%s()",m,b),d("break")}for(d("default:")("r.skipType(t&7)")("break")("}")("}"),f=0;f<p._fieldsArray.length;++f){var _=p._fieldsArray[f];_.required&&d("if(!m.hasOwnProperty(%j))",_.name)("throw util.ProtocolError(%j,{instance:m})",u(_))}return d("return m")}a(g,"a"),t(g,"decoder")},{15:15,36:36,37:37}],14:[function(n,i,c){i.exports=g;var o=n(15),l=n(36),h=n(37);function u(p,d,f,y){return d.resolvedType.group?p("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",f,y,(d.id<<3|3)>>>0,(d.id<<3|4)>>>0):p("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",f,y,(d.id<<3|2)>>>0)}a(u,"u"),t(u,"genTypePartial");function g(p){for(var d=h.codegen(["m","w"],p.name+"$encode")("if(!w)")("w=Writer.create()"),b,f,y=p.fieldsArray.slice().sort(h.compareFieldsById),b=0;b<y.length;++b){var m=y[b].resolve(),_=p._fieldsArray.indexOf(m),w=m.resolvedType instanceof o?"int32":m.type,S=l.basic[w];f="m"+h.safeProp(m.name),m.map?(d("if(%s!=null&&m.hasOwnProperty(%j)){",f,m.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",f)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(m.id<<3|2)>>>0,8|l.mapKey[m.keyType],m.keyType),S===s?d("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",_,f):d(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|S,w,f),d("}")("}")):m.repeated?(d("if(%s!=null&&%s.length){",f,f),m.packed&&l.packed[w]!==s?d("w.uint32(%i).fork()",(m.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",f)("w.%s(%s[i])",w,f)("w.ldelim()"):(d("for(var i=0;i<%s.length;++i)",f),S===s?u(d,m,_,f+"[i]"):d("w.uint32(%i).%s(%s[i])",(m.id<<3|S)>>>0,w,f)),d("}")):(m.optional&&d("if(%s!=null&&m.hasOwnProperty(%j))",f,m.name),S===s?u(d,m,_,f):d("w.uint32(%i).%s(%s)",(m.id<<3|S)>>>0,w,f))}return d("return w")}a(g,"a"),t(g,"encoder")},{15:15,36:36,37:37}],15:[function(n,i,c){i.exports=u;var o=n(24);((u.prototype=Object.create(o.prototype)).constructor=u).className="Enum";var l=n(23),h=n(37);function u(g,p,d,f,y){if(o.call(this,g,d),p&&typeof p!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=f,this.comments=y||{},this.reserved=s,p)for(var b=Object.keys(p),m=0;m<b.length;++m)typeof p[b[m]]=="number"&&(this.valuesById[this.values[b[m]]=p[b[m]]]=b[m])}a(u,"u"),t(u,"Enum"),u.fromJSON=t(function(g,p){var d=new u(g,p.values,p.options,p.comment,p.comments);return d.reserved=p.reserved,d},"fromJSON"),u.prototype.toJSON=t(function(g){var p=g?!!g.keepComments:!1;return h.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:s,"comment",p?this.comment:s,"comments",p?this.comments:s])},"toJSON"),u.prototype.add=t(function(g,p,d){if(!h.isString(g))throw TypeError("name must be a string");if(!h.isInteger(p))throw TypeError("id must be an integer");if(this.values[g]!==s)throw Error("duplicate name '"+g+"' in "+this);if(this.isReservedId(p))throw Error("id "+p+" is reserved in "+this);if(this.isReservedName(g))throw Error("name '"+g+"' is reserved in "+this);if(this.valuesById[p]!==s){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+p+" in "+this);this.values[g]=p}else this.valuesById[this.values[g]=p]=g;return this.comments[g]=d||null,this},"add"),u.prototype.remove=t(function(g){if(!h.isString(g))throw TypeError("name must be a string");var p=this.values[g];if(p==null)throw Error("name '"+g+"' does not exist in "+this);return delete this.valuesById[p],delete this.values[g],delete this.comments[g],this},"remove"),u.prototype.isReservedId=t(function(g){return l.isReservedId(this.reserved,g)},"isReservedId"),u.prototype.isReservedName=t(function(g){return l.isReservedName(this.reserved,g)},"isReservedName")},{23:23,24:24,37:37}],16:[function(n,i,c){i.exports=d;var o=n(24);((d.prototype=Object.create(o.prototype)).constructor=d).className="Field";var l=n(15),h=n(36),u=n(37),g,p=/^required|optional|repeated$/;d.fromJSON=t(function(f,y){return new d(f,y.id,y.type,y.rule,y.extend,y.options,y.comment)},"fromJSON");function d(f,y,b,m,_,w,S){if(u.isObject(m)?(S=_,w=m,m=_=s):u.isObject(_)&&(S=w,w=_,_=s),o.call(this,f,w),!u.isInteger(y)||y<0)throw TypeError("id must be a non-negative integer");if(!u.isString(b))throw TypeError("type must be a string");if(m!==s&&!p.test(m=m.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(_!==s&&!u.isString(_))throw TypeError("extend must be a string");this.rule=m&&m!=="optional"?m:s,this.type=b,this.id=y,this.extend=_||s,this.required=m==="required",this.optional=!this.required,this.repeated=m==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=u.Long?h.long[b]!==s:!1,this.bytes=b==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=S}a(d,"t"),t(d,"Field"),Object.defineProperty(d.prototype,"packed",{get:t(function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed},"get")}),d.prototype.setOption=t(function(f,y,b){return f==="packed"&&(this._packed=null),o.prototype.setOption.call(this,f,y,b)},"setOption"),d.prototype.toJSON=t(function(f){var y=f?!!f.keepComments:!1;return u.toObject(["rule",this.rule!=="optional"&&this.rule||s,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",y?this.comment:s])},"toJSON"),d.prototype.resolve=t(function(){if(this.resolved)return this;if((this.typeDefault=h.defaults[this.type])===s&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof g?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof l&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==s&&this.resolvedType&&!(this.resolvedType instanceof l))&&delete this.options.packed,Object.keys(this.options).length||(this.options=s)),this.long)this.typeDefault=u.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var f;u.base64.test(this.typeDefault)?u.base64.decode(this.typeDefault,f=u.newBuffer(u.base64.length(this.typeDefault)),0):u.utf8.write(this.typeDefault,f=u.newBuffer(u.utf8.length(this.typeDefault)),0),this.typeDefault=f}return this.map?this.defaultValue=u.emptyObject:this.repeated?this.defaultValue=u.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof g&&(this.parent.ctor.prototype[this.name]=this.defaultValue),o.prototype.resolve.call(this)},"resolve"),d.d=t(function(f,y,b,m){return typeof y=="function"?y=u.decorateType(y).name:y&&typeof y=="object"&&(y=u.decorateEnum(y).name),t(function(_,w){u.decorateType(_.constructor).add(new d(w,f,y,b,{default:m}))},"fieldDecorator")},"decorateField"),d._configure=t(function(f){g=f},"configure")},{15:15,24:24,36:36,37:37}],17:[function(n,i,c){var o=i.exports=n(18);o.build="light";function l(u,g,p){return typeof g=="function"?(p=g,g=new o.Root):g||(g=new o.Root),g.load(u,p)}a(l,"d"),t(l,"load"),o.load=l;function h(u,g){return g||(g=new o.Root),g.loadSync(u)}a(h,"c"),t(h,"loadSync"),o.loadSync=h,o.encoder=n(14),o.decoder=n(13),o.verifier=n(40),o.converter=n(12),o.ReflectionObject=n(24),o.Namespace=n(23),o.Root=n(29),o.Enum=n(15),o.Type=n(35),o.Field=n(16),o.OneOf=n(25),o.MapField=n(20),o.Service=n(33),o.Method=n(22),o.Message=n(21),o.wrappers=n(41),o.types=n(36),o.util=n(37),o.ReflectionObject._configure(o.Root),o.Namespace._configure(o.Type,o.Service),o.Root._configure(o.Type),o.Field._configure(o.Type)},{12:12,13:13,14:14,15:15,16:16,18:18,20:20,21:21,22:22,23:23,24:24,25:25,29:29,33:33,35:35,36:36,37:37,40:40,41:41}],18:[function(n,i,c){var o=c;o.build="minimal",o.Writer=n(42),o.BufferWriter=n(43),o.Reader=n(27),o.BufferReader=n(28),o.util=n(39),o.rpc=n(31),o.roots=n(30),o.configure=l;function l(){o.Reader._configure(o.BufferReader),o.util._configure()}a(l,"d"),t(l,"configure"),o.Writer._configure(o.BufferWriter),l()},{27:27,28:28,30:30,31:31,39:39,42:42,43:43}],19:[function(n,i,c){var o=i.exports=n(17);o.build="full",o.tokenize=n(34),o.parse=n(26),o.common=n(11),o.Root._configure(o.Type,o.parse,o.common)},{11:11,17:17,26:26,34:34}],20:[function(n,i,c){i.exports=u;var o=n(16);((u.prototype=Object.create(o.prototype)).constructor=u).className="MapField";var l=n(36),h=n(37);function u(g,p,d,f,y,b){if(o.call(this,g,p,f,s,s,y,b),!h.isString(d))throw TypeError("keyType must be a string");this.keyType=d,this.resolvedKeyType=null,this.map=!0}a(u,"u"),t(u,"MapField"),u.fromJSON=t(function(g,p){return new u(g,p.id,p.keyType,p.type,p.options,p.comment)},"fromJSON"),u.prototype.toJSON=t(function(g){var p=g?!!g.keepComments:!1;return h.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",p?this.comment:s])},"toJSON"),u.prototype.resolve=t(function(){if(this.resolved)return this;if(l.mapKey[this.keyType]===s)throw Error("invalid key type: "+this.keyType);return o.prototype.resolve.call(this)},"resolve"),u.d=t(function(g,p,d){return typeof d=="function"?d=h.decorateType(d).name:d&&typeof d=="object"&&(d=h.decorateEnum(d).name),t(function(f,y){h.decorateType(f.constructor).add(new u(y,g,p,d))},"mapFieldDecorator")},"decorateMapField")},{16:16,36:36,37:37}],21:[function(n,i,c){i.exports=l;var o=n(39);function l(h){if(h)for(var u=Object.keys(h),g=0;g<u.length;++g)this[u[g]]=h[u[g]]}a(l,"d"),t(l,"Message"),l.create=t(function(h){return this.$type.create(h)},"create"),l.encode=t(function(h,u){return this.$type.encode(h,u)},"encode"),l.encodeDelimited=t(function(h,u){return this.$type.encodeDelimited(h,u)},"encodeDelimited"),l.decode=t(function(h){return this.$type.decode(h)},"decode"),l.decodeDelimited=t(function(h){return this.$type.decodeDelimited(h)},"decodeDelimited"),l.verify=t(function(h){return this.$type.verify(h)},"verify"),l.fromObject=t(function(h){return this.$type.fromObject(h)},"fromObject"),l.toObject=t(function(h,u){return this.$type.toObject(h,u)},"toObject"),l.prototype.toJSON=t(function(){return this.$type.toObject(this,o.toJSONOptions)},"toJSON")},{39:39}],22:[function(n,i,c){i.exports=h;var o=n(24);((h.prototype=Object.create(o.prototype)).constructor=h).className="Method";var l=n(37);function h(u,g,p,d,f,y,b,m){if(l.isObject(f)?(b=f,f=y=s):l.isObject(y)&&(b=y,y=s),!(g===s||l.isString(g)))throw TypeError("type must be a string");if(!l.isString(p))throw TypeError("requestType must be a string");if(!l.isString(d))throw TypeError("responseType must be a string");o.call(this,u,b),this.type=g||"rpc",this.requestType=p,this.requestStream=f?!0:s,this.responseType=d,this.responseStream=y?!0:s,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=m}a(h,"c"),t(h,"Method"),h.fromJSON=t(function(u,g){return new h(u,g.type,g.requestType,g.responseType,g.requestStream,g.responseStream,g.options,g.comment)},"fromJSON"),h.prototype.toJSON=t(function(u){var g=u?!!u.keepComments:!1;return l.toObject(["type",this.type!=="rpc"&&this.type||s,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",g?this.comment:s])},"toJSON"),h.prototype.resolve=t(function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),o.prototype.resolve.call(this))},"resolve")},{24:24,37:37}],23:[function(n,i,c){i.exports=f;var o=n(24);((f.prototype=Object.create(o.prototype)).constructor=f).className="Namespace";var l=n(15),h=n(16),u=n(37),g,p;f.fromJSON=t(function(b,m){return new f(b,m.options).addJSON(m.nested)},"fromJSON");function d(b,m){if(!(b&&b.length))return s;for(var _={},w=0;w<b.length;++w)_[b[w].name]=b[w].toJSON(m);return _}a(d,"t"),t(d,"arrayToJSON"),f.arrayToJSON=d,f.isReservedId=t(function(b,m){if(b){for(var _=0;_<b.length;++_)if(typeof b[_]!="string"&&b[_][0]<=m&&b[_][1]>=m)return!0}return!1},"isReservedId"),f.isReservedName=t(function(b,m){if(b){for(var _=0;_<b.length;++_)if(b[_]===m)return!0}return!1},"isReservedName");function f(b,m){o.call(this,b,m),this.nested=s,this._nestedArray=null}a(f,"r"),t(f,"Namespace");function y(b){return b._nestedArray=null,b}a(y,"e"),t(y,"clearCache"),Object.defineProperty(f.prototype,"nestedArray",{get:t(function(){return this._nestedArray||(this._nestedArray=u.toArray(this.nested))},"get")}),f.prototype.toJSON=t(function(b){return u.toObject(["options",this.options,"nested",d(this.nestedArray,b)])},"toJSON"),f.prototype.addJSON=t(function(b){var m=this;if(b)for(var _=Object.keys(b),w=0,S;w<_.length;++w)S=b[_[w]],m.add((S.fields!==s?g.fromJSON:S.values!==s?l.fromJSON:S.methods!==s?p.fromJSON:S.id!==s?h.fromJSON:f.fromJSON)(_[w],S));return this},"addJSON"),f.prototype.get=t(function(b){return this.nested&&this.nested[b]||null},"get"),f.prototype.getEnum=t(function(b){if(this.nested&&this.nested[b]instanceof l)return this.nested[b].values;throw Error("no such enum: "+b)},"getEnum"),f.prototype.add=t(function(b){if(!(b instanceof h&&b.extend!==s||b instanceof g||b instanceof l||b instanceof p||b instanceof f))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var m=this.get(b.name);if(m)if(m instanceof f&&b instanceof f&&!(m instanceof g||m instanceof p)){for(var _=m.nestedArray,w=0;w<_.length;++w)b.add(_[w]);this.remove(m),this.nested||(this.nested={}),b.setOptions(m.options,!0)}else throw Error("duplicate name '"+b.name+"' in "+this)}return this.nested[b.name]=b,b.onAdd(this),y(this)},"add"),f.prototype.remove=t(function(b){if(!(b instanceof o))throw TypeError("object must be a ReflectionObject");if(b.parent!==this)throw Error(b+" is not a member of "+this);return delete this.nested[b.name],Object.keys(this.nested).length||(this.nested=s),b.onRemove(this),y(this)},"remove"),f.prototype.define=t(function(b,m){if(u.isString(b))b=b.split(".");else if(!Array.isArray(b))throw TypeError("illegal path");if(b&&b.length&&b[0]==="")throw Error("path must be relative");for(var _=this;b.length>0;){var w=b.shift();if(_.nested&&_.nested[w]){if(_=_.nested[w],!(_ instanceof f))throw Error("path conflicts with non-namespace objects")}else _.add(_=new f(w))}return m&&_.addJSON(m),_},"define"),f.prototype.resolveAll=t(function(){for(var b=this.nestedArray,m=0;m<b.length;)b[m]instanceof f?b[m++].resolveAll():b[m++].resolve();return this.resolve()},"resolveAll"),f.prototype.lookup=t(function(b,m,_){if(typeof m=="boolean"?(_=m,m=s):m&&!Array.isArray(m)&&(m=[m]),u.isString(b)&&b.length){if(b===".")return this.root;b=b.split(".")}else if(!b.length)return this;if(b[0]==="")return this.root.lookup(b.slice(1),m);var w=this.get(b[0]);if(w){if(b.length===1){if(!m||m.indexOf(w.constructor)>-1)return w}else if(w instanceof f&&(w=w.lookup(b.slice(1),m,!0)))return w}else for(var S=0;S<this.nestedArray.length;++S)if(this._nestedArray[S]instanceof f&&(w=this._nestedArray[S].lookup(b,m,!0)))return w;return this.parent===null||_?null:this.parent.lookup(b,m)},"lookup"),f.prototype.lookupType=t(function(b){var m=this.lookup(b,[g]);if(!m)throw Error("no such type: "+b);return m},"lookupType"),f.prototype.lookupEnum=t(function(b){var m=this.lookup(b,[l]);if(!m)throw Error("no such Enum '"+b+"' in "+this);return m},"lookupEnum"),f.prototype.lookupTypeOrEnum=t(function(b){var m=this.lookup(b,[g,l]);if(!m)throw Error("no such Type or Enum '"+b+"' in "+this);return m},"lookupTypeOrEnum"),f.prototype.lookupService=t(function(b){var m=this.lookup(b,[p]);if(!m)throw Error("no such Service '"+b+"' in "+this);return m},"lookupService"),f._configure=function(b,m){g=b,p=m}},{15:15,16:16,24:24,37:37}],24:[function(n,i,c){i.exports=h,h.className="ReflectionObject";var o=n(37),l;function h(u,g){if(!o.isString(u))throw TypeError("name must be a string");if(g&&!o.isObject(g))throw TypeError("options must be an object");this.options=g,this.name=u,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}a(h,"c"),t(h,"ReflectionObject"),Object.defineProperties(h.prototype,{root:{get:t(function(){for(var u=this;u.parent!==null;)u=u.parent;return u},"get")},fullName:{get:t(function(){for(var u=[this.name],g=this.parent;g;)u.unshift(g.name),g=g.parent;return u.join(".")},"get")}}),h.prototype.toJSON=t(function(){throw Error()},"toJSON"),h.prototype.onAdd=t(function(u){this.parent&&this.parent!==u&&this.parent.remove(this),this.parent=u,this.resolved=!1;var g=u.root;g instanceof l&&g._handleAdd(this)},"onAdd"),h.prototype.onRemove=t(function(u){var g=u.root;g instanceof l&&g._handleRemove(this),this.parent=null,this.resolved=!1},"onRemove"),h.prototype.resolve=t(function(){return this.resolved?this:(this.root instanceof l&&(this.resolved=!0),this)},"resolve"),h.prototype.getOption=t(function(u){return this.options?this.options[u]:s},"getOption"),h.prototype.setOption=t(function(u,g,p){return(!p||!this.options||this.options[u]===s)&&((this.options||(this.options={}))[u]=g),this},"setOption"),h.prototype.setOptions=t(function(u,g){if(u)for(var p=Object.keys(u),d=0;d<p.length;++d)this.setOption(p[d],u[p[d]],g);return this},"setOptions"),h.prototype.toString=t(function(){var u=this.constructor.className,g=this.fullName;return g.length?u+" "+g:u},"toString"),h._configure=function(u){l=u}},{37:37}],25:[function(n,i,c){i.exports=u;var o=n(24);((u.prototype=Object.create(o.prototype)).constructor=u).className="OneOf";var l=n(16),h=n(37);function u(p,d,f,y){if(Array.isArray(d)||(f=d,d=s),o.call(this,p,f),!(d===s||Array.isArray(d)))throw TypeError("fieldNames must be an Array");this.oneof=d||[],this.fieldsArray=[],this.comment=y}a(u,"u"),t(u,"OneOf"),u.fromJSON=t(function(p,d){return new u(p,d.oneof,d.options,d.comment)},"fromJSON"),u.prototype.toJSON=t(function(p){var d=p?!!p.keepComments:!1;return h.toObject(["options",this.options,"oneof",this.oneof,"comment",d?this.comment:s])},"toJSON");function g(p){if(p.parent)for(var d=0;d<p.fieldsArray.length;++d)p.fieldsArray[d].parent||p.parent.add(p.fieldsArray[d])}a(g,"a"),t(g,"addFieldsToParent"),u.prototype.add=t(function(p){if(!(p instanceof l))throw TypeError("field must be a Field");return p.parent&&p.parent!==this.parent&&p.parent.remove(p),this.oneof.push(p.name),this.fieldsArray.push(p),p.partOf=this,g(this),this},"add"),u.prototype.remove=t(function(p){if(!(p instanceof l))throw TypeError("field must be a Field");var d=this.fieldsArray.indexOf(p);if(d<0)throw Error(p+" is not a member of "+this);return this.fieldsArray.splice(d,1),d=this.oneof.indexOf(p.name),d>-1&&this.oneof.splice(d,1),p.partOf=null,this},"remove"),u.prototype.onAdd=t(function(p){o.prototype.onAdd.call(this,p);for(var d=this,f=0;f<this.oneof.length;++f){var y=p.get(this.oneof[f]);y&&!y.partOf&&(y.partOf=d,d.fieldsArray.push(y))}g(this)},"onAdd"),u.prototype.onRemove=t(function(p){for(var d=0,f;d<this.fieldsArray.length;++d)(f=this.fieldsArray[d]).parent&&f.parent.remove(f);o.prototype.onRemove.call(this,p)},"onRemove"),u.d=t(function(){for(var p=new Array(arguments.length),d=0;d<arguments.length;)p[d]=arguments[d++];return t(function(f,y){h.decorateType(f.constructor).add(new u(y,p)),Object.defineProperty(f,y,{get:h.oneOfGetter(p),set:h.oneOfSetter(p)})},"oneOfDecorator")},"decorateOneOf")},{16:16,24:24,37:37}],26:[function(n,i,c){i.exports=q,q.filename=null,q.defaults={keepCase:!1};var o=n(34),l=n(29),h=n(35),u=n(16),g=n(20),p=n(25),d=n(15),f=n(33),y=n(22),b=n(36),m=n(37),_=/^[1-9][0-9]*$/,w=/^-?[1-9][0-9]*$/,S=/^0[x][0-9a-fA-F]+$/,T=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,k=/^-?0[0-7]+$/,O=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,A=/^[a-zA-Z_][a-zA-Z_0-9]*$/,N=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,B=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function q(pe,ge,G){ge instanceof l||(G=ge,ge=new l),G||(G=q.defaults);var ne=o(pe,G.alternateCommentMode||!1),W=ne.next,Ee=ne.push,de=ne.peek,j=ne.skip,le=ne.cmnt,je=!0,Be,X,ue,z,re=!1,Se=ge,Ce=G.keepCase?function(D){return D}:m.camelCase;function Z(D,C,F){var V=q.filename;return F||(q.filename=null),Error("illegal "+(C||"token")+" '"+D+"' ("+(V?V+", ":"")+"line "+ne.line+")")}a(Z,"F"),t(Z,"illegal");function Ze(){var D=[],C;do{if((C=W())!=='"'&&C!=="'")throw Z(C);D.push(W()),j(C),C=de()}while(C==='"'||C==="'");return D.join("")}a(Ze,"Y"),t(Ze,"readString");function Xe(D){var C=W();switch(C){case"'":case'"':return Ee(C),Ze();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return ar(C,!0)}catch{if(D&&N.test(C))return C;throw Z(C,"value")}}a(Xe,"ht"),t(Xe,"readValue");function Bt(D,C){var F,V;do C&&((F=de())==='"'||F==="'")?D.push(Ze()):D.push([V=Ne(W()),j("to",!0)?Ne(W()):V]);while(j(",",!0));j(";")}a(Bt,"ot"),t(Bt,"readRanges");function ar(D,C){var F=1;switch(D.charAt(0)==="-"&&(F=-1,D=D.substring(1)),D){case"inf":case"INF":case"Inf":return F*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(_.test(D))return F*parseInt(D,10);if(S.test(D))return F*parseInt(D,16);if(v.test(D))return F*parseInt(D,8);if(O.test(D))return F*parseFloat(D);throw Z(D,"number",C)}a(ar,"pt"),t(ar,"parseNumber");function Ne(D,C){switch(D){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!C&&D.charAt(0)==="-")throw Z(D,"id");if(w.test(D))return parseInt(D,10);if(T.test(D))return parseInt(D,16);if(k.test(D))return parseInt(D,8);throw Z(D,"id")}a(Ne,"nt"),t(Ne,"parseId");function Q(){if(Be!==s)throw Z("package");if(Be=W(),!N.test(Be))throw Z(Be,"name");Se=Se.define(Be),j(";")}a(Q,"dt"),t(Q,"parsePackage");function Ue(){var D=de(),C;switch(D){case"weak":C=ue||(ue=[]),W();break;case"public":W();default:C=X||(X=[]);break}D=Ze(),j(";"),C.push(D)}a(Ue,"yt"),t(Ue,"parseImport");function ut(){if(j("="),z=Ze(),re=z==="proto3",!re&&z!=="proto2")throw Z(z,"syntax");j(";")}a(ut,"mt"),t(ut,"parseSyntax");function nt(D,C){switch(C){case"option":return ht(D,C),j(";"),!0;case"message":return Es(D,C),!0;case"enum":return hl(D,C),!0;case"service":return fl(D,C),!0;case"extend":return gl(D,C),!0}return!1}a(nt,"at"),t(nt,"parseCommon");function ze(D,C,F){var V=ne.line;if(D&&(D.comment=le(),D.filename=q.filename),j("{",!0)){for(var _e;(_e=W())!=="}";)C(_e);j(";",!0)}else F&&F(),j(";"),D&&typeof D.comment!="string"&&(D.comment=le(V))}a(ze,"K"),t(ze,"ifBlock");function Es(D,C){if(!A.test(C=W()))throw Z(C,"type name");var F=new h(C);ze(F,t(function(V){if(!nt(F,V))switch(V){case"map":ll(F);break;case"required":case"optional":case"repeated":Qe(F,V);break;case"oneof":ul(F,V);break;case"extensions":Bt(F.extensions||(F.extensions=[]));break;case"reserved":Bt(F.reserved||(F.reserved=[]),!0);break;default:if(!re||!N.test(V))throw Z(V);Ee(V),Qe(F,"optional");break}},"parseType_block")),D.add(F)}a(Es,"vt"),t(Es,"parseType");function Qe(D,C,F){var V=W();if(V==="group"){cl(D,C);return}if(!N.test(V))throw Z(V,"type");var _e=W();if(!A.test(_e))throw Z(_e,"name");_e=Ce(_e),j("=");var Oe=new u(_e,Ne(W()),V,C,F);ze(Oe,t(function(vt){if(vt==="option")ht(Oe,vt),j(";");else throw Z(vt)},"parseField_block"),t(function(){Ts(Oe)},"parseField_line")),D.add(Oe),!re&&Oe.repeated&&(b.packed[V]!==s||b.basic[V]===s)&&Oe.setOption("packed",!1,!0)}a(Qe,"st"),t(Qe,"parseField");function cl(D,C){var F=W();if(!A.test(F))throw Z(F,"name");var V=m.lcFirst(F);F===V&&(F=m.ucFirst(F)),j("=");var _e=Ne(W()),Oe=new h(F);Oe.group=!0;var vt=new u(V,_e,F,C);vt.filename=q.filename,ze(Oe,t(function(Ut){switch(Ut){case"option":ht(Oe,Ut),j(";");break;case"required":case"optional":case"repeated":Qe(Oe,Ut);break;default:throw Z(Ut)}},"parseGroup_block")),D.add(Oe).add(vt)}a(cl,"gt"),t(cl,"parseGroup");function ll(D){j("<");var C=W();if(b.mapKey[C]===s)throw Z(C,"type");j(",");var F=W();if(!N.test(F))throw Z(F,"type");j(">");var V=W();if(!A.test(V))throw Z(V,"name");j("=");var _e=new g(Ce(V),Ne(W()),C,F);ze(_e,t(function(Oe){if(Oe==="option")ht(_e,Oe),j(";");else throw Z(Oe)},"parseMapField_block"),t(function(){Ts(_e)},"parseMapField_line")),D.add(_e)}a(ll,"wt"),t(ll,"parseMapField");function ul(D,C){if(!A.test(C=W()))throw Z(C,"name");var F=new p(Ce(C));ze(F,t(function(V){V==="option"?(ht(F,V),j(";")):(Ee(V),Qe(F,"optional"))},"parseOneOf_block")),D.add(F)}a(ul,"Ot"),t(ul,"parseOneOf");function hl(D,C){if(!A.test(C=W()))throw Z(C,"name");var F=new d(C);ze(F,t(function(V){switch(V){case"option":ht(F,V),j(";");break;case"reserved":Bt(F.reserved||(F.reserved=[]),!0);break;default:dl(F,V)}},"parseEnum_block")),D.add(F)}a(hl,"bt"),t(hl,"parseEnum");function dl(D,C){if(!A.test(C))throw Z(C,"name");j("=");var F=Ne(W(),!0),V={};ze(V,t(function(_e){if(_e==="option")ht(V,_e),j(";");else throw Z(_e)},"parseEnumValue_block"),t(function(){Ts(V)},"parseEnumValue_line")),D.add(C,F,V.comment)}a(dl,"_t"),t(dl,"parseEnumValue");function ht(D,C){var F=j("(",!0);if(!N.test(C=W()))throw Z(C,"name");var V=C;F&&(j(")"),V="("+V+")",C=de(),B.test(C)&&(V+=C,W())),j("="),Os(D,V)}a(ht,"Q"),t(ht,"parseOption");function Os(D,C){if(j("{",!0))do{if(!A.test(Je=W()))throw Z(Je,"name");de()==="{"?Os(D,C+"."+Je):(j(":"),de()==="{"?Os(D,C+"."+Je):gi(D,C+"."+Je,Xe(!0)))}while(!j("}",!0));else gi(D,C,Xe(!0))}a(Os,"ut"),t(Os,"parseOptionValue");function gi(D,C,F){D.setOption&&D.setOption(C,F)}a(gi,"ct"),t(gi,"setOption");function Ts(D){if(j("[",!0)){do ht(D,"option");while(j(",",!0));j("]")}return D}a(Ts,"ft"),t(Ts,"parseInlineOptions");function fl(D,C){if(!A.test(C=W()))throw Z(C,"service name");var F=new f(C);ze(F,t(function(V){if(!nt(F,V))if(V==="rpc")pl(F,V);else throw Z(V)},"parseService_block")),D.add(F)}a(fl,"xt"),t(fl,"parseService");function pl(D,C){var F=C;if(!A.test(C=W()))throw Z(C,"name");var V=C,_e,Oe,vt,Ut;if(j("("),j("stream",!0)&&(Oe=!0),!N.test(C=W())||(_e=C,j(")"),j("returns"),j("("),j("stream",!0)&&(Ut=!0),!N.test(C=W())))throw Z(C);vt=C,j(")");var mi=new y(V,F,_e,vt,Oe,Ut);ze(mi,t(function(yi){if(yi==="option")ht(mi,yi),j(";");else throw Z(yi)},"parseMethod_block")),D.add(mi)}a(pl,"At"),t(pl,"parseMethod");function gl(D,C){if(!N.test(C=W()))throw Z(C,"reference");var F=C;ze(null,t(function(V){switch(V){case"required":case"repeated":case"optional":Qe(D,V,F);break;default:if(!re||!N.test(V))throw Z(V);Ee(V),Qe(D,"optional",F);break}},"parseExtension_block"))}a(gl,"St"),t(gl,"parseExtension");for(var Je;(Je=W())!==null;)switch(Je){case"package":if(!je)throw Z(Je);Q();break;case"import":if(!je)throw Z(Je);Ue();break;case"syntax":if(!je)throw Z(Je);ut();break;case"option":if(!je)throw Z(Je);ht(Se,Je),j(";");break;default:if(nt(Se,Je)){je=!1;continue}throw Z(Je)}return q.filename=null,{package:Be,imports:X,weakImports:ue,syntax:z,root:ge}}a(q,"T"),t(q,"parse")},{15:15,16:16,20:20,22:22,25:25,29:29,33:33,34:34,35:35,36:36,37:37}],27:[function(n,i,c){i.exports=p;var o=n(39),l,h=o.LongBits,u=o.utf8;function g(m,_){return RangeError("index out of range: "+m.pos+" + "+(_||1)+" > "+m.len)}a(g,"a"),t(g,"indexOutOfRange");function p(m){this.buf=m,this.pos=0,this.len=m.length}a(p,"s"),t(p,"Reader");var d=typeof Uint8Array<"u"?t(function(m){if(m instanceof Uint8Array||Array.isArray(m))return new p(m);throw Error("illegal buffer")},"create_typed_array"):t(function(m){if(Array.isArray(m))return new p(m);throw Error("illegal buffer")},"create_array");p.create=o.Buffer?t(function(m){return(p.create=t(function(_){return o.Buffer.isBuffer(_)?new l(_):d(_)},"create_buffer"))(m)},"create_buffer_setup"):d,p.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,p.prototype.uint32=t((function(){var m=4294967295;return t(function(){if(m=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(m=(m|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(m=(m|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(m=(m|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(m=(m|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return m;if((this.pos+=5)>this.len)throw this.pos=this.len,g(this,10);return m},"read_uint32")}),"read_uint32_setup")(),p.prototype.int32=t(function(){return this.uint32()|0},"read_int32"),p.prototype.sint32=t(function(){var m=this.uint32();return m>>>1^-(m&1)|0},"read_sint32");function f(){var m=new h(0,0),_=0;if(this.len-this.pos>4){for(;_<4;++_)if(m.lo=(m.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return m;if(m.lo=(m.lo|(this.buf[this.pos]&127)<<28)>>>0,m.hi=(m.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return m;_=0}else{for(;_<3;++_){if(this.pos>=this.len)throw g(this);if(m.lo=(m.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return m}return m.lo=(m.lo|(this.buf[this.pos++]&127)<<_*7)>>>0,m}if(this.len-this.pos>4){for(;_<5;++_)if(m.hi=(m.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return m}else for(;_<5;++_){if(this.pos>=this.len)throw g(this);if(m.hi=(m.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return m}throw Error("invalid varint encoding")}a(f,"r"),t(f,"readLongVarint"),p.prototype.bool=t(function(){return this.uint32()!==0},"read_bool");function y(m,_){return(m[_-4]|m[_-3]<<8|m[_-2]<<16|m[_-1]<<24)>>>0}a(y,"e"),t(y,"readFixed32_end"),p.prototype.fixed32=t(function(){if(this.pos+4>this.len)throw g(this,4);return y(this.buf,this.pos+=4)},"read_fixed32"),p.prototype.sfixed32=t(function(){if(this.pos+4>this.len)throw g(this,4);return y(this.buf,this.pos+=4)|0},"read_sfixed32");function b(){if(this.pos+8>this.len)throw g(this,8);return new h(y(this.buf,this.pos+=4),y(this.buf,this.pos+=4))}a(b,"f"),t(b,"readFixed64"),p.prototype.float=t(function(){if(this.pos+4>this.len)throw g(this,4);var m=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,m},"read_float"),p.prototype.double=t(function(){if(this.pos+8>this.len)throw g(this,4);var m=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,m},"read_double"),p.prototype.bytes=t(function(){var m=this.uint32(),_=this.pos,w=this.pos+m;if(w>this.len)throw g(this,m);return this.pos+=m,Array.isArray(this.buf)?this.buf.slice(_,w):_===w?new this.buf.constructor(0):this._slice.call(this.buf,_,w)},"read_bytes"),p.prototype.string=t(function(){var m=this.bytes();return u.read(m,0,m.length)},"read_string"),p.prototype.skip=t(function(m){if(typeof m=="number"){if(this.pos+m>this.len)throw g(this,m);this.pos+=m}else do if(this.pos>=this.len)throw g(this);while(this.buf[this.pos++]&128);return this},"skip"),p.prototype.skipType=function(m){switch(m){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:do{if((m=this.uint32()&7)===4)break;this.skipType(m)}while(!0);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+m+" at offset "+this.pos)}return this},p._configure=function(m){l=m;var _=o.Long?"toLong":"toNumber";o.merge(p.prototype,{int64:t(function(){return f.call(this)[_](!1)},"read_int64"),uint64:t(function(){return f.call(this)[_](!0)},"read_uint64"),sint64:t(function(){return f.call(this).zzDecode()[_](!1)},"read_sint64"),fixed64:t(function(){return b.call(this)[_](!0)},"read_fixed64"),sfixed64:t(function(){return b.call(this)[_](!1)},"read_sfixed64")})}},{39:39}],28:[function(n,i,c){i.exports=h;var o=n(27);(h.prototype=Object.create(o.prototype)).constructor=h;var l=n(39);function h(u){o.call(this,u)}a(h,"c"),t(h,"BufferReader"),l.Buffer&&(h.prototype._slice=l.Buffer.prototype.slice),h.prototype.string=t(function(){var u=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+u,this.len))},"read_string_buffer")},{27:27,39:39}],29:[function(n,i,c){i.exports=y;var o=n(23);((y.prototype=Object.create(o.prototype)).constructor=y).className="Root";var l=n(16),h=n(15),u=n(25),g=n(37),p,d,f;function y(w){o.call(this,"",w),this.deferred=[],this.files=[]}a(y,"e"),t(y,"Root"),y.fromJSON=t(function(w,S){return S||(S=new y),w.options&&S.setOptions(w.options),S.addJSON(w.nested)},"fromJSON"),y.prototype.resolvePath=g.path.resolve;function b(){}a(b,"f"),t(b,"SYNC"),y.prototype.load=t(a(function w(S,T,v){typeof T=="function"&&(v=T,T=s);var k=this;if(!v)return g.asPromise(w,k,S,T);var O=v===b;function A(G,ne){if(v){var W=v;if(v=null,O)throw G;W(G,ne)}}a(A,"g"),t(A,"finish");function N(G,ne){try{if(g.isString(ne)&&ne.charAt(0)==="{"&&(ne=JSON.parse(ne)),!g.isString(ne))k.setOptions(ne.options).addJSON(ne.nested);else{d.filename=G;var W=d(ne,k,T),Ee,de=0;if(W.imports)for(;de<W.imports.length;++de)(Ee=k.resolvePath(G,W.imports[de]))&&B(Ee);if(W.weakImports)for(de=0;de<W.weakImports.length;++de)(Ee=k.resolvePath(G,W.weakImports[de]))&&B(Ee,!0)}}catch(j){A(j)}!O&&!q&&A(null,k)}a(N,"_"),t(N,"process");function B(G,ne){var W=G.lastIndexOf("google/protobuf/");if(W>-1){var Ee=G.substring(W);Ee in f&&(G=Ee)}if(!(k.files.indexOf(G)>-1)){if(k.files.push(G),G in f){O?N(G,f[G]):(++q,setTimeout(function(){--q,N(G,f[G])}));return}if(O){var de;try{de=g.fs.readFileSync(G).toString("utf8")}catch(j){ne||A(j);return}N(G,de)}else++q,g.fetch(G,function(j,le){if(--q,!!v){if(j){ne?q||A(null,k):A(j);return}N(G,le)}})}}a(B,"D"),t(B,"fetch");var q=0;g.isString(S)&&(S=[S]);for(var pe=0,ge;pe<S.length;++pe)(ge=k.resolvePath("",S[pe]))&&B(ge);return O?k:(q||A(null,k),s)},"p"),"load"),y.prototype.loadSync=t(function(w,S){if(!g.isNode)throw Error("not supported");return this.load(w,S,b)},"loadSync"),y.prototype.resolveAll=t(function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(w){return"'extend "+w.extend+"' in "+w.parent.fullName}).join(", "));return o.prototype.resolveAll.call(this)},"resolveAll");var m=/^[A-Z]/;function _(w,S){var T=S.parent.lookup(S.extend);if(T){var v=new l(S.fullName,S.id,S.type,S.rule,s,S.options);return v.declaringField=S,S.extensionField=v,T.add(v),!0}return!1}a(_,"o"),t(_,"tryHandleExtension"),y.prototype._handleAdd=t(function(w){if(w instanceof l)w.extend!==s&&!w.extensionField&&(_(this,w)||this.deferred.push(w));else if(w instanceof h)m.test(w.name)&&(w.parent[w.name]=w.values);else if(!(w instanceof u)){if(w instanceof p)for(var S=0;S<this.deferred.length;)_(this,this.deferred[S])?this.deferred.splice(S,1):++S;for(var T=0;T<w.nestedArray.length;++T)this._handleAdd(w._nestedArray[T]);m.test(w.name)&&(w.parent[w.name]=w)}},"_handleAdd"),y.prototype._handleRemove=t(function(w){if(w instanceof l){if(w.extend!==s)if(w.extensionField)w.extensionField.parent.remove(w.extensionField),w.extensionField=null;else{var S=this.deferred.indexOf(w);S>-1&&this.deferred.splice(S,1)}}else if(w instanceof h)m.test(w.name)&&delete w.parent[w.name];else if(w instanceof o){for(var T=0;T<w.nestedArray.length;++T)this._handleRemove(w._nestedArray[T]);m.test(w.name)&&delete w.parent[w.name]}},"_handleRemove"),y._configure=function(w,S,T){p=w,d=S,f=T}},{15:15,16:16,23:23,25:25,37:37}],30:[function(n,i,c){i.exports={}},{}],31:[function(n,i,c){var o=c;o.Service=n(32)},{32:32}],32:[function(n,i,c){i.exports=l;var o=n(39);(l.prototype=Object.create(o.EventEmitter.prototype)).constructor=l;function l(h,u,g){if(typeof h!="function")throw TypeError("rpcImpl must be a function");o.EventEmitter.call(this),this.rpcImpl=h,this.requestDelimited=!!u,this.responseDelimited=!!g}a(l,"d"),t(l,"Service"),l.prototype.rpcCall=t(a(function h(u,g,p,d,f){if(!d)throw TypeError("request must be specified");var y=this;if(!f)return o.asPromise(h,y,u,g,p,d);if(!y.rpcImpl)return setTimeout(function(){f(Error("already ended"))},0),s;try{return y.rpcImpl(u,g[y.requestDelimited?"encodeDelimited":"encode"](d).finish(),t(function(b,m){if(b)return y.emit("error",b,u),f(b);if(m===null)return y.end(!0),s;if(!(m instanceof p))try{m=p[y.responseDelimited?"decodeDelimited":"decode"](m)}catch(_){return y.emit("error",_,u),f(_)}return y.emit("data",m,u),f(null,m)},"rpcCallback"))}catch(b){return y.emit("error",b,u),setTimeout(function(){f(b)},0),s}},"c"),"rpcCall"),l.prototype.end=t(function(h){return this.rpcImpl&&(h||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},"end")},{39:39}],33:[function(n,i,c){i.exports=g;var o=n(23);((g.prototype=Object.create(o.prototype)).constructor=g).className="Service";var l=n(22),h=n(37),u=n(31);function g(d,f){o.call(this,d,f),this.methods={},this._methodsArray=null}a(g,"a"),t(g,"Service"),g.fromJSON=t(function(d,f){var y=new g(d,f.options);if(f.methods)for(var b=Object.keys(f.methods),m=0;m<b.length;++m)y.add(l.fromJSON(b[m],f.methods[b[m]]));return f.nested&&y.addJSON(f.nested),y.comment=f.comment,y},"fromJSON"),g.prototype.toJSON=t(function(d){var f=o.prototype.toJSON.call(this,d),y=d?!!d.keepComments:!1;return h.toObject(["options",f&&f.options||s,"methods",o.arrayToJSON(this.methodsArray,d)||{},"nested",f&&f.nested||s,"comment",y?this.comment:s])},"toJSON"),Object.defineProperty(g.prototype,"methodsArray",{get:t(function(){return this._methodsArray||(this._methodsArray=h.toArray(this.methods))},"get")});function p(d){return d._methodsArray=null,d}a(p,"s"),t(p,"clearCache"),g.prototype.get=t(function(d){return this.methods[d]||o.prototype.get.call(this,d)},"get"),g.prototype.resolveAll=t(function(){for(var d=this.methodsArray,f=0;f<d.length;++f)d[f].resolve();return o.prototype.resolve.call(this)},"resolveAll"),g.prototype.add=t(function(d){if(this.get(d.name))throw Error("duplicate name '"+d.name+"' in "+this);return d instanceof l?(this.methods[d.name]=d,d.parent=this,p(this)):o.prototype.add.call(this,d)},"add"),g.prototype.remove=t(function(d){if(d instanceof l){if(this.methods[d.name]!==d)throw Error(d+" is not a member of "+this);return delete this.methods[d.name],d.parent=null,p(this)}return o.prototype.remove.call(this,d)},"remove"),g.prototype.create=t(function(d,f,y){for(var b=new u.Service(d,f,y),m=0,_;m<this.methodsArray.length;++m){var w=h.lcFirst((_=this._methodsArray[m]).resolve().name).replace(/[^$\w_]/g,"");b[w]=h.codegen(["r","c"],h.isReserved(w)?w+"_":w)("return this.rpcCall(m,q,s,r,c)")({m:_,q:_.resolvedRequestType.ctor,s:_.resolvedResponseType.ctor})}return b},"create")},{22:22,23:23,31:31,37:37}],34:[function(n,i,c){i.exports=m;var o=/[\s{}=;:[\],'"()<>]/g,l=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,h=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,u=/^ *[*/]+ */,g=/^\s*\*?\/*/,p=/\n/g,d=/\s/,f=/\\(.?)/g,y={0:"\0",r:"\r",n:`
`,t:"	"};function b(_){return _.replace(f,function(w,S){switch(S){case"\\":case"":return S;default:return y[S]||""}})}a(b,"f"),t(b,"unescape"),m.unescape=b;function m(_,w){_=_.toString();var S=0,T=_.length,v=1,k=null,O=null,A=0,N=!1,B=[],q=null;function pe(X){return Error("illegal "+X+" (line "+v+")")}a(pe,"J"),t(pe,"illegal");function ge(){var X=q==="'"?h:l;X.lastIndex=S-1;var ue=X.exec(_);if(!ue)throw pe("string");return S=X.lastIndex,j(q),q=null,b(ue[1])}a(ge,"H"),t(ge,"readString");function G(X){return _.charAt(X)}a(G,"I"),t(G,"charAt");function ne(X,ue){k=_.charAt(X++),A=v,N=!1;var z;w?z=2:z=3;var re=X-z,Se;do if(--re<0||(Se=_.charAt(re))===`
`){N=!0;break}while(Se===" "||Se==="	");for(var Ce=_.substring(X,ue).split(p),Z=0;Z<Ce.length;++Z)Ce[Z]=Ce[Z].replace(w?g:u,"").trim();O=Ce.join(`
`).trim()}a(ne,"$"),t(ne,"setComment");function W(X){var ue=Ee(X),z=_.substring(X,ue),re=/^\s*\/{1,2}/.test(z);return re}a(W,"B"),t(W,"isDoubleSlashCommentLine");function Ee(X){for(var ue=X;ue<T&&G(ue)!==`
`;)ue++;return ue}a(Ee,"U"),t(Ee,"findEndOfLine");function de(){if(B.length>0)return B.shift();if(q)return ge();var X,ue,z,re,Se;do{if(S===T)return null;for(X=!1;d.test(z=G(S));)if(z===`
`&&++v,++S===T)return null;if(G(S)==="/"){if(++S===T)throw pe("comment");if(G(S)==="/")if(w){if(re=S,Se=!1,W(S)){Se=!0;do{if(S=Ee(S),S===T)break;S++}while(W(S))}else S=Math.min(T,Ee(S)+1);Se&&ne(re,S),v++,X=!0}else{for(Se=G(re=S+1)==="/";G(++S)!==`
`;)if(S===T)return null;++S,Se&&ne(re,S-1),++v,X=!0}else if((z=G(S))==="*"){re=S+1,Se=w||G(re)==="*";do{if(z===`
`&&++v,++S===T)throw pe("comment");ue=z,z=G(S)}while(ue!=="*"||z!=="/");++S,Se&&ne(re,S-2),X=!0}else return"/"}}while(X);var Ce=S;o.lastIndex=0;var Z=o.test(G(Ce++));if(!Z)for(;Ce<T&&!o.test(G(Ce));)++Ce;var Ze=_.substring(S,S=Ce);return(Ze==='"'||Ze==="'")&&(q=Ze),Ze}a(de,"P"),t(de,"next");function j(X){B.push(X)}a(j,"N"),t(j,"push");function le(){if(!B.length){var X=de();if(X===null)return null;j(X)}return B[0]}a(le,"q"),t(le,"peek");function je(X,ue){var z=le(),re=z===X;if(re)return de(),!0;if(!ue)throw pe("token '"+z+"', '"+X+"' expected");return!1}a(je,"rt"),t(je,"skip");function Be(X){var ue=null;return X===s?A===v-1&&(w||k==="*"||N)&&(ue=O):(A<X&&le(),A===X&&!N&&(w||k==="/")&&(ue=O)),ue}return a(Be,"tt"),t(Be,"cmnt"),Object.defineProperty({next:de,peek:le,push:j,skip:je,cmnt:Be},"line",{get:t(function(){return v},"get")})}a(m,"n"),t(m,"tokenize")},{}],35:[function(n,i,c){i.exports=v;var o=n(23);((v.prototype=Object.create(o.prototype)).constructor=v).className="Type";var l=n(15),h=n(25),u=n(16),g=n(20),p=n(33),d=n(21),f=n(27),y=n(42),b=n(37),m=n(14),_=n(13),w=n(40),S=n(12),T=n(41);function v(O,A){o.call(this,O,A),this.fields={},this.oneofs=s,this.extensions=s,this.reserved=s,this.group=s,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}a(v,"m"),t(v,"Type"),Object.defineProperties(v.prototype,{fieldsById:{get:t(function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var O=Object.keys(this.fields),A=0;A<O.length;++A){var N=this.fields[O[A]],B=N.id;if(this._fieldsById[B])throw Error("duplicate id "+B+" in "+this);this._fieldsById[B]=N}return this._fieldsById},"get")},fieldsArray:{get:t(function(){return this._fieldsArray||(this._fieldsArray=b.toArray(this.fields))},"get")},oneofsArray:{get:t(function(){return this._oneofsArray||(this._oneofsArray=b.toArray(this.oneofs))},"get")},ctor:{get:t(function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},"get"),set:t(function(O){var A=O.prototype;A instanceof d||((O.prototype=new d).constructor=O,b.merge(O.prototype,A)),O.$type=O.prototype.$type=this,b.merge(O,d,!0),this._ctor=O;for(var N=0;N<this.fieldsArray.length;++N)this._fieldsArray[N].resolve();var B={};for(N=0;N<this.oneofsArray.length;++N)B[this._oneofsArray[N].resolve().name]={get:b.oneOfGetter(this._oneofsArray[N].oneof),set:b.oneOfSetter(this._oneofsArray[N].oneof)};N&&Object.defineProperties(O.prototype,B)},"set")}}),v.generateConstructor=t(function(O){for(var A=b.codegen(["p"],O.name),N=0,B;N<O.fieldsArray.length;++N)(B=O._fieldsArray[N]).map?A("this%s={}",b.safeProp(B.name)):B.repeated&&A("this%s=[]",b.safeProp(B.name));return A("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},"generateConstructor");function k(O){return O._fieldsById=O._fieldsArray=O._oneofsArray=null,delete O.encode,delete O.decode,delete O.verify,O}a(k,"w"),t(k,"clearCache"),v.fromJSON=t(function(O,A){var N=new v(O,A.options);N.extensions=A.extensions,N.reserved=A.reserved;for(var B=Object.keys(A.fields),q=0;q<B.length;++q)N.add((typeof A.fields[B[q]].keyType<"u"?g.fromJSON:u.fromJSON)(B[q],A.fields[B[q]]));if(A.oneofs)for(B=Object.keys(A.oneofs),q=0;q<B.length;++q)N.add(h.fromJSON(B[q],A.oneofs[B[q]]));if(A.nested)for(B=Object.keys(A.nested),q=0;q<B.length;++q){var pe=A.nested[B[q]];N.add((pe.id!==s?u.fromJSON:pe.fields!==s?v.fromJSON:pe.values!==s?l.fromJSON:pe.methods!==s?p.fromJSON:o.fromJSON)(B[q],pe))}return A.extensions&&A.extensions.length&&(N.extensions=A.extensions),A.reserved&&A.reserved.length&&(N.reserved=A.reserved),A.group&&(N.group=!0),A.comment&&(N.comment=A.comment),N},"fromJSON"),v.prototype.toJSON=t(function(O){var A=o.prototype.toJSON.call(this,O),N=O?!!O.keepComments:!1;return b.toObject(["options",A&&A.options||s,"oneofs",o.arrayToJSON(this.oneofsArray,O),"fields",o.arrayToJSON(this.fieldsArray.filter(function(B){return!B.declaringField}),O)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:s,"reserved",this.reserved&&this.reserved.length?this.reserved:s,"group",this.group||s,"nested",A&&A.nested||s,"comment",N?this.comment:s])},"toJSON"),v.prototype.resolveAll=t(function(){for(var O=this.fieldsArray,A=0;A<O.length;)O[A++].resolve();var N=this.oneofsArray;for(A=0;A<N.length;)N[A++].resolve();return o.prototype.resolveAll.call(this)},"resolveAll"),v.prototype.get=t(function(O){return this.fields[O]||this.oneofs&&this.oneofs[O]||this.nested&&this.nested[O]||null},"get"),v.prototype.add=t(function(O){if(this.get(O.name))throw Error("duplicate name '"+O.name+"' in "+this);if(O instanceof u&&O.extend===s){if(this._fieldsById?this._fieldsById[O.id]:this.fieldsById[O.id])throw Error("duplicate id "+O.id+" in "+this);if(this.isReservedId(O.id))throw Error("id "+O.id+" is reserved in "+this);if(this.isReservedName(O.name))throw Error("name '"+O.name+"' is reserved in "+this);return O.parent&&O.parent.remove(O),this.fields[O.name]=O,O.message=this,O.onAdd(this),k(this)}return O instanceof h?(this.oneofs||(this.oneofs={}),this.oneofs[O.name]=O,O.onAdd(this),k(this)):o.prototype.add.call(this,O)},"add"),v.prototype.remove=t(function(O){if(O instanceof u&&O.extend===s){if(!this.fields||this.fields[O.name]!==O)throw Error(O+" is not a member of "+this);return delete this.fields[O.name],O.parent=null,O.onRemove(this),k(this)}if(O instanceof h){if(!this.oneofs||this.oneofs[O.name]!==O)throw Error(O+" is not a member of "+this);return delete this.oneofs[O.name],O.parent=null,O.onRemove(this),k(this)}return o.prototype.remove.call(this,O)},"remove"),v.prototype.isReservedId=t(function(O){return o.isReservedId(this.reserved,O)},"isReservedId"),v.prototype.isReservedName=t(function(O){return o.isReservedName(this.reserved,O)},"isReservedName"),v.prototype.create=t(function(O){return new this.ctor(O)},"create"),v.prototype.setup=t(function(){for(var O=this.fullName,A=[],N=0;N<this.fieldsArray.length;++N)A.push(this._fieldsArray[N].resolve().resolvedType);this.encode=m(this)({Writer:y,types:A,util:b}),this.decode=_(this)({Reader:f,types:A,util:b}),this.verify=w(this)({types:A,util:b}),this.fromObject=S.fromObject(this)({types:A,util:b}),this.toObject=S.toObject(this)({types:A,util:b});var B=T[O];if(B){var q=Object.create(this);q.fromObject=this.fromObject,this.fromObject=B.fromObject.bind(q),q.toObject=this.toObject,this.toObject=B.toObject.bind(q)}return this},"setup"),v.prototype.encode=t(function(O,A){return this.setup().encode(O,A)},"encode_setup"),v.prototype.encodeDelimited=t(function(O,A){return this.encode(O,A&&A.len?A.fork():A).ldelim()},"encodeDelimited"),v.prototype.decode=t(function(O,A){return this.setup().decode(O,A)},"decode_setup"),v.prototype.decodeDelimited=t(function(O){return O instanceof f||(O=f.create(O)),this.decode(O,O.uint32())},"decodeDelimited"),v.prototype.verify=t(function(O){return this.setup().verify(O)},"verify_setup"),v.prototype.fromObject=t(function(O){return this.setup().fromObject(O)},"fromObject"),v.prototype.toObject=t(function(O,A){return this.setup().toObject(O,A)},"toObject"),v.d=t(function(O){return t(function(A){b.decorateType(A,O)},"typeDecorator")},"decorateType")},{12:12,13:13,14:14,15:15,16:16,20:20,21:21,23:23,25:25,27:27,33:33,37:37,40:40,41:41,42:42}],36:[function(n,i,c){var o=c,l=n(37),h=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function u(g,p){var d=0,f={};for(p|=0;d<g.length;)f[h[d+p]]=g[d++];return f}a(u,"u"),t(u,"bake"),o.basic=u([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),o.defaults=u([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",l.emptyArray,null]),o.long=u([0,0,0,1,1],7),o.mapKey=u([0,0,0,5,5,0,0,0,1,1,0,2],2),o.packed=u([1,5,0,0,0,5,5,0,0,0,1,1,0])},{37:37}],37:[function(n,i,c){var o=i.exports=n(39),l=n(30),h,u;o.codegen=n(3),o.fetch=n(5),o.path=n(8),o.fs=o.inquire("fs"),o.toArray=t(function(y){if(y){for(var b=Object.keys(y),m=new Array(b.length),_=0;_<b.length;)m[_]=y[b[_++]];return m}return[]},"toArray"),o.toObject=t(function(y){for(var b={},m=0;m<y.length;){var _=y[m++],w=y[m++];w!==s&&(b[_]=w)}return b},"toObject");var g=/\\/g,p=/"/g;o.isReserved=t(function(y){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(y)},"isReserved"),o.safeProp=t(function(y){return!/^[$\w_]+$/.test(y)||o.isReserved(y)?'["'+y.replace(g,"\\\\").replace(p,'\\"')+'"]':"."+y},"safeProp"),o.ucFirst=t(function(y){return y.charAt(0).toUpperCase()+y.substring(1)},"ucFirst");var d=/_([a-z])/g;o.camelCase=t(function(y){return y.substring(0,1)+y.substring(1).replace(d,function(b,m){return m.toUpperCase()})},"camelCase"),o.compareFieldsById=t(function(y,b){return y.id-b.id},"compareFieldsById"),o.decorateType=t(function(y,b){if(y.$type)return b&&y.$type.name!==b&&(o.decorateRoot.remove(y.$type),y.$type.name=b,o.decorateRoot.add(y.$type)),y.$type;h||(h=n(35));var m=new h(b||y.name);return o.decorateRoot.add(m),m.ctor=y,Object.defineProperty(y,"$type",{value:m,enumerable:!1}),Object.defineProperty(y.prototype,"$type",{value:m,enumerable:!1}),m},"decorateType");var f=0;o.decorateEnum=t(function(y){if(y.$type)return y.$type;u||(u=n(15));var b=new u("Enum"+f++,y);return o.decorateRoot.add(b),Object.defineProperty(y,"$type",{value:b,enumerable:!1}),b},"decorateEnum"),Object.defineProperty(o,"decorateRoot",{get:t(function(){return l.decorated||(l.decorated=new(n(29)))},"get")})},{15:15,29:29,3:3,30:30,35:35,39:39,5:5,8:8}],38:[function(n,i,c){i.exports=l;var o=n(39);function l(p,d){this.lo=p>>>0,this.hi=d>>>0}a(l,"d"),t(l,"LongBits");var h=l.zero=new l(0,0);h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1};var u=l.zeroHash="\0\0\0\0\0\0\0\0";l.fromNumber=t(function(p){if(p===0)return h;var d=p<0;d&&(p=-p);var f=p>>>0,y=(p-f)/4294967296>>>0;return d&&(y=~y>>>0,f=~f>>>0,++f>4294967295&&(f=0,++y>4294967295&&(y=0))),new l(f,y)},"fromNumber"),l.from=t(function(p){if(typeof p=="number")return l.fromNumber(p);if(o.isString(p))if(o.Long)p=o.Long.fromString(p);else return l.fromNumber(parseInt(p,10));return p.low||p.high?new l(p.low>>>0,p.high>>>0):h},"from"),l.prototype.toNumber=t(function(p){if(!p&&this.hi>>>31){var d=~this.lo+1>>>0,f=~this.hi>>>0;return d||(f=f+1>>>0),-(d+f*4294967296)}return this.lo+this.hi*4294967296},"toNumber"),l.prototype.toLong=t(function(p){return o.Long?new o.Long(this.lo|0,this.hi|0,!!p):{low:this.lo|0,high:this.hi|0,unsigned:!!p}},"toLong");var g=String.prototype.charCodeAt;l.fromHash=t(function(p){return p===u?h:new l((g.call(p,0)|g.call(p,1)<<8|g.call(p,2)<<16|g.call(p,3)<<24)>>>0,(g.call(p,4)|g.call(p,5)<<8|g.call(p,6)<<16|g.call(p,7)<<24)>>>0)},"fromHash"),l.prototype.toHash=t(function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},"toHash"),l.prototype.zzEncode=t(function(){var p=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^p)>>>0,this.lo=(this.lo<<1^p)>>>0,this},"zzEncode"),l.prototype.zzDecode=t(function(){var p=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^p)>>>0,this.hi=(this.hi>>>1^p)>>>0,this},"zzDecode"),l.prototype.length=t(function(){var p=this.lo,d=(this.lo>>>28|this.hi<<4)>>>0,f=this.hi>>>24;return f===0?d===0?p<16384?p<128?1:2:p<2097152?3:4:d<16384?d<128?5:6:d<2097152?7:8:f<128?9:10},"length")},{39:39}],39:[function(n,i,c){var o=c;o.asPromise=n(1),o.base64=n(2),o.EventEmitter=n(4),o.float=n(6),o.inquire=n(7),o.utf8=n(10),o.pool=n(9),o.LongBits=n(38),o.emptyArray=Object.freeze?Object.freeze([]):[],o.emptyObject=Object.freeze?Object.freeze({}):{},o.isNode=!!(Dr.process&&Dr.process.versions&&Dr.process.versions.node),o.isInteger=Number.isInteger||t(function(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u},"isInteger"),o.isString=t(function(u){return typeof u=="string"||u instanceof String},"isString"),o.isObject=t(function(u){return u&&typeof u=="object"},"isObject"),o.isset=o.isSet=t(function(u,g){var p=u[g];return p!=null&&u.hasOwnProperty(g)?typeof p!="object"||(Array.isArray(p)?p.length:Object.keys(p).length)>0:!1},"isSet"),o.Buffer=(function(){try{var u=o.inquire("buffer").Buffer;return u.prototype.utf8Write?u:null}catch{return null}})(),o._Buffer_from=null,o._Buffer_allocUnsafe=null,o.newBuffer=t(function(u){return typeof u=="number"?o.Buffer?o._Buffer_allocUnsafe(u):new o.Array(u):o.Buffer?o._Buffer_from(u):typeof Uint8Array>"u"?u:new Uint8Array(u)},"newBuffer"),o.Array=typeof Uint8Array<"u"?Uint8Array:Array,o.Long=Dr.dcodeIO&&Dr.dcodeIO.Long||o.inquire("long"),o.key2Re=/^true|false|0|1$/,o.key32Re=/^-?(?:0|[1-9][0-9]*)$/,o.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,o.longToHash=t(function(u){return u?o.LongBits.from(u).toHash():o.LongBits.zeroHash},"longToHash"),o.longFromHash=t(function(u,g){var p=o.LongBits.fromHash(u);return o.Long?o.Long.fromBits(p.lo,p.hi,g):p.toNumber(!!g)},"longFromHash");function l(u,g,p){for(var d=Object.keys(g),f=0;f<d.length;++f)(u[d[f]]===s||!p)&&(u[d[f]]=g[d[f]]);return u}a(l,"d"),t(l,"merge"),o.merge=l,o.lcFirst=t(function(u){return u.charAt(0).toLowerCase()+u.substring(1)},"lcFirst");function h(u){function g(p,d){if(!(this instanceof g))return new g(p,d);Object.defineProperty(this,"message",{get:t(function(){return p},"get")}),Error.captureStackTrace?Error.captureStackTrace(this,g):Object.defineProperty(this,"stack",{value:new Error().stack||""}),d&&l(this,d)}return a(g,"a"),t(g,"CustomError"),(g.prototype=Object.create(Error.prototype)).constructor=g,Object.defineProperty(g.prototype,"name",{get:t(function(){return u},"get")}),g.prototype.toString=t(function(){return this.name+": "+this.message},"toString"),g}a(h,"c"),t(h,"newError"),o.newError=h,o.ProtocolError=h("ProtocolError"),o.oneOfGetter=t(function(u){for(var g={},p=0;p<u.length;++p)g[u[p]]=1;return function(){for(var d=Object.keys(this),f=d.length-1;f>-1;--f)if(g[d[f]]===1&&this[d[f]]!==s&&this[d[f]]!==null)return d[f]}},"getOneOf"),o.oneOfSetter=t(function(u){return function(g){for(var p=0;p<u.length;++p)u[p]!==g&&delete this[u[p]]}},"setOneOf"),o.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},o._configure=function(){var u=o.Buffer;if(!u){o._Buffer_from=o._Buffer_allocUnsafe=null;return}o._Buffer_from=u.from!==Uint8Array.from&&u.from||t(function(g,p){return new u(g,p)},"Buffer_from"),o._Buffer_allocUnsafe=u.allocUnsafe||t(function(g){return new u(g)},"Buffer_allocUnsafe")}},{1:1,10:10,2:2,38:38,4:4,6:6,7:7,9:9}],40:[function(n,i,c){i.exports=p;var o=n(15),l=n(37);function h(d,f){return d.name+": "+f+(d.repeated&&f!=="array"?"[]":d.map&&f!=="object"?"{k:"+d.keyType+"}":"")+" expected"}a(h,"c"),t(h,"invalid");function u(d,f,y,b){if(f.resolvedType)if(f.resolvedType instanceof o){d("switch(%s){",b)("default:")("return%j",h(f,"enum value"));for(var m=Object.keys(f.resolvedType.values),_=0;_<m.length;++_)d("case %i:",f.resolvedType.values[m[_]]);d("break")("}")}else d("{")("var e=types[%i].verify(%s);",y,b)("if(e)")("return%j+e",f.name+".")("}");else switch(f.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":d("if(!util.isInteger(%s))",b)("return%j",h(f,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":d("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",b,b,b,b)("return%j",h(f,"integer|Long"));break;case"float":case"double":d('if(typeof %s!=="number")',b)("return%j",h(f,"number"));break;case"bool":d('if(typeof %s!=="boolean")',b)("return%j",h(f,"boolean"));break;case"string":d("if(!util.isString(%s))",b)("return%j",h(f,"string"));break;case"bytes":d('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',b,b,b)("return%j",h(f,"buffer"));break}return d}a(u,"u"),t(u,"genVerifyValue");function g(d,f,y){switch(f.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":d("if(!util.key32Re.test(%s))",y)("return%j",h(f,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":d("if(!util.key64Re.test(%s))",y)("return%j",h(f,"integer|Long key"));break;case"bool":d("if(!util.key2Re.test(%s))",y)("return%j",h(f,"boolean key"));break}return d}a(g,"a"),t(g,"genVerifyKey");function p(d){var f=l.codegen(["m"],d.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),y=d.oneofsArray,b={};y.length&&f("var p={}");for(var m=0;m<d.fieldsArray.length;++m){var _=d._fieldsArray[m].resolve(),w="m"+l.safeProp(_.name);if(_.optional&&f("if(%s!=null&&m.hasOwnProperty(%j)){",w,_.name),_.map)f("if(!util.isObject(%s))",w)("return%j",h(_,"object"))("var k=Object.keys(%s)",w)("for(var i=0;i<k.length;++i){"),g(f,_,"k[i]"),u(f,_,m,w+"[k[i]]")("}");else if(_.repeated)f("if(!Array.isArray(%s))",w)("return%j",h(_,"array"))("for(var i=0;i<%s.length;++i){",w),u(f,_,m,w+"[i]")("}");else{if(_.partOf){var S=l.safeProp(_.partOf.name);b[_.partOf.name]===1&&f("if(p%s===1)",S)("return%j",_.partOf.name+": multiple values"),b[_.partOf.name]=1,f("p%s=1",S)}u(f,_,m,w)}_.optional&&f("}")}return f("return null")}a(p,"s"),t(p,"verifier")},{15:15,37:37}],41:[function(n,i,c){var o=c,l=n(21);o[".google.protobuf.Any"]={fromObject:t(function(h){if(h&&h["@type"]){var u=this.lookup(h["@type"]);if(u){var g=h["@type"].charAt(0)==="."?h["@type"].substr(1):h["@type"];return this.create({type_url:"/"+g,value:u.encode(u.fromObject(h)).finish()})}}return this.fromObject(h)},"fromObject"),toObject:t(function(h,u){if(u&&u.json&&h.type_url&&h.value){var g=h.type_url.substring(h.type_url.lastIndexOf("/")+1),p=this.lookup(g);p&&(h=p.decode(h.value))}if(!(h instanceof this.ctor)&&h instanceof l){var d=h.$type.toObject(h,u);return d["@type"]=h.$type.fullName,d}return this.toObject(h,u)},"toObject")}},{21:21}],42:[function(n,i,c){i.exports=y;var o=n(39),l,h=o.LongBits,u=o.base64,g=o.utf8;function p(v,k,O){this.fn=v,this.len=k,this.next=s,this.val=O}a(p,"s"),t(p,"Op");function d(){}a(d,"t"),t(d,"noop");function f(v){this.head=v.head,this.tail=v.tail,this.len=v.len,this.next=v.states}a(f,"r"),t(f,"State");function y(){this.len=0,this.head=new p(d,0,0),this.tail=this.head,this.states=null}a(y,"e"),t(y,"Writer"),y.create=o.Buffer?t(function(){return(y.create=t(function(){return new l},"create_buffer"))()},"create_buffer_setup"):t(function(){return new y},"create_array"),y.alloc=t(function(v){return new o.Array(v)},"alloc"),o.Array!==Array&&(y.alloc=o.pool(y.alloc,o.Array.prototype.subarray)),y.prototype._push=t(function(v,k,O){return this.tail=this.tail.next=new p(v,k,O),this.len+=k,this},"push");function b(v,k,O){k[O]=v&255}a(b,"f"),t(b,"writeByte");function m(v,k,O){for(;v>127;)k[O++]=v&127|128,v>>>=7;k[O]=v}a(m,"n"),t(m,"writeVarint32");function _(v,k){this.len=v,this.next=s,this.val=k}a(_,"o"),t(_,"VarintOp"),_.prototype=Object.create(p.prototype),_.prototype.fn=m,y.prototype.uint32=t(function(v){return this.len+=(this.tail=this.tail.next=new _((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},"write_uint32"),y.prototype.int32=t(function(v){return v<0?this._push(w,10,h.fromNumber(v)):this.uint32(v)},"write_int32"),y.prototype.sint32=t(function(v){return this.uint32((v<<1^v>>31)>>>0)},"write_sint32");function w(v,k,O){for(;v.hi;)k[O++]=v.lo&127|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;v.lo>127;)k[O++]=v.lo&127|128,v.lo=v.lo>>>7;k[O++]=v.lo}a(w,"p"),t(w,"writeVarint64"),y.prototype.uint64=t(function(v){var k=h.from(v);return this._push(w,k.length(),k)},"write_uint64"),y.prototype.int64=y.prototype.uint64,y.prototype.sint64=t(function(v){var k=h.from(v).zzEncode();return this._push(w,k.length(),k)},"write_sint64"),y.prototype.bool=t(function(v){return this._push(b,1,v?1:0)},"write_bool");function S(v,k,O){k[O]=v&255,k[O+1]=v>>>8&255,k[O+2]=v>>>16&255,k[O+3]=v>>>24}a(S,"h"),t(S,"writeFixed32"),y.prototype.fixed32=t(function(v){return this._push(S,4,v>>>0)},"write_fixed32"),y.prototype.sfixed32=y.prototype.fixed32,y.prototype.fixed64=t(function(v){var k=h.from(v);return this._push(S,4,k.lo)._push(S,4,k.hi)},"write_fixed64"),y.prototype.sfixed64=y.prototype.fixed64,y.prototype.float=t(function(v){return this._push(o.float.writeFloatLE,4,v)},"write_float"),y.prototype.double=t(function(v){return this._push(o.float.writeDoubleLE,8,v)},"write_double");var T=o.Array.prototype.set?t(function(v,k,O){k.set(v,O)},"writeBytes_set"):t(function(v,k,O){for(var A=0;A<v.length;++A)k[O+A]=v[A]},"writeBytes_for");y.prototype.bytes=t(function(v){var k=v.length>>>0;if(!k)return this._push(b,1,0);if(o.isString(v)){var O=y.alloc(k=u.length(v));u.decode(v,O,0),v=O}return this.uint32(k)._push(T,k,v)},"write_bytes"),y.prototype.string=t(function(v){var k=g.length(v);return k?this.uint32(k)._push(g.write,k,v):this._push(b,1,0)},"write_string"),y.prototype.fork=t(function(){return this.states=new f(this),this.head=this.tail=new p(d,0,0),this.len=0,this},"fork"),y.prototype.reset=t(function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new p(d,0,0),this.len=0),this},"reset"),y.prototype.ldelim=t(function(){var v=this.head,k=this.tail,O=this.len;return this.reset().uint32(O),O&&(this.tail.next=v.next,this.tail=k,this.len+=O),this},"ldelim"),y.prototype.finish=t(function(){for(var v=this.head.next,k=this.constructor.alloc(this.len),O=0;v;)v.fn(v.val,k,O),O+=v.len,v=v.next;return k},"finish"),y._configure=function(v){l=v}},{39:39}],43:[function(n,i,c){i.exports=u;var o=n(42);(u.prototype=Object.create(o.prototype)).constructor=u;var l=n(39),h=l.Buffer;function u(){o.call(this)}a(u,"u"),t(u,"BufferWriter"),u.alloc=t(function(d){return(u.alloc=l._Buffer_allocUnsafe)(d)},"alloc_buffer");var g=h&&h.prototype instanceof Uint8Array&&h.prototype.set.name==="set"?t(function(d,f,y){f.set(d,y)},"writeBytesBuffer_set"):t(function(d,f,y){if(d.copy)d.copy(f,y,0,d.length);else for(var b=0;b<d.length;)f[y++]=d[b++]},"writeBytesBuffer_copy");u.prototype.bytes=t(function(d){l.isString(d)&&(d=l._Buffer_from(d,"base64"));var f=d.length>>>0;return this.uint32(f),f&&this._push(g,f,d),this},"write_bytes_buffer");function p(d,f,y){d.length<40?l.utf8.write(d,f,y):f.utf8Write(d,y)}a(p,"s"),t(p,"writeStringBuffer"),u.prototype.string=t(function(d){var f=h.byteLength(d);return this.uint32(f),f&&this._push(p,f,d),this},"write_string_buffer")},{39:39,42:42}]},{},[19])})()})(fi)),fi.exports}a(H0,"requireProtobuf");var W0=H0();const Lr=q0(W0);var z0=Object.defineProperty,$=a((r,e)=>z0(r,"name",{value:e,configurable:!0}),"s$2");let se=Lr.Reader,$e=Lr.Writer,Ae=Lr.util;const x=Lr.roots["push-server"]||(Lr.roots["push-server"]={});x.RequestBatch=(function(){function r(e){if(this.requests=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"RequestBatch"),r.prototype.requests=Ae.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=$e.create()),e.requests!=null&&e.requests.length)for(var s=0;s<e.requests.length;++s)x.Request.encode(e.requests[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.RequestBatch;e.pos<s;){var i=e.uint32();i>>>3===1?(n.requests&&n.requests.length||(n.requests=[]),n.requests.push(x.Request.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.Request=(function(){function r(t){if(t)for(var s=Object.keys(t),n=0;n<s.length;++n)t[s[n]]!=null&&(this[s[n]]=t[s[n]])}a(r,"t"),$(r,"Request"),r.prototype.incomingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:Ae.oneOfGetter(e=["incomingMessages","channelStats","serverStats"]),set:Ae.oneOfSetter(e)}),r.create=$(function(t){return new r(t)},"create"),r.encode=$(function(t,s){return s||(s=$e.create()),t.incomingMessages!=null&&t.hasOwnProperty("incomingMessages")&&x.IncomingMessagesRequest.encode(t.incomingMessages,s.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&x.ChannelStatsRequest.encode(t.channelStats,s.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&x.ServerStatsRequest.encode(t.serverStats,s.uint32(26).fork()).ldelim(),s},"encode"),r.decode=$(function(t,s){t instanceof se||(t=se.create(t));for(var n=s===void 0?t.len:t.pos+s,i=new x.Request;t.pos<n;){var c=t.uint32();switch(c>>>3){case 1:i.incomingMessages=x.IncomingMessagesRequest.decode(t,t.uint32());break;case 2:i.channelStats=x.ChannelStatsRequest.decode(t,t.uint32());break;case 3:i.serverStats=x.ServerStatsRequest.decode(t,t.uint32());break;default:t.skipType(c&7);break}}return i},"decode"),r})(),x.IncomingMessagesRequest=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"IncomingMessagesRequest"),r.prototype.messages=Ae.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=$e.create()),e.messages!=null&&e.messages.length)for(var s=0;s<e.messages.length;++s)x.IncomingMessage.encode(e.messages[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.IncomingMessagesRequest;e.pos<s;){var i=e.uint32();i>>>3===1?(n.messages&&n.messages.length||(n.messages=[]),n.messages.push(x.IncomingMessage.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.IncomingMessage=(function(){function r(e){if(this.receivers=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"IncomingMessage"),r.prototype.receivers=Ae.emptyArray,r.prototype.sender=null,r.prototype.body="",r.prototype.expiry=0,r.prototype.type="",r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=$e.create()),e.receivers!=null&&e.receivers.length)for(var s=0;s<e.receivers.length;++s)x.Receiver.encode(e.receivers[s],t.uint32(10).fork()).ldelim();return e.sender!=null&&e.hasOwnProperty("sender")&&x.Sender.encode(e.sender,t.uint32(18).fork()).ldelim(),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(26).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(32).uint32(e.expiry),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(42).string(e.type),t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.IncomingMessage;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.receivers&&n.receivers.length||(n.receivers=[]),n.receivers.push(x.Receiver.decode(e,e.uint32()));break;case 2:n.sender=x.Sender.decode(e,e.uint32());break;case 3:n.body=e.string();break;case 4:n.expiry=e.uint32();break;case 5:n.type=e.string();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.ChannelStatsRequest=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ChannelStatsRequest"),r.prototype.channels=Ae.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=$e.create()),e.channels!=null&&e.channels.length)for(var s=0;s<e.channels.length;++s)x.ChannelId.encode(e.channels[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ChannelStatsRequest;e.pos<s;){var i=e.uint32();i>>>3===1?(n.channels&&n.channels.length||(n.channels=[]),n.channels.push(x.ChannelId.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.ChannelId=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ChannelId"),r.prototype.id=Ae.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=Ae.newBuffer([]),r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=$e.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ChannelId;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.signature=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.ServerStatsRequest=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ServerStatsRequest"),r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=$e.create()),t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ServerStatsRequest;e.pos<s;){var i=e.uint32();switch(i>>>3){default:e.skipType(i&7);break}}return n},"decode"),r})(),x.Sender=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"Sender"),r.prototype.type=0,r.prototype.id=Ae.newBuffer([]),r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=$e.create()),e.type!=null&&e.hasOwnProperty("type")&&t.uint32(8).int32(e.type),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(18).bytes(e.id),t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.Sender;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.type=e.int32();break;case 2:n.id=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.SenderType=(function(){var r={},e=Object.create(r);return e[r[0]="UNKNOWN"]=0,e[r[1]="CLIENT"]=1,e[r[2]="BACKEND"]=2,e})(),x.Receiver=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"Receiver"),r.prototype.id=Ae.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.signature=Ae.newBuffer([]),r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=$e.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.signature!=null&&e.hasOwnProperty("signature")&&t.uint32(26).bytes(e.signature),t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.Receiver;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.signature=e.bytes();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.ResponseBatch=(function(){function r(e){if(this.responses=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ResponseBatch"),r.prototype.responses=Ae.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=$e.create()),e.responses!=null&&e.responses.length)for(var s=0;s<e.responses.length;++s)x.Response.encode(e.responses[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ResponseBatch;e.pos<s;){var i=e.uint32();i>>>3===1?(n.responses&&n.responses.length||(n.responses=[]),n.responses.push(x.Response.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.Response=(function(){function r(t){if(t)for(var s=Object.keys(t),n=0;n<s.length;++n)t[s[n]]!=null&&(this[s[n]]=t[s[n]])}a(r,"t"),$(r,"Response"),r.prototype.outgoingMessages=null,r.prototype.channelStats=null,r.prototype.serverStats=null;var e;return Object.defineProperty(r.prototype,"command",{get:Ae.oneOfGetter(e=["outgoingMessages","channelStats","serverStats"]),set:Ae.oneOfSetter(e)}),r.create=$(function(t){return new r(t)},"create"),r.encode=$(function(t,s){return s||(s=$e.create()),t.outgoingMessages!=null&&t.hasOwnProperty("outgoingMessages")&&x.OutgoingMessagesResponse.encode(t.outgoingMessages,s.uint32(10).fork()).ldelim(),t.channelStats!=null&&t.hasOwnProperty("channelStats")&&x.ChannelStatsResponse.encode(t.channelStats,s.uint32(18).fork()).ldelim(),t.serverStats!=null&&t.hasOwnProperty("serverStats")&&x.JsonResponse.encode(t.serverStats,s.uint32(26).fork()).ldelim(),s},"encode"),r.decode=$(function(t,s){t instanceof se||(t=se.create(t));for(var n=s===void 0?t.len:t.pos+s,i=new x.Response;t.pos<n;){var c=t.uint32();switch(c>>>3){case 1:i.outgoingMessages=x.OutgoingMessagesResponse.decode(t,t.uint32());break;case 2:i.channelStats=x.ChannelStatsResponse.decode(t,t.uint32());break;case 3:i.serverStats=x.JsonResponse.decode(t,t.uint32());break;default:t.skipType(c&7);break}}return i},"decode"),r})(),x.OutgoingMessagesResponse=(function(){function r(e){if(this.messages=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"OutgoingMessagesResponse"),r.prototype.messages=Ae.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=$e.create()),e.messages!=null&&e.messages.length)for(var s=0;s<e.messages.length;++s)x.OutgoingMessage.encode(e.messages[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.OutgoingMessagesResponse;e.pos<s;){var i=e.uint32();i>>>3===1?(n.messages&&n.messages.length||(n.messages=[]),n.messages.push(x.OutgoingMessage.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.OutgoingMessage=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"OutgoingMessage"),r.prototype.id=Ae.newBuffer([]),r.prototype.body="",r.prototype.expiry=0,r.prototype.created=0,r.prototype.sender=null,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=$e.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.body!=null&&e.hasOwnProperty("body")&&t.uint32(18).string(e.body),e.expiry!=null&&e.hasOwnProperty("expiry")&&t.uint32(24).uint32(e.expiry),e.created!=null&&e.hasOwnProperty("created")&&t.uint32(37).fixed32(e.created),e.sender!=null&&e.hasOwnProperty("sender")&&x.Sender.encode(e.sender,t.uint32(42).fork()).ldelim(),t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.OutgoingMessage;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.body=e.string();break;case 3:n.expiry=e.uint32();break;case 4:n.created=e.fixed32();break;case 5:n.sender=x.Sender.decode(e,e.uint32());break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.ChannelStatsResponse=(function(){function r(e){if(this.channels=[],e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ChannelStatsResponse"),r.prototype.channels=Ae.emptyArray,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){if(t||(t=$e.create()),e.channels!=null&&e.channels.length)for(var s=0;s<e.channels.length;++s)x.ChannelStats.encode(e.channels[s],t.uint32(10).fork()).ldelim();return t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ChannelStatsResponse;e.pos<s;){var i=e.uint32();i>>>3===1?(n.channels&&n.channels.length||(n.channels=[]),n.channels.push(x.ChannelStats.decode(e,e.uint32()))):e.skipType(i&7)}return n},"decode"),r})(),x.ChannelStats=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"ChannelStats"),r.prototype.id=Ae.newBuffer([]),r.prototype.isPrivate=!1,r.prototype.isOnline=!1,r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=$e.create()),e.id!=null&&e.hasOwnProperty("id")&&t.uint32(10).bytes(e.id),e.isPrivate!=null&&e.hasOwnProperty("isPrivate")&&t.uint32(16).bool(e.isPrivate),e.isOnline!=null&&e.hasOwnProperty("isOnline")&&t.uint32(24).bool(e.isOnline),t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.ChannelStats;e.pos<s;){var i=e.uint32();switch(i>>>3){case 1:n.id=e.bytes();break;case 2:n.isPrivate=e.bool();break;case 3:n.isOnline=e.bool();break;default:e.skipType(i&7);break}}return n},"decode"),r})(),x.JsonResponse=(function(){function r(e){if(e)for(var t=Object.keys(e),s=0;s<t.length;++s)e[t[s]]!=null&&(this[t[s]]=e[t[s]])}return a(r,"t"),$(r,"JsonResponse"),r.prototype.json="",r.create=$(function(e){return new r(e)},"create"),r.encode=$(function(e,t){return t||(t=$e.create()),e.json!=null&&e.hasOwnProperty("json")&&t.uint32(10).string(e.json),t},"encode"),r.decode=$(function(e,t){e instanceof se||(e=se.create(e));for(var s=t===void 0?e.len:e.pos+t,n=new x.JsonResponse;e.pos<s;){var i=e.uint32();i>>>3===1?n.json=e.string():e.skipType(i&7)}return n},"decode"),r})();const J0=x.ResponseBatch,Kc=x.RequestBatch,K0=x.IncomingMessage,Gc=x.Receiver;var G0=Object.defineProperty,Y0=a((r,e)=>G0(r,"name",{value:e,configurable:!0}),"o$1");class Yc{static{a(this,"AbstractConnector")}static{Y0(this,"AbstractConnector")}_logger;_connected=!1;_connectionType;_disconnectCode=0;_disconnectReason="";_parent;_callbacks;constructor(e){this._logger=oe.createNullLogger(),this._parent=e.parent,this._connectionType=fe.Undefined,this._callbacks={onOpen:M.isFunction(e.onOpen)?e.onOpen:()=>{},onDisconnect:M.isFunction(e.onDisconnect)?e.onDisconnect:()=>{},onError:M.isFunction(e.onError)?e.onError:()=>{},onMessage:M.isFunction(e.onMessage)?e.onMessage:()=>{}}}setLogger(e){this._logger=e}getLogger(){return this._logger}destroy(){}get connected(){return this._connected}set connected(e){e!=this._connected&&(this._connected=e,this._connected?this._callbacks.onOpen():this._callbacks.onDisconnect({code:this.disconnectCode,reason:this.disconnectReason}))}get disconnectCode(){return this._disconnectCode}get disconnectReason(){return this._disconnectReason}get connectionPath(){return this._parent.getConnectionPath(this._connectionType)}}var Z0=Object.defineProperty,X0=a((r,e)=>Z0(r,"name",{value:e,configurable:!0}),"s$1");class Q0 extends Yc{static{a(this,"WebSocketConnector")}static{X0(this,"WebSocketConnector")}_socket;_onSocketOpenHandler;_onSocketCloseHandler;_onSocketErrorHandler;_onSocketMessageHandler;constructor(e){super(e),this._connectionType=fe.WebSocket,this._socket=null,this._onSocketOpenHandler=this._onSocketOpen.bind(this),this._onSocketCloseHandler=this._onSocketClose.bind(this),this._onSocketErrorHandler=this._onSocketError.bind(this),this._onSocketMessageHandler=this._onSocketMessage.bind(this)}destroy(){super.destroy(),this._socket&&(this._socket.close(),this._socket=null)}connect(){if(this._socket){if(this._socket.readyState===1)return;this.clearEventListener(),this._socket.close(),this._socket=null}this._createSocket()}get socket(){return this._socket}disconnect(e,t){this._socket!==null&&(this.clearEventListener(),this._socket.close(e,t)),this._socket=null,this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}send(e){return!this._socket||this._socket.readyState!==1?(this.getLogger().error(`${K.getDateForLog()}: Pull: WebSocket is not connected`).catch(()=>{}),!1):(this._socket.send(e),!0)}_onSocketOpen(){this.connected=!0}_onSocketClose(e){this._socket=null,this._disconnectCode=Number(e.code),this._disconnectReason=e.reason,this.connected=!1}_onSocketError(e){this._callbacks.onError(new Error(`Socket error: ${e}`))}_onSocketMessage(e){this._callbacks.onMessage(e.data)}clearEventListener(){this._socket&&(this._socket.removeEventListener("open",this._onSocketOpenHandler),this._socket.removeEventListener("close",this._onSocketCloseHandler),this._socket.removeEventListener("error",this._onSocketErrorHandler),this._socket.removeEventListener("message",this._onSocketMessageHandler))}_createSocket(){if(this._socket)throw new Error("Socket already exists");if(!this.connectionPath)throw new Error("Websocket connection path is not defined");this._socket=new WebSocket(this.connectionPath),this._socket.binaryType="arraybuffer",this._socket.addEventListener("open",this._onSocketOpenHandler),this._socket.addEventListener("close",this._onSocketCloseHandler),this._socket.addEventListener("error",this._onSocketErrorHandler),this._socket.addEventListener("message",this._onSocketMessageHandler)}}var eb=Object.defineProperty,tb=a((r,e)=>eb(r,"name",{value:e,configurable:!0}),"s");const rb=60;class sb extends Yc{static{a(this,"LongPollingConnector")}static{tb(this,"LongPollingConnector")}_active;_requestTimeout;_failureTimeout;_xhr;_requestAborted;constructor(e){super(e),this._active=!1,this._connectionType=fe.LongPolling,this._requestTimeout=null,this._failureTimeout=null,this._xhr=null,this._requestAborted=!1}connect(){if(!this._xhr){if(typeof XMLHttpRequest>"u"){this._callbacks.onError(new Error("LongPollingConnector: XMLHttpRequest is not available in this environment (SSR/Node); a long-polling connection requires a browser"));return}this._xhr=this.createXhr()}this._active=!0,this.performRequest()}disconnect(e,t){this._active=!1,this.clearTimeOut(),this._xhr&&(this._requestAborted=!0,this._xhr.abort()),this._disconnectCode=e,this._disconnectReason=t,this.connected=!1}performRequest(){if(!this._active)return;if(!this.connectionPath)throw new Error("Long polling connection path is not defined");const e=this._xhr;e&&(e.readyState!==0&&e.readyState!==4||(this.clearTimeOut(),this._failureTimeout=setTimeout(()=>{this.connected=!0},5e3),this._requestTimeout=setTimeout(this.onRequestTimeout.bind(this),rb*1e3),e.open("GET",this.connectionPath),e.send()))}onRequestTimeout(){this._requestAborted=!0,this._xhr?.abort(),this.performRequest()}onXhrReadyStateChange(){const e=this._xhr;e&&e.readyState===4&&((!this._requestAborted||e.status==200)&&this.onResponse(e.response),this._requestAborted=!1)}send(e){const t=this._parent.getPublicationPath();if(!t)return this.getLogger().error(`${K.getDateForLog()}: Pull: publication path is empty`).catch(()=>{}),!1;if(typeof XMLHttpRequest>"u")return this.getLogger().error(`${K.getDateForLog()}: Pull: XMLHttpRequest is not available; cannot publish`).catch(()=>{}),!1;const s=new XMLHttpRequest;return s.open("POST",t),s.send(e),!0}onResponse(e){this.clearTimeOut();const t=this._xhr;if(t)if(t.status===200)this.connected=!0,M.isStringFilled(e)||e instanceof ArrayBuffer?this._callbacks.onMessage(e):this._parent.session.mid=null,this.performRequest();else if(t.status===304){if(this.connected=!0,t.getResponseHeader("Expires")==="Thu, 01 Jan 1973 11:11:01 GMT"){const s=t.getResponseHeader("Last-Message-Id");M.isStringFilled(s)&&this._parent.setLastMessageId(s||"")}this.performRequest()}else this._callbacks.onError(new Error("Could not connect to the server")),this.connected=!1}clearTimeOut(){this._failureTimeout&&(clearTimeout(this._failureTimeout),this._failureTimeout=null),this._requestTimeout&&(clearTimeout(this._requestTimeout),this._requestTimeout=null)}createXhr(){const e=new XMLHttpRequest;return this._parent.isProtobufSupported()&&!this._parent.isJsonRpc()&&(e.responseType="arraybuffer"),e.addEventListener("readystatechange",this.onXhrReadyStateChange.bind(this)),e}}var nb=Object.defineProperty,Zc=a((r,e)=>nb(r,"name",{value:e,configurable:!0}),"C");const Pr=19,Xc=1800,ib=5e3,ob=60*1e3,Qc=10,el=10,ab="ping",cb="pong",tl="bx-pull-session",lb=20,rl={api:{},channels:{},publicChannels:{},server:{timeShift:0},clientId:null,jwt:null,exp:0};class sl{static{a(this,"PullClient")}static{Zc(this,"PullClient")}_logger;_restClient;_status;_context;_guestMode;_guestUserId;_userId;_configGetMethod;_getPublicListMethod;_siteId;_enabled;_unloading=!1;_starting=!1;_debug=!1;_connectionAttempt=0;_connectionType=fe.WebSocket;_skipStorageInit;_skipCheckRevision;_subscribers={};_watchTagsQueue=new Map;_watchUpdateInterval=174e4;_watchForceUpdateInterval=5e3;_configTimestamp=0;_session={mid:null,tag:null,time:null,history:{},lastMessageIds:[],messageCount:0};_connectors={[fe.Undefined]:null,[fe.WebSocket]:null,[fe.LongPolling]:null};_isSecure;_config=null;_storage=null;_sharedConfig;_channelManager;_jsonRpcAdapter=null;_reconnectTimeout=null;_restartTimeout=null;_restoreWebSocketTimeout=null;_checkInterval=null;_offlineTimeout=null;_watchUpdateTimeout=null;_pingWaitTimeout=null;_timerFields=["_reconnectTimeout","_restartTimeout","_restoreWebSocketTimeout","_checkInterval","_offlineTimeout","_watchUpdateTimeout","_pingWaitTimeout"];_windowListeners=[];_isManualDisconnect=!1;_disposed=!1;_loggingEnabled=!1;_onPingTimeoutHandler;_onBeforeUnloadHandler;_onOfflineHandler;_onOnlineHandler;_userStatusCallbacks={};_connectPromise=null;_startingPromise=null;_startGeneration=0;constructor(e){this._logger=oe.createNullLogger(),this._restClient=e.b24,this._status=Ge.Offline,this._context="master",e.restApplication&&(typeof e.configGetMethod>"u"&&(e.configGetMethod="pull.application.config.get"),typeof e.skipCheckRevision>"u"&&(e.skipCheckRevision=!0),M.isStringFilled(e.restApplication)&&(e.siteId=e.restApplication),e.serverEnabled=!0),this._guestMode=e.guestMode?K.toBoolean(e.guestMode):!1,this._guestUserId=e.guestUserId?K.toInteger(e.guestUserId):0,this._guestMode&&this._guestUserId>0?this._userId=this._guestUserId:(this._guestMode=!1,this._userId=e.userId?K.toInteger(e.userId):0),this._siteId=e.siteId??"none",this._enabled=M.isUndefined(e.serverEnabled)?!0:e.serverEnabled===!0,this._configGetMethod=M.isStringFilled(e.configGetMethod)?e.configGetMethod||"":"pull.config.get",this._getPublicListMethod=M.isStringFilled(e.getPublicListMethod)?e.getPublicListMethod||"":"pull.channel.public.list",this._skipStorageInit=e.skipStorageInit===!0,this._skipCheckRevision=e.skipCheckRevision===!0,M.isUndefined(e.configTimestamp)||(this._configTimestamp=K.toInteger(e.configTimestamp)),this._isSecure=typeof document<"u"&&document?.location.href.indexOf("https")===0,this._userId&&!this._skipStorageInit&&(this._storage=new Wc({userId:this._userId,siteId:this._siteId})),this._sharedConfig=new j0({onWebSocketBlockChanged:this.onWebSocketBlockChanged.bind(this),storage:this._storage}),this._channelManager=new V0({b24:this._restClient,getPublicListMethod:this._getPublicListMethod}),this._loggingEnabled=this._sharedConfig.isLoggingEnabled(),this._onPingTimeoutHandler=this.onPingTimeout.bind(this),this._onBeforeUnloadHandler=this.onBeforeUnload.bind(this),this._onOfflineHandler=this.onOffline.bind(this),this._onOnlineHandler=this.onOnline.bind(this)}setLogger(e){this._logger=e,this._jsonRpcAdapter?.setLogger(this.getLogger()),this._storage?.setLogger(this.getLogger()),this._sharedConfig.setLogger(this.getLogger()),this._channelManager.setLogger(this.getLogger()),this._connectors.webSocket?.setLogger(this.getLogger()),this._connectors.longPolling?.setLogger(this.getLogger())}getLogger(){return this._logger}destroy(){this._disposed=!0,this._startGeneration++,this.stop(Pe.NORMAL_CLOSURE,"manual stop"),this.removeAllWindowListeners(),this._storage&&this._storage.remove(He.PullConfig),this.persistSession()}init(){this._disposed||(this._connectors.webSocket=new Q0({parent:this,onOpen:this.onWebSocketOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onWebSocketDisconnect.bind(this),onError:this.onWebSocketError.bind(this)}),this._connectors.longPolling=new sb({parent:this,onOpen:this.onLongPollingOpen.bind(this),onMessage:this.onIncomingMessage.bind(this),onDisconnect:this.onLongPollingDisconnect.bind(this),onError:this.onLongPollingError.bind(this)}),this._connectionType=this.isWebSocketAllowed()?fe.WebSocket:fe.LongPolling,this.addWindowListener("beforeunload",this._onBeforeUnloadHandler),this.addWindowListener("offline",this._onOfflineHandler),this.addWindowListener("online",this._onOnlineHandler),this._jsonRpcAdapter=new F0({connector:this._connectors.webSocket,handlers:{"incoming.message":this.handleRpcIncomingMessage.bind(this)}}))}get connector(){return this._connectors[this._connectionType]}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._offlineTimeout&&(clearTimeout(this._offlineTimeout),this._offlineTimeout=null),e===Ge.Offline?this.sendPullStatusDelayed(e,ib):this.sendPullStatus(e))}get session(){return this._session}subscribe(e){if(!M.isPlainObject(e))return this.attachCommandHandler(e);if(e=e,e.type=e.type||Ye.Server,e.command=e.command||null,e.type==Ye.Server||e.type==Ye.Client){if(typeof e.moduleId>"u")throw new TypeError(`${K.getDateForLog()}: Pull.subscribe: parameter moduleId is not specified`);return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),e.command?(typeof this._subscribers[e.type][e.moduleId].commands[e.command]>"u"&&(this._subscribers[e.type][e.moduleId].commands[e.command]=[]),this._subscribers[e.type][e.moduleId].commands[e.command].push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||typeof e.command>"u"||e.command===null||(this._subscribers[e.type][e.moduleId].commands[e.command]=this._subscribers[e.type][e.moduleId].commands[e.command].filter(t=>t!==e.callback))}):(this._subscribers[e.type][e.moduleId].callbacks.push(e.callback),()=>{typeof e.type>"u"||typeof e.moduleId>"u"||(this._subscribers[e.type][e.moduleId].callbacks=this._subscribers[e.type][e.moduleId].callbacks.filter(t=>t!==e.callback))})}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].push(e.callback),()=>{typeof e.type>"u"||(this._subscribers[e.type]=this._subscribers[e.type].filter(t=>t!==e.callback))}}attachCommandHandler(e){if(typeof e.getModuleId!="function"||typeof e.getModuleId()!="string")return this.getLogger().error(`${K.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string.`).catch(()=>{}),()=>{};let t=Ye.Server;return typeof e.getSubscriptionType=="function"&&(t=e.getSubscriptionType()),this.subscribe({type:t,moduleId:e.getModuleId(),callback:Zc(s=>{let n=null;if(typeof e.getMap=="function"){const i=e.getMap();if(i&&typeof i=="object"){const c=i[s.command];typeof c=="function"?n=c.bind(e):typeof c=="string"&&typeof e[c]=="function"&&(n=e[c].bind(e))}}if(!n){const i=`handle${K.capitalize(s.command)}`;typeof e[i]=="function"&&(n=e[i].bind(e))}n&&(this._debug&&this._context!=="master"&&this.getLogger().warning(`${K.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,qe({data:s})).catch(()=>{}),n(s.params,s.extra,s.command))},"callback")})}async start(e=null){if(this._disposed)return Promise.reject({ex:{error:"PULL_DISPOSED",error_description:"PullClient has been destroyed; create a new instance"}});let t=!0;if(this.isConnected())return Promise.resolve(!0);if(this._starting&&this._startingPromise)return this._startingPromise;if(!this._userId)throw new Error("Not set userId");if(this._siteId==="none")throw new Error("Not set siteId");let s=!1;if(e&&M.isPlainObject(e)&&(typeof e?.skipReconnectToLastSession<"u"&&(s=e.skipReconnectToLastSession,delete e.skipReconnectToLastSession),this._config=e,t=!1),!this._enabled)return Promise.reject({ex:{error:"PULL_DISABLED",error_description:"Push & Pull server is disabled"}});const n=Date.now();let i;!s&&this._storage&&(i=this._storage.get(tl,null)),M.isPlainObject(i)&&Object.prototype.hasOwnProperty.call(i,"ttl")&&i.ttl>=n&&(this._session.mid=i.mid),this._starting=!0;const c=++this._startGeneration;return this._startingPromise=new Promise((o,l)=>{this.loadConfig("client_start").then(h=>{if(this._disposed||this._startGeneration!==c){this._starting=!1,l({ex:{error:"PULL_DISPOSED",error_description:"PullClient has been destroyed; create a new instance"}});return}this.setConfig(h,t),this.init(),this.updateWatch(!0),this.startCheckConfig(),this.connect().then(()=>o(!0),u=>l(u))}).catch(h=>{this._starting=!1,this.status=Ge.Offline,this.stopCheckConfig(),this.getLogger().error(`${K.getDateForLog()}: Pull: could not read push-server config`,{error:h}).catch(()=>{}),l(h)})})}restart(e=Pe.NORMAL_CLOSURE,t="manual restart"){if(this._disposed)return;this._restartTimeout&&(clearTimeout(this._restartTimeout),this._restartTimeout=null),this.getLogger().debug(`${K.getDateForLog()}: Pull: restarting with code ${e}`).catch(()=>{}),this.disconnect(e,t),this._storage&&this._storage.remove(He.PullConfig),this._config=null;const s=`${e}_${t.replaceAll(" ","_")}`;this.loadConfig(s).then(n=>{this.setConfig(n,!0),this.updateWatch(),this.startCheckConfig(),this.connect().catch(i=>{this.getLogger().error("restart error",{error:i}).catch(()=>{})})},n=>{this.getLogger().error(`${K.getDateForLog()}: Pull: could not read push-server config `,{error:n}).catch(()=>{}),this.status=Ge.Offline,this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),(n?.status==401||n?.status==403)&&(this.stopCheckConfig(),this.onCustomEvent("onPullError",["AUTHORIZE_ERROR"]))})}stop(e=Pe.NORMAL_CLOSURE,t="manual stop"){this.disconnect(e,t),this.stopCheckConfig(),this.clearAllTimers()}clearAllTimers(){for(const e of this._timerFields){const t=this[e];t&&(e==="_checkInterval"?clearInterval(t):clearTimeout(t)),this[e]=null}}armTimeout(e,t,s){const n=this[e];n&&clearTimeout(n),this[e]=setTimeout(t,s)}addWindowListener(e,t){typeof window>"u"||(window.addEventListener(e,t),this._windowListeners.push({type:e,handler:t}))}removeAllWindowListeners(){if(typeof window<"u")for(const{type:e,handler:t}of this._windowListeners)window.removeEventListener(e,t);this._windowListeners=[]}reconnect(e,t,s=1){this.disconnect(e,t),this.scheduleReconnect(s)}setLastMessageId(e){this._session.mid=e}async sendMessage(e,t,s,n,i){const c={userList:e,body:{module_id:t,command:s,params:n},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(dt.Publish,c):this.sendMessageBatch([c])}async sendMessageToChannels(e,t,s,n,i){const c={channelList:e,body:{module_id:t,command:s,params:n},expiry:i};return this.isJsonRpc()?this._jsonRpcAdapter?.executeOutgoingRpcCommand(dt.Publish,c):this.sendMessageBatch([c])}capturePullEvent(e=!0){this._debug=e}enableLogging(e=!0){this._sharedConfig.setLoggingEnabled(e),this._loggingEnabled=e}async listChannels(){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(dt.ListChannels,{})||Promise.reject(new Error("jsonRpcAdapter not init"))}async getUsersLastSeen(e){if(!M.isArray(e)||!e.every(s=>typeof s=="number"))throw new Error("userList must be an array of numbers");const t={};return new Promise((s,n)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(dt.GetUsersLastSeen,{userList:e}).then(i=>{const c=[];for(let l=0;l<e.length;l++)Object.prototype.hasOwnProperty.call(i,e[l])||c.push(e[l]);if(c.length===0)return s(t);const o={userIds:c,sendToQueueSever:!0};this._restClient.actions.v2.call.make({method:"pull.api.user.getLastSeen",params:o}).then(l=>{const h=l.getData().result;for(const u in h)t[Number(u)]=Number(h[u]);return s(t)}).catch(l=>{this.getLogger().error("getUsersLastSeen",{error:l}).catch(()=>{}),n(l)})}).catch(i=>{this.getLogger().error("getUsersLastSeen",{error:i}).catch(()=>{}),n(i)})})}async ping(e=5){return this._jsonRpcAdapter?.executeOutgoingRpcCommand(dt.Ping,{},e)}async subscribeUserStatusChange(e,t){return new Promise((s,n)=>{this._jsonRpcAdapter?.executeOutgoingRpcCommand(dt.SubscribeStatusChange,{userId:e}).then(()=>(this._userStatusCallbacks[e]||(this._userStatusCallbacks[e]=[]),M.isFunction(t)&&this._userStatusCallbacks[e].push(t),s())).catch(i=>n(i))})}async unsubscribeUserStatusChange(e,t){return this._userStatusCallbacks[e]&&(this._userStatusCallbacks[e]=this._userStatusCallbacks[e].filter(s=>s!==t),this._userStatusCallbacks[e].length===0)?this._jsonRpcAdapter?.executeOutgoingRpcCommand(dt.UnsubscribeStatusChange,{userId:e}):Promise.resolve()}getRevision(){return this._config&&this._config.api?this._config.api.revision_web:null}getServerVersion(){return this._config&&this._config.server?this._config.server.version:0}getServerMode(){return this._config&&this._config.server?this._config.server.mode:null}getConfig(){return this._config}getDebugInfo(){if(!JSON||!JSON.stringify)return{};let e;this._config&&this._config.channels?e={ChannelID:this._config.channels.private?.id?is:"n/a",ChannelDie:this._config.channels.private?.end||"n/a",ChannelDieShared:this._config.channels.shared?.end||"n/a"}:e={ConfigError:"config is not loaded"};let t="-";this._connectors.webSocket&&this._connectors.webSocket?.socket&&(this.isJsonRpc()?t="json-rpc":t=this._connectors.webSocket?.socket?.url.search("binaryMode=true")!=-1?"protobuf":"text");const s=this.connector?.connectionPath;return{UserId:this._userId+(this._userId>0?"":"(guest)"),"Guest userId":this._guestMode&&this._guestUserId!==0?this._guestUserId:"-","Browser online":typeof navigator<"u"&&navigator.onLine?"Y":"N",Connect:this.isConnected()?"Y":"N","Server type":this.isSharedMode()?"cloud":"local","WebSocket supported":this.isWebSocketSupported()?"Y":"N","WebSocket connected":this._connectors.webSocket&&this._connectors.webSocket.connected?"Y":"N","WebSocket mode":t,"Try connect":this._reconnectTimeout?"Y":"N","Try number":this._connectionAttempt,Path:s?Sa(s,["CHANNEL_ID"]):"-",...e,"Last message":this._session.mid||"-","Session history":this._session.history,"Watch tags":this._watchTagsQueue.entries()}}getConnectionPath(e){let t;const s={};switch(e){case fe.WebSocket:t=this._isSecure?this._config?.server.websocket_secure:this._config?.server.websocket;break;case fe.LongPolling:t=this._isSecure?this._config?.server.long_pooling_secure:this._config?.server.long_polling;break;default:throw new Error(`Unknown connection type ${e}`)}if(!M.isStringFilled(t))throw new Error("Empty path");if(typeof this._config?.jwt=="string"&&this._config?.jwt!=="")s.token=this._config?.jwt;else{const n=[];if(this._config?.channels?.private?.id&&n.push(this._config.channels.private.id),this._config?.channels?.shared?.id&&n.push(this._config.channels.shared.id),n.length===0)throw new Error("Empty channels");s.CHANNEL_ID=n.join("/")}if(this.isJsonRpc()?s.jsonRpc="true":this.isProtobufSupported()&&(s.binaryMode="true"),this.isSharedMode()){if(!this._config?.clientId)throw new Error("Push-server is in shared mode, but clientId is not set");s.clientId=this._config.clientId}return this._session.mid&&(s.mid=this._session.mid),this._session.tag&&(s.tag=this._session.tag),this._session.time&&(s.time=this._session.time),s.revision=Pr,`${t}?${K.buildQueryString(s)}`}getPublicationPath(){const e=this._isSecure?this._config?.server.publish_secure:this._config?.server.publish;if(!e)return"";const t=[];this._config?.channels.private?.id&&t.push(this._config.channels.private.id),this._config?.channels.shared?.id&&t.push(this._config.channels.shared.id);const s={CHANNEL_ID:t.join("/")};return e+"?"+K.buildQueryString(s)}isConnected(){return this.connector?this.connector.connected:!1}isWebSocketSupported(){return typeof window<"u"&&typeof window.WebSocket<"u"}isWebSocketAllowed(){return this._sharedConfig.isWebSocketBlocked()?!1:this.isWebSocketEnabled()}isWebSocketEnabled(){return!this.isWebSocketSupported()||!this._config||!this._config.server?!1:this._config.server.websocket_enabled}isPublishingSupported(){return this.getServerVersion()>3}isPublishingEnabled(){return this.isPublishingSupported()?this._config?.server.publish_enabled===!0:!1}isProtobufSupported(){return this.getServerVersion()==4&&!aa.isIE()}isJsonRpc(){return this.getServerVersion()>=5}isSharedMode(){return this.getServerMode()===an.Shared}emit(e){if(e.type==Ye.Server||e.type==Ye.Client){if(typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]={}),typeof e.moduleId>"u")throw new TypeError(`${K.getDateForLog()}: Pull.emit: parameter moduleId is not specified`);return typeof this._subscribers[e.type][e.moduleId]>"u"&&(this._subscribers[e.type][e.moduleId]={callbacks:[],commands:{}}),this._subscribers[e.type][e.moduleId].callbacks.length>0&&this._subscribers[e.type][e.moduleId].callbacks.forEach(t=>{t(e.data,{type:e.type,moduleId:e.moduleId??"?"})}),!(typeof e.data>"u")&&!(typeof e.data.command>"u")&&this._subscribers[e.type][e.moduleId].commands[e.data.command]&&this._subscribers[e.type][e.moduleId].commands[e.data.command].length>0&&this._subscribers[e.type][e.moduleId].commands[e.data.command].forEach(t=>{typeof e.data>"u"||t(e.data.params,e.data.extra,e.data.command,{type:e.type,moduleId:e.moduleId})}),!0}else return typeof this._subscribers[e.type]>"u"&&(this._subscribers[e.type]=[]),this._subscribers[e.type].length<=0||this._subscribers[e.type].forEach(t=>{t(e.data,{type:e.type})}),!0}broadcastMessage(e){const t=e.module_id=e.module_id.toLowerCase(),s=e.command;e.extra||(e.extra={}),e.extra.server_time_unix&&(e.extra.server_time_ago=(Date.now()-e.extra.server_time_unix*1e3)/1e3-(this._config?.server.timeShift||0),e.extra.server_time_ago=Math.max(e.extra.server_time_ago,0)),this.logMessage(e);try{e.extra.sender&&e.extra.sender.type===ns.Client?(this.onCustomEvent("onPullClientEvent-"+t,[s,e.params,e.extra],!0),this.onCustomEvent("onPullClientEvent",[t,s,e.params,e.extra],!0),this.emit({type:Ye.Client,moduleId:t,data:{command:s,params:M.clone(e.params),extra:M.clone(e.extra)}})):t==="pull"?this.handleInternalPullEvent(s,e):t=="online"?((e?.extra?.server_time_ago||0)<240&&(this.onCustomEvent("onPullOnlineEvent",[s,e.params,e.extra],!0),this.emit({type:Ye.Online,data:{command:s,params:M.clone(e.params),extra:M.clone(e.extra)}})),s==="userStatusChange"&&this.emitUserStatusChange(e.params.user_id,e.params.online)):(this.onCustomEvent("onPullEvent-"+t,[s,e.params,e.extra],!0),this.onCustomEvent("onPullEvent",[t,s,e.params,e.extra],!0),this.emit({type:Ye.Server,moduleId:t,data:{command:s,params:M.clone(e.params),extra:M.clone(e.extra)}}))}catch(n){this.getLogger().warning("PULL ERROR",{errorType:"broadcastMessages execute error",errorEvent:n,message:qe(e)}).catch(()=>{})}e.extra&&e.extra.revision_web&&this.checkRevision(K.toInteger(e.extra.revision_web))}broadcastMessages(e){for(const t of e)this.broadcastMessage(t)}async sendMessageBatch(e){if(!this.isPublishingEnabled())return this.getLogger().error("Client publishing is not supported or is disabled").catch(()=>{}),Promise.reject(new Error("Client publishing is not supported or is disabled"));if(this.isJsonRpc()){const t=this._jsonRpcAdapter?.createPublishRequest(e);return this.connector?.send(JSON.stringify(t)),Promise.resolve(!0)}else{const t={};for(const s of e)if(typeof s.userList<"u")for(const n of s.userList){const i=Number(n);t[i]=i}this._channelManager?.getPublicIds(Object.values(t)).then(s=>{const n=this.connector?.send(this.encodeMessageBatch(e,s));return Promise.resolve(n)})}}encodeMessageBatch(e,t){const s=[];e.forEach(i=>{const c=i.body;let o=[];if(i.userList&&(o=this.createMessageReceivers(i.userList,t)),i.channelList){if(!M.isArray(i.channelList))throw new TypeError("messageFields.publicChannels must be an array");i.channelList.forEach(h=>{let u,g;if(typeof h=="string"&&h.includes(".")){const p=h.toString().split(".");u=p[0],g=p[1]}else if(typeof h=="object"&&"publicId"in h&&"signature"in h)u=h?.publicId,g=h?.signature;else throw new Error(`Public channel MUST be either a string, formatted like "{publicId}.{signature}" or an object with fields 'publicId' and 'signature'`);o.push(Gc.create({id:this.encodeId(u),signature:this.encodeId(g)}))})}const l=K0.create({receivers:o,body:JSON.stringify(c),expiry:i.expiry||0});s.push(l)});const n=Kc.create({requests:[{incomingMessages:{messages:s}}]});return Kc.encode(n).finish()}createMessageReceivers(e,t){const s=[];for(const n of e){if(!t[n]||!t[n].publicId)throw new Error(`Could not determine public id for user ${n}`);s.push(Gc.create({id:this.encodeId(t[n].publicId),signature:this.encodeId(t[n].signature)}))}return s}emitUserStatusChange(e,t){if(this._userStatusCallbacks[e])for(const s of this._userStatusCallbacks[e])s({userId:e,isOnline:t})}restoreUserStatusSubscription(){for(const e in this._userStatusCallbacks)Object.prototype.hasOwnProperty.call(this._userStatusCallbacks,e)&&this._userStatusCallbacks[e].length>0&&this._jsonRpcAdapter?.executeOutgoingRpcCommand(dt.SubscribeStatusChange,{userId:e})}async loadConfig(e){if(this._config){if(this.isConfigActual(this._config)&&this.checkRevision(this._config.api.revision_web))return Promise.resolve(this._config);this._config=Object.assign({},rl)}else{this._config=Object.assign({},rl);let t;if(this._storage&&(t=this._storage.get(He.PullConfig,null)),this.isConfigActual(t)&&this.checkRevision(t.api.revision_web))return Promise.resolve(t);this._storage&&this._storage.remove(He.PullConfig)}return new Promise((t,s)=>{this._restClient.actions.v2.call.make({method:this._configGetMethod,params:{CACHE:"N"}}).then(n=>{const i=n.getData().result,c=Math.floor((Date.now()-new Date(i.serverTime).getTime())/1e3);delete i.serverTime;const o=Object.assign({},i);o.server.timeShift=c,t(o)}).catch(n=>{s(n)})})}isConfigActual(e){if(!M.isPlainObject(e)||Number(e.server.config_timestamp)!==this._configTimestamp)return!1;const t=new Date;if(M.isNumber(e.exp)&&e.exp>0&&e.exp<t.getTime()/1e3||Object.keys(e.channels).length===0)return!1;for(const s in e.channels){if(!Object.prototype.hasOwnProperty.call(e.channels,s))continue;const n=e.channels[s];if(new Date(n.end)<t)return!1}return!0}startCheckConfig(){this._disposed||(this._checkInterval&&(clearInterval(this._checkInterval),this._checkInterval=null),this._checkInterval=setInterval(this.checkConfig.bind(this),ob))}stopCheckConfig(){this._checkInterval&&clearInterval(this._checkInterval),this._checkInterval=null}checkConfig(){if(this.isConfigActual(this._config)){if(!this.checkRevision(K.toInteger(this._config?.api.revision_web)))return!1}else this.logToConsole("Stale config detected. Restarting"),this.restart(Pe.CONFIG_EXPIRED,"config expired");return!0}setConfig(e,t){for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&Object.prototype.hasOwnProperty.call(this._config,s)&&(this._config[s]=e[s]);if(e.publicChannels&&this.setPublicIds(Object.values(e.publicChannels)),this._configTimestamp=Number(e.server.config_timestamp),this._storage&&t&&!this._disposed)try{this._storage.set(He.PullConfig,e)}catch(s){typeof localStorage<"u"&&localStorage.removeItem&&localStorage.removeItem("history"),this.getLogger().error(`${K.getDateForLog()}: Pull: Could not cache config in local storage.`,{error:s}).catch(()=>{})}}setPublicIds(e){this._channelManager.setPublicIds(e)}checkRevision(e){return this._skipCheckRevision?!0:e>0&&e!==Pr?(this._enabled=!1,this.showNotification("PULL_OLD_REVISION"),this.disconnect(Pe.NORMAL_CLOSURE,"check_revision"),this.onCustomEvent("onPullRevisionUp",[e,Pr]),this.emit({type:Ye.Revision,data:{server:e,client:Pr}}),this.logToConsole(`Pull revision changed from ${Pr} to ${e}. Reload required`),!1):!0}disconnect(e,t){this.connector&&(this._isManualDisconnect=!0,this.connector.disconnect(e,t))}restoreWebSocketConnection(){this._connectionType!==fe.WebSocket&&this._connectors.webSocket?.connect()}scheduleReconnect(e=0){this._disposed||!this._enabled||(e||(e=this.getConnectionAttemptDelay(this._connectionAttempt)),this.logToConsole(`Pull: scheduling reconnection in ${e} seconds; attempt # ${this._connectionAttempt}`),this.armTimeout("_reconnectTimeout",()=>{this.connect().catch(t=>{this.getLogger().error("scheduleReconnect",{error:t}).catch(()=>{})})},e*1e3))}scheduleRestoreWebSocketConnection(){this._disposed||(this.logToConsole(`Pull: scheduling restoration of websocket connection in ${Xc} seconds`),!this._restoreWebSocketTimeout&&this.armTimeout("_restoreWebSocketTimeout",()=>{this._restoreWebSocketTimeout=null,this.restoreWebSocketConnection()},Xc*1e3))}async connect(){return this._disposed||!this._enabled?Promise.reject():this.connector?.connected?Promise.resolve():(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this.status=Ge.Connecting,this._connectionAttempt++,new Promise((e,t)=>{this._connectPromise={resolve:e,reject:t},this.connector?.connect()}))}scheduleRestart(e,t,s=0){this._disposed||(s<1&&(s=Math.ceil(Math.random()*30)+5),this.armTimeout("_restartTimeout",()=>this.restart(e,t),s*1e3))}handleRpcIncomingMessage(e){this._session.mid=e.mid;const t=e.body;return e.body.extra||(t.extra={}),t.extra.sender=e.sender,"user_params"in e&&M.isPlainObject(e.user_params)&&Object.assign(t.params,e.user_params),"dictionary"in e&&M.isPlainObject(e.dictionary)&&Object.assign(t.params,e.dictionary),this.checkDuplicate(e.mid)&&(this.addMessageToStat(t),this.trimDuplicates(),this.broadcastMessage(t)),this.connector?.send(`mack:${e.mid}`),{}}handleIncomingEvents(e){const t=[];if(e.length===0){this._session.mid=null;return}for(const s of e)this.updateSessionFromEvent(s),!(s.mid&&!this.checkDuplicate(s.mid))&&(this.addMessageToStat(s.text),t.push(s.text));this.trimDuplicates(),this.broadcastMessages(t)}updateSessionFromEvent(e){this._session.mid=e.mid||null,this._session.tag=e.tag||null,this._session.time=e.time||null}handleInternalPullEvent(e,t){switch(e.toUpperCase()){case Sr.CHANNEL_EXPIRE:{if(t.params.action==="reconnect"){const s=t.params?.channel.type;s==="private"&&this._config?.channels?.private&&(this._config.channels.private=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: [updated]`)),s==="shared"&&this._config?.channels?.shared&&(this._config.channels.shared=t.params.new_channel,this.logToConsole(`Pull: new config for ${t.params.channel.type} channel set: [updated]`)),this.reconnect(Pe.CONFIG_REPLACED,"config was replaced")}else this.restart(Pe.CHANNEL_EXPIRED,"channel expired received");break}case Sr.CONFIG_EXPIRE:{this.restart(Pe.CONFIG_EXPIRED,"config expired received");break}case Sr.SERVER_RESTART:{this.reconnect(Pe.SERVER_RESTARTED,"server was restarted",15);break}}}onIncomingMessage(e){if(this.isJsonRpc())e===ab?this.onJsonRpcPing():this._jsonRpcAdapter?.parseJsonRpcMessage(e);else{const t=this.extractMessages(e);this.handleIncomingEvents(t)}}onLongPollingOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Ge.Online,this.logToConsole("Pull: Long polling connection with push-server opened"),this.isWebSocketEnabled()&&this.scheduleRestoreWebSocketConnection(),this._connectPromise&&this._connectPromise.resolve({})}onLongPollingDisconnect(e){this._connectionType===fe.LongPolling&&(this.status=Ge.Offline),this.logToConsole(`Pull: Long polling connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`),this._isManualDisconnect||this.scheduleReconnect(),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onLongPollingError(e){this._starting=!1,this._connectionType===fe.LongPolling&&(this.status=Ge.Offline),this.getLogger().error(`${K.getDateForLog()}: Pull: Long polling connection error`,{error:e}).catch(()=>{}),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}onWebSocketBlockChanged(e){const t=e.isWebSocketBlocked;t&&this._connectionType===fe.WebSocket&&!this.isConnected()?(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._connectionAttempt=0,this._connectionType=fe.LongPolling,this.scheduleReconnect(1)):!t&&this._connectionType===fe.LongPolling&&(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this._connectionAttempt=0,this._connectionType=fe.WebSocket,this.scheduleReconnect(1))}onWebSocketOpen(){this._unloading=!1,this._starting=!1,this._connectionAttempt=0,this._isManualDisconnect=!1,this.status=Ge.Online,this._sharedConfig.setWebSocketBlocked(!1),this._sharedConfig.setLongPollingBlocked(!0),this._connectionType==fe.LongPolling&&(this._connectionType=fe.WebSocket,this._connectors.longPolling?.disconnect(Pe.CONFIG_REPLACED,"Fire at onWebSocketOpen")),this._restoreWebSocketTimeout&&(clearTimeout(this._restoreWebSocketTimeout),this._restoreWebSocketTimeout=null),this.logToConsole("Pull: Websocket connection with push-server opened"),this._connectPromise&&this._connectPromise.resolve({}),this.restoreUserStatusSubscription()}onWebSocketDisconnect(e){this._connectionType===fe.WebSocket&&(this.status=Ge.Offline),this.logToConsole(`Pull: Websocket connection with push-server closed. Code: ${e.code}, reason: ${e.reason}`,!0),this._isManualDisconnect||(e.code==Pe.WRONG_CHANNEL_ID?this.scheduleRestart(Pe.WRONG_CHANNEL_ID,"wrong channel signature"):this.scheduleReconnect()),this._sharedConfig.setLongPollingBlocked(!0),this._isManualDisconnect=!1,this.clearPingWaitTimeout()}onWebSocketError(e){this._starting=!1,this._connectionType===fe.WebSocket&&(this.status=Ge.Offline),this.getLogger().error(`${K.getDateForLog()}: Pull: WebSocket connection error`,{error:e}).catch(()=>{}),this.scheduleReconnect(),this._connectPromise&&this._connectPromise.reject(e),this.clearPingWaitTimeout()}extractMessages(e){if(e instanceof ArrayBuffer)return this.extractProtobufMessages(e);if(M.isStringFilled(e))return this.extractPlainTextMessages(e);throw new Error("Error pullEvent type")}extractProtobufMessages(e){const t=[];try{const s=J0.decode(new Uint8Array(e));for(let n=0;n<s.responses.length;n++){const i=s.responses[n];if(i.command!=="outgoingMessages")continue;const c=i.outgoingMessages.messages;for(const o of c){let l;try{l=JSON.parse(o.body)}catch(u){this.getLogger().error(`${K.getDateForLog()}: Pull: Could not parse message body`,{error:u}).catch(()=>{});continue}l.extra||(l.extra={}),l.extra.sender={type:o.sender.type},o.sender.id instanceof Uint8Array&&(l.extra.sender.id=this.decodeId(o.sender.id));const h={mid:this.decodeId(o.id),text:l};t.push(h)}}}catch(s){this.getLogger().error(`${K.getDateForLog()}: Pull: Could not parse message`,{error:s}).catch(()=>{})}return t}extractPlainTextMessages(e){const t=[],s=e.match(/#!NGINXNMS!#(.*?)#!NGINXNME!#/g);if(s===null)return this.getLogger().warning("PULL ERROR",{errorType:"parseResponse error parsing message",byteLength:e.length}).catch(()=>{}),[];for(let n=0;n<s.length;n++){if(s[n]=s[n].substring(12,s[n].length-12),s[n].length<=0)continue;let i;try{i=JSON.parse(s[n])}catch{continue}t.push(i)}return t}decodeId(e){let t="";for(const s of e){const n=s.toString(16);n.length===1&&(t+="0"),t+=n}return t}encodeId(e){if(!e)return new Uint8Array;const t=[];for(let s=0;s<e.length;s+=2)t.push(Number.parseInt(e.slice(s,s+2),16));return new Uint8Array(t)}onOffline(){this._disposed||this.disconnect(Pe.NORMAL_CLOSURE,"offline")}onOnline(){this._disposed||this.connect().catch(e=>{this.getLogger().error("onOnline",{error:e}).catch(()=>{})})}onBeforeUnload(){this._unloading=!0,this.persistSession(),this.scheduleReconnect(15)}persistSession(){const e=M.clone(this.session);if(e.ttl=Date.now()+lb*1e3,this._storage)try{this._storage.set(tl,JSON.stringify(e))}catch(t){this.getLogger().error(`${K.getDateForLog()}: Pull: Could not save session info in local storage. Error: `,{error:t}).catch(()=>{})}}sendPullStatusDelayed(e,t){this._disposed||this.armTimeout("_offlineTimeout",()=>{this._offlineTimeout=null,this.sendPullStatus(e)},t)}sendPullStatus(e){this._unloading||(this.onCustomEvent("onPullStatus",[e]),this.emit({type:Ye.Status,data:{status:e}}))}extendWatch(e,t=!1){this._watchTagsQueue.get(e)||(this._watchTagsQueue.set(e,!0),t&&this.updateWatch(t))}updateWatch(e=!1){this._disposed||this.armTimeout("_watchUpdateTimeout",()=>{const t=[...this._watchTagsQueue.keys()];t.length>0?this._restClient.actions.v2.call.make({method:"pull.watch.extend",params:{tags:t}}).then(s=>{const n=s.getData().result;for(const i of n)this.clearWatch(i);this.updateWatch()}).catch(()=>{this.updateWatch()}):this.updateWatch()},e?this._watchForceUpdateInterval:this._watchUpdateInterval)}clearWatch(e){this._watchTagsQueue.delete(e)}onJsonRpcPing(){this.updatePingWaitTimeout(),this.connector?.send(cb)}updatePingWaitTimeout(){this._disposed||this.armTimeout("_pingWaitTimeout",this._onPingTimeoutHandler,el*2*1e3)}clearPingWaitTimeout(){this._pingWaitTimeout&&clearTimeout(this._pingWaitTimeout),this._pingWaitTimeout=null}onPingTimeout(){this._pingWaitTimeout=null,!(this._disposed||!this._enabled||!this.isConnected())&&(this.getLogger().warning(`No pings are received in ${el*2} seconds. Reconnecting`).catch(()=>{}),this.disconnect(Pe.STUCK,"connection stuck"),this.scheduleReconnect())}getConnectionAttemptDelay(e){let t;return e<1?t=.5:e<3?t=15:e<5?t=45:e<10?t=600:t=3600,t+t*Math.random()*.2}checkDuplicate(e){return this._session.lastMessageIds.includes(e)?(this.getLogger().warning(`Duplicate message ${e} skipped`).catch(()=>{}),!1):(this._session.lastMessageIds.push(e),!0)}trimDuplicates(){this._session.lastMessageIds.length>Qc&&(this._session.lastMessageIds=this._session.lastMessageIds.slice(-Qc))}logMessage(e){this._debug&&(e.extra?.sender&&e.extra.sender.type===ns.Client?this.getLogger().info(`onPullClientEvent-${e.module_id}`,qe({command:e.command,params:e.params,extra:e.extra})).catch(()=>{}):e.module_id=="online"?this.getLogger().info("onPullOnlineEvent",qe({command:e.command,params:e.params,extra:e.extra})).catch(()=>{}):this.getLogger().info("onPullEvent",qe({moduleId:e.module_id,command:e.command,params:e.params,extra:e.extra})).catch(()=>{}))}logToConsole(e,t=!1){(this._loggingEnabled||t)&&this.getLogger().debug(`${K.getDateForLog()}: ${e}`).catch(()=>{})}addMessageToStat(e){this._session.history[e.module_id]||(this._session.history[e.module_id]={}),this._session.history[e.module_id][e.command]||(this.session.history[e.module_id][e.command]=0),this._session.history[e.module_id][e.command]++,this._session.messageCount++}showNotification(e){this.getLogger().notice(e).catch(()=>{})}onCustomEvent(e,t,s=!1){}}var ub=Object.defineProperty,hb=a((r,e)=>ub(r,"name",{value:e,configurable:!0}),"l$2");class nl{static{a(this,"B24HelperManager")}static{hb(this,"B24HelperManager")}_b24;_isInit=!1;_profile=null;_app=null;_payment=null;_license=null;_currency=null;_appOptions=null;_userOptions=null;_b24PullClient=null;_pullClientUnSubscribe=[];_pullClientModuleId="";_logger;constructor(e){this._logger=oe.createNullLogger(),this._b24=e}setLogger(e){this._logger=e,this._profile!==null&&this._profile.setLogger(this.getLogger()),this._app!==null&&this._app.setLogger(this.getLogger()),this._payment!==null&&this._payment.setLogger(this.getLogger()),this._license!==null&&this._license.setLogger(this.getLogger()),this._currency!==null&&this._currency.setLogger(this.getLogger()),this._appOptions!==null&&this._appOptions.setLogger(this.getLogger()),this._userOptions!==null&&this._userOptions.setLogger(this.getLogger())}getLogger(){return this._logger}destroy(){this._destroyPullClient()}async loadData(e=[he.App,he.Profile],t="helper-load-data"){const s={[he.App]:{method:"app.info"},[he.Profile]:{method:"profile"},[he.Currency]:[{method:"crm.currency.base.get"},{method:"crm.currency.list"}],[he.AppOptions]:{method:"app.option.get"},[he.UserOptions]:{method:"user.option.get"}},n=e.reduce((i,c)=>{if(s[c])if(Array.isArray(s[c]))for(const[o,l]of s[c].entries())i[`get_${c}_${o}`]=l;else i[`get_${c}`]=s[c];return i},{});try{const i=(await this._b24.actions.v2.batch.make({calls:n,options:{isHaltOnError:!0,returnAjaxResult:!1,requestId:t}})).getData();i[`get_${he.App}`]&&(this._app=await this.parseAppData(i[`get_${he.App}`]),this._payment=await this.parsePaymentData(i[`get_${he.App}`]),this._license=await this.parseLicenseData(i[`get_${he.App}`])),i[`get_${he.Profile}`]&&(this._profile=await this.parseUserData(i[`get_${he.Profile}`])),i[`get_${he.Currency}_0`]&&i[`get_${he.Currency}_1`]&&(this._currency=await this.parseCurrencyData({currencyBase:i[`get_${he.Currency}_0`],currencyList:i[`get_${he.Currency}_1`]})),i[`get_${he.AppOptions}`]&&(this._appOptions=await this.parseOptionsData("app",i[`get_${he.AppOptions}`])),i[`get_${he.UserOptions}`]&&(this._userOptions=await this.parseOptionsData("user",i[`get_${he.UserOptions}`])),this._isInit=!0}catch(i){throw i instanceof Error?i:(this.getLogger().error("Failed to load data",{error:i}).catch(()=>{}),new Error("Failed to load data",{cause:i}))}}async parseUserData(e){const t=new p0(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number(e.ID),isAdmin:e.ADMIN===!0,lastName:e?.LAST_NAME||"",name:e?.NAME||"",gender:e?.PERSONAL_GENDER||"",photo:e?.PERSONAL_PHOTO||"",TimeZone:e?.TIME_ZONE||"",TimeZoneOffset:e?.TIME_ZONE_OFFSET}).then(()=>t)}async parseAppData(e){const t=new y0(this._b24);return t.setLogger(this.getLogger()),t.initData({id:Number.parseInt(e.ID),code:e.CODE,version:Number.parseInt(e.VERSION),status:e.STATUS,isInstalled:e.INSTALLED}).then(()=>t)}async parsePaymentData(e){const t=new w0(this._b24);return t.setLogger(this.getLogger()),t.initData({isExpired:e.PAYMENT_EXPIRED==="Y",days:Number.parseInt(e.DAYS||"0")}).then(()=>t)}async parseLicenseData(e){const t=new E0(this._b24);return t.setLogger(this.getLogger()),t.initData({languageId:e.LANGUAGE_ID,license:e.LICENSE,licensePrevious:e.LICENSE_PREVIOUS,licenseType:e.LICENSE_TYPE,licenseFamily:e.LICENSE_FAMILY,isSelfHosted:e.LICENSE.includes("selfhosted")}).then(()=>t)}async parseCurrencyData(e){const t=new A0(this._b24);return t.setLogger(this.getLogger()),t.initData(e).then(()=>t)}async parseOptionsData(e,t){const s=new di(this._b24,e);return s.setLogger(this.getLogger()),s.initData(t).then(()=>s)}get isInit(){return this._isInit}get forB24Form(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");if(this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return{app_code:this.appInfo.data.code,app_status:this.appInfo.data.status,payment_expired:this.paymentInfo.data.isExpired?"Y":"N",days:this.paymentInfo.data.days,b24_plan:this.licenseInfo.data.license,c_name:this.profileInfo.data.name,c_last_name:this.profileInfo.data.lastName,hostname:this.hostName}}get hostName(){return this._b24.getTargetOrigin()}get profileInfo(){if(this.ensureInitialized(),this._profile===null)throw new Error("B24HelperManager.profileInfo not initialized");return this._profile}get appInfo(){if(this.ensureInitialized(),this._app===null)throw new Error("B24HelperManager.appInfo not initialized");return this._app}get paymentInfo(){if(this.ensureInitialized(),this._payment===null)throw new Error("B24HelperManager.paymentInfo not initialized");return this._payment}get licenseInfo(){if(this.ensureInitialized(),this._license===null)throw new Error("B24HelperManager.licenseInfo not initialized");return this._license}get currency(){if(this.ensureInitialized(),this._currency===null)throw new Error("B24HelperManager.currency not initialized");return this._currency}get appOptions(){if(this.ensureInitialized(),this._appOptions===null)throw new Error("B24HelperManager.appOptions not initialized");return this._appOptions}get userOptions(){if(this.ensureInitialized(),this._userOptions===null)throw new Error("B24HelperManager.userOptions not initialized");return this._userOptions}get isSelfHosted(){return this.licenseInfo.data.isSelfHosted}get primaryKeyIncrementValue(){return this.isSelfHosted?1:2}get b24SpecificUrl(){return this.isSelfHosted?{[Lt.MainSettings]:"/configs/",[Lt.UfList]:"/configs/userfield_list.php",[Lt.UfPage]:"/configs/userfield.php"}:{[Lt.MainSettings]:"/settings/configs/",[Lt.UfList]:"/settings/configs/userfield_list.php",[Lt.UfPage]:"/settings/configs/userfield.php"}}usePullClient(e="prefix",t){return this._b24PullClient?this:(this.initializePullClient(typeof t>"u"?this.profileInfo.data.id||0:t,e),this)}initializePullClient(e,t="prefix"){this._b24PullClient=new sl({b24:this._b24,restApplication:this._b24.auth.getUniq(t),userId:e})}subscribePullClient(e,t="application"){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId=t,this._pullClientUnSubscribe.push(this._b24PullClient.subscribe({moduleId:this._pullClientModuleId,callback:e})),this}startPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");this._b24PullClient.start().catch(e=>{this.getLogger().error(`${K.getDateForLog()}: Pull not running`,{error:e}).catch(()=>{})})}getModuleIdPullClient(){if(!this._b24PullClient)throw new Error("PullClient not init");return this._pullClientModuleId}_destroyPullClient(){for(const e of this._pullClientUnSubscribe)e();this._b24PullClient?.destroy(),this._b24PullClient=null}ensureInitialized(){if(!this._isInit)throw new Error("B24HelperManager not initialized")}}var db=Object.defineProperty,It=a((r,e)=>db(r,"name",{value:e,configurable:!0}),"l$1");const fb=It(()=>{let r=!1,e=!1,t=null;return{initB24Helper:It(async(s,n=[he.App,he.Profile],i="helper-load-data")=>(t===null&&(t=new nl(s)),r||(await t.loadData(n,i),r=!0),t),"initB24Helper"),isInitB24Helper:It(()=>r,"isInitB24Helper"),destroyB24Helper:It(()=>{t?.destroy(),t=null,r=!1,e=!1},"destroyB24Helper"),getB24Helper:It(()=>{if(t===null)throw new U({code:"JSSDK_HELPER_NOT_INIT",description:"B24HelperManager is not initialized. You need to call initB24Helper first.",status:0});return t},"getB24Helper"),usePullClient:It(()=>{if(t===null)throw new U({code:"JSSDK_HELPER_NOT_INIT",description:"B24HelperManager is not initialized. You need to call initB24Helper first.",status:0});t.usePullClient(),e=!0},"usePullClient"),useSubscribePullClient:It((s,n="application")=>{if(!e)throw new U({code:"JSSDK_HELPER_PULL_CLIENT_NOT_INIT",description:"PullClient is not initialized. You need to call usePullClient first.",status:0});t?.subscribePullClient(s,n)},"useSubscribePullClient"),startPullClient:It(()=>{if(!e)throw new U({code:"JSSDK_HELPER_PULL_CLIENT_NOT_INIT",description:"PullClient is not initialized. You need to call usePullClient first.",status:0});t?.startPullClient()},"startPullClient")}},"useB24Helper");var pb=Object.defineProperty,pi=a((r,e)=>pb(r,"name",{value:e,configurable:!0}),"a");let Mr=null;function il(){const r={DOMAIN:null,PROTOCOL:!1,APP_SID:null,LANG:null};if(window.name){const[e,t,s]=window.name.split("|");r.DOMAIN=e,r.PROTOCOL=Number.parseInt(t??"0")===1,r.APP_SID=s,r.LANG=null}return r}a(il,"l"),pi(il,"parseFrameQueryParams");async function ol(r){const e=il();if(!e.DOMAIN||!e.APP_SID)throw new U({code:"JSSDK_CLIENT_SIDE_WARNING",description:"Well done! Now paste this URL into the Bitrix24 app settings",status:500});const t=new Uc(e,r);try{await t.init()}catch(s){try{t.destroy()}catch{}throw s}return t}a(ol,"p"),pi(ol,"makeFrame");async function al(r){if(Mr!==null)return Mr;const e=ol(r);return Mr=e,e.catch(()=>{Mr===e&&(Mr=null)}),e}a(al,"initializeB24Frame"),pi(al,"initializeB24Frame"),I.AbstractB24=as,I.AbstractLogger=rn,I.AdaptiveDelayer=Oa,I.AjaxError=we,I.AjaxResult=vr,I.ApiVersion=ee,I.AppFrame=Dc,I.AuthHookManager=Cc,I.AuthManager=Pc,I.AuthOAuthManager=qc,I.B24Frame=Uc,I.B24HelperManager=nl,I.B24Hook=ui,I.B24LangList=ln,I.B24LocaleMap=kd,I.B24OAuth=u0,I.B24PullClientManager=sl,I.BatchRefV3=Py,I.Browser=aa,I.CatalogProductImageType=da,I.CatalogProductType=ha,I.CatalogRoundingRuleType=fa,I.CloseReasons=Pe,I.ConnectionType=fe,I.ConsolaAdapter=Wh,I.ConsoleHandler=Zo,I.ConsoleV2Handler=tn,I.DataType=Qo,I.DialogManager=$c,I.EnumAppStatus=yt,I.EnumBitrix24Edition=pa,I.EnumBizprocBaseType=ga,I.EnumBizprocDocumentType=ma,I.EnumCrmEntityType=ca,I.EnumCrmEntityTypeId=lt,I.EnumCrmEntityTypeShort=on,I.Environment=br,I.FilterV3=Ny,I.HttpV2=ws,I.HttpV3=Ss,I.JsonFormatter=wh,I.LineFormatter=Qr,I.ListRpcError=cn,I.LoadDataType=he,I.LogLevel=J,I.Logger=wr,I.LoggerBrowser=sn,I.LoggerFactory=oe,I.LoggerType=Xo,I.LsKeys=He,I.MemoryHandler=jh,I.MessageCommands=ce,I.MessageManager=Nc,I.NullLogger=_r,I.OperatingLimiter=Ea,I.OptionsManager=Fc,I.ParamsFactory=mn,I.ParentManager=Mc,I.PlacementManager=Bc,I.ProductRowDiscountTypeId=ua,I.PullStatus=Ge,I.RateLimiter=va,I.RefreshTokenError=Vc,I.RestrictionManager=Er,I.Result=Me,I.RpcMethod=dt,I.SdkError=U,I.SenderType=ns,I.ServerMode=an,I.SliderManager=jc,I.StatusDescriptions=wa,I.StreamHandler=Vh,I.SubscriptionType=Ye,I.SystemCommands=Sr,I.TelegramFormatter=Yo,I.TelegramHandler=Qh,I.Text=K,I.Type=M,I.TypeOption=bt,I.TypeSpecificUrl=Lt,I.WinstonAdapter=Kh,I.convertBizprocDocumentTypeToCrmEntityTypeId=ya,I.getDocumentId=ba,I.getDocumentType=ss,I.getDocumentTypeForFilter=_a,I.getEnumCrmEntityTypeShort=la,I.getEnumValue=ra,I.getEnvironment=es,I.initializeB24Frame=al,I.isArrayOfArray=ta,I.memoryUsageProcessor=Ch,I.omit=nn,I.pick=ea,I.pidProcessor=Ih,I.useB24Helper=fb,I.useFormatter=Ry,I.versionManager=tr}));
//# sourceMappingURL=index.min.js.map