bkper-js 2.33.0 → 2.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bkper.min.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var bkperjs=(()=>{var js=Object.create;var zt=Object.defineProperty;var zs=Object.getOwnPropertyDescriptor;var qs=Object.getOwnPropertyNames;var Zs=Object.getPrototypeOf,Ws=Object.prototype.hasOwnProperty;var Ys=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ks=(n,e)=>{for(var t in e)zt(n,t,{get:e[t],enumerable:!0})},_n=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of qs(e))!Ws.call(n,i)&&i!==t&&zt(n,i,{get:()=>e[i],enumerable:!(r=zs(e,i))||r.enumerable});return n};var Js=(n,e,t)=>(t=n!=null?js(Zs(n)):{},_n(e||!n||!n.__esModule?zt(t,"default",{value:n,enumerable:!0}):t,n)),Qs=n=>_n(zt({},"__esModule",{value:!0}),n);var ao=Ys(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});function ei(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function ie(n,e,t){return e&&ei(n.prototype,e),t&&ei(n,t),n}function K(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}function Fr(n){return Fr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Fr(n)}function Qt(n,e){return Qt=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Qt(n,e)}function ra(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(n){return!1}}function Yt(n,e,t){return ra()?Yt=Reflect.construct:Yt=function(i,o,s){var a=[null];a.push.apply(a,o);var c=Function.bind.apply(i,a),l=new c;return s&&Qt(l,s.prototype),l},Yt.apply(null,arguments)}function na(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Pr(n){var e=typeof Map=="function"?new Map:void 0;return Pr=function(r){if(r===null||!na(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return Yt(r,arguments,Fr(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Qt(i,r)},Pr(n)}function ia(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function oa(n,e){if(n){if(typeof n=="string")return ti(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ti(n,e)}}function ti(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Te(n){var e=0;if(typeof Symbol=="undefined"||n[Symbol.iterator]==null){if(Array.isArray(n)||(n=oa(n)))return function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}};throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return e=n[Symbol.iterator](),e.next.bind(e)}var Be=(function(n){K(e,n);function e(){return n.apply(this,arguments)||this}return e})(Pr(Error)),sa=(function(n){K(e,n);function e(t){return n.call(this,"Invalid DateTime: "+t.toMessage())||this}return e})(Be),aa=(function(n){K(e,n);function e(t){return n.call(this,"Invalid Interval: "+t.toMessage())||this}return e})(Be),ua=(function(n){K(e,n);function e(t){return n.call(this,"Invalid Duration: "+t.toMessage())||this}return e})(Be),kt=(function(n){K(e,n);function e(){return n.apply(this,arguments)||this}return e})(Be),Ci=(function(n){K(e,n);function e(t){return n.call(this,"Invalid unit "+t)||this}return e})(Be),W=(function(n){K(e,n);function e(){return n.apply(this,arguments)||this}return e})(Be),Ee=(function(n){K(e,n);function e(){return n.call(this,"Zone is an abstract class")||this}return e})(Be),h="numeric",oe="short",j="long",Xt={year:h,month:h,day:h},Hr={year:h,month:oe,day:h},Di={year:h,month:oe,day:h,weekday:oe},$r={year:h,month:j,day:h},jr={year:h,month:j,day:h,weekday:j},zr={hour:h,minute:h},qr={hour:h,minute:h,second:h},Zr={hour:h,minute:h,second:h,timeZoneName:oe},Wr={hour:h,minute:h,second:h,timeZoneName:j},Yr={hour:h,minute:h,hour12:!1},Kr={hour:h,minute:h,second:h,hour12:!1},Jr={hour:h,minute:h,second:h,hour12:!1,timeZoneName:oe},Qr={hour:h,minute:h,second:h,hour12:!1,timeZoneName:j},Xr={year:h,month:h,day:h,hour:h,minute:h},en={year:h,month:h,day:h,hour:h,minute:h,second:h},tn={year:h,month:oe,day:h,hour:h,minute:h},rn={year:h,month:oe,day:h,hour:h,minute:h,second:h},Si={year:h,month:oe,day:h,weekday:oe,hour:h,minute:h},nn={year:h,month:j,day:h,hour:h,minute:h,timeZoneName:oe},on={year:h,month:j,day:h,hour:h,minute:h,second:h,timeZoneName:oe},sn={year:h,month:j,day:h,weekday:j,hour:h,minute:h,timeZoneName:j},an={year:h,month:j,day:h,weekday:j,hour:h,minute:h,second:h,timeZoneName:j};function b(n){return typeof n=="undefined"}function Pe(n){return typeof n=="number"}function ir(n){return typeof n=="number"&&n%1===0}function la(n){return typeof n=="string"}function ca(n){return Object.prototype.toString.call(n)==="[object Date]"}function de(){try{return typeof Intl!="undefined"&&Intl.DateTimeFormat}catch(n){return!1}}function Mt(){return!b(Intl.DateTimeFormat.prototype.formatToParts)}function Ii(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(n){return!1}}function da(n){return Array.isArray(n)?n:[n]}function ri(n,e,t){if(n.length!==0)return n.reduce(function(r,i){var o=[e(i),i];return r&&t(r[0],o[0])===r[0]?r:o},null)[1]}function ki(n,e){return e.reduce(function(t,r){return t[r]=n[r],t},{})}function Qe(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function pe(n,e,t){return ir(n)&&n>=e&&n<=t}function fa(n,e){return n-e*Math.floor(n/e)}function Ke(n,e){e===void 0&&(e=2);var t=n<0?"-":"",r=t?n*-1:n,i;return r.toString().length<e?i=("0".repeat(e)+r).slice(-e):i=r.toString(),""+t+i}function V(n){if(!(b(n)||n===null||n===""))return parseInt(n,10)}function un(n){if(!(b(n)||n===null||n==="")){var e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function ln(n,e,t){t===void 0&&(t=!1);var r=Math.pow(10,e),i=t?Math.trunc:Math.round;return i(n*r)/r}function Ft(n){return n%4===0&&(n%100!==0||n%400===0)}function xt(n){return Ft(n)?366:365}function er(n,e){var t=fa(e-1,12)+1,r=n+(e-t)/12;return t===2?Ft(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function cn(n){var e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function tr(n){var e=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7,t=n-1,r=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||r===3?53:52}function Br(n){return n>99?n:n>60?1900+n:2e3+n}function Oi(n,e,t,r){r===void 0&&(r=null);var i=new Date(n),o={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);var s=Object.assign({timeZoneName:e},o),a=de();if(a&&Mt()){var c=new Intl.DateTimeFormat(t,s).formatToParts(i).find(function(p){return p.type.toLowerCase()==="timezonename"});return c?c.value:null}else if(a){var l=new Intl.DateTimeFormat(t,o).format(i),u=new Intl.DateTimeFormat(t,s).format(i),d=u.substring(l.length),f=d.replace(/^[, \u200e]+/,"");return f}else return null}function or(n,e){var t=parseInt(n,10);Number.isNaN(t)&&(t=0);var r=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-r:r;return t*60+i}function xi(n){var e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new W("Invalid unit value "+n);return e}function rr(n,e,t){var r={};for(var i in n)if(Qe(n,i)){if(t.indexOf(i)>=0)continue;var o=n[i];if(o==null)continue;r[e(i)]=xi(o)}return r}function nr(n,e){var t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),i=n>=0?"+":"-";switch(e){case"short":return""+i+Ke(t,2)+":"+Ke(r,2);case"narrow":return""+i+t+(r>0?":"+r:"");case"techie":return""+i+Ke(t,2)+Ke(r,2);default:throw new RangeError("Value format "+e+" is out of range for property format")}}function sr(n){return ki(n,["hour","minute","second","millisecond"])}var Ni=/[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/;function I(n){return JSON.stringify(n,Object.keys(n).sort())}var ha=["January","February","March","April","May","June","July","August","September","October","November","December"],Mi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],pa=["J","F","M","A","M","J","J","A","S","O","N","D"];function Fi(n){switch(n){case"narrow":return[].concat(pa);case"short":return[].concat(Mi);case"long":return[].concat(ha);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}}var Pi=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Bi=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ma=["M","T","W","T","F","S","S"];function _i(n){switch(n){case"narrow":return[].concat(ma);case"short":return[].concat(Bi);case"long":return[].concat(Pi);case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Ri=["AM","PM"],ga=["Before Christ","Anno Domini"],ya=["BC","AD"],va=["B","A"];function Li(n){switch(n){case"narrow":return[].concat(va);case"short":return[].concat(ya);case"long":return[].concat(ga);default:return null}}function wa(n){return Ri[n.hour<12?0:1]}function Ea(n,e){return _i(e)[n.weekday-1]}function Ta(n,e){return Fi(e)[n.month-1]}function ba(n,e){return Li(e)[n.year<0?0:1]}function Aa(n,e,t,r){t===void 0&&(t="always"),r===void 0&&(r=!1);var i={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."]},o=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&o){var s=n==="days";switch(e){case 1:return s?"tomorrow":"next "+i[n][0];case-1:return s?"yesterday":"last "+i[n][0];case 0:return s?"today":"this "+i[n][0]}}var a=Object.is(e,-0)||e<0,c=Math.abs(e),l=c===1,u=i[n],d=r?l?u[1]:u[2]||u[1]:l?i[n][0]:n;return a?c+" "+d+" ago":"in "+c+" "+d}function Ca(n){var e=ki(n,["weekday","era","year","month","day","hour","minute","second","timeZoneName","hour12"]),t=I(e),r="EEEE, LLLL d, yyyy, h:mm a";switch(t){case I(Xt):return"M/d/yyyy";case I(Hr):return"LLL d, yyyy";case I(Di):return"EEE, LLL d, yyyy";case I($r):return"LLLL d, yyyy";case I(jr):return"EEEE, LLLL d, yyyy";case I(zr):return"h:mm a";case I(qr):return"h:mm:ss a";case I(Zr):return"h:mm a";case I(Wr):return"h:mm a";case I(Yr):return"HH:mm";case I(Kr):return"HH:mm:ss";case I(Jr):return"HH:mm";case I(Qr):return"HH:mm";case I(Xr):return"M/d/yyyy, h:mm a";case I(tn):return"LLL d, yyyy, h:mm a";case I(nn):return"LLLL d, yyyy, h:mm a";case I(sn):return r;case I(en):return"M/d/yyyy, h:mm:ss a";case I(rn):return"LLL d, yyyy, h:mm:ss a";case I(Si):return"EEE, d LLL yyyy, h:mm a";case I(on):return"LLLL d, yyyy, h:mm:ss a";case I(an):return"EEEE, LLLL d, yyyy, h:mm:ss a";default:return r}}function ni(n,e){for(var t="",r=Te(n),i;!(i=r()).done;){var o=i.value;o.literal?t+=o.val:t+=e(o.val)}return t}var Da={D:Xt,DD:Hr,DDD:$r,DDDD:jr,t:zr,tt:qr,ttt:Zr,tttt:Wr,T:Yr,TT:Kr,TTT:Jr,TTTT:Qr,f:Xr,ff:tn,fff:nn,ffff:sn,F:en,FF:rn,FFF:on,FFFF:an},le=(function(){n.create=function(r,i){return i===void 0&&(i={}),new n(r,i)},n.parseFormat=function(r){for(var i=null,o="",s=!1,a=[],c=0;c<r.length;c++){var l=r.charAt(c);l==="'"?(o.length>0&&a.push({literal:s,val:o}),i=null,o="",s=!s):s||l===i?o+=l:(o.length>0&&a.push({literal:!1,val:o}),o=l,i=l)}return o.length>0&&a.push({literal:s,val:o}),a},n.macroTokenToFormatOpts=function(r){return Da[r]};function n(t,r){this.opts=r,this.loc=t,this.systemLoc=null}var e=n.prototype;return e.formatWithSystemDefault=function(r,i){this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem());var o=this.systemLoc.dtFormatter(r,Object.assign({},this.opts,i));return o.format()},e.formatDateTime=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.format()},e.formatDateTimeParts=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.formatToParts()},e.resolvedOptions=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.resolvedOptions()},e.num=function(r,i){if(i===void 0&&(i=0),this.opts.forceSimple)return Ke(r,i);var o=Object.assign({},this.opts);return i>0&&(o.padTo=i),this.loc.numberFormatter(o).format(r)},e.formatDateTimeFromString=function(r,i){var o=this,s=this.loc.listingMode()==="en",a=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory"&&Mt(),c=function(y,S){return o.loc.extract(r,y,S)},l=function(y){return r.isOffsetFixed&&r.offset===0&&y.allowZ?"Z":r.isValid?r.zone.formatOffset(r.ts,y.format):""},u=function(){return s?wa(r):c({hour:"numeric",hour12:!0},"dayperiod")},d=function(y,S){return s?Ta(r,y):c(S?{month:y}:{month:y,day:"numeric"},"month")},f=function(y,S){return s?Ea(r,y):c(S?{weekday:y}:{weekday:y,month:"long",day:"numeric"},"weekday")},p=function(y){var S=n.macroTokenToFormatOpts(y);return S?o.formatWithSystemDefault(r,S):y},g=function(y){return s?ba(r,y):c({era:y},"era")},v=function(y){switch(y){case"S":return o.num(r.millisecond);case"u":case"SSS":return o.num(r.millisecond,3);case"s":return o.num(r.second);case"ss":return o.num(r.second,2);case"m":return o.num(r.minute);case"mm":return o.num(r.minute,2);case"h":return o.num(r.hour%12===0?12:r.hour%12);case"hh":return o.num(r.hour%12===0?12:r.hour%12,2);case"H":return o.num(r.hour);case"HH":return o.num(r.hour,2);case"Z":return l({format:"narrow",allowZ:o.opts.allowZ});case"ZZ":return l({format:"short",allowZ:o.opts.allowZ});case"ZZZ":return l({format:"techie",allowZ:o.opts.allowZ});case"ZZZZ":return r.zone.offsetName(r.ts,{format:"short",locale:o.loc.locale});case"ZZZZZ":return r.zone.offsetName(r.ts,{format:"long",locale:o.loc.locale});case"z":return r.zoneName;case"a":return u();case"d":return a?c({day:"numeric"},"day"):o.num(r.day);case"dd":return a?c({day:"2-digit"},"day"):o.num(r.day,2);case"c":return o.num(r.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return o.num(r.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return a?c({month:"numeric",day:"numeric"},"month"):o.num(r.month);case"LL":return a?c({month:"2-digit",day:"numeric"},"month"):o.num(r.month,2);case"LLL":return d("short",!0);case"LLLL":return d("long",!0);case"LLLLL":return d("narrow",!0);case"M":return a?c({month:"numeric"},"month"):o.num(r.month);case"MM":return a?c({month:"2-digit"},"month"):o.num(r.month,2);case"MMM":return d("short",!1);case"MMMM":return d("long",!1);case"MMMMM":return d("narrow",!1);case"y":return a?c({year:"numeric"},"year"):o.num(r.year);case"yy":return a?c({year:"2-digit"},"year"):o.num(r.year.toString().slice(-2),2);case"yyyy":return a?c({year:"numeric"},"year"):o.num(r.year,4);case"yyyyyy":return a?c({year:"numeric"},"year"):o.num(r.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return o.num(r.weekYear.toString().slice(-2),2);case"kkkk":return o.num(r.weekYear,4);case"W":return o.num(r.weekNumber);case"WW":return o.num(r.weekNumber,2);case"o":return o.num(r.ordinal);case"ooo":return o.num(r.ordinal,3);case"q":return o.num(r.quarter);case"qq":return o.num(r.quarter,2);case"X":return o.num(Math.floor(r.ts/1e3));case"x":return o.num(r.ts);default:return p(y)}};return ni(n.parseFormat(i),v)},e.formatDurationFromString=function(r,i){var o=this,s=function(f){switch(f[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"M":return"month";case"y":return"year";default:return null}},a=function(f){return function(p){var g=s(p);return g?o.num(f.get(g),p.length):p}},c=n.parseFormat(i),l=c.reduce(function(d,f){var p=f.literal,g=f.val;return p?d:d.concat(g)},[]),u=r.shiftTo.apply(r,l.map(s).filter(function(d){return d}));return ni(c,a(u))},n})(),ne=(function(){function n(t,r){this.reason=t,this.explanation=r}var e=n.prototype;return e.toMessage=function(){return this.explanation?this.reason+": "+this.explanation:this.reason},n})(),Xe=(function(){function n(){}var e=n.prototype;return e.offsetName=function(r,i){throw new Ee},e.formatOffset=function(r,i){throw new Ee},e.offset=function(r){throw new Ee},e.equals=function(r){throw new Ee},ie(n,[{key:"type",get:function(){throw new Ee}},{key:"name",get:function(){throw new Ee}},{key:"universal",get:function(){throw new Ee}},{key:"isValid",get:function(){throw new Ee}}]),n})(),Sr=null,Ui=(function(n){K(e,n);function e(){return n.apply(this,arguments)||this}var t=e.prototype;return t.offsetName=function(i,o){var s=o.format,a=o.locale;return Oi(i,s,a)},t.formatOffset=function(i,o){return nr(this.offset(i),o)},t.offset=function(i){return-new Date(i).getTimezoneOffset()},t.equals=function(i){return i.type==="local"},ie(e,[{key:"type",get:function(){return"local"}},{key:"name",get:function(){return de()?new Intl.DateTimeFormat().resolvedOptions().timeZone:"local"}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!0}}],[{key:"instance",get:function(){return Sr===null&&(Sr=new e),Sr}}]),e})(Xe),Sa=RegExp("^"+Ni.source+"$"),Kt={};function Ia(n){return Kt[n]||(Kt[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Kt[n]}var ka={year:0,month:1,day:2,hour:3,minute:4,second:5};function Oa(n,e){var t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t),i=r[1],o=r[2],s=r[3],a=r[4],c=r[5],l=r[6];return[s,i,o,a,c,l]}function xa(n,e){for(var t=n.formatToParts(e),r=[],i=0;i<t.length;i++){var o=t[i],s=o.type,a=o.value,c=ka[s];b(c)||(r[c]=parseInt(a,10))}return r}var qt={},ce=(function(n){K(e,n),e.create=function(i){return qt[i]||(qt[i]=new e(i)),qt[i]},e.resetCache=function(){qt={},Kt={}},e.isValidSpecifier=function(i){return!!(i&&i.match(Sa))},e.isValidZone=function(i){try{return new Intl.DateTimeFormat("en-US",{timeZone:i}).format(),!0}catch(o){return!1}},e.parseGMTOffset=function(i){if(i){var o=i.match(/^Etc\/GMT(0|[+-]\d{1,2})$/i);if(o)return-60*parseInt(o[1])}return null};function e(r){var i;return i=n.call(this)||this,i.zoneName=r,i.valid=e.isValidZone(r),i}var t=e.prototype;return t.offsetName=function(i,o){var s=o.format,a=o.locale;return Oi(i,s,a,this.name)},t.formatOffset=function(i,o){return nr(this.offset(i),o)},t.offset=function(i){var o=new Date(i);if(isNaN(o))return NaN;var s=Ia(this.name),a=s.formatToParts?xa(s,o):Oa(s,o),c=a[0],l=a[1],u=a[2],d=a[3],f=a[4],p=a[5],g=d===24?0:d,v=cn({year:c,month:l,day:u,hour:g,minute:f,second:p,millisecond:0}),w=+o,y=w%1e3;return w-=y>=0?y:1e3+y,(v-w)/(60*1e3)},t.equals=function(i){return i.type==="iana"&&i.name===this.name},ie(e,[{key:"type",get:function(){return"iana"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return this.valid}}]),e})(Xe),Ir=null,$=(function(n){K(e,n),e.instance=function(i){return i===0?e.utcInstance:new e(i)},e.parseSpecifier=function(i){if(i){var o=i.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(o)return new e(or(o[1],o[2]))}return null},ie(e,null,[{key:"utcInstance",get:function(){return Ir===null&&(Ir=new e(0)),Ir}}]);function e(r){var i;return i=n.call(this)||this,i.fixed=r,i}var t=e.prototype;return t.offsetName=function(){return this.name},t.formatOffset=function(i,o){return nr(this.fixed,o)},t.offset=function(){return this.fixed},t.equals=function(i){return i.type==="fixed"&&i.fixed===this.fixed},ie(e,[{key:"type",get:function(){return"fixed"}},{key:"name",get:function(){return this.fixed===0?"UTC":"UTC"+nr(this.fixed,"narrow")}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e})(Xe),_r=(function(n){K(e,n);function e(r){var i;return i=n.call(this)||this,i.zoneName=r,i}var t=e.prototype;return t.offsetName=function(){return null},t.formatOffset=function(){return""},t.offset=function(){return NaN},t.equals=function(){return!1},ie(e,[{key:"type",get:function(){return"invalid"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!1}}]),e})(Xe);function Me(n,e){var t;if(b(n)||n===null)return e;if(n instanceof Xe)return n;if(la(n)){var r=n.toLowerCase();return r==="local"?e:r==="utc"||r==="gmt"?$.utcInstance:(t=ce.parseGMTOffset(n))!=null?$.instance(t):ce.isValidSpecifier(r)?ce.create(n):$.parseSpecifier(r)||new _r(n)}else return Pe(n)?$.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new _r(n)}var ii=function(){return Date.now()},kr=null,oi=null,si=null,ai=null,ui=!1,x=(function(){function n(){}return n.resetCaches=function(){B.resetCache(),ce.resetCache()},ie(n,null,[{key:"now",get:function(){return ii},set:function(t){ii=t}},{key:"defaultZoneName",get:function(){return n.defaultZone.name},set:function(t){t?kr=Me(t):kr=null}},{key:"defaultZone",get:function(){return kr||Ui.instance}},{key:"defaultLocale",get:function(){return oi},set:function(t){oi=t}},{key:"defaultNumberingSystem",get:function(){return si},set:function(t){si=t}},{key:"defaultOutputCalendar",get:function(){return ai},set:function(t){ai=t}},{key:"throwOnInvalid",get:function(){return ui},set:function(t){ui=t}}]),n})(),Rr={};function Lr(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=Rr[t];return r||(r=new Intl.DateTimeFormat(n,e),Rr[t]=r),r}var Ur={};function Na(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=Ur[t];return r||(r=new Intl.NumberFormat(n,e),Ur[t]=r),r}var Gr={};function Ma(n,e){e===void 0&&(e={});var t=e,r=t.base,i=ia(t,["base"]),o=JSON.stringify([n,i]),s=Gr[o];return s||(s=new Intl.RelativeTimeFormat(n,e),Gr[o]=s),s}var Ne=null;function Fa(){if(Ne)return Ne;if(de()){var n=new Intl.DateTimeFormat().resolvedOptions().locale;return Ne=!n||n==="und"?"en-US":n,Ne}else return Ne="en-US",Ne}function Pa(n){var e=n.indexOf("-u-");if(e===-1)return[n];var t,r=n.substring(0,e);try{t=Lr(n).resolvedOptions()}catch(a){t=Lr(r).resolvedOptions()}var i=t,o=i.numberingSystem,s=i.calendar;return[r,o,s]}function Ba(n,e,t){return de()?((t||e)&&(n+="-u",t&&(n+="-ca-"+t),e&&(n+="-nu-"+e)),n):[]}function _a(n){for(var e=[],t=1;t<=12;t++){var r=M.utc(2016,t,1);e.push(n(r))}return e}function Ra(n){for(var e=[],t=1;t<=7;t++){var r=M.utc(2016,11,13+t);e.push(n(r))}return e}function Zt(n,e,t,r,i){var o=n.listingMode(t);return o==="error"?null:o==="en"?r(e):i(e)}function La(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||de()&&new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}var Ua=(function(){function n(t,r,i){if(this.padTo=i.padTo||0,this.floor=i.floor||!1,!r&&de()){var o={useGrouping:!1};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=Na(t,o)}}var e=n.prototype;return e.format=function(r){if(this.inf){var i=this.floor?Math.floor(r):r;return this.inf.format(i)}else{var o=this.floor?Math.floor(r):ln(r,3);return Ke(o,this.padTo)}},n})(),Ga=(function(){function n(t,r,i){this.opts=i,this.hasIntl=de();var o;if(t.zone.universal&&this.hasIntl){var s=-1*(t.offset/60),a=s>=0?"Etc/GMT+"+s:"Etc/GMT"+s,c=ce.isValidZone(a);t.offset!==0&&c?(o=a,this.dt=t):(o="UTC",i.timeZoneName?this.dt=t:this.dt=t.offset===0?t:M.fromMillis(t.ts+t.offset*60*1e3))}else t.zone.type==="local"?this.dt=t:(this.dt=t,o=t.zone.name);if(this.hasIntl){var l=Object.assign({},this.opts);o&&(l.timeZone=o),this.dtf=Lr(r,l)}}var e=n.prototype;return e.format=function(){if(this.hasIntl)return this.dtf.format(this.dt.toJSDate());var r=Ca(this.opts),i=B.create("en-US");return le.create(i).formatDateTimeFromString(this.dt,r)},e.formatToParts=function(){return this.hasIntl&&Mt()?this.dtf.formatToParts(this.dt.toJSDate()):[]},e.resolvedOptions=function(){return this.hasIntl?this.dtf.resolvedOptions():{locale:"en-US",numberingSystem:"latn",outputCalendar:"gregory"}},n})(),Va=(function(){function n(t,r,i){this.opts=Object.assign({style:"long"},i),!r&&Ii()&&(this.rtf=Ma(t,i))}var e=n.prototype;return e.format=function(r,i){return this.rtf?this.rtf.format(r,i):Aa(i,r,this.opts.numeric,this.opts.style!=="long")},e.formatToParts=function(r,i){return this.rtf?this.rtf.formatToParts(r,i):[]},n})(),B=(function(){n.fromOpts=function(r){return n.create(r.locale,r.numberingSystem,r.outputCalendar,r.defaultToEN)},n.create=function(r,i,o,s){s===void 0&&(s=!1);var a=r||x.defaultLocale,c=a||(s?"en-US":Fa()),l=i||x.defaultNumberingSystem,u=o||x.defaultOutputCalendar;return new n(c,l,u,a)},n.resetCache=function(){Ne=null,Rr={},Ur={},Gr={}},n.fromObject=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.outputCalendar;return n.create(o,s,a)};function n(t,r,i,o){var s=Pa(t),a=s[0],c=s[1],l=s[2];this.locale=a,this.numberingSystem=r||c||null,this.outputCalendar=i||l||null,this.intl=Ba(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}var e=n.prototype;return e.listingMode=function(r){r===void 0&&(r=!0);var i=de(),o=i&&Mt(),s=this.isEnglish(),a=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return!o&&!(s&&a)&&!r?"error":!o||s&&a?"en":"intl"},e.clone=function(r){return!r||Object.getOwnPropertyNames(r).length===0?this:n.create(r.locale||this.specifiedLocale,r.numberingSystem||this.numberingSystem,r.outputCalendar||this.outputCalendar,r.defaultToEN||!1)},e.redefaultToEN=function(r){return r===void 0&&(r={}),this.clone(Object.assign({},r,{defaultToEN:!0}))},e.redefaultToSystem=function(r){return r===void 0&&(r={}),this.clone(Object.assign({},r,{defaultToEN:!1}))},e.months=function(r,i,o){var s=this;return i===void 0&&(i=!1),o===void 0&&(o=!0),Zt(this,r,o,Fi,function(){var a=i?{month:r,day:"numeric"}:{month:r},c=i?"format":"standalone";return s.monthsCache[c][r]||(s.monthsCache[c][r]=_a(function(l){return s.extract(l,a,"month")})),s.monthsCache[c][r]})},e.weekdays=function(r,i,o){var s=this;return i===void 0&&(i=!1),o===void 0&&(o=!0),Zt(this,r,o,_i,function(){var a=i?{weekday:r,year:"numeric",month:"long",day:"numeric"}:{weekday:r},c=i?"format":"standalone";return s.weekdaysCache[c][r]||(s.weekdaysCache[c][r]=Ra(function(l){return s.extract(l,a,"weekday")})),s.weekdaysCache[c][r]})},e.meridiems=function(r){var i=this;return r===void 0&&(r=!0),Zt(this,void 0,r,function(){return Ri},function(){if(!i.meridiemCache){var o={hour:"numeric",hour12:!0};i.meridiemCache=[M.utc(2016,11,13,9),M.utc(2016,11,13,19)].map(function(s){return i.extract(s,o,"dayperiod")})}return i.meridiemCache})},e.eras=function(r,i){var o=this;return i===void 0&&(i=!0),Zt(this,r,i,Li,function(){var s={era:r};return o.eraCache[r]||(o.eraCache[r]=[M.utc(-40,1,1),M.utc(2017,1,1)].map(function(a){return o.extract(a,s,"era")})),o.eraCache[r]})},e.extract=function(r,i,o){var s=this.dtFormatter(r,i),a=s.formatToParts(),c=a.find(function(l){return l.type.toLowerCase()===o});return c?c.value:null},e.numberFormatter=function(r){return r===void 0&&(r={}),new Ua(this.intl,r.forceSimple||this.fastNumbers,r)},e.dtFormatter=function(r,i){return i===void 0&&(i={}),new Ga(r,this.intl,i)},e.relFormatter=function(r){return r===void 0&&(r={}),new Va(this.intl,this.isEnglish(),r)},e.isEnglish=function(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||de()&&new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")},e.equals=function(r){return this.locale===r.locale&&this.numberingSystem===r.numberingSystem&&this.outputCalendar===r.outputCalendar},ie(n,[{key:"fastNumbers",get:function(){return this.fastNumbersCached==null&&(this.fastNumbersCached=La(this)),this.fastNumbersCached}}]),n})();function et(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];var r=e.reduce(function(i,o){return i+o.source},"");return RegExp("^"+r+"$")}function _e(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(r){return e.reduce(function(i,o){var s=i[0],a=i[1],c=i[2],l=o(r,c),u=l[0],d=l[1],f=l[2];return[Object.assign(s,u),a||d,f]},[{},null,1]).slice(0,2)}}function tt(n){if(n==null)return[null,null];for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];for(var i=0,o=t;i<o.length;i++){var s=o[i],a=s[0],c=s[1],l=a.exec(n);if(l)return c(l)}return[null,null]}function Gi(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(r,i){var o={},s;for(s=0;s<e.length;s++)o[e[s]]=V(r[i+s]);return[o,null,i+s]}}var Vi=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,dn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Hi=RegExp(""+dn.source+Vi.source+"?"),fn=RegExp("(?:T"+Hi.source+")?"),Ha=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,$a=/(\d{4})-?W(\d\d)(?:-?(\d))?/,ja=/(\d{4})-?(\d{3})/,za=Gi("weekYear","weekNumber","weekDay"),qa=Gi("year","ordinal"),Za=/(\d{4})-(\d\d)-(\d\d)/,$i=RegExp(dn.source+" ?(?:"+Vi.source+"|("+Ni.source+"))?"),Wa=RegExp("(?: "+$i.source+")?");function Je(n,e,t){var r=n[e];return b(r)?t:V(r)}function ji(n,e){var t={year:Je(n,e),month:Je(n,e+1,1),day:Je(n,e+2,1)};return[t,null,e+3]}function Re(n,e){var t={hours:Je(n,e,0),minutes:Je(n,e+1,0),seconds:Je(n,e+2,0),milliseconds:un(n[e+3])};return[t,null,e+4]}function rt(n,e){var t=!n[e]&&!n[e+1],r=or(n[e+1],n[e+2]),i=t?null:$.instance(r);return[{},i,e+3]}function zi(n,e){var t=n[e]?ce.create(n[e]):null;return[{},t,e+1]}var Ya=RegExp("^T?"+dn.source+"$"),Ka=/^-?P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,9}))?S)?)?)$/;function Ja(n){var e=n[0],t=n[1],r=n[2],i=n[3],o=n[4],s=n[5],a=n[6],c=n[7],l=n[8],u=e[0]==="-",d=c&&c[0]==="-",f=function(g,v){return v===void 0&&(v=!1),g!==void 0&&(v||g&&u)?-g:g};return[{years:f(V(t)),months:f(V(r)),weeks:f(V(i)),days:f(V(o)),hours:f(V(s)),minutes:f(V(a)),seconds:f(V(c),c==="-0"),milliseconds:f(un(l),d)}]}var Qa={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function hn(n,e,t,r,i,o,s){var a={year:e.length===2?Br(V(e)):V(e),month:Mi.indexOf(t)+1,day:V(r),hour:V(i),minute:V(o)};return s&&(a.second=V(s)),n&&(a.weekday=n.length>3?Pi.indexOf(n)+1:Bi.indexOf(n)+1),a}var Xa=/^(?:(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 eu(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=n[8],l=n[9],u=n[10],d=n[11],f=hn(e,i,r,t,o,s,a),p;return c?p=Qa[c]:l?p=0:p=or(u,d),[f,new $(p)]}function tu(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var ru=/^(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$/,nu=/^(Monday|Tuesday|Wedsday|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$/,iu=/^(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 li(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=hn(e,i,r,t,o,s,a);return[c,$.utcInstance]}function ou(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=hn(e,a,t,r,i,o,s);return[c,$.utcInstance]}var su=et(Ha,fn),au=et($a,fn),uu=et(ja,fn),lu=et(Hi),cu=_e(ji,Re,rt),du=_e(za,Re,rt),fu=_e(qa,Re,rt),hu=_e(Re,rt);function pu(n){return tt(n,[su,cu],[au,du],[uu,fu],[lu,hu])}function mu(n){return tt(tu(n),[Xa,eu])}function gu(n){return tt(n,[ru,li],[nu,li],[iu,ou])}function yu(n){return tt(n,[Ka,Ja])}var vu=_e(Re);function wu(n){return tt(n,[Ya,vu])}var Eu=et(Za,Wa),Tu=et($i),bu=_e(ji,Re,rt,zi),Au=_e(Re,rt,zi);function Cu(n){return tt(n,[Eu,bu],[Tu,Au])}var Du="Invalid Duration",qi={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}},Su=Object.assign({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}},qi),Z=146097/400,Ze=146097/4800,Iu=Object.assign({years:{quarters:4,months:12,weeks:Z/7,days:Z,hours:Z*24,minutes:Z*24*60,seconds:Z*24*60*60,milliseconds:Z*24*60*60*1e3},quarters:{months:3,weeks:Z/28,days:Z/4,hours:Z*24/4,minutes:Z*24*60/4,seconds:Z*24*60*60/4,milliseconds:Z*24*60*60*1e3/4},months:{weeks:Ze/7,days:Ze,hours:Ze*24,minutes:Ze*24*60,seconds:Ze*24*60*60,milliseconds:Ze*24*60*60*1e3}},qi),We=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],ku=We.slice(0).reverse();function xe(n,e,t){t===void 0&&(t=!1);var r={values:t?e.values:Object.assign({},n.values,e.values||{}),loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy};return new H(r)}function Ou(n){return n<0?Math.floor(n):Math.ceil(n)}function Zi(n,e,t,r,i){var o=n[i][t],s=e[t]/o,a=Math.sign(s)===Math.sign(r[i]),c=!a&&r[i]!==0&&Math.abs(s)<=1?Ou(s):Math.trunc(s);r[i]+=c,e[t]-=c*o}function xu(n,e){ku.reduce(function(t,r){return b(e[r])?t:(t&&Zi(n,e,t,e,r),r)},null)}var H=(function(){function n(t){var r=t.conversionAccuracy==="longterm"||!1;this.values=t.values,this.loc=t.loc||B.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=r?Iu:Su,this.isLuxonDuration=!0}n.fromMillis=function(r,i){return n.fromObject(Object.assign({milliseconds:r},i))},n.fromObject=function(r){if(r==null||typeof r!="object")throw new W("Duration.fromObject: argument expected to be an object, got "+(r===null?"null":typeof r));return new n({values:rr(r,n.normalizeUnit,["locale","numberingSystem","conversionAccuracy","zone"]),loc:B.fromObject(r),conversionAccuracy:r.conversionAccuracy})},n.fromISO=function(r,i){var o=yu(r),s=o[0];if(s){var a=Object.assign(s,i);return n.fromObject(a)}else return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.fromISOTime=function(r,i){var o=wu(r),s=o[0];if(s){var a=Object.assign(s,i);return n.fromObject(a)}else return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new W("need to specify a reason the Duration is invalid");var o=r instanceof ne?r:new ne(r,i);if(x.throwOnInvalid)throw new ua(o);return new n({invalid:o})},n.normalizeUnit=function(r){var i={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"}[r&&r.toLowerCase()];if(!i)throw new Ci(r);return i},n.isDuration=function(r){return r&&r.isLuxonDuration||!1};var e=n.prototype;return e.toFormat=function(r,i){i===void 0&&(i={});var o=Object.assign({},i,{floor:i.round!==!1&&i.floor!==!1});return this.isValid?le.create(this.loc,o).formatDurationFromString(this,r):Du},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var i=Object.assign({},this.values);return r.includeConfig&&(i.conversionAccuracy=this.conversionAccuracy,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale),i},e.toISO=function(){if(!this.isValid)return null;var r="P";return this.years!==0&&(r+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(r+=this.months+this.quarters*3+"M"),this.weeks!==0&&(r+=this.weeks+"W"),this.days!==0&&(r+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(r+="T"),this.hours!==0&&(r+=this.hours+"H"),this.minutes!==0&&(r+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(r+=ln(this.seconds+this.milliseconds/1e3,3)+"S"),r==="P"&&(r+="T0S"),r},e.toISOTime=function(r){if(r===void 0&&(r={}),!this.isValid)return null;var i=this.toMillis();if(i<0||i>=864e5)return null;r=Object.assign({suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended"},r);var o=this.shiftTo("hours","minutes","seconds","milliseconds"),s=r.format==="basic"?"hhmm":"hh:mm";(!r.suppressSeconds||o.seconds!==0||o.milliseconds!==0)&&(s+=r.format==="basic"?"ss":":ss",(!r.suppressMilliseconds||o.milliseconds!==0)&&(s+=".SSS"));var a=o.toFormat(s);return r.includePrefix&&(a="T"+a),a},e.toJSON=function(){return this.toISO()},e.toString=function(){return this.toISO()},e.toMillis=function(){return this.as("milliseconds")},e.valueOf=function(){return this.toMillis()},e.plus=function(r){if(!this.isValid)return this;for(var i=Fe(r),o={},s=Te(We),a;!(a=s()).done;){var c=a.value;(Qe(i.values,c)||Qe(this.values,c))&&(o[c]=i.get(c)+this.get(c))}return xe(this,{values:o},!0)},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r);return this.plus(i.negate())},e.mapUnits=function(r){if(!this.isValid)return this;for(var i={},o=0,s=Object.keys(this.values);o<s.length;o++){var a=s[o];i[a]=xi(r(this.values[a],a))}return xe(this,{values:i},!0)},e.get=function(r){return this[n.normalizeUnit(r)]},e.set=function(r){if(!this.isValid)return this;var i=Object.assign(this.values,rr(r,n.normalizeUnit,[]));return xe(this,{values:i})},e.reconfigure=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.conversionAccuracy,c=this.loc.clone({locale:o,numberingSystem:s}),l={loc:c};return a&&(l.conversionAccuracy=a),xe(this,l)},e.as=function(r){return this.isValid?this.shiftTo(r).get(r):NaN},e.normalize=function(){if(!this.isValid)return this;var r=this.toObject();return xu(this.matrix,r),xe(this,{values:r},!0)},e.shiftTo=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!this.isValid)return this;if(i.length===0)return this;i=i.map(function(S){return n.normalizeUnit(S)});for(var s={},a={},c=this.toObject(),l,u=Te(We),d;!(d=u()).done;){var f=d.value;if(i.indexOf(f)>=0){l=f;var p=0;for(var g in a)p+=this.matrix[g][f]*a[g],a[g]=0;Pe(c[f])&&(p+=c[f]);var v=Math.trunc(p);s[f]=v,a[f]=p-v;for(var w in c)We.indexOf(w)>We.indexOf(f)&&Zi(this.matrix,c,w,s,f)}else Pe(c[f])&&(a[f]=c[f])}for(var y in a)a[y]!==0&&(s[l]+=y===l?a[y]:a[y]/this.matrix[l][y]);return xe(this,{values:s},!0).normalize()},e.negate=function(){if(!this.isValid)return this;for(var r={},i=0,o=Object.keys(this.values);i<o.length;i++){var s=o[i];r[s]=-this.values[s]}return xe(this,{values:r},!0)},e.equals=function(r){if(!this.isValid||!r.isValid||!this.loc.equals(r.loc))return!1;function i(c,l){return c===void 0||c===0?l===void 0||l===0:c===l}for(var o=Te(We),s;!(s=o()).done;){var a=s.value;if(!i(this.values[a],r.values[a]))return!1}return!0},ie(n,[{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"years",get:function(){return this.isValid?this.values.years||0:NaN}},{key:"quarters",get:function(){return this.isValid?this.values.quarters||0:NaN}},{key:"months",get:function(){return this.isValid?this.values.months||0:NaN}},{key:"weeks",get:function(){return this.isValid?this.values.weeks||0:NaN}},{key:"days",get:function(){return this.isValid?this.values.days||0:NaN}},{key:"hours",get:function(){return this.isValid?this.values.hours||0:NaN}},{key:"minutes",get:function(){return this.isValid?this.values.minutes||0:NaN}},{key:"seconds",get:function(){return this.isValid?this.values.seconds||0:NaN}},{key:"milliseconds",get:function(){return this.isValid?this.values.milliseconds||0:NaN}},{key:"isValid",get:function(){return this.invalid===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),n})();function Fe(n){if(Pe(n))return H.fromMillis(n);if(H.isDuration(n))return n;if(typeof n=="object")return H.fromObject(n);throw new W("Unknown duration argument "+n+" of type "+typeof n)}var Ct="Invalid Interval";function Nu(n,e){return!n||!n.isValid?Nt.invalid("missing or invalid start"):!e||!e.isValid?Nt.invalid("missing or invalid end"):e<n?Nt.invalid("end before start","The end of an interval must be after its start, but you had start="+n.toISO()+" and end="+e.toISO()):null}var Nt=(function(){function n(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new W("need to specify a reason the Interval is invalid");var o=r instanceof ne?r:new ne(r,i);if(x.throwOnInvalid)throw new aa(o);return new n({invalid:o})},n.fromDateTimes=function(r,i){var o=It(r),s=It(i),a=Nu(o,s);return a==null?new n({start:o,end:s}):a},n.after=function(r,i){var o=Fe(i),s=It(r);return n.fromDateTimes(s,s.plus(o))},n.before=function(r,i){var o=Fe(i),s=It(r);return n.fromDateTimes(s.minus(o),s)},n.fromISO=function(r,i){var o=(r||"").split("/",2),s=o[0],a=o[1];if(s&&a){var c,l;try{c=M.fromISO(s,i),l=c.isValid}catch(g){l=!1}var u,d;try{u=M.fromISO(a,i),d=u.isValid}catch(g){d=!1}if(l&&d)return n.fromDateTimes(c,u);if(l){var f=H.fromISO(a,i);if(f.isValid)return n.after(c,f)}else if(d){var p=H.fromISO(s,i);if(p.isValid)return n.before(u,p)}}return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.isInterval=function(r){return r&&r.isLuxonInterval||!1};var e=n.prototype;return e.length=function(r){return r===void 0&&(r="milliseconds"),this.isValid?this.toDuration.apply(this,[r]).get(r):NaN},e.count=function(r){if(r===void 0&&(r="milliseconds"),!this.isValid)return NaN;var i=this.start.startOf(r),o=this.end.startOf(r);return Math.floor(o.diff(i,r).get(r))+1},e.hasSame=function(r){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,r):!1},e.isEmpty=function(){return this.s.valueOf()===this.e.valueOf()},e.isAfter=function(r){return this.isValid?this.s>r:!1},e.isBefore=function(r){return this.isValid?this.e<=r:!1},e.contains=function(r){return this.isValid?this.s<=r&&this.e>r:!1},e.set=function(r){var i=r===void 0?{}:r,o=i.start,s=i.end;return this.isValid?n.fromDateTimes(o||this.s,s||this.e):this},e.splitAt=function(){var r=this;if(!this.isValid)return[];for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];for(var a=o.map(It).filter(function(p){return r.contains(p)}).sort(),c=[],l=this.s,u=0;l<this.e;){var d=a[u]||this.e,f=+d>+this.e?this.e:d;c.push(n.fromDateTimes(l,f)),l=f,u+=1}return c},e.splitBy=function(r){var i=Fe(r);if(!this.isValid||!i.isValid||i.as("milliseconds")===0)return[];for(var o=this.s,s=1,a,c=[];o<this.e;){var l=this.start.plus(i.mapUnits(function(u){return u*s}));a=+l>+this.e?this.e:l,c.push(n.fromDateTimes(o,a)),o=a,s+=1}return c},e.divideEqually=function(r){return this.isValid?this.splitBy(this.length()/r).slice(0,r):[]},e.overlaps=function(r){return this.e>r.s&&this.s<r.e},e.abutsStart=function(r){return this.isValid?+this.e==+r.s:!1},e.abutsEnd=function(r){return this.isValid?+r.e==+this.s:!1},e.engulfs=function(r){return this.isValid?this.s<=r.s&&this.e>=r.e:!1},e.equals=function(r){return!this.isValid||!r.isValid?!1:this.s.equals(r.s)&&this.e.equals(r.e)},e.intersection=function(r){if(!this.isValid)return this;var i=this.s>r.s?this.s:r.s,o=this.e<r.e?this.e:r.e;return i>=o?null:n.fromDateTimes(i,o)},e.union=function(r){if(!this.isValid)return this;var i=this.s<r.s?this.s:r.s,o=this.e>r.e?this.e:r.e;return n.fromDateTimes(i,o)},n.merge=function(r){var i=r.sort(function(a,c){return a.s-c.s}).reduce(function(a,c){var l=a[0],u=a[1];return u?u.overlaps(c)||u.abutsStart(c)?[l,u.union(c)]:[l.concat([u]),c]:[l,c]},[[],null]),o=i[0],s=i[1];return s&&o.push(s),o},n.xor=function(r){for(var i,o=null,s=0,a=[],c=r.map(function(g){return[{time:g.s,type:"s"},{time:g.e,type:"e"}]}),l=(i=Array.prototype).concat.apply(i,c),u=l.sort(function(g,v){return g.time-v.time}),d=Te(u),f;!(f=d()).done;){var p=f.value;s+=p.type==="s"?1:-1,s===1?o=p.time:(o&&+o!=+p.time&&a.push(n.fromDateTimes(o,p.time)),o=null)}return n.merge(a)},e.difference=function(){for(var r=this,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return n.xor([this].concat(o)).map(function(a){return r.intersection(a)}).filter(function(a){return a&&!a.isEmpty()})},e.toString=function(){return this.isValid?"["+this.s.toISO()+" \u2013 "+this.e.toISO()+")":Ct},e.toISO=function(r){return this.isValid?this.s.toISO(r)+"/"+this.e.toISO(r):Ct},e.toISODate=function(){return this.isValid?this.s.toISODate()+"/"+this.e.toISODate():Ct},e.toISOTime=function(r){return this.isValid?this.s.toISOTime(r)+"/"+this.e.toISOTime(r):Ct},e.toFormat=function(r,i){var o=i===void 0?{}:i,s=o.separator,a=s===void 0?" \u2013 ":s;return this.isValid?""+this.s.toFormat(r)+a+this.e.toFormat(r):Ct},e.toDuration=function(r,i){return this.isValid?this.e.diff(this.s,r,i):H.invalid(this.invalidReason)},e.mapEndpoints=function(r){return n.fromDateTimes(r(this.s),r(this.e))},ie(n,[{key:"start",get:function(){return this.isValid?this.s:null}},{key:"end",get:function(){return this.isValid?this.e:null}},{key:"isValid",get:function(){return this.invalidReason===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),n})(),Ot=(function(){function n(){}return n.hasDST=function(t){t===void 0&&(t=x.defaultZone);var r=M.now().setZone(t).set({month:12});return!t.universal&&r.offset!==r.set({month:6}).offset},n.isValidIANAZone=function(t){return ce.isValidSpecifier(t)&&ce.isValidZone(t)},n.normalizeZone=function(t){return Me(t,x.defaultZone)},n.months=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l,d=i.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t)},n.monthsFormat=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l,d=i.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t,!0)},n.weekdays=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t)},n.weekdaysFormat=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t,!0)},n.meridiems=function(t){var r=t===void 0?{}:t,i=r.locale,o=i===void 0?null:i;return B.create(o).meridiems()},n.eras=function(t,r){t===void 0&&(t="short");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o;return B.create(s,null,"gregory").eras(t)},n.features=function(){var t=!1,r=!1,i=!1,o=!1;if(de()){t=!0,r=Mt(),o=Ii();try{i=new Intl.DateTimeFormat("en",{timeZone:"America/New_York"}).resolvedOptions().timeZone==="America/New_York"}catch(s){i=!1}}return{intl:t,intlTokens:r,zones:i,relative:o}},n})();function ci(n,e){var t=function(o){return o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf()},r=t(e)-t(n);return Math.floor(H.fromMillis(r).as("days"))}function Mu(n,e,t){for(var r=[["years",function(v,w){return w.year-v.year}],["quarters",function(v,w){return w.quarter-v.quarter}],["months",function(v,w){return w.month-v.month+(w.year-v.year)*12}],["weeks",function(v,w){var y=ci(v,w);return(y-y%7)/7}],["days",ci]],i={},o,s,a=0,c=r;a<c.length;a++){var l=c[a],u=l[0],d=l[1];if(t.indexOf(u)>=0){var f;o=u;var p=d(n,e);if(s=n.plus((f={},f[u]=p,f)),s>e){var g;n=n.plus((g={},g[u]=p-1,g)),p-=1}else n=s;i[u]=p}}return[n,i,s,o]}function Fu(n,e,t,r){var i=Mu(n,e,t),o=i[0],s=i[1],a=i[2],c=i[3],l=e-o,u=t.filter(function(g){return["hours","minutes","seconds","milliseconds"].indexOf(g)>=0});if(u.length===0){if(a<e){var d;a=o.plus((d={},d[c]=1,d))}a!==o&&(s[c]=(s[c]||0)+l/(a-o))}var f=H.fromObject(Object.assign(s,r));if(u.length>0){var p;return(p=H.fromMillis(l,r)).shiftTo.apply(p,u).plus(f)}else return f}var pn={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"},di={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]},Pu=pn.hanidec.replace(/[\[|\]]/g,"").split("");function Bu(n){var e=parseInt(n,10);if(isNaN(e)){e="";for(var t=0;t<n.length;t++){var r=n.charCodeAt(t);if(n[t].search(pn.hanidec)!==-1)e+=Pu.indexOf(n[t]);else for(var i in di){var o=di[i],s=o[0],a=o[1];r>=s&&r<=a&&(e+=r-s)}}return parseInt(e,10)}else return e}function te(n,e){var t=n.numberingSystem;return e===void 0&&(e=""),new RegExp(""+pn[t||"latn"]+e)}var _u="missing Intl.DateTimeFormat.formatToParts support";function A(n,e){return e===void 0&&(e=function(r){return r}),{regex:n,deser:function(r){var i=r[0];return e(Bu(i))}}}var Ru="\xA0",Wi="( |"+Ru+")",Yi=new RegExp(Wi,"g");function Lu(n){return n.replace(/\./g,"\\.?").replace(Yi,Wi)}function fi(n){return n.replace(/\./g,"").replace(Yi," ").toLowerCase()}function re(n,e){return n===null?null:{regex:RegExp(n.map(Lu).join("|")),deser:function(r){var i=r[0];return n.findIndex(function(o){return fi(i)===fi(o)})+e}}}function hi(n,e){return{regex:n,deser:function(r){var i=r[1],o=r[2];return or(i,o)},groups:e}}function pi(n){return{regex:n,deser:function(t){var r=t[0];return r}}}function Uu(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Gu(n,e){var t=te(e),r=te(e,"{2}"),i=te(e,"{3}"),o=te(e,"{4}"),s=te(e,"{6}"),a=te(e,"{1,2}"),c=te(e,"{1,3}"),l=te(e,"{1,6}"),u=te(e,"{1,9}"),d=te(e,"{2,4}"),f=te(e,"{4,6}"),p=function(y){return{regex:RegExp(Uu(y.val)),deser:function(ae){var D=ae[0];return D},literal:!0}},g=function(y){if(n.literal)return p(y);switch(y.val){case"G":return re(e.eras("short",!1),0);case"GG":return re(e.eras("long",!1),0);case"y":return A(l);case"yy":return A(d,Br);case"yyyy":return A(o);case"yyyyy":return A(f);case"yyyyyy":return A(s);case"M":return A(a);case"MM":return A(r);case"MMM":return re(e.months("short",!0,!1),1);case"MMMM":return re(e.months("long",!0,!1),1);case"L":return A(a);case"LL":return A(r);case"LLL":return re(e.months("short",!1,!1),1);case"LLLL":return re(e.months("long",!1,!1),1);case"d":return A(a);case"dd":return A(r);case"o":return A(c);case"ooo":return A(i);case"HH":return A(r);case"H":return A(a);case"hh":return A(r);case"h":return A(a);case"mm":return A(r);case"m":return A(a);case"q":return A(a);case"qq":return A(r);case"s":return A(a);case"ss":return A(r);case"S":return A(c);case"SSS":return A(i);case"u":return pi(u);case"a":return re(e.meridiems(),0);case"kkkk":return A(o);case"kk":return A(d,Br);case"W":return A(a);case"WW":return A(r);case"E":case"c":return A(t);case"EEE":return re(e.weekdays("short",!1,!1),1);case"EEEE":return re(e.weekdays("long",!1,!1),1);case"ccc":return re(e.weekdays("short",!0,!1),1);case"cccc":return re(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return hi(new RegExp("([+-]"+a.source+")(?::("+r.source+"))?"),2);case"ZZZ":return hi(new RegExp("([+-]"+a.source+")("+r.source+")?"),2);case"z":return pi(/[a-z_+-/]{1,256}?/i);default:return p(y)}},v=g(n)||{invalidReason:_u};return v.token=n,v}var Vu={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",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"}};function Hu(n,e,t){var r=n.type,i=n.value;if(r==="literal")return{literal:!0,val:i};var o=t[r],s=Vu[r];if(typeof s=="object"&&(s=s[o]),s)return{literal:!1,val:s}}function $u(n){var e=n.map(function(t){return t.regex}).reduce(function(t,r){return t+"("+r.source+")"},"");return["^"+e+"$",n]}function ju(n,e,t){var r=n.match(e);if(r){var i={},o=1;for(var s in t)if(Qe(t,s)){var a=t[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(o,o+c))),o+=c}return[r,i]}else return[r,{}]}function zu(n){var e=function(o){switch(o){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}},t;b(n.Z)?b(n.z)?t=null:t=ce.create(n.z):t=new $(n.Z),b(n.q)||(n.M=(n.q-1)*3+1),b(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),b(n.u)||(n.S=un(n.u));var r=Object.keys(n).reduce(function(i,o){var s=e(o);return s&&(i[s]=n[o]),i},{});return[r,t]}var Or=null;function qu(){return Or||(Or=M.fromMillis(1555555555555)),Or}function Zu(n,e){if(n.literal)return n;var t=le.macroTokenToFormatOpts(n.val);if(!t)return n;var r=le.create(e,t),i=r.formatDateTimeParts(qu()),o=i.map(function(s){return Hu(s,e,t)});return o.includes(void 0)?n:o}function Wu(n,e){var t;return(t=Array.prototype).concat.apply(t,n.map(function(r){return Zu(r,e)}))}function Ki(n,e,t){var r=Wu(le.parseFormat(t),n),i=r.map(function(w){return Gu(w,n)}),o=i.find(function(w){return w.invalidReason});if(o)return{input:e,tokens:r,invalidReason:o.invalidReason};var s=$u(i),a=s[0],c=s[1],l=RegExp(a,"i"),u=ju(e,l,c),d=u[0],f=u[1],p=f?zu(f):[null,null],g=p[0],v=p[1];if(Qe(f,"a")&&Qe(f,"H"))throw new kt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:l,rawMatches:d,matches:f,result:g,zone:v}}function Yu(n,e,t){var r=Ki(n,e,t),i=r.result,o=r.zone,s=r.invalidReason;return[i,o,s]}var Ji=[0,31,59,90,120,151,181,212,243,273,304,334],Qi=[0,31,60,91,121,152,182,213,244,274,305,335];function Y(n,e){return new ne("unit out of range","you specified "+e+" (of type "+typeof e+") as a "+n+", which is invalid")}function Xi(n,e,t){var r=new Date(Date.UTC(n,e-1,t)).getUTCDay();return r===0?7:r}function eo(n,e,t){return t+(Ft(n)?Qi:Ji)[e-1]}function to(n,e){var t=Ft(n)?Qi:Ji,r=t.findIndex(function(o){return o<e}),i=e-t[r];return{month:r+1,day:i}}function Vr(n){var e=n.year,t=n.month,r=n.day,i=eo(e,t,r),o=Xi(e,t,r),s=Math.floor((i-o+10)/7),a;return s<1?(a=e-1,s=tr(a)):s>tr(e)?(a=e+1,s=1):a=e,Object.assign({weekYear:a,weekNumber:s,weekday:o},sr(n))}function mi(n){var e=n.weekYear,t=n.weekNumber,r=n.weekday,i=Xi(e,1,4),o=xt(e),s=t*7+r-i-3,a;s<1?(a=e-1,s+=xt(a)):s>o?(a=e+1,s-=xt(e)):a=e;var c=to(a,s),l=c.month,u=c.day;return Object.assign({year:a,month:l,day:u},sr(n))}function xr(n){var e=n.year,t=n.month,r=n.day,i=eo(e,t,r);return Object.assign({year:e,ordinal:i},sr(n))}function gi(n){var e=n.year,t=n.ordinal,r=to(e,t),i=r.month,o=r.day;return Object.assign({year:e,month:i,day:o},sr(n))}function Ku(n){var e=ir(n.weekYear),t=pe(n.weekNumber,1,tr(n.weekYear)),r=pe(n.weekday,1,7);return e?t?r?!1:Y("weekday",n.weekday):Y("week",n.week):Y("weekYear",n.weekYear)}function Ju(n){var e=ir(n.year),t=pe(n.ordinal,1,xt(n.year));return e?t?!1:Y("ordinal",n.ordinal):Y("year",n.year)}function ro(n){var e=ir(n.year),t=pe(n.month,1,12),r=pe(n.day,1,er(n.year,n.month));return e?t?r?!1:Y("day",n.day):Y("month",n.month):Y("year",n.year)}function no(n){var e=n.hour,t=n.minute,r=n.second,i=n.millisecond,o=pe(e,0,23)||e===24&&t===0&&r===0&&i===0,s=pe(t,0,59),a=pe(r,0,59),c=pe(i,0,999);return o?s?a?c?!1:Y("millisecond",i):Y("second",r):Y("minute",t):Y("hour",e)}var Nr="Invalid DateTime",yi=864e13;function Wt(n){return new ne("unsupported zone",'the zone "'+n.name+'" is not supported')}function Mr(n){return n.weekData===null&&(n.weekData=Vr(n.c)),n.weekData}function Dt(n,e){var t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new M(Object.assign({},t,e,{old:t}))}function io(n,e,t){var r=n-e*60*1e3,i=t.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;var o=t.offset(r);return i===o?[r,i]:[n-Math.min(i,o)*60*1e3,Math.max(i,o)]}function vi(n,e){n+=e*60*1e3;var t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Jt(n,e,t){return io(cn(n),e,t)}function wi(n,e){var t=n.o,r=n.c.year+Math.trunc(e.years),i=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o=Object.assign({},n.c,{year:r,month:i,day:Math.min(n.c.day,er(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7}),s=H.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"),a=cn(o),c=io(a,t,n.zone),l=c[0],u=c[1];return s!==0&&(l+=s,u=n.zone.offset(l)),{ts:l,o:u}}function St(n,e,t,r,i){var o=t.setZone,s=t.zone;if(n&&Object.keys(n).length!==0){var a=e||s,c=M.fromObject(Object.assign(n,t,{zone:a,setZone:void 0}));return o?c:c.setZone(s)}else return M.invalid(new ne("unparsable",'the input "'+i+`" can't be parsed as `+r))}function Ye(n,e,t){return t===void 0&&(t=!0),n.isValid?le.create(B.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function Ei(n,e){var t=e.suppressSeconds,r=t===void 0?!1:t,i=e.suppressMilliseconds,o=i===void 0?!1:i,s=e.includeOffset,a=e.includePrefix,c=a===void 0?!1:a,l=e.includeZone,u=l===void 0?!1:l,d=e.spaceZone,f=d===void 0?!1:d,p=e.format,g=p===void 0?"extended":p,v=g==="basic"?"HHmm":"HH:mm";(!r||n.second!==0||n.millisecond!==0)&&(v+=g==="basic"?"ss":":ss",(!o||n.millisecond!==0)&&(v+=".SSS")),(u||s)&&f&&(v+=" "),u?v+="z":s&&(v+=g==="basic"?"ZZZ":"ZZ");var w=Ye(n,v);return c&&(w="T"+w),w}var oo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Qu={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Xu={ordinal:1,hour:0,minute:0,second:0,millisecond:0},so=["year","month","day","hour","minute","second","millisecond"],el=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],tl=["year","ordinal","hour","minute","second","millisecond"];function Ti(n){var 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"}[n.toLowerCase()];if(!e)throw new Ci(n);return e}function bi(n,e){for(var t=Te(so),r;!(r=t()).done;){var i=r.value;b(n[i])&&(n[i]=oo[i])}var o=ro(n)||no(n);if(o)return M.invalid(o);var s=x.now(),a=e.offset(s),c=Jt(n,a,e),l=c[0],u=c[1];return new M({ts:l,zone:e,o:u})}function Ai(n,e,t){var r=b(t.round)?!0:t.round,i=function(d,f){d=ln(d,r||t.calendary?0:2,!0);var p=e.loc.clone(t).relFormatter(t);return p.format(d,f)},o=function(d){return t.calendary?e.hasSame(n,d)?0:e.startOf(d).diff(n.startOf(d),d).get(d):e.diff(n,d).get(d)};if(t.unit)return i(o(t.unit),t.unit);for(var s=Te(t.units),a;!(a=s()).done;){var c=a.value,l=o(c);if(Math.abs(l)>=1)return i(l,c)}return i(n>e?-0:0,t.units[t.units.length-1])}var M=(function(){function n(t){var r=t.zone||x.defaultZone,i=t.invalid||(Number.isNaN(t.ts)?new ne("invalid input"):null)||(r.isValid?null:Wt(r));this.ts=b(t.ts)?x.now():t.ts;var o=null,s=null;if(!i){var a=t.old&&t.old.ts===this.ts&&t.old.zone.equals(r);if(a){var c=[t.old.c,t.old.o];o=c[0],s=c[1]}else{var l=r.offset(this.ts);o=vi(this.ts,l),i=Number.isNaN(o.year)?new ne("invalid input"):null,o=i?null:o,s=i?null:l}}this._zone=r,this.loc=t.loc||B.create(),this.invalid=i,this.weekData=null,this.c=o,this.o=s,this.isLuxonDateTime=!0}n.now=function(){return new n({})},n.local=function(r,i,o,s,a,c,l){return b(r)?n.now():bi({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},x.defaultZone)},n.utc=function(r,i,o,s,a,c,l){return b(r)?new n({ts:x.now(),zone:$.utcInstance}):bi({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},$.utcInstance)},n.fromJSDate=function(r,i){i===void 0&&(i={});var o=ca(r)?r.valueOf():NaN;if(Number.isNaN(o))return n.invalid("invalid input");var s=Me(i.zone,x.defaultZone);return s.isValid?new n({ts:o,zone:s,loc:B.fromObject(i)}):n.invalid(Wt(s))},n.fromMillis=function(r,i){if(i===void 0&&(i={}),Pe(r))return r<-yi||r>yi?n.invalid("Timestamp out of range"):new n({ts:r,zone:Me(i.zone,x.defaultZone),loc:B.fromObject(i)});throw new W("fromMillis requires a numerical input, but received a "+typeof r+" with value "+r)},n.fromSeconds=function(r,i){if(i===void 0&&(i={}),Pe(r))return new n({ts:r*1e3,zone:Me(i.zone,x.defaultZone),loc:B.fromObject(i)});throw new W("fromSeconds requires a numerical input")},n.fromObject=function(r){var i=Me(r.zone,x.defaultZone);if(!i.isValid)return n.invalid(Wt(i));var o=x.now(),s=i.offset(o),a=rr(r,Ti,["zone","locale","outputCalendar","numberingSystem"]),c=!b(a.ordinal),l=!b(a.year),u=!b(a.month)||!b(a.day),d=l||u,f=a.weekYear||a.weekNumber,p=B.fromObject(r);if((d||c)&&f)throw new kt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new kt("Can't mix ordinal dates with month/day");var g=f||a.weekday&&!d,v,w,y=vi(o,s);g?(v=el,w=Qu,y=Vr(y)):c?(v=tl,w=Xu,y=xr(y)):(v=so,w=oo);for(var S=!1,ae=Te(v),D;!(D=ae()).done;){var L=D.value,Cr=a[L];b(Cr)?S?a[L]=w[L]:a[L]=y[L]:S=!0}var Gs=g?Ku(a):c?Ju(a):ro(a),Pn=Gs||no(a);if(Pn)return n.invalid(Pn);var Vs=g?mi(a):c?gi(a):a,Bn=Jt(Vs,s,i),Hs=Bn[0],$s=Bn[1],Dr=new n({ts:Hs,zone:i,o:$s,loc:p});return a.weekday&&d&&r.weekday!==Dr.weekday?n.invalid("mismatched weekday","you can't specify both a weekday of "+a.weekday+" and a date of "+Dr.toISO()):Dr},n.fromISO=function(r,i){i===void 0&&(i={});var o=pu(r),s=o[0],a=o[1];return St(s,a,i,"ISO 8601",r)},n.fromRFC2822=function(r,i){i===void 0&&(i={});var o=mu(r),s=o[0],a=o[1];return St(s,a,i,"RFC 2822",r)},n.fromHTTP=function(r,i){i===void 0&&(i={});var o=gu(r),s=o[0],a=o[1];return St(s,a,i,"HTTP",i)},n.fromFormat=function(r,i,o){if(o===void 0&&(o={}),b(r)||b(i))throw new W("fromFormat requires an input string and a format");var s=o,a=s.locale,c=a===void 0?null:a,l=s.numberingSystem,u=l===void 0?null:l,d=B.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0}),f=Yu(d,r,i),p=f[0],g=f[1],v=f[2];return v?n.invalid(v):St(p,g,o,"format "+i,r)},n.fromString=function(r,i,o){return o===void 0&&(o={}),n.fromFormat(r,i,o)},n.fromSQL=function(r,i){i===void 0&&(i={});var o=Cu(r),s=o[0],a=o[1];return St(s,a,i,"SQL",r)},n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new W("need to specify a reason the DateTime is invalid");var o=r instanceof ne?r:new ne(r,i);if(x.throwOnInvalid)throw new sa(o);return new n({invalid:o})},n.isDateTime=function(r){return r&&r.isLuxonDateTime||!1};var e=n.prototype;return e.get=function(r){return this[r]},e.resolvedLocaleOpts=function(r){r===void 0&&(r={});var i=le.create(this.loc.clone(r),r).resolvedOptions(this),o=i.locale,s=i.numberingSystem,a=i.calendar;return{locale:o,numberingSystem:s,outputCalendar:a}},e.toUTC=function(r,i){return r===void 0&&(r=0),i===void 0&&(i={}),this.setZone($.instance(r),i)},e.toLocal=function(){return this.setZone(x.defaultZone)},e.setZone=function(r,i){var o=i===void 0?{}:i,s=o.keepLocalTime,a=s===void 0?!1:s,c=o.keepCalendarTime,l=c===void 0?!1:c;if(r=Me(r,x.defaultZone),r.equals(this.zone))return this;if(r.isValid){var u=this.ts;if(a||l){var d=r.offset(this.ts),f=this.toObject(),p=Jt(f,d,r);u=p[0]}return Dt(this,{ts:u,zone:r})}else return n.invalid(Wt(r))},e.reconfigure=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.outputCalendar,c=this.loc.clone({locale:o,numberingSystem:s,outputCalendar:a});return Dt(this,{loc:c})},e.setLocale=function(r){return this.reconfigure({locale:r})},e.set=function(r){if(!this.isValid)return this;var i=rr(r,Ti,[]),o=!b(i.weekYear)||!b(i.weekNumber)||!b(i.weekday),s=!b(i.ordinal),a=!b(i.year),c=!b(i.month)||!b(i.day),l=a||c,u=i.weekYear||i.weekNumber;if((l||s)&&u)throw new kt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new kt("Can't mix ordinal dates with month/day");var d;o?d=mi(Object.assign(Vr(this.c),i)):b(i.ordinal)?(d=Object.assign(this.toObject(),i),b(i.day)&&(d.day=Math.min(er(d.year,d.month),d.day))):d=gi(Object.assign(xr(this.c),i));var f=Jt(d,this.o,this.zone),p=f[0],g=f[1];return Dt(this,{ts:p,o:g})},e.plus=function(r){if(!this.isValid)return this;var i=Fe(r);return Dt(this,wi(this,i))},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r).negate();return Dt(this,wi(this,i))},e.startOf=function(r){if(!this.isValid)return this;var i={},o=H.normalizeUnit(r);switch(o){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(o==="weeks"&&(i.weekday=1),o==="quarters"){var s=Math.ceil(this.month/3);i.month=(s-1)*3+1}return this.set(i)},e.endOf=function(r){var i;return this.isValid?this.plus((i={},i[r]=1,i)).startOf(r).minus(1):this},e.toFormat=function(r,i){return i===void 0&&(i={}),this.isValid?le.create(this.loc.redefaultToEN(i)).formatDateTimeFromString(this,r):Nr},e.toLocaleString=function(r){return r===void 0&&(r=Xt),this.isValid?le.create(this.loc.clone(r),r).formatDateTime(this):Nr},e.toLocaleParts=function(r){return r===void 0&&(r={}),this.isValid?le.create(this.loc.clone(r),r).formatDateTimeParts(this):[]},e.toISO=function(r){return r===void 0&&(r={}),this.isValid?this.toISODate(r)+"T"+this.toISOTime(r):null},e.toISODate=function(r){var i=r===void 0?{}:r,o=i.format,s=o===void 0?"extended":o,a=s==="basic"?"yyyyMMdd":"yyyy-MM-dd";return this.year>9999&&(a="+"+a),Ye(this,a)},e.toISOWeekDate=function(){return Ye(this,"kkkk-'W'WW-c")},e.toISOTime=function(r){var i=r===void 0?{}:r,o=i.suppressMilliseconds,s=o===void 0?!1:o,a=i.suppressSeconds,c=a===void 0?!1:a,l=i.includeOffset,u=l===void 0?!0:l,d=i.includePrefix,f=d===void 0?!1:d,p=i.format,g=p===void 0?"extended":p;return Ei(this,{suppressSeconds:c,suppressMilliseconds:s,includeOffset:u,includePrefix:f,format:g})},e.toRFC2822=function(){return Ye(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)},e.toHTTP=function(){return Ye(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")},e.toSQLDate=function(){return Ye(this,"yyyy-MM-dd")},e.toSQLTime=function(r){var i=r===void 0?{}:r,o=i.includeOffset,s=o===void 0?!0:o,a=i.includeZone,c=a===void 0?!1:a;return Ei(this,{includeOffset:s,includeZone:c,spaceZone:!0})},e.toSQL=function(r){return r===void 0&&(r={}),this.isValid?this.toSQLDate()+" "+this.toSQLTime(r):null},e.toString=function(){return this.isValid?this.toISO():Nr},e.valueOf=function(){return this.toMillis()},e.toMillis=function(){return this.isValid?this.ts:NaN},e.toSeconds=function(){return this.isValid?this.ts/1e3:NaN},e.toJSON=function(){return this.toISO()},e.toBSON=function(){return this.toJSDate()},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var i=Object.assign({},this.c);return r.includeConfig&&(i.outputCalendar=this.outputCalendar,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale),i},e.toJSDate=function(){return new Date(this.isValid?this.ts:NaN)},e.diff=function(r,i,o){if(i===void 0&&(i="milliseconds"),o===void 0&&(o={}),!this.isValid||!r.isValid)return H.invalid(this.invalid||r.invalid,"created by diffing an invalid DateTime");var s=Object.assign({locale:this.locale,numberingSystem:this.numberingSystem},o),a=da(i).map(H.normalizeUnit),c=r.valueOf()>this.valueOf(),l=c?this:r,u=c?r:this,d=Fu(l,u,a,s);return c?d.negate():d},e.diffNow=function(r,i){return r===void 0&&(r="milliseconds"),i===void 0&&(i={}),this.diff(n.now(),r,i)},e.until=function(r){return this.isValid?Nt.fromDateTimes(this,r):this},e.hasSame=function(r,i){if(!this.isValid)return!1;var o=r.valueOf(),s=this.setZone(r.zone,{keepLocalTime:!0});return s.startOf(i)<=o&&o<=s.endOf(i)},e.equals=function(r){return this.isValid&&r.isValid&&this.valueOf()===r.valueOf()&&this.zone.equals(r.zone)&&this.loc.equals(r.loc)},e.toRelative=function(r){if(r===void 0&&(r={}),!this.isValid)return null;var i=r.base||n.fromObject({zone:this.zone}),o=r.padding?this<i?-r.padding:r.padding:0,s=["years","months","days","hours","minutes","seconds"],a=r.unit;return Array.isArray(r.unit)&&(s=r.unit,a=void 0),Ai(i,this.plus(o),Object.assign(r,{numeric:"always",units:s,unit:a}))},e.toRelativeCalendar=function(r){return r===void 0&&(r={}),this.isValid?Ai(r.base||n.fromObject({zone:this.zone}),this,Object.assign(r,{numeric:"auto",units:["years","months","days"],calendary:!0})):null},n.min=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!i.every(n.isDateTime))throw new W("min requires all arguments be DateTimes");return ri(i,function(s){return s.valueOf()},Math.min)},n.max=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!i.every(n.isDateTime))throw new W("max requires all arguments be DateTimes");return ri(i,function(s){return s.valueOf()},Math.max)},n.fromFormatExplain=function(r,i,o){o===void 0&&(o={});var s=o,a=s.locale,c=a===void 0?null:a,l=s.numberingSystem,u=l===void 0?null:l,d=B.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0});return Ki(d,r,i)},n.fromStringExplain=function(r,i,o){return o===void 0&&(o={}),n.fromFormatExplain(r,i,o)},ie(n,[{key:"isValid",get:function(){return this.invalid===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}},{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"outputCalendar",get:function(){return this.isValid?this.loc.outputCalendar:null}},{key:"zone",get:function(){return this._zone}},{key:"zoneName",get:function(){return this.isValid?this.zone.name:null}},{key:"year",get:function(){return this.isValid?this.c.year:NaN}},{key:"quarter",get:function(){return this.isValid?Math.ceil(this.c.month/3):NaN}},{key:"month",get:function(){return this.isValid?this.c.month:NaN}},{key:"day",get:function(){return this.isValid?this.c.day:NaN}},{key:"hour",get:function(){return this.isValid?this.c.hour:NaN}},{key:"minute",get:function(){return this.isValid?this.c.minute:NaN}},{key:"second",get:function(){return this.isValid?this.c.second:NaN}},{key:"millisecond",get:function(){return this.isValid?this.c.millisecond:NaN}},{key:"weekYear",get:function(){return this.isValid?Mr(this).weekYear:NaN}},{key:"weekNumber",get:function(){return this.isValid?Mr(this).weekNumber:NaN}},{key:"weekday",get:function(){return this.isValid?Mr(this).weekday:NaN}},{key:"ordinal",get:function(){return this.isValid?xr(this.c).ordinal:NaN}},{key:"monthShort",get:function(){return this.isValid?Ot.months("short",{locObj:this.loc})[this.month-1]:null}},{key:"monthLong",get:function(){return this.isValid?Ot.months("long",{locObj:this.loc})[this.month-1]:null}},{key:"weekdayShort",get:function(){return this.isValid?Ot.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}},{key:"weekdayLong",get:function(){return this.isValid?Ot.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}},{key:"offset",get:function(){return this.isValid?+this.o:NaN}},{key:"offsetNameShort",get:function(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}},{key:"offsetNameLong",get:function(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}},{key:"isOffsetFixed",get:function(){return this.isValid?this.zone.universal:null}},{key:"isInDST",get:function(){return this.isOffsetFixed?!1:this.offset>this.set({month:1}).offset||this.offset>this.set({month:5}).offset}},{key:"isInLeapYear",get:function(){return Ft(this.year)}},{key:"daysInMonth",get:function(){return er(this.year,this.month)}},{key:"daysInYear",get:function(){return this.isValid?xt(this.year):NaN}},{key:"weeksInWeekYear",get:function(){return this.isValid?tr(this.weekYear):NaN}}],[{key:"DATE_SHORT",get:function(){return Xt}},{key:"DATE_MED",get:function(){return Hr}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return Di}},{key:"DATE_FULL",get:function(){return $r}},{key:"DATE_HUGE",get:function(){return jr}},{key:"TIME_SIMPLE",get:function(){return zr}},{key:"TIME_WITH_SECONDS",get:function(){return qr}},{key:"TIME_WITH_SHORT_OFFSET",get:function(){return Zr}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return Wr}},{key:"TIME_24_SIMPLE",get:function(){return Yr}},{key:"TIME_24_WITH_SECONDS",get:function(){return Kr}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return Jr}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return Qr}},{key:"DATETIME_SHORT",get:function(){return Xr}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return en}},{key:"DATETIME_MED",get:function(){return tn}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return rn}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return Si}},{key:"DATETIME_FULL",get:function(){return nn}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return on}},{key:"DATETIME_HUGE",get:function(){return sn}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return an}}]),n})();function It(n){if(M.isDateTime(n))return n;if(n&&n.valueOf&&Pe(n.valueOf()))return M.fromJSDate(n);if(n&&typeof n=="object")return M.fromObject(n);throw new W("Unknown datetime argument: "+n+", of type "+typeof n)}var rl="1.28.1";z.DateTime=M;z.Duration=H;z.FixedOffsetZone=$;z.IANAZone=ce;z.Info=Ot;z.Interval=Nt;z.InvalidZone=_r;z.LocalZone=Ui;z.Settings=x;z.VERSION=rl;z.Zone=Xe});var bl={};Ks(bl,{Account:()=>G,AccountType:()=>F,AccountsDataTableBuilder:()=>at,Agent:()=>ut,Amount:()=>E,App:()=>ve,Backlog:()=>wt,Balance:()=>ke,BalanceType:()=>be,BalancesDataTableBuilder:()=>he,BalancesReport:()=>yt,Billing:()=>ft,Bkper:()=>k,BkperError:()=>ue,Book:()=>Q,BooksDataTableBuilder:()=>Ar,BotResponse:()=>dt,BotResponseType:()=>it,Collaborator:()=>lt,Collection:()=>De,Connection:()=>je,DecimalSeparator:()=>He,Event:()=>ht,EventList:()=>pt,EventType:()=>dr,File:()=>Ie,Group:()=>J,GroupsDataTableBuilder:()=>Et,Integration:()=>X,Month:()=>cr,Period:()=>lr,Periodicity:()=>_t,Permission:()=>nt,Query:()=>vt,Template:()=>bt,Transaction:()=>se,TransactionList:()=>mt,TransactionStatus:()=>me,TransactionsDataTableBuilder:()=>Tt,User:()=>Se,Visibility:()=>ur});var ue=class extends Error{constructor(e,t,r){super(t),this.name="BkperError",this.code=e,this.reason=r}};var Xs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},qe=class{constructor(e){this.params=[],this.headers={},this.method="GET",this.payload=null,this.url=e}setMethod(e){return this.method=e,this}setHeader(e,t){return this.headers[e]=t,this}addParam(e,t){return this.params.push({name:e,value:t}),this}setPayload(e){return this.payload=e,this}getUrl(){let e=this.url;if(this.params!=null){let i=0;e.indexOf("?")<0?e+="?":i++;for(let o of this.params){i>0&&(e+="&");var t=o.name,r=o.value;r!=null&&(e+=t+"="+encodeURIComponent(r),i++)}}return e}execute(){return Xs(this,void 0,void 0,function*(){let e=this.getUrl(),t={method:this.method,headers:this.headers};this.payload&&this.method!=="GET"&&(typeof this.payload=="string"?t.body=this.payload:(t.body=JSON.stringify(this.payload),!this.headers["Content-Type"]&&!this.headers["content-type"]&&(t.headers=Object.assign(Object.assign({},this.headers),{"Content-Type":"application/json"}))));let r=yield fetch(e,t),i,o=r.headers.get("content-type");return o&&o.includes("application/json")?i=yield r.json():i=yield r.text(),{data:i,status:r.status,headers:r.headers}})}};var At=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ea="https://api.bkper.app";function ta(n){return n.apiBaseUrl?n.apiBaseUrl:ea}var ee=class extends qe{constructor(e,t){let r=ta(t);super(`${r}/${e}`),this.retry=0,this.config=t,this.requestPath=e}fetch(){let e=Object.create(null,{execute:{get:()=>super.execute}});return At(this,void 0,void 0,function*(){this.addCustomHeaders(),yield this.addAgentIdHeader(),this.setHeader("Authorization",`Bearer ${yield this.getAccessToken()}`),yield this.addApiKeyHeader();try{let t=yield e.execute.call(this);if(t.status>=200&&t.status<300)return t;if(t.status==404){let r={response:{status:t.status,data:t.data}};throw this.handleError(r)}else if(this.shouldRetry(t.status)&&this.retry<3){this.retry++;let r=this.config;return r.requestRetryHandler?yield r.requestRetryHandler(t.status,t.data,this.retry):console.log(`${JSON.stringify(t.data)} - Retrying ${this.retry}/3... `),yield this.fetch()}else{let r={response:{status:t.status,data:t.data}};throw this.handleError(r)}}catch(t){if(t instanceof ue||t.response)throw t;if(this.isNetworkError(t)&&this.retry<3){this.retry++;let r=this.config;return r.requestRetryHandler?yield r.requestRetryHandler(520,t,this.retry):console.log(`${this.formatNetworkErrorMessage(t)} - Retrying ${this.retry}/3... `),yield this.fetch()}throw this.handleError(t)}})}shouldRetry(e){return e==408||e==429||e!=null&&e>=500}isNetworkError(e){return e instanceof TypeError&&e.message.toLowerCase().includes("fetch")}formatNetworkErrorMessage(e){var t,r,i,o,s;let a=[];return!((t=e.cause)===null||t===void 0)&&t.code&&a.push(e.cause.code),!((r=e.cause)===null||r===void 0)&&r.hostname?a.push(e.cause.hostname):!((i=e.cause)===null||i===void 0)&&i.address&&a.push(e.cause.address),((o=e.cause)===null||o===void 0?void 0:o.port)!==void 0&&a.push(`port=${e.cause.port}`),!((s=e.cause)===null||s===void 0)&&s.syscall&&a.push(`syscall=${e.cause.syscall}`),a.length>0?`Network error calling ${this.requestPath}: ${e.message} (${a.join(", ")})`:`Network error calling ${this.requestPath}: ${e.message}`}handleError(e){var t,r,i,o,s,a,c,l,u;let d=this.config,f=d.requestErrorHandler?d.requestErrorHandler(e):void 0;if(f)return f;if(e instanceof ue)return e;if(this.isNetworkError(e))return new ue(((t=e.response)===null||t===void 0?void 0:t.status)||((r=e.response)===null||r===void 0?void 0:r.code)||e.status||e.code||0,this.formatNetworkErrorMessage(e),void 0);{let p=((o=(i=e.response)===null||i===void 0?void 0:i.data)===null||o===void 0?void 0:o.error)||((s=e.data)===null||s===void 0?void 0:s.error)||e.error;return p?new ue(p.code,p.message,(c=(a=p.errors)===null||a===void 0?void 0:a[0])===null||c===void 0?void 0:c.reason):new ue(((l=e.response)===null||l===void 0?void 0:l.status)||((u=e.response)===null||u===void 0?void 0:u.code)||e.status||e.code||0,e.message||String(e),void 0)}}addCustomHeaders(){return At(this,void 0,void 0,function*(){let e=this.config;if(e.requestHeadersProvider){let t=yield e.requestHeadersProvider();Object.entries(t).forEach(([r,i])=>this.setHeader(r,i))}})}addAgentIdHeader(){return At(this,void 0,void 0,function*(){let e=this.config;if(e.agentIdProvider){let t=yield e.agentIdProvider();t&&this.setHeader("bkper-agent-id",t)}})}addApiKeyHeader(){return At(this,void 0,void 0,function*(){let e=this.config;if(e.apiKeyProvider){let t=yield e.apiKeyProvider();t&&this.setHeader("bkper-api-key",t)}})}getAccessToken(){return At(this,void 0,void 0,function*(){let e,t=this.config;return t.oauthTokenProvider?e=yield t.oauthTokenProvider():console.warn("Token provider NOT configured!"),e&&(e=e.replace("Bearer ",""),e=e.replace("bearer ","")),e})}},m=class extends ee{constructor(e,t){super(`v5/books/${e}`,t)}},O=class extends ee{constructor(e,t){super(`v5/${e}`,t)}};var we=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Rn(n,e,t){return we(this,void 0,void 0,function*(){var r=yield new m(`${n}/accounts`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Ln(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Un(n,e,t){return we(this,void 0,void 0,function*(){var r=e,i=yield new m(`${n}/accounts`,t).setMethod("PUT").setPayload(r).fetch();return i.data})}function Gn(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/batch`,t).setMethod("PUT").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Vn(n,e,t){return we(this,void 0,void 0,function*(){var r=yield new m(`${n}/accounts/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function Hn(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/delete/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function $n(n,e,t){return we(this,void 0,void 0,function*(){return(yield new m(`${n}/accounts/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function jn(n,e){return we(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/accounts`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var Oe=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function qn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Zn(n,e,t){return Oe(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/groups/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Wn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Yn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function Kn(n,e){return Oe(this,void 0,void 0,function*(){var t=yield new m(`${n}/groups`,e).setMethod("GET").fetch(),r=t.data;return r!=null&&r.items?r.items:[]})}function Jn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups/${encodeURIComponent(e)}`,t).setMethod("GET").fetch();return r.data})}function Qn(n,e,t){return Oe(this,void 0,void 0,function*(){if(!e)return[];var r=yield new m(`${n}/groups/${encodeURIComponent(e)}/accounts`,t).setMethod("GET").fetch(),i=r.data;return i!=null&&i.items?i.items:[]})}var Rt=Js(ao(),1);var nl=20,il=1,Le=1e6,uo=1e6,ol=-7,sl=21,al=!1,Pt="[big.js] ",Ue=Pt+"Invalid ",ar=Ue+"decimal places",ul=Ue+"rounding mode",lo=Pt+"Division by zero",C={},fe=void 0,ll=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function co(){function n(e){var t=this;if(!(t instanceof n))return e===fe?co():new n(e);if(e instanceof n)t.s=e.s,t.e=e.e,t.c=e.c.slice();else{if(typeof e!="string"){if(n.strict===!0&&typeof e!="bigint")throw TypeError(Ue+"value");e=e===0&&1/e<0?"-0":String(e)}cl(t,e)}t.constructor=n}return n.prototype=C,n.DP=nl,n.RM=il,n.NE=ol,n.PE=sl,n.strict=al,n.roundDown=0,n.roundHalfUp=1,n.roundHalfEven=2,n.roundUp=3,n}function cl(n,e){var t,r,i;if(!ll.test(e))throw Error(Ue+"number");for(n.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),i=e.length,r=0;r<i&&e.charAt(r)=="0";)++r;if(r==i)n.c=[n.e=0];else{for(;i>0&&e.charAt(--i)=="0";);for(n.e=t-r-1,n.c=[],t=0;r<=i;)n.c[t++]=+e.charAt(r++)}return n}function Ge(n,e,t,r){var i=n.c;if(t===fe&&(t=n.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(ul);if(e<1)r=t===3&&(r||!!i[0])||e===0&&(t===1&&i[0]>=5||t===2&&(i[0]>5||i[0]===5&&(r||i[1]!==fe))),i.length=1,r?(n.e=n.e-e+1,i[0]=1):i[0]=n.e=0;else if(e<i.length){if(r=t===1&&i[e]>=5||t===2&&(i[e]>5||i[e]===5&&(r||i[e+1]!==fe||i[e-1]&1))||t===3&&(r||!!i[0]),i.length=e,r){for(;++i[--e]>9;)if(i[e]=0,e===0){++n.e,i.unshift(1);break}}for(e=i.length;!i[--e];)i.pop()}return n}function Ve(n,e,t){var r=n.e,i=n.c.join(""),o=i.length;if(e)i=i.charAt(0)+(o>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)i="0"+i;i="0."+i}else if(r>0)if(++r>o)for(r-=o;r--;)i+="0";else r<o&&(i=i.slice(0,r)+"."+i.slice(r));else o>1&&(i=i.charAt(0)+"."+i.slice(1));return n.s<0&&t?"-"+i:i}C.abs=function(){var n=new this.constructor(this);return n.s=1,n};C.cmp=function(n){var e,t=this,r=t.c,i=(n=new t.constructor(n)).c,o=t.s,s=n.s,a=t.e,c=n.e;if(!r[0]||!i[0])return r[0]?o:i[0]?-s:0;if(o!=s)return o;if(e=o<0,a!=c)return a>c^e?1:-1;for(s=(a=r.length)<(c=i.length)?a:c,o=-1;++o<s;)if(r[o]!=i[o])return r[o]>i[o]^e?1:-1;return a==c?0:a>c^e?1:-1};C.div=function(n){var e=this,t=e.constructor,r=e.c,i=(n=new t(n)).c,o=e.s==n.s?1:-1,s=t.DP;if(s!==~~s||s<0||s>Le)throw Error(ar);if(!i[0])throw Error(lo);if(!r[0])return n.s=o,n.c=[n.e=0],n;var a,c,l,u,d,f=i.slice(),p=a=i.length,g=r.length,v=r.slice(0,a),w=v.length,y=n,S=y.c=[],ae=0,D=s+(y.e=e.e-n.e)+1;for(y.s=o,o=D<0?0:D,f.unshift(0);w++<a;)v.push(0);do{for(l=0;l<10;l++){if(a!=(w=v.length))u=a>w?1:-1;else for(d=-1,u=0;++d<a;)if(i[d]!=v[d]){u=i[d]>v[d]?1:-1;break}if(u<0){for(c=w==a?i:f;w;){if(v[--w]<c[w]){for(d=w;d&&!v[--d];)v[d]=9;--v[d],v[w]+=10}v[w]-=c[w]}for(;!v[0];)v.shift()}else break}S[ae++]=u?l:++l,v[0]&&u?v[w]=r[p]||0:v=[r[p]]}while((p++<g||v[0]!==fe)&&o--);return!S[0]&&ae!=1&&(S.shift(),y.e--,D--),ae>D&&Ge(y,D,t.RM,v[0]!==fe),y};C.eq=function(n){return this.cmp(n)===0};C.gt=function(n){return this.cmp(n)>0};C.gte=function(n){return this.cmp(n)>-1};C.lt=function(n){return this.cmp(n)<0};C.lte=function(n){return this.cmp(n)<1};C.minus=C.sub=function(n){var e,t,r,i,o=this,s=o.constructor,a=o.s,c=(n=new s(n)).s;if(a!=c)return n.s=-c,o.plus(n);var l=o.c.slice(),u=o.e,d=n.c,f=n.e;if(!l[0]||!d[0])return d[0]?n.s=-c:l[0]?n=new s(o):n.s=1,n;if(a=u-f){for((i=a<0)?(a=-a,r=l):(f=u,r=d),r.reverse(),c=a;c--;)r.push(0);r.reverse()}else for(t=((i=l.length<d.length)?l:d).length,a=c=0;c<t;c++)if(l[c]!=d[c]){i=l[c]<d[c];break}if(i&&(r=l,l=d,d=r,n.s=-n.s),(c=(t=d.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;t>a;){if(l[--t]<d[t]){for(e=t;e&&!l[--e];)l[e]=9;--l[e],l[t]+=10}l[t]-=d[t]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--f;return l[0]||(n.s=1,l=[f=0]),n.c=l,n.e=f,n};C.mod=function(n){var e,t=this,r=t.constructor,i=t.s,o=(n=new r(n)).s;if(!n.c[0])throw Error(lo);return t.s=n.s=1,e=n.cmp(t)==1,t.s=i,n.s=o,e?new r(t):(i=r.DP,o=r.RM,r.DP=r.RM=0,t=t.div(n),r.DP=i,r.RM=o,this.minus(t.times(n)))};C.neg=function(){var n=new this.constructor(this);return n.s=-n.s,n};C.plus=C.add=function(n){var e,t,r,i=this,o=i.constructor;if(n=new o(n),i.s!=n.s)return n.s=-n.s,i.minus(n);var s=i.e,a=i.c,c=n.e,l=n.c;if(!a[0]||!l[0])return l[0]||(a[0]?n=new o(i):n.s=i.s),n;if(a=a.slice(),e=s-c){for(e>0?(c=s,r=l):(e=-e,r=a),r.reverse();e--;)r.push(0);r.reverse()}for(a.length-l.length<0&&(r=l,l=a,a=r),e=l.length,t=0;e;a[e]%=10)t=(a[--e]=a[e]+l[e]+t)/10|0;for(t&&(a.unshift(t),++c),e=a.length;a[--e]===0;)a.pop();return n.c=a,n.e=c,n};C.pow=function(n){var e=this,t=new e.constructor("1"),r=t,i=n<0;if(n!==~~n||n<-uo||n>uo)throw Error(Ue+"exponent");for(i&&(n=-n);n&1&&(r=r.times(e)),n>>=1,!!n;)e=e.times(e);return i?t.div(r):r};C.prec=function(n,e){if(n!==~~n||n<1||n>Le)throw Error(Ue+"precision");return Ge(new this.constructor(this),n,e)};C.round=function(n,e){if(n===fe)n=0;else if(n!==~~n||n<-Le||n>Le)throw Error(ar);return Ge(new this.constructor(this),n+this.e+1,e)};C.sqrt=function(){var n,e,t,r=this,i=r.constructor,o=r.s,s=r.e,a=new i("0.5");if(!r.c[0])return new i(r);if(o<0)throw Error(Pt+"No square root");o=Math.sqrt(+Ve(r,!0,!0)),o===0||o===1/0?(e=r.c.join(""),e.length+s&1||(e+="0"),o=Math.sqrt(e),s=((s+1)/2|0)-(s<0||s&1),n=new i((o==1/0?"5e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+s)):n=new i(o+""),s=n.e+(i.DP+=4);do t=n,n=a.times(t.plus(r.div(t)));while(t.c.slice(0,s).join("")!==n.c.slice(0,s).join(""));return Ge(n,(i.DP-=4)+n.e+1,i.RM)};C.times=C.mul=function(n){var e,t=this,r=t.constructor,i=t.c,o=(n=new r(n)).c,s=i.length,a=o.length,c=t.e,l=n.e;if(n.s=t.s==n.s?1:-1,!i[0]||!o[0])return n.c=[n.e=0],n;for(n.e=c+l,s<a&&(e=i,i=o,o=e,l=s,s=a,a=l),e=new Array(l=s+a);l--;)e[l]=0;for(c=a;c--;){for(a=0,l=s+c;l>c;)a=e[l]+o[c]*i[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=a}for(a?++n.e:e.shift(),c=e.length;!e[--c];)e.pop();return n.c=e,n};C.toExponential=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Le)throw Error(ar);for(t=Ge(new t.constructor(t),++n,e);t.c.length<n;)t.c.push(0)}return Ve(t,!0,!!r)};C.toFixed=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Le)throw Error(ar);for(t=Ge(new t.constructor(t),n+t.e+1,e),n=n+t.e+1;t.c.length<n;)t.c.push(0)}return Ve(t,!1,!!r)};C[Symbol.for("nodejs.util.inspect.custom")]=C.toJSON=C.toString=function(){var n=this,e=n.constructor;return Ve(n,n.e<=e.NE||n.e>=e.PE,!!n.c[0])};C.toNumber=function(){var n=+Ve(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(n.toString()))throw Error(Pt+"Imprecise conversion");return n};C.toPrecision=function(n,e){var t=this,r=t.constructor,i=t.c[0];if(n!==fe){if(n!==~~n||n<1||n>Le)throw Error(Ue+"precision");for(t=Ge(new r(t),n,e);t.c.length<n;)t.c.push(0)}return Ve(t,n<=t.e||t.e<=r.NE||t.e>=r.PE,!!i)};C.valueOf=function(){var n=this,e=n.constructor;if(e.strict===!0)throw Error(Pt+"valueOf disallowed");return Ve(n,n.e<=e.NE||n.e>=e.PE,!0)};var dl=co(),Bt=dl;var E=class n{constructor(e){this.checkNumberNotNull(e),typeof e=="string"?this.big=new Bt(e):e instanceof n?this.big=new Bt(e.big):e.toString?this.big=new Bt(e.toString()):this.big=new Bt(+e)}abs(){let e=this.big.abs();return this.wrap(e)}cmp(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.cmp(e):e instanceof n?this.big.cmp(e.big):e.toString?this.big.cmp(e.toString()):this.big.cmp(+e)}div(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.div(e):e instanceof n?t=this.big.div(e.big):e.toString?t=this.big.div(e.toString()):t=this.big.div(+e),this.wrap(t)}eq(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.eq(e):e instanceof n?this.big.eq(e.big):e.toString?this.big.eq(e.toString()):this.big.eq(+e)}gt(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.gt(e):e instanceof n?this.big.gt(e.big):e.toString?this.big.gt(e.toString()):this.big.gt(+e)}gte(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.gte(e):e instanceof n?this.big.gte(e.big):e.toString?this.big.gte(e.toString()):this.big.gte(+e)}lt(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.lt(e):e instanceof n?this.big.lt(e.big):e.toString?this.big.lt(e.toString()):this.big.lt(+e)}lte(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.lte(e):e instanceof n?this.big.lte(e.big):e.toString?this.big.lte(e.toString()):this.big.lte(+e)}plus(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.plus(e):e instanceof n?t=this.big.plus(e.big):e.toString?t=this.big.plus(e.toString()):t=this.big.plus(+e),this.wrap(t)}minus(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.minus(e):e instanceof n?t=this.big.minus(e.big):e.toString?t=this.big.minus(e.toString()):t=this.big.minus(+e),this.wrap(t)}mod(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.mod(e):e instanceof n?t=this.big.mod(e.big):e.toString?t=this.big.mod(e.toString()):t=this.big.mod(+e),this.wrap(t)}round(e){let t=this.big.round(e);return this.wrap(t)}times(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.times(e):e instanceof n?t=this.big.times(e.big):e.toString?t=this.big.times(e.toString()):t=this.big.times(+e),this.wrap(t)}toFixed(e){return this.big.toFixed(e)}toString(){return this.big.toString()}toNumber(){return this.big.toNumber()}checkNumberNotNull(e){if(e==null)throw new Error("Invalid number: null")}static create(){return Object.create(this.prototype)}wrap(e){let t=n.create();return t.big=e,t}};var _t;(function(n){n.DAILY="DAILY",n.MONTHLY="MONTHLY",n.YEARLY="YEARLY"})(_t||(_t={}));var He;(function(n){n.COMMA="COMMA",n.DOT="DOT"})(He||(He={}));var nt;(function(n){n.NONE="NONE",n.VIEWER="VIEWER",n.RECORDER="RECORDER",n.POSTER="POSTER",n.EDITOR="EDITOR",n.OWNER="OWNER"})(nt||(nt={}));var ur;(function(n){n.PUBLIC="PUBLIC",n.PRIVATE="PRIVATE"})(ur||(ur={}));var F;(function(n){n.ASSET="ASSET",n.LIABILITY="LIABILITY",n.INCOMING="INCOMING",n.OUTGOING="OUTGOING"})(F||(F={}));var be;(function(n){n.TOTAL="TOTAL",n.PERIOD="PERIOD",n.CUMULATIVE="CUMULATIVE"})(be||(be={}));var lr;(function(n){n.MONTH="MONTH",n.QUARTER="QUARTER",n.YEAR="YEAR"})(lr||(lr={}));var cr;(function(n){n.JANUARY="JANUARY",n.FEBRUARY="FEBRUARY",n.MARCH="MARCH",n.APRIL="APRIL",n.MAY="MAY",n.JUNE="JUNE",n.JULY="JULY",n.AUGUST="AUGUST",n.SEPTEMBER="SEPTEMBER",n.OCTOBER="OCTOBER",n.NOVEMBER="NOVEMBER",n.DECEMBER="DECEMBER"})(cr||(cr={}));var me;(function(n){n.TRASHED="TRASHED",n.DRAFT="DRAFT",n.UNCHECKED="UNCHECKED",n.CHECKED="CHECKED"})(me||(me={}));var it;(function(n){n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR"})(it||(it={}));var dr;(function(n){n.FILE_CREATED="FILE_CREATED",n.FILE_UPDATED="FILE_UPDATED",n.TRANSACTION_CREATED="TRANSACTION_CREATED",n.TRANSACTION_UPDATED="TRANSACTION_UPDATED",n.TRANSACTION_DELETED="TRANSACTION_DELETED",n.TRANSACTION_POSTED="TRANSACTION_POSTED",n.TRANSACTION_CHECKED="TRANSACTION_CHECKED",n.TRANSACTION_UNCHECKED="TRANSACTION_UNCHECKED",n.TRANSACTION_RESTORED="TRANSACTION_RESTORED",n.ACCOUNT_CREATED="ACCOUNT_CREATED",n.ACCOUNT_UPDATED="ACCOUNT_UPDATED",n.ACCOUNT_DELETED="ACCOUNT_DELETED",n.QUERY_CREATED="QUERY_CREATED",n.QUERY_UPDATED="QUERY_UPDATED",n.QUERY_DELETED="QUERY_DELETED",n.GROUP_CREATED="GROUP_CREATED",n.GROUP_UPDATED="GROUP_UPDATED",n.GROUP_DELETED="GROUP_DELETED",n.COMMENT_CREATED="COMMENT_CREATED",n.COMMENT_DELETED="COMMENT_DELETED",n.COLLABORATOR_ADDED="COLLABORATOR_ADDED",n.COLLABORATOR_UPDATED="COLLABORATOR_UPDATED",n.COLLABORATOR_REMOVED="COLLABORATOR_REMOVED",n.INTEGRATION_CREATED="INTEGRATION_CREATED",n.INTEGRATION_UPDATED="INTEGRATION_UPDATED",n.INTEGRATION_DELETED="INTEGRATION_DELETED",n.BOOK_UPDATED="BOOK_UPDATED",n.BOOK_DELETED="BOOK_DELETED"})(dr||(dr={}));function hr(n,e){return e<=0?"":e===1?n:n+hr(n,e-1)}function ho(n){if(!n||typeof n!="string")return[];let e=/#([a-zA-Z0-9_]+)/g,t=new Set,r;for(;(r=e.exec(n))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}var fr=null;function pr(n,e){return n==null&&(n=new E("0")),e?new E(n).round(e):new E(n).round(2)}function ge(n,e,t){if(n==null)return"";if(typeof n=="string"){if(n.trim()=="")return"";n=new E(n)}if(n==null)return"";t==null&&(t=2);var r=n.toFixed(t)+"";return e==He.DOT?r.replace(/\,/g,"."):r.replace(/\./g,",")}function mr(n,e){if(n!=null){if(!isNaN(+n)&&isFinite(+n))return new E(n);e==He.DOT?n=n.replace(/\,/g,""):n=n.replace(/\./g,"").replace(/\,/g,".");try{return new E(n)}catch(t){return}}}function po(n,e){if(!n)return new Date;var t=n/1e4,r=n/100%100,i=n%100,o=gn(t,r,i,e);return o}function gn(n,e,t,r){var i=new Date(n,e-1,t);return r||(r=0),i.setTime(i.getTime()+r*60*1e3),i}function Lt(n,e,t){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!t||t=="")&&(t="UTC"),e?Rt.DateTime.fromJSDate(n,{zone:t}).toFormat(e):$e(n,t))}function $e(n,e){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!e||e=="")&&(e="UTC"),Rt.DateTime.fromJSDate(n,{zone:e}).toISODate())}function ot(n){return+n.replace(/-/g,"")}function gr(n,e,t){e||(e="yyyy-MM-dd");let r=Rt.DateTime.fromFormat(n,e,{zone:t}).toJSDate();return r instanceof Date&&!isNaN(r.getTime())?r:Rt.DateTime.fromFormat(n,"yyyy-MM-dd",{zone:t}).toJSDate()}function q(n,e){return n==null?new E(0):e!=null&&!e?n.times(-1):n}function Ae(n){for(var e=0,t=0;t<n.length;t++)n[t].length>e&&(e=n[t].length);for(var t=0;t<n.length;t++)for(;n[t].length<e;)n[t].push(null);return n}function ye(n){return Ut(n,"_")}function Ut(n,e){return!n||typeof n!="string"?"":(e&&(n=n.replace(new RegExp(e,"g")," ")),n=n.replace(new RegExp("-","g")," "),n=n.replace(/ +(?= )/g,""),n=fl(n.trim().toLowerCase()),e&&(n=n.replace(new RegExp(" ","g"),e)),n)}function fl(n){for(var e=n.split(""),t="",r=0;r<e.length;r++)t+=e[r]in fo()?fo()[e[r]]:e[r];return t}function fo(){if(fr==null){fr={};for(var n=0;n<mn.length;n++)for(var e=mn[n].letters.split(""),t=0;t<e.length;t++)fr[e[t]]=mn[n].base}return fr}var mn=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}];var P=class{constructor(e){this.payload=e||{}}json(){return Object.assign({},this.payload)}};var U=class extends P{isHiddenProperty(e){return e.endsWith("_")}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}setProperties(e){return this.payload.properties=Object.assign({},e),this}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}setProperty(e,t){return e==null||e.trim()==""?this:(this.payload.properties==null&&(this.payload.properties={}),t||(t=""),this.payload.properties[e]=t,this)}deleteProperty(e){return this.setProperty(e,null),this}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}setVisibleProperty(e,t){return this.isHiddenProperty(e)?this:this.setProperty(e,t)}setVisibleProperties(e){if(e==null)return this;let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.isHiddenProperty(r)||(t[r]=e[r]));return this.setProperties(t)}getVisibleProperties(){let e=this.getProperties(),t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.isHiddenProperty(r)||(t[r]=e[r]));return t}};var Gt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},J=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.children=new Map,this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}isBalanceVerified(){return Gt(this,void 0,void 0,function*(){let e=yield this.getAccounts();for(let t of e)if(!t.isBalanceVerified())return!1;return!0})}isLocked(){return this.payload.locked==null?!1:this.payload.locked}setLocked(e){return this.payload.locked=e,this}getNormalizedName(){return this.payload.normalizedName?this.payload.normalizedName:Ut(this.getName())}getAccounts(){return Gt(this,void 0,void 0,function*(){if(this.accounts)return Array.from(this.accounts.values());let e=this.getId();if(!e)return[];let t=yield Qn(this.book.getId(),e,this.getConfig());return t?t.map(i=>new G(this.book,i)):[]})}getType(){return this.payload.type}isHidden(){return this.payload.hidden}setHidden(e){return this.payload.hidden=e,this}isCredit(){return this.payload.credit}isMixed(){return this.payload.mixed}isPermanent(){return this.payload.permanent}getParent(){return this.parent}setParent(e){return e?this.payload.parent={id:e.getId(),name:e.getName(),normalizedName:e.getNormalizedName()}:this.payload.parent=void 0,this}hasParent(){return this.payload.parent!=null}getChildren(){return Array.from(this.children.values())||[]}addChild(e){let t=e.getId();t&&this.children.set(t,e)}getDescendants(){let e=new Set;return this.traverseDescendants(this,e),e}getDescendantTreeIds(){return new Set(Array.from(this.getDescendants()).map(e=>e.getId()||""))}hasChildren(){return this.getChildren().length>0}isLeaf(){return this.getChildren().length===0}isRoot(){return this.getParent()==null}getDepth(){return this.depth==null&&(this.parent?this.depth=this.parent.getDepth()+1:this.depth=0),this.depth}getRoot(){return this.root==null&&(this.parent!=null?this.root=this.parent.getRoot():this.root=this),this.root}getRootName(){let e=this.getRoot();return e!=null&&e.getName()||""}traverseDescendants(e,t){t.add(e);let r=e.getChildren();if(r.length>0)for(let i of r)this.traverseDescendants(i,t)}buildGroupTree(e){if(this.parent=void 0,this.depth=void 0,this.root=void 0,this.payload.parent){let t=e.get(this.payload.parent.id||"");t&&(this.parent=t,t.addChild(this))}}addAccount(e){let t=e==null?void 0:e.getId();t&&(this.accounts||(this.accounts=new Map),this.accounts.set(t,e))}hasAccounts(){return this.payload.hasAccounts}create(){return Gt(this,void 0,void 0,function*(){return this.payload=yield qn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}update(){return Gt(this,void 0,void 0,function*(){return this.payload=yield Wn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}remove(){return Gt(this,void 0,void 0,function*(){return this.payload=yield Yn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(!0),this})}updateGroupCache(e){this.book.setGroup(this.payload,e),this.book.clearCache()}};var st=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},G=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}isBalanceVerified(){return this.payload.balanceVerified}getNormalizedName(){return this.payload.normalizedName?this.payload.normalizedName:Ut(this.getName())}getType(){return this.payload.type}setType(e){return this.payload.type=e,this}isArchived(){return this.payload.archived}setArchived(e){return this.payload.archived=e,this}hasTransactionPosted(){return this.payload.hasTransactionPosted}isPermanent(){return this.payload.permanent}isCredit(){return this.payload.credit}getGroups(){return st(this,void 0,void 0,function*(){if(!this.getId())return[];if(yield this.book.getGroups(),this.payload.groups!=null){let t=[];for(let r of this.payload.groups){let i=yield this.book.getGroup(r.id);i&&t.push(i)}return t}return[]})}setGroups(e){return this.payload.groups=void 0,e!=null&&e.forEach(t=>this.addGroup(t)),this}addGroup(e){return this.payload.groups||(this.payload.groups=[]),e instanceof J?this.payload.groups.push(e.json()):this.payload.groups.push(e),this}removeGroup(e){return st(this,void 0,void 0,function*(){if(this.payload.groups!=null){let t;if(e instanceof J?t=e:typeof e=="string"&&(t=yield this.book.getGroup(e)),t)for(let r=0;r<this.payload.groups.length;r++)this.payload.groups[r].id==t.getId()&&this.payload.groups.splice(r,1)}return this})}isInGroup(e){return st(this,void 0,void 0,function*(){if(e==null)return!1;if(e instanceof J)return this.isInGroupObject_(e);var t=yield this.book.getGroup(e);return t==null?!1:this.isInGroupObject_(t)})}isInGroupObject_(e){if(this.payload.groups==null)return!1;for(var t=0;t<this.payload.groups.length;t++)if(this.payload.groups[t]==e.getId())return!0;return!1}create(){return st(this,void 0,void 0,function*(){return this.payload=yield Rn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}update(){return st(this,void 0,void 0,function*(){return this.payload=yield Un(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}remove(){return st(this,void 0,void 0,function*(){return this.payload=yield Vn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(!0),this})}updateAccountCache(e){this.book.setAccount(this.payload,e),this.book.clearCache()}};var mo=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},at=class{constructor(e){this.accounts=e,this.shouldIncludeArchived=!1,this.shouldAddGroups=!1,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.propertyKeys=[]}archived(e){return this.shouldIncludeArchived=e,this}groups(e){return this.shouldAddGroups=e,this}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}getPropertyKeys(){if(this.propertyKeys.length===0){for(let e of this.accounts)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}return this.propertyKeys}getTypeIndex(e){return e===F.ASSET?0:e===F.LIABILITY?1:e===F.INCOMING?2:3}getMaxNumberOfGroups(){return mo(this,void 0,void 0,function*(){let e=0;for(let t of this.accounts){let r=yield t.getGroups();r.length>e&&(e=r.length)}return e})}sortGroupsHierarchyPath_(e){let t=[],r=[];for(let a of e)a.getParent()!=null||a.hasChildren()?t.push(a):r.push(a);let i=new Map;for(let a of t){let l=a.getRoot().getId()||"";i.has(l)||i.set(l,[]),i.get(l).push(a)}let o=Array.from(i.entries()).sort((a,c)=>{let l=a[1][0].getRoot(),u=c[1][0].getRoot();return l.getNormalizedName().localeCompare(u.getNormalizedName())}).map(([a,c])=>c.sort((l,u)=>l.getDepth()-u.getDepth()));r.sort((a,c)=>a.getNormalizedName().localeCompare(c.getNormalizedName()));let s=[];for(let a of o)s.push(...a);return s.push(...r),s}build(){return mo(this,void 0,void 0,function*(){let e=new Array,t=this.accounts;this.shouldIncludeArchived||(t=this.accounts.filter(o=>!o.isArchived()));let r=[];if(this.shouldAddIds&&r.push("Account Id"),r.push("Name"),r.push("Type"),this.shouldAddGroups){let o=yield this.getMaxNumberOfGroups();for(let s=0;s<o;s++)r.push("Group")}t.sort((o,s)=>{let a=this.getTypeIndex(o.getType())-this.getTypeIndex(s.getType());return a===0&&(a=o.getNormalizedName().localeCompare(s.getNormalizedName())),a});let i=[];this.shouldAddProperties&&(i=this.getPropertyKeys());for(let o of t){let s=[];if(this.shouldAddIds&&s.push(o.getId()),s.push(o.getName()),s.push(o.getType()),this.shouldAddGroups){let a=this.sortGroupsHierarchyPath_(yield o.getGroups());for(let c of a)s.push(c.getName())}if(this.shouldAddGroups&&this.shouldAddProperties){let a=r.length-s.length;for(let c=0;c<a;c++)s.push("")}if(this.shouldAddProperties){let a=o.getProperties();for(let c of i){let l=a[c];if(l){s.push(l);continue}s.push("")}}e.push(s)}return this.shouldAddProperties&&(r=r.concat(i)),e.unshift(r),Ae(e),e})}};var ut=class{constructor(e){this.payload=e||{}}json(){return Object.assign({},this.payload)}getId(){return this.payload.id}getName(){return this.payload.name}getLogoUrl(){return this.payload.logo}getLogoUrlDark(){return this.payload.logoDark}};var vr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function go(n){return vr(this,void 0,void 0,function*(){let e=yield new ee("v5/apps",n).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}function yo(n,e){return vr(this,void 0,void 0,function*(){return(yield new ee(`v5/apps/${n}`,e).setMethod("GET").fetch()).data})}function vo(n,e){return vr(this,void 0,void 0,function*(){var t=yield new ee("v5/apps",e).setMethod("POST").setPayload(n).fetch();return t.data})}function wo(n,e){return vr(this,void 0,void 0,function*(){var t=yield new ee("v5/apps",e).setMethod("PUT").setPayload(n).fetch();return t.data})}var Ce=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function To(n,e){return Ce(this,void 0,void 0,function*(){let t=new m("",e);n&&t.addParam("query",n);let r=yield t.fetch();if(r.data==null)return[];let o=r.data.items;return o==null?[]:o})}function bo(n,e,t,r){return Ce(this,void 0,void 0,function*(){if(n==null)throw new Error("Book id null!");return e=e||!1,t=t||!1,(yield new m(n,r).addParam("loadAccounts",e).addParam("loadGroups",t).fetch()).data})}function Ao(n,e){return Ce(this,void 0,void 0,function*(){return(yield new m("",e).setMethod("POST").setPayload(n).fetch()).data})}function Co(n,e,t){return Ce(this,void 0,void 0,function*(){var r=yield new m(`${n}`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Do(n,e){return Ce(this,void 0,void 0,function*(){new m(`${n}/audit`,e).setMethod("PATCH").fetch()})}function So(n,e){return Ce(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/apps`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Io(n,e,t,r,i){return Ce(this,void 0,void 0,function*(){let o=new m(`${n}/copy`,i).setMethod("POST").addParam("name",e);return t&&(o.addParam("copyTransactions",t),r&&o.addParam("fromDate",r)),(yield o.fetch()).data})}function ko(n,e){return Ce(this,void 0,void 0,function*(){return(yield new m(`${n}`,e).setMethod("DELETE").fetch()).data})}var wr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function xo(n,e){return wr(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/queries`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function No(n,e,t){return wr(this,void 0,void 0,function*(){return(yield new m(`${n}/queries`,t).setMethod("POST").setPayload(e).fetch()).data})}function Mo(n,e,t){return wr(this,void 0,void 0,function*(){return(yield new m(`${n}/queries`,t).setMethod("PUT").setPayload(e).fetch()).data})}function Fo(n,e,t){return wr(this,void 0,void 0,function*(){return(yield new m(`${n}/queries/${e}`,t).setMethod("DELETE").fetch()).data})}var hl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Bo(n,e,t){return hl(this,void 0,void 0,function*(){var r;let i=yield new m(`${n}/balances`,t).addParam("query",e).addParam("time",Date.now()).fetch(),o=(r=i.data)===null||r===void 0?void 0:r.balancesUrl;if(o){let s=yield new qe(o).setMethod("GET").execute();i={data:s.data,status:s.status}}return i.data})}var yn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function _o(n,e,t){return yn(this,void 0,void 0,function*(){var r=yield new m(`${n}/files`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Er(n,e,t){return yn(this,void 0,void 0,function*(){var r=yield new m(`${n}/files/${e}`,t).setMethod("GET").fetch();return r.data})}function Ro(n,e,t){return yn(this,void 0,void 0,function*(){return(yield new m(`${n}/files`,t).setMethod("PUT").setPayload(e).fetch()).data})}var Tr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Uo(n,e){return Tr(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function vn(n,e,t){return Tr(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations`,t).setPayload(e).setMethod("POST").fetch()).data})}function wn(n,e,t){return Tr(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations`,t).setPayload(e).setMethod("PUT").fetch()).data})}function Go(n,e,t){return Tr(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations/${e}`,t).setMethod("DELETE").fetch()).data})}var _=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ho(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function $o(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/post/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function jo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;return r=yield(yield new m(`${n}/transactions/batch`,t).setMethod("POST").setPayload(i).fetch()).data,r!=null&&r.items!=null?r.items:[]})}function zo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;return i=yield(yield new m(`${n}/transactions/batch`,r).setMethod("PUT").setPayload(o).addParam("updateChecked",t).fetch()).data,i!=null&&i.items!=null?i.items:[]})}function qo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/check/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Zo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/uncheck/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Wo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;i=yield(yield new m(`${n}/transactions/trash/batch`,r).setMethod("PATCH").setPayload(o).addParam("trashChecked",t).fetch()).data})}function Yo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;r=yield(yield new m(`${n}/transactions/untrash/batch`,t).setMethod("PATCH").setPayload(i).fetch()).data})}function Ko(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Jo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/post`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function Qo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/check`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function Xo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/uncheck`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function es(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/trash`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ts(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/restore`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function rs(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/${e}`,t).setMethod("GET").fetch();return r.data})}function ns(n,e,t,r,i){return _(this,void 0,void 0,function*(){e||(e=""),t||(t=100);var o=new m(`${n}/transactions`,i);o.addParam("query",e),o.addParam("limit",t),r!=null&&o.setHeader("cursor",r);var s=yield o.fetch();return s.data})}function is(n,e,t){return _(this,void 0,void 0,function*(){let r=Object.assign({},e);return(yield new m(`${n}/transactions/merge`,t).setMethod("PATCH").setPayload(r).fetch()).data})}function os(n,e,t){return _(this,void 0,void 0,function*(){return(yield new m(`${n}/transactions/count`,t).setMethod("GET").addParam("query",e).fetch()).data})}var Vt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function as(n,e,t,r,i,o,s,a){return Vt(this,void 0,void 0,function*(){let c=new m(`${n.getId()}/events`,a);c.addParam("after",e),c.addParam("before",t),c.addParam("error",r),c.addParam("resoureId",i),c.addParam("limit",o),s!=null&&c.setHeader("cursor",s);var l=yield c.fetch();return l.data})}function us(n,e,t,r){return Vt(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("PUT").fetch()).data})}function ls(n,e,t,r){return Vt(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("DELETE").fetch()).data})}function cs(n,e,t,r){return Vt(this,void 0,void 0,function*(){let i=new m(`${n.getId()}/events/replay/batch`,r).setMethod("PATCH").setPayload(e);t&&i.addParam("errorsOnly",t),yield i.fetch()})}function ds(n,e){return Vt(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/backlog`,e).setMethod("GET").fetch()).data})}var En=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function hs(n,e){return En(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/collaborators`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Tn(n,e,t,r){return En(this,void 0,void 0,function*(){let i=new m(`${n}/collaborators`,r).setMethod("POST").setPayload(e);return t&&(i=i.addParam("message",t)),(yield i.fetch()).data})}function ps(n,e,t){return En(this,void 0,void 0,function*(){return(yield new m(`${n}/collaborators/${e}`,t).setMethod("DELETE").fetch()).data})}var bn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},lt=class extends P{constructor(e,t){super(t),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getEmail(){return this.payload.email}setEmail(e){return this.payload.email=e,this}getPermission(){return this.payload.permission}setPermission(e){return this.payload.permission=e,this}create(e){return bn(this,void 0,void 0,function*(){return this.payload=yield Tn(this.book.getId(),this.payload,e,this.getConfig()),this.book.clearCollaboratorCache(),this})}update(){return bn(this,void 0,void 0,function*(){return this.payload=yield Tn(this.book.getId(),this.payload,void 0,this.getConfig()),this.book.clearCollaboratorCache(),this})}remove(){return bn(this,void 0,void 0,function*(){let e=this.getEmail();if(!e)throw new Error("Collaborator email is required");return this.payload=yield ps(this.book.getId(),e,this.getConfig()),this.book.clearCollaboratorCache(),this})}};var ct=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function gs(n){return ct(this,void 0,void 0,function*(){var e;let t=yield new O("collections",n).fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function ys(n,e){return ct(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("POST").setPayload(n).fetch()).data})}function vs(n,e){return ct(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("PUT").setPayload(n).fetch()).data})}function ws(n,e){return ct(this,void 0,void 0,function*(){var t;let r=yield new O(`collections/${n.id}`,e).setMethod("DELETE").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Es(n,e,t){return ct(this,void 0,void 0,function*(){var r;let i=yield new O(`collections/${n}/books/add`,t).setMethod("PATCH").setPayload(e).fetch();return((r=i==null?void 0:i.data)===null||r===void 0?void 0:r.items)||[]})}function Ts(n,e,t){return ct(this,void 0,void 0,function*(){var r;let i=yield new O(`collections/${n}/books/remove`,t).setMethod("PATCH").setPayload(e).fetch();return((r=i==null?void 0:i.data)===null||r===void 0?void 0:r.items)||[]})}var Ht=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},De=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getOwnerUsername(){return this.payload.ownerUsername}getPermission(){return this.payload.permission?this.payload.permission:void 0}getBooks(){let e=[];if(this.payload.books==null)return e;for(let t of this.payload.books){let r=new Q(t,this.config);e.push(r)}return e}addBooks(e){return Ht(this,void 0,void 0,function*(){let t=this.getId();if(t&&e.length>0){let r={items:e.map(o=>o.json())};return(yield Es(t,r,this.getConfig())).map(o=>new Q(o,this.config))}return[]})}removeBooks(e){return Ht(this,void 0,void 0,function*(){let t=this.getId();if(t&&e.length>0){let r={items:e.map(o=>o.json())};return(yield Ts(t,r,this.getConfig())).map(o=>new Q(o,this.config))}return[]})}getUpdatedAt(){return this.payload.updatedAt}create(){return Ht(this,void 0,void 0,function*(){return this.payload=yield ys(this.payload,this.getConfig()),this})}update(){return Ht(this,void 0,void 0,function*(){return this.payload=yield vs(this.payload,this.getConfig()),this})}remove(){return Ht(this,void 0,void 0,function*(){return(yield ws(this.payload,this.getConfig())).map(t=>new Q(t,this.config))})}};var As=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},dt=class{constructor(e,t){this.event=e,this.payload=t||{}}getType(){return this.payload.type}getAgentId(){return this.payload.agentId}getMessage(){return this.payload.message}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}getEvent(){return this.event}replay(){return As(this,void 0,void 0,function*(){let e=this.event.getId();if(e==null)throw new Error("Event id null!");let t=this.getAgentId();if(t==null)throw new Error("Agent id null!");let r=yield us(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}remove(){return As(this,void 0,void 0,function*(){let e=this.event.getId();if(e==null)throw new Error("Event id null!");let t=this.getAgentId();if(t==null)throw new Error("Agent id null!");let r=yield ls(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}updateCache(e){var t;this.event.payload=e,this.event.clearCache();let r=(t=e==null?void 0:e.botResponses)===null||t===void 0?void 0:t.find(i=>i.agentId&&i.agentId===this.getAgentId());this.payload=r||{}}};var $t=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Cs(n,e){return $t(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("GET").fetch()).data})}function Ds(n){return $t(this,void 0,void 0,function*(){var e;let t=yield new O("user/connections",n).setMethod("GET").fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function Ss(n,e){return $t(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("POST").fetch()).data})}function Is(n,e){return $t(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("DELETE").fetch()).data})}function ks(n,e){return $t(this,void 0,void 0,function*(){var t;let r=yield new O(`user/connections/${n}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var ml=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},X=class extends U{constructor(e,t){super(e||{}),this.config=t}getConfig(){return this.config||k.globalConfig}getBookId(){return this.payload.bookId}getId(){return this.payload.id}getName(){return this.payload.name}getAddedBy(){return this.payload.addedBy}getAgentId(){return this.payload.agentId}getLogo(){return this.payload.logo}getLogoUrl(){return this.payload.logo}getLogoUrlDark(){return this.payload.logoDark}getDateAddedMs(){return this.payload.dateAddedMs}getLastUpdateMs(){return this.payload.lastUpdateMs}remove(){return ml(this,void 0,void 0,function*(){let e=this.getBookId(),t=this.getId();return e&&t&&(this.payload=yield Go(e,t,this.getConfig())),this})}};var An=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},je=class extends U{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getAgentId(){return this.payload.agentId}setAgentId(e){return this.payload.agentId=e,this}getName(){return this.payload.name}getLogo(){return this.payload.logo}getDateAddedMs(){return this.payload.dateAddedMs}getEmail(){return this.payload.email}setName(e){return this.payload.name=e,this}setUUID(e){return this.payload.uuid=e,this}getUUID(){return this.payload.uuid}getType(){return this.payload.type}setType(e){return this.payload.type=e,this}clearTokenProperties(){this.getPropertyKeys().filter(e=>e.includes("token")).forEach(e=>this.deleteProperty(e))}getIntegrations(){return An(this,void 0,void 0,function*(){let e=this.getId();return e?(yield ks(e,this.getConfig())).map(i=>new X(i,this.config)):[]})}create(){return An(this,void 0,void 0,function*(){return this.payload=yield Ss(this.payload,this.getConfig()),this})}remove(){return An(this,void 0,void 0,function*(){let e=this.getId();return e&&(this.payload=yield Is(e,this.getConfig())),this})}};var jt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function xs(n){return jt(this,void 0,void 0,function*(){return(yield new O("user",n).setMethod("GET").fetch()).data})}function Ns(n){return jt(this,void 0,void 0,function*(){return(yield new O("user/billing",n).setMethod("GET").fetch()).data})}function Ms(n){return jt(this,void 0,void 0,function*(){return(yield new O("user/billing/counts",n).setMethod("GET").fetch()).data})}function Fs(n,e){return jt(this,void 0,void 0,function*(){return(yield new O("user/billing/portal",e).addParam("returnUrl",n).fetch()).data})}function Ps(n,e,t,r,i){return jt(this,void 0,void 0,function*(){let o=new O("user/billing/checkout",i).addParam("plan",n);return r&&o.addParam("cycle",r),e&&o.addParam("successUrl",e),t&&o.addParam("cancelUrl",t),(yield o.fetch()).data})}var Dn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ft=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}isEnabled(){return this.payload.enabled}getEmail(){return this.payload.email}getHostedDomain(){return this.payload.hostedDomain}getPlan(){return this.payload.plan}isPlanOverdue(){return this.payload.planOverdue}getAdminEmail(){return this.payload.adminEmail}hasStartedTrial(){return this.payload.startedTrial}getDaysLeftInTrial(){return this.payload.daysLeftInTrial}getTotalTransactionsThisMonth(){return this.payload.totalTransactionsThisMonth}getTotalTransactionsThisYear(){return this.payload.totalTransactionsThisYear}getCounts(){return Dn(this,void 0,void 0,function*(){return yield Ms(this.getConfig())})}getPortalUrl(e){return Dn(this,void 0,void 0,function*(){let t=yield Fs(e,this.getConfig());return t==null?void 0:t.url})}getCheckoutUrl(e,t,r,i){return Dn(this,void 0,void 0,function*(){let o=yield Ps(e,t,r,i,this.getConfig());return o==null?void 0:o.url})}};var Sn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Se=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getGivenName(){return this.payload.givenName}getName(){return this.payload.name}getAvatarUrl(){return this.payload.avatarUrl}getFullName(){return this.payload.fullName}getEmail(){return this.payload.email}getHostedDomain(){return this.payload.hostedDomain}getUsername(){return this.payload.username}getBilling(){return Sn(this,void 0,void 0,function*(){let e=yield Ns(this.getConfig());return new ft(e,this.config)})}hasUsedConnections(){return this.payload.bankConnections}getConnections(){return Sn(this,void 0,void 0,function*(){return(yield Ds(this.getConfig())).map(t=>new je(t,this.config))})}getConnection(e){return Sn(this,void 0,void 0,function*(){let t=yield Cs(e,this.getConfig());return new je(t,this.config)})}};var ht=class{constructor(e,t){this.book=e,this.payload=t||{}}json(){return Object.assign({},this.payload)}getBook(){return this.book}getId(){return this.payload.id}getUser(){return this.payload.user?new Se(this.payload.user,this.book.getConfig()):void 0}getAgent(){return this.payload.agent?new ut(this.payload.agent):void 0}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}getType(){return this.payload.type}getBotResponses(){if(this.botResponses!==void 0)return this.botResponses;let e=[];if(this.payload.botResponses)for(let t of this.payload.botResponses)e.push(new dt(this,t));return this.botResponses=e,this.botResponses}hasErrorResponse(){let e=this.getBotResponses();for(let t of e)if(t.getType()===it.ERROR)return!0;return!1}clearCache(){this.botResponses=void 0}};var pt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.map(t=>new ht(this.book,t)))||[]}};var In=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Ie=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.book=e}getBook(){return this.book}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getContentType(){return this.payload.contentType}setContentType(e){return this.payload.contentType=e,this}getContent(){return In(this,void 0,void 0,function*(){let e=this.getId();return this.getId()!=null&&(this.payload==null||this.payload.content==null)&&this.book&&e&&(this.payload=yield Er(this.book.getId(),e,this.getConfig())),this.payload.content})}setContent(e){return this.payload.content=e,this}getUrl(){return this.payload.url}getSize(){return this.payload.size}create(){return In(this,void 0,void 0,function*(){return this.payload=yield _o(this.book.getId(),this.payload,this.getConfig()),this})}update(){return In(this,void 0,void 0,function*(){return this.payload=yield Ro(this.book.getId(),this.payload,this.getConfig()),this})}};var R=[];for(let n=0;n<256;++n)R.push((n+256).toString(16).slice(1));function Bs(n,e=0){return(R[n[e+0]]+R[n[e+1]]+R[n[e+2]]+R[n[e+3]]+"-"+R[n[e+4]]+R[n[e+5]]+"-"+R[n[e+6]]+R[n[e+7]]+"-"+R[n[e+8]]+R[n[e+9]]+"-"+R[n[e+10]]+R[n[e+11]]+R[n[e+12]]+R[n[e+13]]+R[n[e+14]]+R[n[e+15]]).toLowerCase()}var kn,gl=new Uint8Array(16);function On(){if(!kn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");kn=crypto.getRandomValues.bind(crypto)}return kn(gl)}var yl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xn={randomUUID:yl};function vl(n,e,t){var i,o,s;if(xn.randomUUID&&!e&&!n)return xn.randomUUID();n=n||{};let r=(s=(o=n.random)!=null?o:(i=n.rng)==null?void 0:i.call(n))!=null?s:On();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[t+a]=r[a];return e}return Bs(r)}var Nn=vl;var N=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},se=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.pendingFiles=new Map,this.book=e}getConfig(){return this.book.getConfig()}getBook(){return this.book}getId(){return this.payload.id}getAgentId(){return this.payload.agentId}getAgentName(){return this.payload.agentName}getAgentLogoUrl(){return this.payload.agentLogo}getAgentLogoUrlDark(){return this.payload.agentLogoDark}getRemoteIds(){return this.payload.remoteIds||[]}addRemoteId(e){return this.payload.remoteIds==null&&(this.payload.remoteIds=[]),e&&this.payload.remoteIds.push(e),this}isPosted(){return this.payload.posted}isChecked(){return this.payload.checked}setChecked(e){return this.payload.checked=e,this}isTrashed(){return this.payload.trashed}isLocked(){let e=this.getDate()||$e(new Date,this.book.getTimeZone()),t=this.book.getMostRecentLockDate_();return t!=null&&ot(t)>=ot(e)}getStatus(){return this.isTrashed()?me.TRASHED:this.isPosted()?this.isChecked()?me.CHECKED:me.UNCHECKED:me.DRAFT}getTags(){if(this.payload.tags&&this.payload.tags.length>0)return this.payload.tags;let e=this.getDescription();return e&&e.includes("#")?ho(e):[]}getUrls(){return this.payload.urls||[]}setUrls(e){return this.payload.urls=void 0,e&&e.forEach(t=>{this.addUrl(t)}),this}addUrl(e){return this.payload.urls==null&&(this.payload.urls=[]),e&&this.payload.urls.push(e),this}getFiles(){return this.payload.files&&this.payload.files.length>0?this.payload.files.map(t=>new Ie(this.book,t)):[]}removeFile(e){let t=e.getId();return t&&(this.payload.files!=null&&(this.payload.files=this.payload.files.filter(r=>r.id!==t)),this.pendingFiles.delete(t)),this}addFile(e){var t;this.payload.files==null&&(this.payload.files=[]);let r=e.getId(),i=(t=e.getBook())===null||t===void 0?void 0:t.getId();return(r==null||i!=this.book.getId())&&(r==null&&(e.payload.id=`temporary_${Nn()}`),this.pendingFiles.set(e.getId(),e)),this.payload.files.push(e.json()),this}createPendingFiles(){return N(this,void 0,void 0,function*(){if(this.pendingFiles.size===0)return;this.payload.files==null&&(this.payload.files=[]);let e=Array.from(this.pendingFiles.entries()).map(r=>N(this,[r],void 0,function*([i,o]){o.book=this.book,o.setProperty("upload_method","attachment");let s=yield o.create();return{fileId:i,createdFile:s}})),t=yield Promise.all(e);for(let{fileId:r,createdFile:i}of t){let o=this.payload.files.findIndex(s=>s.id===r);o>=0?this.payload.files[o]=i.json():this.payload.files.push(i.json())}this.pendingFiles.clear()})}hasTag(e){for(var t=this.getTags(),r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}getCreditAccount(){return N(this,void 0,void 0,function*(){if(this.payload.creditAccount)return yield this.book.getAccount(this.payload.creditAccount.id)})}getCreditAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getCreditAccount())!=null?(e=yield this.getCreditAccount())===null||e===void 0?void 0:e.getName():""})}setCreditAccount(e){return e==null?(this.payload.creditAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.creditAccount=e.json()):e.id!=null&&(this.payload.creditAccount=e),this)}from(e){return this.setCreditAccount(e)}getDebitAccount(){return N(this,void 0,void 0,function*(){if(this.payload.debitAccount)return yield this.book.getAccount(this.payload.debitAccount.id)})}getDebitAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getDebitAccount())!=null?(e=yield this.getDebitAccount())===null||e===void 0?void 0:e.getName():""})}setDebitAccount(e){return e==null?(this.payload.debitAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.debitAccount={id:e.getId(),name:e.getName()}):e.id!=null&&(this.payload.debitAccount={id:e.id,name:e.name}),this)}to(e){return this.setDebitAccount(e)}getAmount(){return this.payload.amount!=null&&this.payload.amount.trim()!=""?new E(this.payload.amount):void 0}getAmountFormatted(){let e=this.getAmount();if(e)return this.book.formatValue(e)}setAmount(e){return typeof e=="string"?(e=mr(e,this.book.getDecimalSeparator())+"",this.payload.amount=e.toString(),this):(e=new E(e),e.eq(0)?(this.payload.amount=void 0,this):(this.payload.amount=e.abs().toString(),this))}getCreditAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return this.getAmount()})}getDebitAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isDebit(t))return this.getAmount()})}getOtherAccount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return yield this.getDebitAccount();if(yield this.isDebit(t))return yield this.getCreditAccount()})}getOtherAccountName(e){return N(this,void 0,void 0,function*(){var t=yield this.getOtherAccount(e);return t!=null?t.getName():""})}isCredit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getCreditAccount())!=null&&e!=null&&((t=yield this.getCreditAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}isDebit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getDebitAccount())!=null&&e!=null&&((t=yield this.getDebitAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}getAccount_(e){return N(this,void 0,void 0,function*(){return e==null||e instanceof G?e:yield this.book.getAccount(e)})}getDescription(){return this.payload.description==null?"":this.payload.description}setDescription(e){return this.payload.description=e,this}getDate(){return this.payload.date}setDate(e){if(typeof e=="string")if(e.indexOf("/")>0){let t=gr(e,this.book.getDatePattern(),this.book.getTimeZone());this.payload.date=$e(t,this.book.getTimeZone())}else e.indexOf("-")>=0&&(this.payload.date=e);else Object.prototype.toString.call(e)==="[object Date]"&&(this.payload.date=$e(e,this.book.getTimeZone()));return this}getDateObject(){return po(this.getDateValue(),this.book.getTimeZoneOffset())}getDateValue(){return this.payload.dateValue}getDateFormatted(){return this.payload.dateFormatted}getCreatedAt(){return new Date(new Number(this.payload.createdAt).valueOf())}getCreatedAtFormatted(){return Lt(this.getCreatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCreatedBy(){return this.payload.createdBy}getUpdatedAt(){return new Date(new Number(this.payload.updatedAt).valueOf())}getUpdatedAtFormatted(){return Lt(this.getUpdatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCaEvolvedBalance_(){return this.payload.creditAccount!=null&&this.payload.creditAccount.balance!=null?new E(this.payload.creditAccount.balance):void 0}getDaEvolvedBalance_(){return this.payload.debitAccount!=null&&this.payload.debitAccount.balance!=null?new E(this.payload.debitAccount.balance):void 0}getAccountBalance(e){return N(this,void 0,void 0,function*(){var t=this.getCaEvolvedBalance_(),r=!0;if(t==null&&(t=this.getDaEvolvedBalance_(),r=!1),t!=null){if(!e){var i=r?yield this.getCreditAccount():yield this.getDebitAccount();t=q(t,i==null?void 0:i.isCredit())}return pr(t,this.book.getFractionDigits())}else return})}create(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield Ho(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}update(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield Ko(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}check(){return N(this,void 0,void 0,function*(){var e;let t=yield Qo(this.book.getId(),this.payload,this.getConfig());return this.payload.checked=(e=t.transaction)===null||e===void 0?void 0:e.checked,this})}uncheck(){return N(this,void 0,void 0,function*(){var e;let t=yield Xo(this.book.getId(),this.payload,this.getConfig());return this.payload.checked=(e=t.transaction)===null||e===void 0?void 0:e.checked,this})}post(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield Jo(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}trash(){return N(this,void 0,void 0,function*(){var e;let t=yield es(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}untrash(){return N(this,void 0,void 0,function*(){var e;let t=yield ts(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}};var wl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},mt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getAccount(){return wl(this,void 0,void 0,function*(){if(this.payload.account)return yield this.book.getAccount(this.payload.account)})}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;let t=[];for(let r of(e=this.payload.items)!==null&&e!==void 0?e:[])t.push(new se(this.book,r));return t}};var ke=class{constructor(e,t){this.container=e,this.payload=t}getDay(){return this.payload.day}getMonth(){return this.payload.month}getYear(){return this.payload.year}getDate(){var e=this.getYear(),t=this.getMonth(),r=this.getDay();(t==null||t==0)&&e++,(r==null||r==0)&&t++;var i=gn(e,t,r,this.container.getBalancesReport().getBook().getTimeZoneOffset());return i}getFuzzyDate(){return this.payload.fuzzyDate}getCumulativeBalance(){return q(this.getCumulativeBalanceRaw(),this.container.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit)}getPeriodBalance(){return q(this.getPeriodBalanceRaw(),this.container.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance)}getPeriodCredit(){return new E(this.payload.periodCredit)}getPeriodDebit(){return new E(this.payload.periodDebit)}};var he=class{constructor(e,t,r){this.maxDepth=0,this.expandAllAccounts=!1,this.expandAllGroups=!1,this.skipRoot=!1,this.book=e,this.balancesContainers=t,this.periodicity=r,this.balanceType=be.TOTAL,this.shouldFormatDate=!1,this.shouldHideDates=!1,this.shouldHideNames=!1,this.shouldFormatValue=!1,this.shouldTranspose=!1,this.shouldTrial=!1,this.shouldPeriod=!1,this.shouldRaw=!1,this.shouldAddProperties=!1,this.shouldAddHiddenProperties=!1}getBalance(e,t){return this.getRepresentativeBalance(e,t).toNumber()}getRepresentativeBalance(e,t){return e==null?new E(0):t?e.times(-1):e}getBalanceText(e,t){return this.book.formatValue(this.getRepresentativeBalance(e,t))}formatDates(e){return this.shouldFormatDate=e,this}formatValues(e){return this.shouldFormatValue=e,this}expanded(e){return typeof e=="boolean"&&e==!0?(this.maxDepth=1,this.skipRoot=!0):e==-1?this.expandAllGroups=!0:e==-2?this.expandAllAccounts=!0:typeof e=="number"&&e>0&&(this.maxDepth=e),this}type(e){return this.balanceType=e,this}transposed(e){return this.shouldTranspose=e,this}hideDates(e){return this.shouldHideDates=e,this}hideNames(e){return this.shouldHideNames=e,this}properties(e){return this.shouldAddProperties=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}trial(e){return this.shouldTrial=e,this}period(e){return this.shouldPeriod=e,this}raw(e){return this.shouldRaw=e,this}build(){return this.balanceType==be.TOTAL?this.buildTotalDataTable_():this.buildTimeDataTable_()}addPropertyKeys(e,t){for(let r of t.getPropertyKeys())!this.shouldAddHiddenProperties&&r.endsWith("_")||e.indexOf(r)<=-1&&e.push(r)}flattenContainers(e,t){for(let r of this.balancesContainers)this.expandAllAccounts?(this.flattenAllAccounts(r,e,t),e.sort(this.sortContainersFunction)):r.isFromGroup()&&this.expandAllGroups?this.flattenAllGroups(r,e,t):this.flattenMaxDepth(r,e,t)}flattenAllAccounts(e,t,r){if(e.isFromGroup())for(let i of e.getBalancesContainers())this.flattenAllAccounts(i,t,r);else t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e)}sortContainersFunction(e,t){let r=0;e.isPermanent()&&!t.isPermanent()?r=-1:!e.isPermanent()&&t.isPermanent()&&(r=1),r==0&&(e.getParent()&&!t.getParent()?r=-1:!e.getParent()&&t.getParent()&&(r=1)),r==0&&(r=i(e)-i(t)),r==0&&(r=e.getName().toLowerCase().localeCompare(t.getName().toLowerCase()));function i(o){return o.isPermanent()&&!o.isCredit()?0:o.isPermanent()&&o.isCredit()?1:!o.isPermanent()&&o.isCredit()?2:!o.isPermanent()&&!o.isCredit()?3:4}return r}flattenMaxDepth(e,t,r){let i=e.getDepth();if(i<=this.maxDepth){!this.skipRoot&&!this.shouldTranspose&&(e.payload.name=hr(" ",i*4)+e.payload.name),(!this.skipRoot||i!=0)&&(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e));let o=e.getBalancesContainers();if(o&&o.length>0){o.sort(this.sortContainersFunction);for(let s of o)this.flattenMaxDepth(s,t,r)}}}flattenAllGroups(e,t,r){if(e.isFromGroup()){if(!this.shouldTranspose){let i=e.getDepth();e.payload.name=hr(" ",i*4)+e.payload.name}if(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e),e.hasGroupBalances()){let i=e.getBalancesContainers();i.sort(this.sortContainersFunction);for(let o of i)this.flattenAllGroups(o,t,r)}}}buildTotalDataTable_(){var e=new Array;if(this.balancesContainers==null)return e;this.balancesContainers.sort((c,l)=>c!=null&&l!=null?c.getName().toLowerCase().localeCompare(l.getName().toLowerCase()):-1);let t=[],r=new Array;if(this.flattenContainers(r,t),this.shouldAddProperties){t.sort();let c=["name","balance"];for(let l of t)c.push(l);e.push(c)}for(var i=0;i<r.length;i++){var o=r[i];if(o!=null){var s=new Array,a=o.getName();if(s.push(a),this.shouldTrial?this.shouldFormatValue?this.shouldPeriod?(s.push(o.getPeriodDebitText()),s.push(o.getPeriodCreditText())):(s.push(o.getCumulativeDebitText()),s.push(o.getCumulativeCreditText())):this.shouldPeriod?(s.push(o.getPeriodDebit().toNumber()),s.push(o.getPeriodCredit().toNumber())):(s.push(o.getCumulativeDebit().toNumber()),s.push(o.getCumulativeCredit().toNumber())):this.shouldFormatValue?this.shouldPeriod?this.shouldRaw?s.push(o.getPeriodBalanceRawText()):s.push(this.getBalanceText(o.getPeriodBalanceRaw(),o.isPermanent())):this.shouldRaw?s.push(o.getCumulativeBalanceRawText()):s.push(this.getBalanceText(o.getCumulativeBalanceRaw(),o.isPermanent())):this.shouldPeriod?this.shouldRaw?s.push(o.getPeriodBalanceRaw().toNumber()):s.push(this.getBalance(o.getPeriodBalanceRaw(),o.isPermanent())):this.shouldRaw?s.push(o.getCumulativeBalanceRaw().toNumber()):s.push(this.getBalance(o.getCumulativeBalanceRaw(),o.isPermanent())),this.shouldAddProperties){let c=o.getProperties();for(let l of t){let u=c[l];if(u){s.push(u);continue}s.push("")}}e.push(s)}}return this.shouldHideNames&&(e=e.map(c=>c.slice(1))),this.shouldTranspose&&e.length>0&&(e=e[0].map((c,l)=>e.map(u=>u[l]))),e}buildTimeDataTable_(){var e=new Array,t=new Object,r=this.balanceType==be.CUMULATIVE,i=new Array;if(i.push(""),this.balancesContainers==null)return e;let o=[],s=new Array;this.flattenContainers(s,o);for(let D of s){i.push(D.getName());var a=D.getBalances();if(a!=null)for(let L of a){var c=L.getFuzzyDate(),l=t[c];l==null&&(l={},l.date=L.getDate(),t[c]=l);var u;r?u=L.getCumulativeBalanceRaw():u=L.getPeriodBalanceRaw(),l[D.getName()]=this.shouldRaw?u:this.getRepresentativeBalance(u,D.isPermanent())}}e.push(i);var d=new Array;for(var f in t){var p=t[f],g=new Array;g.push(p.date);for(let D of s){var u=p[D.getName()];u==null?u="null_amount":(u=new E(u),this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber()),g.push(u)}d.push(g)}d.sort(function(D,L){return D[0].getTime()-L[0].getTime()});for(var v=null,w=0;w<d.length;w++){var g=d[w];if(w==0)for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}else for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"&&r)v&&(g[y]=v[y]);else if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}v=g,e.push(g)}if(this.shouldFormatDate&&e.length>0)for(var y=1;y<e.length;y++){var g=e[y];g.length>0&&(g[0]=$e(g[0],this.book.getTimeZone()))}if(this.shouldAddProperties){o.sort();for(let D of o){var ae=[D];for(let L of s)ae.push(L.getProperty(D)||"");e.push(ae)}}return this.shouldHideNames&&e.shift(),this.shouldHideDates&&(e=e.map(D=>D.slice(1))),!this.shouldTranspose&&e.length>0&&(e=e[0].map((D,L)=>e.map(Cr=>Cr[L]))),e}};var _s=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},gt=class{constructor(e,t,r){this.parent=e,this.balancesReport=t,this.payload=r}getBalancesReport(){return this.balancesReport}getName(){return this.payload.name}getNormalizedName(){return this.payload.normalizedName}getGroup(){return _s(this,void 0,void 0,function*(){return null})}getAccount(){return _s(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getAccount(this.getNormalizedName()))||null})}getParent(){return this.parent}getDepth(){if(this.depth==null){let e=this.getParent();this.depth=e!=null?e.getDepth()+1:0}return this.depth}isCredit(){return this.payload.credit}isPermanent(){return this.payload.permanent||!1}isFromAccount(){return!0}isFromGroup(){return!1}hasGroupBalances(){return!1}getCumulativeBalance(){return q(new E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return q(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}createDataTable(){return new he(this.balancesReport.getBook(),[this],this.balancesReport.getPeriodicity())}getBalancesContainers(){return[]}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainer(e){let t=ye(e);if(this.getNormalizedName()==t)return this;throw`${e} does not match ${this.getName()}`}};var Rs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},br=class n{constructor(e,t,r){this.parent=e,this.balancesReport=t,this.payload=r}getBalancesReport(){return this.balancesReport}getName(){return this.payload.name}getNormalizedName(){return this.payload.normalizedName}getGroup(){return Rs(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getGroup(this.getNormalizedName()))||null})}getAccount(){return Rs(this,void 0,void 0,function*(){return null})}getParent(){return this.parent}getDepth(){if(this.depth==null){let e=this.getParent();this.depth=e!=null?e.getDepth()+1:0}return this.depth}isCredit(){return this.payload.credit||!1}isPermanent(){return this.payload.permanent||!1}isFromAccount(){return!1}isFromGroup(){return!0}hasGroupBalances(){let e=this.getGroupContainers();return e!=null&&e.length>0}getCumulativeBalance(){return q(new E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return q(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}createDataTable(){return new he(this.balancesReport.getBook(),this.getBalancesContainers(),this.balancesReport.getPeriodicity())}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainers(){let e=[],t=this.getGroupContainers();t&&t.length>0&&(e=e.concat(t));let r=this.getAccountContainers();return r&&r.length>0&&(e=e.concat(r)),e}getGroupContainers(){let e=this.payload.groupBalances;if(this.groupBalances==null&&e!=null){this.groupBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.groupBalances.push(new n(this,this.balancesReport,r))}}return this.groupBalances||[]}getAccountContainers(){let e=this.payload.accountBalances;if(this.accountBalances==null&&e!=null){this.accountBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.accountBalances.push(new gt(this,this.balancesReport,r))}}return this.accountBalances||[]}getBalancesContainer(e){var t;let r=ye(e),i=this.getBalancesContainers();if(i==null||i.length===0)throw`${e} not found on group ${this.getName()}`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,i));let o=(t=this.balancesContainersMap)===null||t===void 0?void 0:t.get(r);if(!o)throw`${e} not found on group ${this.getName()}`;return o}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let i=t[r],o=i.getNormalizedName();o&&(e.has(o)||e.set(o,i));let s=i.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var yt=class{constructor(e,t){this.book=e,this.payload=t}getBook(){return this.book}createDataTable(){return new he(this.book,this.getBalancesContainers(),this.getPeriodicity())}getPeriodicity(){return this.payload.periodicity}getBalancesContainers(){let e=[],t=this.getRootAccountBalancesContainers();t!=null&&t.length>0&&(e=e.concat(t));let r=this.getGroupBalancesContainers();return r!=null&&r.length>0&&(e=e.concat(r)),e}getBalancesContainer(e){var t;let r=ye(e),i=this.getBalancesContainers();if(i==null||i.length===0)throw`${e} not found`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,i));let o=(t=this.balancesContainersMap)===null||t===void 0?void 0:t.get(r);if(!o)throw`${e} not found`;return o}getRootAccountBalancesContainers(){if(this.accountBalancesContainers==null&&this.payload.accountBalances!=null){this.accountBalancesContainers=[];for(let e=0;e<this.payload.accountBalances.length;e++){let t=this.payload.accountBalances[e],r=new gt(null,this,t);this.accountBalancesContainers.push(r)}}return this.accountBalancesContainers||[]}getGroupBalancesContainers(){if(this.groupBalancesContainers==null&&this.payload.groupBalances!=null){this.groupBalancesContainers=[];for(let e=0;e<this.payload.groupBalances.length;e++){let t=this.payload.groupBalances[e],r=new br(null,this,t);this.groupBalancesContainers.push(r)}}return this.groupBalancesContainers||[]}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let i=t[r],o=i.getNormalizedName();o&&(e.has(o)||e.set(o,i));let s=i.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var Mn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},vt=class extends P{constructor(e,t){super(t),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getTitle(){return this.payload.title}setTitle(e){return this.payload.title=e,this}getQuery(){return this.payload.query}setQuery(e){return this.payload.query=e,this}create(){return Mn(this,void 0,void 0,function*(){return this.payload=yield No(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}update(){return Mn(this,void 0,void 0,function*(){return this.payload=yield Mo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}remove(){return Mn(this,void 0,void 0,function*(){let e=this.getId();if(!e)throw new Error("Query id null!");return this.payload=yield Fo(this.book.getId(),e,this.getConfig()),this.updateQueryCache(!0),this})}updateQueryCache(e){this.book.queries&&(this.book.queries=this.book.queries.filter(t=>t.getId()!==this.getId()),e||this.book.queries.push(this))}};var wt=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getCount(){return this.payload.count}};var Et=class{constructor(e){this.COMPARATOR=(t,r)=>{let i=this.getTypeIndex(this.getStringType(t))-this.getTypeIndex(this.getStringType(r));return i===0&&(i=this.getHasChildrenIndex(t.hasChildren())-this.getHasChildrenIndex(r.hasChildren())),i===0&&(i=t.getNormalizedName().localeCompare(r.getNormalizedName())),i},this.groups=e,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.shouldShowTree=!1,this.propertyKeys=[]}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}tree(e){return this.shouldShowTree=e,this}mapPropertyKeys(){this.propertyKeys=[];for(let e of this.groups)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}getStringType(e){let t=e.getType()?e.getType()+"":void 0;return t||(t=e.isPermanent()?F.ASSET+"_"+F.LIABILITY:F.INCOMING+"_"+F.OUTGOING),t}getTypeIndex(e){return e===F.ASSET+"_"+F.LIABILITY?0:e===F.ASSET?1:e===F.LIABILITY?2:e===F.INCOMING+"_"+F.OUTGOING?3:e===F.INCOMING?4:5}getHasChildrenIndex(e){return e?0:1}build(){let e=new Array,t=this.groups;t.sort(this.COMPARATOR);let r=[];this.shouldAddIds&&r.push("Group Id"),r.push("Name"),r.push("Type"),this.shouldShowTree||r.push("Parent"),this.shouldAddProperties&&this.mapPropertyKeys();for(let i of t)i.isHidden()||i.getParent()||(e.push(this.buildGroupLine(i,0)),e=this.traverse(i,e,1));return this.shouldAddProperties&&(r=r.concat(this.propertyKeys)),e.unshift(r),Ae(e),e}buildGroupLine(e,t){let r=[];this.shouldAddIds&&r.push(e.getId());let i=this.shouldShowTree?" ".repeat(t)+e.getName():e.getName();if(r.push(i),r.push(this.getStringType(e)),!this.shouldShowTree){let o=e.getParent()?e.getParent().getName():"";r.push(o)}if(this.shouldAddProperties){let o=e.getProperties();for(let s of this.propertyKeys){let a=o[s];if(a){r.push(a);continue}r.push("")}}return r}traverse(e,t,r){let i=e.getChildren();i.sort(this.COMPARATOR);for(let o of i)t.push(this.buildGroupLine(o,r)),o.hasChildren()&&this.traverse(o,t,r+1);return t}};var Fn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Tt=class{constructor(e,t,r){this.shouldFormatDates=!1,this.shouldFormatValues=!1,this.shouldAddUrls=!1,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddRecordedAt=!0,this.shouldAddHiddenProperties=!1,this.book=e,this.transactions=t,this.account=r}formatDates(e){return this.shouldFormatDates=e,this}formatValues(e){return this.shouldFormatValues=e,this}urls(e){return this.shouldAddUrls=e,this}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}recordedAt(e){return this.shouldAddRecordedAt=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}includeUrls(e){return this.urls(e)}includeProperties(e){return this.properties(e)}includeIds(e){return this.ids(e)}getAccount(){return this.account}build(){return Fn(this,void 0,void 0,function*(){let e=this.getHeaderLine(),t=yield this.get2DArray_();return t.length>0?(t.splice(0,0,e),Ae(t),t):[e]})}getHeaderLine(){let e=[];if(this.shouldAddIds&&e.push("Transaction Id"),e.push("Status"),e.push("Date"),e.push("Origin"),e.push("Destination"),e.push("Description"),e.push("Amount"),this.shouldShowBalances()&&e.push("Balance"),this.shouldAddRecordedAt&&e.push("Recorded at"),this.shouldAddProperties)for(let t of this.getPropertyKeys())e.push(t);if(this.shouldAddIds)for(let t of this.getRemoteIdHeaders())e.push(t);if(this.shouldAddUrls)for(let t of this.getAttachmentHeaders())e.push(t);return e}get2DArray_(){return Fn(this,void 0,void 0,function*(){let e=[];for(let t of this.transactions){let r=[];this.shouldAddIds&&r.push(t.getId()),r.push(t.getStatus()),this.shouldFormatDates?r.push(t.getDateFormatted()):r.push(t.getDateObject()),r.push(yield t.getCreditAccountName()),r.push(yield t.getDebitAccountName()),r.push(t.getDescription());let i=t.getAmount();if(i!=null){if(this.shouldShowBalances()&&this.account){let o=yield this.isCreditOnTransaction_(t,this.account);i=q(i,!o)}this.shouldFormatValues?r.push(ge(i,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(i.toNumber())}else r.push("");if(this.shouldShowBalances()){let o=yield t.getAccountBalance();o!=null?this.shouldFormatValues?r.push(ge(o,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(o.toNumber()):r.push("")}this.shouldAddRecordedAt&&(this.shouldFormatDates?r.push(t.getCreatedAtFormatted()):r.push(t.getCreatedAt())),this.shouldAddProperties&&this.addPropertiesToLine(r,t),this.shouldAddIds&&this.addRemoteIdsToLine(r,t),this.shouldAddUrls&&this.addUrlsToLine(r,t),e.push(r)}return e})}shouldShowBalances(){return this.account!=null&&this.account.isPermanent()===!0}isCreditOnTransaction_(e,t){return Fn(this,void 0,void 0,function*(){let r=yield e.getCreditAccount();return t==null||r==null?!1:r.getId()===t.getId()})}getPropertyKeys(){if(this.propertyKeys==null){this.propertyKeys=[];for(let e of this.transactions)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}return this.propertyKeys}getAttachmentHeaders(){if(this.attachmentHeaders==null){this.attachmentHeaders=[];for(let e of this.transactions){let t=this.getUrls(e);t.length>this.attachmentHeaders.length&&(this.attachmentHeaders=[],t.forEach(()=>this.attachmentHeaders.push("Attachment")))}}return this.attachmentHeaders}getRemoteIdHeaders(){if(this.remoteIdHeaders==null){this.remoteIdHeaders=[];for(let e of this.transactions){let t=e.getRemoteIds();t&&t.length>this.remoteIdHeaders.length&&(this.remoteIdHeaders=[],t.forEach(()=>this.remoteIdHeaders.push("Remote Id")))}}return this.remoteIdHeaders}addPropertiesToLine(e,t){let r=e.length;for(let i of this.getPropertyKeys())e.push("");for(let i of t.getPropertyKeys()){if(!this.shouldAddHiddenProperties&&i.endsWith("_"))continue;let o=this.getPropertyKeys().indexOf(i)+r;e[o]=t.getProperty(i)}}addRemoteIdsToLine(e,t){let r=e.length;for(let o of this.getRemoteIdHeaders())e.push("");let i=t.getRemoteIds();if(i)for(let o=r;o<r+i.length;o++)e[o]=i[o-r]}addUrlsToLine(e,t){let r=e.length;for(let o of this.getAttachmentHeaders())e.push("");let i=this.getUrls(t);for(let o=r;o<r+i.length;o++)e[o]=i[o-r]}getUrls(e){let t=e.getUrls();t==null&&(t=[]);let r=e.getFiles();return r!=null&&(t=t.concat(r.map(i=>i.getUrl()).filter(i=>i!=null))),t}};var T=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Q=class n extends U{constructor(e,t){super(e),this.allGroupsLoaded=!1,this.allAccountsLoaded=!1,this.config=t,this.payload.permission==nt.RECORDER&&(this.payload.groups=this.payload.groups||[],this.payload.accounts=this.payload.accounts||[]),this.allGroupsLoaded=this.mapGroups(this.payload.groups),this.allAccountsLoaded=this.mapAccounts(this.payload.accounts)}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id||""}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getFractionDigits(){return this.payload.fractionDigits}getDecimalPlaces(){return this.getFractionDigits()}setFractionDigits(e){return this.payload.fractionDigits=e,this}getPeriod(){return this.payload.period}setPeriod(e){return this.payload.period=e,this}getPeriodStartMonth(){return this.payload.periodStartMonth}setPeriodStartMonth(e){return this.payload.periodStartMonth=e,this}getPageSize(){return this.payload.pageSize}setPageSize(e){return this.payload.pageSize=e,this}getOwnerName(){return this.payload.ownerName}getLogoUrl(){return this.payload.logoUrl}getPermission(){return this.payload.permission}getCollection(){return this.payload.collection!=null&&this.collection==null&&(this.collection=new De(this.payload.collection,this.config)),this.collection}getDatePattern(){return this.payload.datePattern}setDatePattern(e){return this.payload.datePattern=e,this}getLockDate(){return this.payload.lockDate}setLockDate(e){return e==null&&(e="1900-00-00"),this.payload.lockDate=e,this}getClosingDate(){return this.payload.closingDate}setClosingDate(e){return e==null&&(e="1900-00-00"),this.payload.closingDate=e,this}getDecimalSeparator(){return this.payload.decimalSeparator}setDecimalSeparator(e){return this.payload.decimalSeparator=e,this}getTimeZone(){return this.payload.timeZone}setTimeZone(e){return this.payload.timeZone=e,this}getTimeZoneOffset(){return this.payload.timeZoneOffset}getAutoPost(){return this.payload.autoPost}setAutoPost(e){return this.payload.autoPost=e,this}getLastUpdateMs(){return this.payload.lastUpdateMs?+this.payload.lastUpdateMs:void 0}getTotalTransactions(){return this.payload.totalTransactions?+this.payload.totalTransactions:0}getTotalTransactionsCurrentMonth(){return this.payload.totalTransactionsCurrentMonth?+this.payload.totalTransactionsCurrentMonth:0}getTotalTransactionsCurrentYear(){return this.payload.totalTransactionsCurrentYear?+this.payload.totalTransactionsCurrentYear:0}getVisibility(){return this.payload.visibility}setVisibility(e){return this.payload.visibility=e,this}formatDate(e,t){return(t==null||t.trim()=="")&&(t=this.getTimeZone()),Lt(e,this.getDatePattern(),t)}parseDate(e){return gr(e,this.getDatePattern(),this.getTimeZone())}formatValue(e){return e?ge(e,this.getDecimalSeparator(),this.getFractionDigits()):""}parseValue(e){return mr(e,this.getDecimalSeparator())}round(e){return pr(e,this.getFractionDigits())}batchCreateTransactions(e){return T(this,void 0,void 0,function*(){let t=[];return e.forEach(r=>t.push(r.json())),t=yield jo(this.getId(),t,this.getConfig()),e=t.map(r=>new se(this,r)),e})}batchPostTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield $o(this.getId(),t,this.getConfig())})}batchUpdateTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];return e.forEach(i=>r.push(i.json())),r=yield zo(this.getId(),r,t,this.getConfig()),e=r.map(i=>new se(this,i)),e})}batchCheckTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield qo(this.getId(),t,this.getConfig())})}batchUncheckTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Zo(this.getId(),t,this.getConfig())})}batchTrashTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];e.forEach(i=>r.push(i.json())),yield Wo(this.getId(),r,t,this.getConfig())})}batchUntrashTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Yo(this.getId(),t,this.getConfig())})}mergeTransactions(e,t){return T(this,void 0,void 0,function*(){let r={items:[e.json(),t.json()]},i=yield is(this.getId(),r,this.getConfig());return new se(this,i.transaction||{})})}batchReplayEvents(e,t){return T(this,void 0,void 0,function*(){let o={items:e.map(s=>s.getId()).map(s=>({id:s}))};yield cs(this,o,t,this.getConfig())})}batchCreateAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:yield Promise.all(e.map(o=>this.normalizeAccountPayloadForBatchCreate_(o)))},r=yield Ln(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}normalizeAccountPayloadForBatchCreate_(e){return T(this,void 0,void 0,function*(){let t=e.json();if(!t.groups||t.groups.length===0)return t;let r=[];for(let i of t.groups){let o=i.id||i.name;if(!o||o.trim()==="")throw new Error("Account group reference must include id or name");let s=yield this.getGroup(o);if(!s)throw new Error(`Group not found: ${o}`);r.push(s.json())}return t.groups=r,t})}batchUpdateAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Gn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}batchDeleteAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Hn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o,!0)}return this.clearCache(),i}return[]})}batchCreateGroups(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Zn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new J(this,o);i.push(s),this.setGroup(o)}return this.clearCache(),i}return[]})}audit(){Do(this.getId(),this.getConfig())}getApps(){return T(this,void 0,void 0,function*(){if(this.apps!=null)return this.apps;let e=yield So(this.getId(),this.getConfig());return this.apps=e.map(t=>new ve(t,this.config)),this.apps})}getIntegrations(){return T(this,void 0,void 0,function*(){return(yield Uo(this.getId(),this.getConfig())).map(r=>new X(r,this.config))})}createIntegration(e){return T(this,void 0,void 0,function*(){return e instanceof X?e=yield vn(this.getId(),e.json(),this.getConfig()):e=yield vn(this.getId(),e,this.getConfig()),new X(e,this.config)})}updateIntegration(e){return T(this,void 0,void 0,function*(){return e instanceof X?e=yield wn(this.getId(),e.json(),this.getConfig()):e=yield wn(this.getId(),e,this.getConfig()),new X(e,this.config)})}getAccount(e){return T(this,void 0,void 0,function*(){if(!e||e.trim()=="")return;let t;if(this.idAccountMap&&(t=this.idAccountMap.get(e)),!t&&this.nameAccountMap&&(t=this.nameAccountMap.get(ye(e))),!t){let r=yield $n(this.getId(),e,this.getConfig());r&&(t=new G(this,r),this.updateAccountCache(t))}return t})}updateGroupCache(e){this.updateGroupIdMap(e),this.updateGroupNameMap(e)}updateGroupIdMap(e){this.idGroupMap=this.idGroupMap||new Map;let t=e.getId();t&&this.idGroupMap.set(t,e)}updateGroupNameMap(e){this.nameGroupMap=this.nameGroupMap||new Map;let t=e.getNormalizedName();t&&this.nameGroupMap.set(t,e)}updateAccountCache(e){this.updateAccountIdMap(e),this.updateAccountNameMap(e)}updateAccountIdMap(e){this.idAccountMap=this.idAccountMap||new Map;let t=e.getId();t&&this.idAccountMap.set(t,e)}updateAccountNameMap(e){this.nameAccountMap=this.nameAccountMap||new Map;let t=e.getNormalizedName();t&&this.nameAccountMap.set(t,e)}getMostRecentLockDate_(){let e=this.getClosingDate(),t=this.getLockDate();return!e&&!t?null:!e&&t?t:e&&!t||ot(e)>ot(t)?e:t}getGroup(e){return T(this,void 0,void 0,function*(){if(!e||e.trim()=="")return;let t;if(this.idGroupMap&&(t=this.idGroupMap.get(e)),!t&&this.nameGroupMap&&(t=this.nameGroupMap.get(ye(e))),!t){let r=yield Jn(this.getId(),e,this.getConfig());r&&(t=new J(this,r),this.updateGroupCache(t))}return t})}getGroups(){return T(this,void 0,void 0,function*(){var e,t;if(this.idGroupMap&&this.allGroupsLoaded)return Array.from(((e=this.idGroupMap)===null||e===void 0?void 0:e.values())||[]);let r=yield Kn(this.getId(),this.getConfig());return this.allGroupsLoaded=this.mapGroups(r),Array.from(((t=this.idGroupMap)===null||t===void 0?void 0:t.values())||[])})}mapGroups(e){if(!e)return!1;let t=e.map(r=>new J(this,r));this.idGroupMap=new Map,this.nameGroupMap=new Map;for(let r of t)this.updateGroupCache(r),r.buildGroupTree(this.idGroupMap);for(let r of t)r.buildGroupTree(this.idGroupMap);return!0}getAccounts(){return T(this,void 0,void 0,function*(){var e,t;if(this.idAccountMap&&this.allAccountsLoaded)return Array.from(((e=this.idAccountMap)===null||e===void 0?void 0:e.values())||[]);yield this.getGroups();let r=yield jn(this.getId(),this.getConfig());return this.allAccountsLoaded=this.mapAccounts(r),Array.from(((t=this.idAccountMap)===null||t===void 0?void 0:t.values())||[])})}mapAccounts(e){if(!e)return!1;let t=e.map(r=>new G(this,r));this.idAccountMap=new Map,this.nameAccountMap=new Map;for(let r of t)this.updateAccountCache(r),this.linkAccountsAndGroups(r);return this.ensureGroupsAccountMapsLoaded(),!0}linkAccountsAndGroups(e){var t;let r=e.json().groups||[];for(let i of r){let o=(t=this.idGroupMap)===null||t===void 0?void 0:t.get(i.id||"");o!=null&&o.addAccount(e)}}ensureGroupsAccountMapsLoaded(){if(this.idGroupMap)for(let e of this.idGroupMap.values())e.accounts==null&&(e.accounts=new Map)}clearCache(){this.clearGroupCache(),this.clearAccountCache()}clearGroupCache(){this.allGroupsLoaded=!1,this.idGroupMap=void 0,this.nameGroupMap=void 0}clearAccountCache(){this.allAccountsLoaded=!1,this.idAccountMap=void 0,this.nameAccountMap=void 0}clearCollaboratorCache(){this.collaborators=void 0}setAccount(e,t){let r=this.payload.accounts||[];t?this.payload.accounts=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.accounts=r.map(o=>o.id===e.id?e:o):this.payload.accounts=[...r,e]}setGroup(e,t){let r=this.payload.groups||[];t?this.payload.groups=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.groups=r.map(o=>o.id===e.id?e:o):this.payload.groups=[...r,e]}listTransactions(e,t,r){return T(this,void 0,void 0,function*(){let i=yield ns(this.getId(),e,t,r,this.getConfig());return new mt(this,i)})}countTransactions(e){return T(this,void 0,void 0,function*(){return(yield os(this.getId(),e,this.getConfig())).total})}listEvents(e,t,r,i,o,s){return T(this,void 0,void 0,function*(){let a=yield as(this,e,t,r,i,o,s,this.getConfig());return new pt(this,a)})}getTransaction(e){return T(this,void 0,void 0,function*(){let t=yield rs(this.getId(),e,this.getConfig());return t?new se(this,t):void 0})}getFile(e){return T(this,void 0,void 0,function*(){let t=yield Er(this.getId(),e,this.getConfig());return t?new Ie(this,t):void 0})}create(){return T(this,void 0,void 0,function*(){return this.payload=yield Ao(this.payload,this.getConfig()),this})}copy(e,t,r){return T(this,void 0,void 0,function*(){let i=yield Io(this.getId(),e,t,r,this.getConfig());return new n(i,this.config)})}update(){return T(this,void 0,void 0,function*(){return this.payload=yield Co(this.getId(),this.payload,this.getConfig()),this})}remove(){return T(this,void 0,void 0,function*(){return this.payload=yield ko(this.getId(),this.getConfig()),this})}getBalancesReport(e){return T(this,void 0,void 0,function*(){let t=yield Bo(this.getId(),e,this.getConfig());return new yt(this,t)})}getSavedQueries(){return T(this,void 0,void 0,function*(){if(this.queries==null){let e=yield xo(this.getId(),this.getConfig());this.queries=e.map(t=>new vt(this,t))}return this.queries})}getCollaborators(){return T(this,void 0,void 0,function*(){if(!this.collaborators){let e=yield hs(this.getId(),this.getConfig());this.collaborators=e.map(t=>new lt(this,t))}return this.collaborators})}getBacklog(){return T(this,void 0,void 0,function*(){let e=yield ds(this,this.getConfig());return new wt(e,this.config)})}createAccountsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getAccounts()),new at(e)})}createGroupsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getGroups()),new Et(e)})}createTransactionsDataTable(e,t){return new Tt(this,e,t)}};var El=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ls(n){return El(this,void 0,void 0,function*(){let e=yield new ee("v5/templates",n).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}var bt=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getName(){return this.payload.name}getDescription(){return this.payload.description}getImageUrl(){return this.payload.imageUrl}getCategory(){return this.payload.category}getTimesUsed(){return this.payload.timesUsed||0}getBookId(){return this.payload.bookId}getBookLink(){return this.payload.bookLink}getSheetsLink(){return this.payload.sheetsLink}};var ze=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},k=class n{static setConfig(e){n.globalConfig=e}constructor(e){this.config=e||n.globalConfig}getConfig(){return this.config}getBook(e,t,r){return ze(this,void 0,void 0,function*(){let i=yield bo(e,t,r,this.config);return new Q(i,this.config)})}getBooks(e){return ze(this,void 0,void 0,function*(){return(yield To(e,this.config)).map(r=>new Q(r,this.config))})}getCollections(){return ze(this,void 0,void 0,function*(){return(yield gs(this.config)).map(t=>new De(t,this.config))})}getApps(){return ze(this,void 0,void 0,function*(){return(yield go(this.config)).map(t=>new ve(t,this.config))})}getApp(e){return ze(this,void 0,void 0,function*(){let t=yield yo(e,this.config);return new ve(t,this.config)})}getTemplates(){return ze(this,void 0,void 0,function*(){return(yield Ls(this.config)).map(t=>new bt(t,this.config))})}getUser(){return ze(this,void 0,void 0,function*(){let e=yield xs(this.config);return new Se(e,this.config)})}};k.globalConfig={};var Us=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ve=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}setWebhookUrlDev(e){return this.payload.webhookUrlDev=e,this}getId(){return this.payload.id}getName(){return this.payload.name}hasEvents(){return(this.getEvents()||[]).length>0}getEvents(){return this.payload.events}isPublished(){return this.payload.published||!1}isInstallable(){return this.payload.installable||!1}getLogoUrl(){return this.payload.logoUrl}getLogoUrlDark(){return this.payload.logoUrlDark}getDescription(){return this.payload.description}setUsers(e){return this.payload.users=e,this}getUsers(){return this.payload.users}getMenuUrl(){return this.payload.menuUrl}getMenuUrlDev(){return this.payload.menuUrlDev}getMenuText(){return this.payload.menuText}getMenuPopupWidth(){return this.payload.menuPopupWidth}getMenuPopupHeight(){return this.payload.menuPopupHeight}getOwnerName(){return this.payload.ownerName}getOwnerLogoUrl(){return this.payload.ownerLogoUrl}getOwnerWebsiteUrl(){return this.payload.ownerWebsite}getFilePatterns(){return this.payload.filePatterns}setDevelopers(e){return this.payload.developers=e,this}getDevelopers(){return this.payload.developers}setClientSecret(e){return this.payload.clientSecret=e,this}getWebsiteUrl(){return this.payload.website}isRepositoryPrivate(){return this.payload.repoPrivate}getRepositoryUrl(){return this.payload.repoUrl}getReadme(){return this.payload.readmeMd||this.payload.readme}setReadme(e){return this.payload.readmeMd=e,this}create(){return Us(this,void 0,void 0,function*(){return yield vo(this.payload,this.getConfig()),this})}update(){return Us(this,void 0,void 0,function*(){return yield wo(this.payload,this.getConfig()),this})}};var Ar=class{constructor(e){this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.propertyKeys=[],this.books=e}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}mapPropertyKeys(){this.propertyKeys=[];for(let e of this.books)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}build(){var e,t;let r=new Array;this.books.sort((o,s)=>{var a,c;let l=(a=o.getCollection())===null||a===void 0?void 0:a.getName(),u=(c=s.getCollection())===null||c===void 0?void 0:c.getName();if(l&&!u)return-1;if(!l&&u)return 1;let d=(l||"").localeCompare(u||"");return d===0&&(d=(o.getName()||"").localeCompare(s.getName()||"")),d});let i=[];this.shouldAddIds&&i.push("Book Id"),i.push("Name"),i.push("Collection"),i.push("Date Pattern"),i.push("Decimal Separator"),i.push("Fraction Digits"),i.push("Period"),i.push("Owner"),this.shouldAddProperties&&(this.mapPropertyKeys(),i=i.concat(this.propertyKeys));for(let o of this.books){let s=[];if(this.shouldAddIds&&s.push(o.getId()),s.push(o.getName()||""),s.push(((e=o.getCollection())===null||e===void 0?void 0:e.getName())||""),s.push(o.getDatePattern()||""),s.push(o.getDecimalSeparator()||""),s.push((t=o.getFractionDigits())!==null&&t!==void 0?t:""),s.push(o.getPeriod()||""),s.push(o.getOwnerName()||""),this.shouldAddProperties){let a=o.getProperties();for(let c of this.propertyKeys)s.push(a[c]||"")}r.push(s)}return r.unshift(i),Ae(r),r}};return Qs(bl);})();
1
+ "use strict";var bkperjs=(()=>{var zs=Object.create;var qt=Object.defineProperty;var qs=Object.getOwnPropertyDescriptor;var Zs=Object.getOwnPropertyNames;var Ws=Object.getPrototypeOf,Ys=Object.prototype.hasOwnProperty;var Ks=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Js=(n,e)=>{for(var t in e)qt(n,t,{get:e[t],enumerable:!0})},Rn=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Zs(e))!Ys.call(n,i)&&i!==t&&qt(n,i,{get:()=>e[i],enumerable:!(r=qs(e,i))||r.enumerable});return n};var Qs=(n,e,t)=>(t=n!=null?zs(Ws(n)):{},Rn(e||!n||!n.__esModule?qt(t,"default",{value:n,enumerable:!0}):t,n)),Xs=n=>Rn(qt({},"__esModule",{value:!0}),n);var uo=Ks(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});function ti(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function ie(n,e,t){return e&&ti(n.prototype,e),t&&ti(n,t),n}function K(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}function Pr(n){return Pr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Pr(n)}function Xt(n,e){return Xt=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Xt(n,e)}function na(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(n){return!1}}function Kt(n,e,t){return na()?Kt=Reflect.construct:Kt=function(i,o,s){var a=[null];a.push.apply(a,o);var c=Function.bind.apply(i,a),l=new c;return s&&Xt(l,s.prototype),l},Kt.apply(null,arguments)}function ia(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Br(n){var e=typeof Map=="function"?new Map:void 0;return Br=function(r){if(r===null||!ia(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return Kt(r,arguments,Pr(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Xt(i,r)},Br(n)}function oa(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function sa(n,e){if(n){if(typeof n=="string")return ri(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ri(n,e)}}function ri(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Te(n){var e=0;if(typeof Symbol=="undefined"||n[Symbol.iterator]==null){if(Array.isArray(n)||(n=sa(n)))return function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}};throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return e=n[Symbol.iterator](),e.next.bind(e)}var Be=(function(n){K(e,n);function e(){return n.apply(this,arguments)||this}return e})(Br(Error)),aa=(function(n){K(e,n);function e(t){return n.call(this,"Invalid DateTime: "+t.toMessage())||this}return e})(Be),ua=(function(n){K(e,n);function e(t){return n.call(this,"Invalid Interval: "+t.toMessage())||this}return e})(Be),la=(function(n){K(e,n);function e(t){return n.call(this,"Invalid Duration: "+t.toMessage())||this}return e})(Be),Ot=(function(n){K(e,n);function e(){return n.apply(this,arguments)||this}return e})(Be),Di=(function(n){K(e,n);function e(t){return n.call(this,"Invalid unit "+t)||this}return e})(Be),W=(function(n){K(e,n);function e(){return n.apply(this,arguments)||this}return e})(Be),Ee=(function(n){K(e,n);function e(){return n.call(this,"Zone is an abstract class")||this}return e})(Be),h="numeric",oe="short",j="long",er={year:h,month:h,day:h},$r={year:h,month:oe,day:h},Si={year:h,month:oe,day:h,weekday:oe},jr={year:h,month:j,day:h},zr={year:h,month:j,day:h,weekday:j},qr={hour:h,minute:h},Zr={hour:h,minute:h,second:h},Wr={hour:h,minute:h,second:h,timeZoneName:oe},Yr={hour:h,minute:h,second:h,timeZoneName:j},Kr={hour:h,minute:h,hour12:!1},Jr={hour:h,minute:h,second:h,hour12:!1},Qr={hour:h,minute:h,second:h,hour12:!1,timeZoneName:oe},Xr={hour:h,minute:h,second:h,hour12:!1,timeZoneName:j},en={year:h,month:h,day:h,hour:h,minute:h},tn={year:h,month:h,day:h,hour:h,minute:h,second:h},rn={year:h,month:oe,day:h,hour:h,minute:h},nn={year:h,month:oe,day:h,hour:h,minute:h,second:h},Ii={year:h,month:oe,day:h,weekday:oe,hour:h,minute:h},on={year:h,month:j,day:h,hour:h,minute:h,timeZoneName:oe},sn={year:h,month:j,day:h,hour:h,minute:h,second:h,timeZoneName:oe},an={year:h,month:j,day:h,weekday:j,hour:h,minute:h,timeZoneName:j},un={year:h,month:j,day:h,weekday:j,hour:h,minute:h,second:h,timeZoneName:j};function A(n){return typeof n=="undefined"}function Pe(n){return typeof n=="number"}function or(n){return typeof n=="number"&&n%1===0}function ca(n){return typeof n=="string"}function da(n){return Object.prototype.toString.call(n)==="[object Date]"}function de(){try{return typeof Intl!="undefined"&&Intl.DateTimeFormat}catch(n){return!1}}function Ft(){return!A(Intl.DateTimeFormat.prototype.formatToParts)}function ki(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(n){return!1}}function fa(n){return Array.isArray(n)?n:[n]}function ni(n,e,t){if(n.length!==0)return n.reduce(function(r,i){var o=[e(i),i];return r&&t(r[0],o[0])===r[0]?r:o},null)[1]}function Oi(n,e){return e.reduce(function(t,r){return t[r]=n[r],t},{})}function Qe(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function pe(n,e,t){return or(n)&&n>=e&&n<=t}function ha(n,e){return n-e*Math.floor(n/e)}function Ke(n,e){e===void 0&&(e=2);var t=n<0?"-":"",r=t?n*-1:n,i;return r.toString().length<e?i=("0".repeat(e)+r).slice(-e):i=r.toString(),""+t+i}function V(n){if(!(A(n)||n===null||n===""))return parseInt(n,10)}function ln(n){if(!(A(n)||n===null||n==="")){var e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function cn(n,e,t){t===void 0&&(t=!1);var r=Math.pow(10,e),i=t?Math.trunc:Math.round;return i(n*r)/r}function Pt(n){return n%4===0&&(n%100!==0||n%400===0)}function xt(n){return Pt(n)?366:365}function tr(n,e){var t=ha(e-1,12)+1,r=n+(e-t)/12;return t===2?Pt(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function dn(n){var e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function rr(n){var e=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7,t=n-1,r=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||r===3?53:52}function _r(n){return n>99?n:n>60?1900+n:2e3+n}function Ni(n,e,t,r){r===void 0&&(r=null);var i=new Date(n),o={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);var s=Object.assign({timeZoneName:e},o),a=de();if(a&&Ft()){var c=new Intl.DateTimeFormat(t,s).formatToParts(i).find(function(p){return p.type.toLowerCase()==="timezonename"});return c?c.value:null}else if(a){var l=new Intl.DateTimeFormat(t,o).format(i),u=new Intl.DateTimeFormat(t,s).format(i),d=u.substring(l.length),f=d.replace(/^[, \u200e]+/,"");return f}else return null}function sr(n,e){var t=parseInt(n,10);Number.isNaN(t)&&(t=0);var r=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-r:r;return t*60+i}function xi(n){var e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new W("Invalid unit value "+n);return e}function nr(n,e,t){var r={};for(var i in n)if(Qe(n,i)){if(t.indexOf(i)>=0)continue;var o=n[i];if(o==null)continue;r[e(i)]=xi(o)}return r}function ir(n,e){var t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),i=n>=0?"+":"-";switch(e){case"short":return""+i+Ke(t,2)+":"+Ke(r,2);case"narrow":return""+i+t+(r>0?":"+r:"");case"techie":return""+i+Ke(t,2)+Ke(r,2);default:throw new RangeError("Value format "+e+" is out of range for property format")}}function ar(n){return Oi(n,["hour","minute","second","millisecond"])}var Mi=/[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/;function I(n){return JSON.stringify(n,Object.keys(n).sort())}var pa=["January","February","March","April","May","June","July","August","September","October","November","December"],Fi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ma=["J","F","M","A","M","J","J","A","S","O","N","D"];function Pi(n){switch(n){case"narrow":return[].concat(ma);case"short":return[].concat(Fi);case"long":return[].concat(pa);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}}var Bi=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],_i=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ga=["M","T","W","T","F","S","S"];function Ri(n){switch(n){case"narrow":return[].concat(ga);case"short":return[].concat(_i);case"long":return[].concat(Bi);case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Li=["AM","PM"],ya=["Before Christ","Anno Domini"],va=["BC","AD"],wa=["B","A"];function Ui(n){switch(n){case"narrow":return[].concat(wa);case"short":return[].concat(va);case"long":return[].concat(ya);default:return null}}function Ea(n){return Li[n.hour<12?0:1]}function Ta(n,e){return Ri(e)[n.weekday-1]}function Aa(n,e){return Pi(e)[n.month-1]}function ba(n,e){return Ui(e)[n.year<0?0:1]}function Ca(n,e,t,r){t===void 0&&(t="always"),r===void 0&&(r=!1);var i={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."]},o=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&o){var s=n==="days";switch(e){case 1:return s?"tomorrow":"next "+i[n][0];case-1:return s?"yesterday":"last "+i[n][0];case 0:return s?"today":"this "+i[n][0]}}var a=Object.is(e,-0)||e<0,c=Math.abs(e),l=c===1,u=i[n],d=r?l?u[1]:u[2]||u[1]:l?i[n][0]:n;return a?c+" "+d+" ago":"in "+c+" "+d}function Da(n){var e=Oi(n,["weekday","era","year","month","day","hour","minute","second","timeZoneName","hour12"]),t=I(e),r="EEEE, LLLL d, yyyy, h:mm a";switch(t){case I(er):return"M/d/yyyy";case I($r):return"LLL d, yyyy";case I(Si):return"EEE, LLL d, yyyy";case I(jr):return"LLLL d, yyyy";case I(zr):return"EEEE, LLLL d, yyyy";case I(qr):return"h:mm a";case I(Zr):return"h:mm:ss a";case I(Wr):return"h:mm a";case I(Yr):return"h:mm a";case I(Kr):return"HH:mm";case I(Jr):return"HH:mm:ss";case I(Qr):return"HH:mm";case I(Xr):return"HH:mm";case I(en):return"M/d/yyyy, h:mm a";case I(rn):return"LLL d, yyyy, h:mm a";case I(on):return"LLLL d, yyyy, h:mm a";case I(an):return r;case I(tn):return"M/d/yyyy, h:mm:ss a";case I(nn):return"LLL d, yyyy, h:mm:ss a";case I(Ii):return"EEE, d LLL yyyy, h:mm a";case I(sn):return"LLLL d, yyyy, h:mm:ss a";case I(un):return"EEEE, LLLL d, yyyy, h:mm:ss a";default:return r}}function ii(n,e){for(var t="",r=Te(n),i;!(i=r()).done;){var o=i.value;o.literal?t+=o.val:t+=e(o.val)}return t}var Sa={D:er,DD:$r,DDD:jr,DDDD:zr,t:qr,tt:Zr,ttt:Wr,tttt:Yr,T:Kr,TT:Jr,TTT:Qr,TTTT:Xr,f:en,ff:rn,fff:on,ffff:an,F:tn,FF:nn,FFF:sn,FFFF:un},le=(function(){n.create=function(r,i){return i===void 0&&(i={}),new n(r,i)},n.parseFormat=function(r){for(var i=null,o="",s=!1,a=[],c=0;c<r.length;c++){var l=r.charAt(c);l==="'"?(o.length>0&&a.push({literal:s,val:o}),i=null,o="",s=!s):s||l===i?o+=l:(o.length>0&&a.push({literal:!1,val:o}),o=l,i=l)}return o.length>0&&a.push({literal:s,val:o}),a},n.macroTokenToFormatOpts=function(r){return Sa[r]};function n(t,r){this.opts=r,this.loc=t,this.systemLoc=null}var e=n.prototype;return e.formatWithSystemDefault=function(r,i){this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem());var o=this.systemLoc.dtFormatter(r,Object.assign({},this.opts,i));return o.format()},e.formatDateTime=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.format()},e.formatDateTimeParts=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.formatToParts()},e.resolvedOptions=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.resolvedOptions()},e.num=function(r,i){if(i===void 0&&(i=0),this.opts.forceSimple)return Ke(r,i);var o=Object.assign({},this.opts);return i>0&&(o.padTo=i),this.loc.numberFormatter(o).format(r)},e.formatDateTimeFromString=function(r,i){var o=this,s=this.loc.listingMode()==="en",a=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory"&&Ft(),c=function(y,S){return o.loc.extract(r,y,S)},l=function(y){return r.isOffsetFixed&&r.offset===0&&y.allowZ?"Z":r.isValid?r.zone.formatOffset(r.ts,y.format):""},u=function(){return s?Ea(r):c({hour:"numeric",hour12:!0},"dayperiod")},d=function(y,S){return s?Aa(r,y):c(S?{month:y}:{month:y,day:"numeric"},"month")},f=function(y,S){return s?Ta(r,y):c(S?{weekday:y}:{weekday:y,month:"long",day:"numeric"},"weekday")},p=function(y){var S=n.macroTokenToFormatOpts(y);return S?o.formatWithSystemDefault(r,S):y},g=function(y){return s?ba(r,y):c({era:y},"era")},v=function(y){switch(y){case"S":return o.num(r.millisecond);case"u":case"SSS":return o.num(r.millisecond,3);case"s":return o.num(r.second);case"ss":return o.num(r.second,2);case"m":return o.num(r.minute);case"mm":return o.num(r.minute,2);case"h":return o.num(r.hour%12===0?12:r.hour%12);case"hh":return o.num(r.hour%12===0?12:r.hour%12,2);case"H":return o.num(r.hour);case"HH":return o.num(r.hour,2);case"Z":return l({format:"narrow",allowZ:o.opts.allowZ});case"ZZ":return l({format:"short",allowZ:o.opts.allowZ});case"ZZZ":return l({format:"techie",allowZ:o.opts.allowZ});case"ZZZZ":return r.zone.offsetName(r.ts,{format:"short",locale:o.loc.locale});case"ZZZZZ":return r.zone.offsetName(r.ts,{format:"long",locale:o.loc.locale});case"z":return r.zoneName;case"a":return u();case"d":return a?c({day:"numeric"},"day"):o.num(r.day);case"dd":return a?c({day:"2-digit"},"day"):o.num(r.day,2);case"c":return o.num(r.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return o.num(r.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return a?c({month:"numeric",day:"numeric"},"month"):o.num(r.month);case"LL":return a?c({month:"2-digit",day:"numeric"},"month"):o.num(r.month,2);case"LLL":return d("short",!0);case"LLLL":return d("long",!0);case"LLLLL":return d("narrow",!0);case"M":return a?c({month:"numeric"},"month"):o.num(r.month);case"MM":return a?c({month:"2-digit"},"month"):o.num(r.month,2);case"MMM":return d("short",!1);case"MMMM":return d("long",!1);case"MMMMM":return d("narrow",!1);case"y":return a?c({year:"numeric"},"year"):o.num(r.year);case"yy":return a?c({year:"2-digit"},"year"):o.num(r.year.toString().slice(-2),2);case"yyyy":return a?c({year:"numeric"},"year"):o.num(r.year,4);case"yyyyyy":return a?c({year:"numeric"},"year"):o.num(r.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return o.num(r.weekYear.toString().slice(-2),2);case"kkkk":return o.num(r.weekYear,4);case"W":return o.num(r.weekNumber);case"WW":return o.num(r.weekNumber,2);case"o":return o.num(r.ordinal);case"ooo":return o.num(r.ordinal,3);case"q":return o.num(r.quarter);case"qq":return o.num(r.quarter,2);case"X":return o.num(Math.floor(r.ts/1e3));case"x":return o.num(r.ts);default:return p(y)}};return ii(n.parseFormat(i),v)},e.formatDurationFromString=function(r,i){var o=this,s=function(f){switch(f[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"M":return"month";case"y":return"year";default:return null}},a=function(f){return function(p){var g=s(p);return g?o.num(f.get(g),p.length):p}},c=n.parseFormat(i),l=c.reduce(function(d,f){var p=f.literal,g=f.val;return p?d:d.concat(g)},[]),u=r.shiftTo.apply(r,l.map(s).filter(function(d){return d}));return ii(c,a(u))},n})(),ne=(function(){function n(t,r){this.reason=t,this.explanation=r}var e=n.prototype;return e.toMessage=function(){return this.explanation?this.reason+": "+this.explanation:this.reason},n})(),Xe=(function(){function n(){}var e=n.prototype;return e.offsetName=function(r,i){throw new Ee},e.formatOffset=function(r,i){throw new Ee},e.offset=function(r){throw new Ee},e.equals=function(r){throw new Ee},ie(n,[{key:"type",get:function(){throw new Ee}},{key:"name",get:function(){throw new Ee}},{key:"universal",get:function(){throw new Ee}},{key:"isValid",get:function(){throw new Ee}}]),n})(),Ir=null,Gi=(function(n){K(e,n);function e(){return n.apply(this,arguments)||this}var t=e.prototype;return t.offsetName=function(i,o){var s=o.format,a=o.locale;return Ni(i,s,a)},t.formatOffset=function(i,o){return ir(this.offset(i),o)},t.offset=function(i){return-new Date(i).getTimezoneOffset()},t.equals=function(i){return i.type==="local"},ie(e,[{key:"type",get:function(){return"local"}},{key:"name",get:function(){return de()?new Intl.DateTimeFormat().resolvedOptions().timeZone:"local"}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!0}}],[{key:"instance",get:function(){return Ir===null&&(Ir=new e),Ir}}]),e})(Xe),Ia=RegExp("^"+Mi.source+"$"),Jt={};function ka(n){return Jt[n]||(Jt[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Jt[n]}var Oa={year:0,month:1,day:2,hour:3,minute:4,second:5};function Na(n,e){var t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t),i=r[1],o=r[2],s=r[3],a=r[4],c=r[5],l=r[6];return[s,i,o,a,c,l]}function xa(n,e){for(var t=n.formatToParts(e),r=[],i=0;i<t.length;i++){var o=t[i],s=o.type,a=o.value,c=Oa[s];A(c)||(r[c]=parseInt(a,10))}return r}var Zt={},ce=(function(n){K(e,n),e.create=function(i){return Zt[i]||(Zt[i]=new e(i)),Zt[i]},e.resetCache=function(){Zt={},Jt={}},e.isValidSpecifier=function(i){return!!(i&&i.match(Ia))},e.isValidZone=function(i){try{return new Intl.DateTimeFormat("en-US",{timeZone:i}).format(),!0}catch(o){return!1}},e.parseGMTOffset=function(i){if(i){var o=i.match(/^Etc\/GMT(0|[+-]\d{1,2})$/i);if(o)return-60*parseInt(o[1])}return null};function e(r){var i;return i=n.call(this)||this,i.zoneName=r,i.valid=e.isValidZone(r),i}var t=e.prototype;return t.offsetName=function(i,o){var s=o.format,a=o.locale;return Ni(i,s,a,this.name)},t.formatOffset=function(i,o){return ir(this.offset(i),o)},t.offset=function(i){var o=new Date(i);if(isNaN(o))return NaN;var s=ka(this.name),a=s.formatToParts?xa(s,o):Na(s,o),c=a[0],l=a[1],u=a[2],d=a[3],f=a[4],p=a[5],g=d===24?0:d,v=dn({year:c,month:l,day:u,hour:g,minute:f,second:p,millisecond:0}),w=+o,y=w%1e3;return w-=y>=0?y:1e3+y,(v-w)/(60*1e3)},t.equals=function(i){return i.type==="iana"&&i.name===this.name},ie(e,[{key:"type",get:function(){return"iana"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return this.valid}}]),e})(Xe),kr=null,$=(function(n){K(e,n),e.instance=function(i){return i===0?e.utcInstance:new e(i)},e.parseSpecifier=function(i){if(i){var o=i.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(o)return new e(sr(o[1],o[2]))}return null},ie(e,null,[{key:"utcInstance",get:function(){return kr===null&&(kr=new e(0)),kr}}]);function e(r){var i;return i=n.call(this)||this,i.fixed=r,i}var t=e.prototype;return t.offsetName=function(){return this.name},t.formatOffset=function(i,o){return ir(this.fixed,o)},t.offset=function(){return this.fixed},t.equals=function(i){return i.type==="fixed"&&i.fixed===this.fixed},ie(e,[{key:"type",get:function(){return"fixed"}},{key:"name",get:function(){return this.fixed===0?"UTC":"UTC"+ir(this.fixed,"narrow")}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e})(Xe),Rr=(function(n){K(e,n);function e(r){var i;return i=n.call(this)||this,i.zoneName=r,i}var t=e.prototype;return t.offsetName=function(){return null},t.formatOffset=function(){return""},t.offset=function(){return NaN},t.equals=function(){return!1},ie(e,[{key:"type",get:function(){return"invalid"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!1}}]),e})(Xe);function Me(n,e){var t;if(A(n)||n===null)return e;if(n instanceof Xe)return n;if(ca(n)){var r=n.toLowerCase();return r==="local"?e:r==="utc"||r==="gmt"?$.utcInstance:(t=ce.parseGMTOffset(n))!=null?$.instance(t):ce.isValidSpecifier(r)?ce.create(n):$.parseSpecifier(r)||new Rr(n)}else return Pe(n)?$.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new Rr(n)}var oi=function(){return Date.now()},Or=null,si=null,ai=null,ui=null,li=!1,N=(function(){function n(){}return n.resetCaches=function(){B.resetCache(),ce.resetCache()},ie(n,null,[{key:"now",get:function(){return oi},set:function(t){oi=t}},{key:"defaultZoneName",get:function(){return n.defaultZone.name},set:function(t){t?Or=Me(t):Or=null}},{key:"defaultZone",get:function(){return Or||Gi.instance}},{key:"defaultLocale",get:function(){return si},set:function(t){si=t}},{key:"defaultNumberingSystem",get:function(){return ai},set:function(t){ai=t}},{key:"defaultOutputCalendar",get:function(){return ui},set:function(t){ui=t}},{key:"throwOnInvalid",get:function(){return li},set:function(t){li=t}}]),n})(),Lr={};function Ur(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=Lr[t];return r||(r=new Intl.DateTimeFormat(n,e),Lr[t]=r),r}var Gr={};function Ma(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=Gr[t];return r||(r=new Intl.NumberFormat(n,e),Gr[t]=r),r}var Vr={};function Fa(n,e){e===void 0&&(e={});var t=e,r=t.base,i=oa(t,["base"]),o=JSON.stringify([n,i]),s=Vr[o];return s||(s=new Intl.RelativeTimeFormat(n,e),Vr[o]=s),s}var xe=null;function Pa(){if(xe)return xe;if(de()){var n=new Intl.DateTimeFormat().resolvedOptions().locale;return xe=!n||n==="und"?"en-US":n,xe}else return xe="en-US",xe}function Ba(n){var e=n.indexOf("-u-");if(e===-1)return[n];var t,r=n.substring(0,e);try{t=Ur(n).resolvedOptions()}catch(a){t=Ur(r).resolvedOptions()}var i=t,o=i.numberingSystem,s=i.calendar;return[r,o,s]}function _a(n,e,t){return de()?((t||e)&&(n+="-u",t&&(n+="-ca-"+t),e&&(n+="-nu-"+e)),n):[]}function Ra(n){for(var e=[],t=1;t<=12;t++){var r=M.utc(2016,t,1);e.push(n(r))}return e}function La(n){for(var e=[],t=1;t<=7;t++){var r=M.utc(2016,11,13+t);e.push(n(r))}return e}function Wt(n,e,t,r,i){var o=n.listingMode(t);return o==="error"?null:o==="en"?r(e):i(e)}function Ua(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||de()&&new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}var Ga=(function(){function n(t,r,i){if(this.padTo=i.padTo||0,this.floor=i.floor||!1,!r&&de()){var o={useGrouping:!1};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=Ma(t,o)}}var e=n.prototype;return e.format=function(r){if(this.inf){var i=this.floor?Math.floor(r):r;return this.inf.format(i)}else{var o=this.floor?Math.floor(r):cn(r,3);return Ke(o,this.padTo)}},n})(),Va=(function(){function n(t,r,i){this.opts=i,this.hasIntl=de();var o;if(t.zone.universal&&this.hasIntl){var s=-1*(t.offset/60),a=s>=0?"Etc/GMT+"+s:"Etc/GMT"+s,c=ce.isValidZone(a);t.offset!==0&&c?(o=a,this.dt=t):(o="UTC",i.timeZoneName?this.dt=t:this.dt=t.offset===0?t:M.fromMillis(t.ts+t.offset*60*1e3))}else t.zone.type==="local"?this.dt=t:(this.dt=t,o=t.zone.name);if(this.hasIntl){var l=Object.assign({},this.opts);o&&(l.timeZone=o),this.dtf=Ur(r,l)}}var e=n.prototype;return e.format=function(){if(this.hasIntl)return this.dtf.format(this.dt.toJSDate());var r=Da(this.opts),i=B.create("en-US");return le.create(i).formatDateTimeFromString(this.dt,r)},e.formatToParts=function(){return this.hasIntl&&Ft()?this.dtf.formatToParts(this.dt.toJSDate()):[]},e.resolvedOptions=function(){return this.hasIntl?this.dtf.resolvedOptions():{locale:"en-US",numberingSystem:"latn",outputCalendar:"gregory"}},n})(),Ha=(function(){function n(t,r,i){this.opts=Object.assign({style:"long"},i),!r&&ki()&&(this.rtf=Fa(t,i))}var e=n.prototype;return e.format=function(r,i){return this.rtf?this.rtf.format(r,i):Ca(i,r,this.opts.numeric,this.opts.style!=="long")},e.formatToParts=function(r,i){return this.rtf?this.rtf.formatToParts(r,i):[]},n})(),B=(function(){n.fromOpts=function(r){return n.create(r.locale,r.numberingSystem,r.outputCalendar,r.defaultToEN)},n.create=function(r,i,o,s){s===void 0&&(s=!1);var a=r||N.defaultLocale,c=a||(s?"en-US":Pa()),l=i||N.defaultNumberingSystem,u=o||N.defaultOutputCalendar;return new n(c,l,u,a)},n.resetCache=function(){xe=null,Lr={},Gr={},Vr={}},n.fromObject=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.outputCalendar;return n.create(o,s,a)};function n(t,r,i,o){var s=Ba(t),a=s[0],c=s[1],l=s[2];this.locale=a,this.numberingSystem=r||c||null,this.outputCalendar=i||l||null,this.intl=_a(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}var e=n.prototype;return e.listingMode=function(r){r===void 0&&(r=!0);var i=de(),o=i&&Ft(),s=this.isEnglish(),a=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return!o&&!(s&&a)&&!r?"error":!o||s&&a?"en":"intl"},e.clone=function(r){return!r||Object.getOwnPropertyNames(r).length===0?this:n.create(r.locale||this.specifiedLocale,r.numberingSystem||this.numberingSystem,r.outputCalendar||this.outputCalendar,r.defaultToEN||!1)},e.redefaultToEN=function(r){return r===void 0&&(r={}),this.clone(Object.assign({},r,{defaultToEN:!0}))},e.redefaultToSystem=function(r){return r===void 0&&(r={}),this.clone(Object.assign({},r,{defaultToEN:!1}))},e.months=function(r,i,o){var s=this;return i===void 0&&(i=!1),o===void 0&&(o=!0),Wt(this,r,o,Pi,function(){var a=i?{month:r,day:"numeric"}:{month:r},c=i?"format":"standalone";return s.monthsCache[c][r]||(s.monthsCache[c][r]=Ra(function(l){return s.extract(l,a,"month")})),s.monthsCache[c][r]})},e.weekdays=function(r,i,o){var s=this;return i===void 0&&(i=!1),o===void 0&&(o=!0),Wt(this,r,o,Ri,function(){var a=i?{weekday:r,year:"numeric",month:"long",day:"numeric"}:{weekday:r},c=i?"format":"standalone";return s.weekdaysCache[c][r]||(s.weekdaysCache[c][r]=La(function(l){return s.extract(l,a,"weekday")})),s.weekdaysCache[c][r]})},e.meridiems=function(r){var i=this;return r===void 0&&(r=!0),Wt(this,void 0,r,function(){return Li},function(){if(!i.meridiemCache){var o={hour:"numeric",hour12:!0};i.meridiemCache=[M.utc(2016,11,13,9),M.utc(2016,11,13,19)].map(function(s){return i.extract(s,o,"dayperiod")})}return i.meridiemCache})},e.eras=function(r,i){var o=this;return i===void 0&&(i=!0),Wt(this,r,i,Ui,function(){var s={era:r};return o.eraCache[r]||(o.eraCache[r]=[M.utc(-40,1,1),M.utc(2017,1,1)].map(function(a){return o.extract(a,s,"era")})),o.eraCache[r]})},e.extract=function(r,i,o){var s=this.dtFormatter(r,i),a=s.formatToParts(),c=a.find(function(l){return l.type.toLowerCase()===o});return c?c.value:null},e.numberFormatter=function(r){return r===void 0&&(r={}),new Ga(this.intl,r.forceSimple||this.fastNumbers,r)},e.dtFormatter=function(r,i){return i===void 0&&(i={}),new Va(r,this.intl,i)},e.relFormatter=function(r){return r===void 0&&(r={}),new Ha(this.intl,this.isEnglish(),r)},e.isEnglish=function(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||de()&&new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")},e.equals=function(r){return this.locale===r.locale&&this.numberingSystem===r.numberingSystem&&this.outputCalendar===r.outputCalendar},ie(n,[{key:"fastNumbers",get:function(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Ua(this)),this.fastNumbersCached}}]),n})();function et(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];var r=e.reduce(function(i,o){return i+o.source},"");return RegExp("^"+r+"$")}function _e(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(r){return e.reduce(function(i,o){var s=i[0],a=i[1],c=i[2],l=o(r,c),u=l[0],d=l[1],f=l[2];return[Object.assign(s,u),a||d,f]},[{},null,1]).slice(0,2)}}function tt(n){if(n==null)return[null,null];for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];for(var i=0,o=t;i<o.length;i++){var s=o[i],a=s[0],c=s[1],l=a.exec(n);if(l)return c(l)}return[null,null]}function Vi(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(r,i){var o={},s;for(s=0;s<e.length;s++)o[e[s]]=V(r[i+s]);return[o,null,i+s]}}var Hi=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,fn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,$i=RegExp(""+fn.source+Hi.source+"?"),hn=RegExp("(?:T"+$i.source+")?"),$a=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ja=/(\d{4})-?W(\d\d)(?:-?(\d))?/,za=/(\d{4})-?(\d{3})/,qa=Vi("weekYear","weekNumber","weekDay"),Za=Vi("year","ordinal"),Wa=/(\d{4})-(\d\d)-(\d\d)/,ji=RegExp(fn.source+" ?(?:"+Hi.source+"|("+Mi.source+"))?"),Ya=RegExp("(?: "+ji.source+")?");function Je(n,e,t){var r=n[e];return A(r)?t:V(r)}function zi(n,e){var t={year:Je(n,e),month:Je(n,e+1,1),day:Je(n,e+2,1)};return[t,null,e+3]}function Re(n,e){var t={hours:Je(n,e,0),minutes:Je(n,e+1,0),seconds:Je(n,e+2,0),milliseconds:ln(n[e+3])};return[t,null,e+4]}function rt(n,e){var t=!n[e]&&!n[e+1],r=sr(n[e+1],n[e+2]),i=t?null:$.instance(r);return[{},i,e+3]}function qi(n,e){var t=n[e]?ce.create(n[e]):null;return[{},t,e+1]}var Ka=RegExp("^T?"+fn.source+"$"),Ja=/^-?P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,9}))?S)?)?)$/;function Qa(n){var e=n[0],t=n[1],r=n[2],i=n[3],o=n[4],s=n[5],a=n[6],c=n[7],l=n[8],u=e[0]==="-",d=c&&c[0]==="-",f=function(g,v){return v===void 0&&(v=!1),g!==void 0&&(v||g&&u)?-g:g};return[{years:f(V(t)),months:f(V(r)),weeks:f(V(i)),days:f(V(o)),hours:f(V(s)),minutes:f(V(a)),seconds:f(V(c),c==="-0"),milliseconds:f(ln(l),d)}]}var Xa={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function pn(n,e,t,r,i,o,s){var a={year:e.length===2?_r(V(e)):V(e),month:Fi.indexOf(t)+1,day:V(r),hour:V(i),minute:V(o)};return s&&(a.second=V(s)),n&&(a.weekday=n.length>3?Bi.indexOf(n)+1:_i.indexOf(n)+1),a}var 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 tu(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=n[8],l=n[9],u=n[10],d=n[11],f=pn(e,i,r,t,o,s,a),p;return c?p=Xa[c]:l?p=0:p=sr(u,d),[f,new $(p)]}function ru(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var nu=/^(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|Wedsday|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$/,ou=/^(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 ci(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=pn(e,i,r,t,o,s,a);return[c,$.utcInstance]}function su(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=pn(e,a,t,r,i,o,s);return[c,$.utcInstance]}var au=et($a,hn),uu=et(ja,hn),lu=et(za,hn),cu=et($i),du=_e(zi,Re,rt),fu=_e(qa,Re,rt),hu=_e(Za,Re,rt),pu=_e(Re,rt);function mu(n){return tt(n,[au,du],[uu,fu],[lu,hu],[cu,pu])}function gu(n){return tt(ru(n),[eu,tu])}function yu(n){return tt(n,[nu,ci],[iu,ci],[ou,su])}function vu(n){return tt(n,[Ja,Qa])}var wu=_e(Re);function Eu(n){return tt(n,[Ka,wu])}var Tu=et(Wa,Ya),Au=et(ji),bu=_e(zi,Re,rt,qi),Cu=_e(Re,rt,qi);function Du(n){return tt(n,[Tu,bu],[Au,Cu])}var Su="Invalid Duration",Zi={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}},Iu=Object.assign({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}},Zi),Z=146097/400,Ze=146097/4800,ku=Object.assign({years:{quarters:4,months:12,weeks:Z/7,days:Z,hours:Z*24,minutes:Z*24*60,seconds:Z*24*60*60,milliseconds:Z*24*60*60*1e3},quarters:{months:3,weeks:Z/28,days:Z/4,hours:Z*24/4,minutes:Z*24*60/4,seconds:Z*24*60*60/4,milliseconds:Z*24*60*60*1e3/4},months:{weeks:Ze/7,days:Ze,hours:Ze*24,minutes:Ze*24*60,seconds:Ze*24*60*60,milliseconds:Ze*24*60*60*1e3}},Zi),We=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Ou=We.slice(0).reverse();function Ne(n,e,t){t===void 0&&(t=!1);var r={values:t?e.values:Object.assign({},n.values,e.values||{}),loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy};return new H(r)}function Nu(n){return n<0?Math.floor(n):Math.ceil(n)}function Wi(n,e,t,r,i){var o=n[i][t],s=e[t]/o,a=Math.sign(s)===Math.sign(r[i]),c=!a&&r[i]!==0&&Math.abs(s)<=1?Nu(s):Math.trunc(s);r[i]+=c,e[t]-=c*o}function xu(n,e){Ou.reduce(function(t,r){return A(e[r])?t:(t&&Wi(n,e,t,e,r),r)},null)}var H=(function(){function n(t){var r=t.conversionAccuracy==="longterm"||!1;this.values=t.values,this.loc=t.loc||B.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=r?ku:Iu,this.isLuxonDuration=!0}n.fromMillis=function(r,i){return n.fromObject(Object.assign({milliseconds:r},i))},n.fromObject=function(r){if(r==null||typeof r!="object")throw new W("Duration.fromObject: argument expected to be an object, got "+(r===null?"null":typeof r));return new n({values:nr(r,n.normalizeUnit,["locale","numberingSystem","conversionAccuracy","zone"]),loc:B.fromObject(r),conversionAccuracy:r.conversionAccuracy})},n.fromISO=function(r,i){var o=vu(r),s=o[0];if(s){var a=Object.assign(s,i);return n.fromObject(a)}else return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.fromISOTime=function(r,i){var o=Eu(r),s=o[0];if(s){var a=Object.assign(s,i);return n.fromObject(a)}else return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new W("need to specify a reason the Duration is invalid");var o=r instanceof ne?r:new ne(r,i);if(N.throwOnInvalid)throw new la(o);return new n({invalid:o})},n.normalizeUnit=function(r){var i={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"}[r&&r.toLowerCase()];if(!i)throw new Di(r);return i},n.isDuration=function(r){return r&&r.isLuxonDuration||!1};var e=n.prototype;return e.toFormat=function(r,i){i===void 0&&(i={});var o=Object.assign({},i,{floor:i.round!==!1&&i.floor!==!1});return this.isValid?le.create(this.loc,o).formatDurationFromString(this,r):Su},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var i=Object.assign({},this.values);return r.includeConfig&&(i.conversionAccuracy=this.conversionAccuracy,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale),i},e.toISO=function(){if(!this.isValid)return null;var r="P";return this.years!==0&&(r+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(r+=this.months+this.quarters*3+"M"),this.weeks!==0&&(r+=this.weeks+"W"),this.days!==0&&(r+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(r+="T"),this.hours!==0&&(r+=this.hours+"H"),this.minutes!==0&&(r+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(r+=cn(this.seconds+this.milliseconds/1e3,3)+"S"),r==="P"&&(r+="T0S"),r},e.toISOTime=function(r){if(r===void 0&&(r={}),!this.isValid)return null;var i=this.toMillis();if(i<0||i>=864e5)return null;r=Object.assign({suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended"},r);var o=this.shiftTo("hours","minutes","seconds","milliseconds"),s=r.format==="basic"?"hhmm":"hh:mm";(!r.suppressSeconds||o.seconds!==0||o.milliseconds!==0)&&(s+=r.format==="basic"?"ss":":ss",(!r.suppressMilliseconds||o.milliseconds!==0)&&(s+=".SSS"));var a=o.toFormat(s);return r.includePrefix&&(a="T"+a),a},e.toJSON=function(){return this.toISO()},e.toString=function(){return this.toISO()},e.toMillis=function(){return this.as("milliseconds")},e.valueOf=function(){return this.toMillis()},e.plus=function(r){if(!this.isValid)return this;for(var i=Fe(r),o={},s=Te(We),a;!(a=s()).done;){var c=a.value;(Qe(i.values,c)||Qe(this.values,c))&&(o[c]=i.get(c)+this.get(c))}return Ne(this,{values:o},!0)},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r);return this.plus(i.negate())},e.mapUnits=function(r){if(!this.isValid)return this;for(var i={},o=0,s=Object.keys(this.values);o<s.length;o++){var a=s[o];i[a]=xi(r(this.values[a],a))}return Ne(this,{values:i},!0)},e.get=function(r){return this[n.normalizeUnit(r)]},e.set=function(r){if(!this.isValid)return this;var i=Object.assign(this.values,nr(r,n.normalizeUnit,[]));return Ne(this,{values:i})},e.reconfigure=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.conversionAccuracy,c=this.loc.clone({locale:o,numberingSystem:s}),l={loc:c};return a&&(l.conversionAccuracy=a),Ne(this,l)},e.as=function(r){return this.isValid?this.shiftTo(r).get(r):NaN},e.normalize=function(){if(!this.isValid)return this;var r=this.toObject();return xu(this.matrix,r),Ne(this,{values:r},!0)},e.shiftTo=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!this.isValid)return this;if(i.length===0)return this;i=i.map(function(S){return n.normalizeUnit(S)});for(var s={},a={},c=this.toObject(),l,u=Te(We),d;!(d=u()).done;){var f=d.value;if(i.indexOf(f)>=0){l=f;var p=0;for(var g in a)p+=this.matrix[g][f]*a[g],a[g]=0;Pe(c[f])&&(p+=c[f]);var v=Math.trunc(p);s[f]=v,a[f]=p-v;for(var w in c)We.indexOf(w)>We.indexOf(f)&&Wi(this.matrix,c,w,s,f)}else Pe(c[f])&&(a[f]=c[f])}for(var y in a)a[y]!==0&&(s[l]+=y===l?a[y]:a[y]/this.matrix[l][y]);return Ne(this,{values:s},!0).normalize()},e.negate=function(){if(!this.isValid)return this;for(var r={},i=0,o=Object.keys(this.values);i<o.length;i++){var s=o[i];r[s]=-this.values[s]}return Ne(this,{values:r},!0)},e.equals=function(r){if(!this.isValid||!r.isValid||!this.loc.equals(r.loc))return!1;function i(c,l){return c===void 0||c===0?l===void 0||l===0:c===l}for(var o=Te(We),s;!(s=o()).done;){var a=s.value;if(!i(this.values[a],r.values[a]))return!1}return!0},ie(n,[{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"years",get:function(){return this.isValid?this.values.years||0:NaN}},{key:"quarters",get:function(){return this.isValid?this.values.quarters||0:NaN}},{key:"months",get:function(){return this.isValid?this.values.months||0:NaN}},{key:"weeks",get:function(){return this.isValid?this.values.weeks||0:NaN}},{key:"days",get:function(){return this.isValid?this.values.days||0:NaN}},{key:"hours",get:function(){return this.isValid?this.values.hours||0:NaN}},{key:"minutes",get:function(){return this.isValid?this.values.minutes||0:NaN}},{key:"seconds",get:function(){return this.isValid?this.values.seconds||0:NaN}},{key:"milliseconds",get:function(){return this.isValid?this.values.milliseconds||0:NaN}},{key:"isValid",get:function(){return this.invalid===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),n})();function Fe(n){if(Pe(n))return H.fromMillis(n);if(H.isDuration(n))return n;if(typeof n=="object")return H.fromObject(n);throw new W("Unknown duration argument "+n+" of type "+typeof n)}var Dt="Invalid Interval";function Mu(n,e){return!n||!n.isValid?Mt.invalid("missing or invalid start"):!e||!e.isValid?Mt.invalid("missing or invalid end"):e<n?Mt.invalid("end before start","The end of an interval must be after its start, but you had start="+n.toISO()+" and end="+e.toISO()):null}var Mt=(function(){function n(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new W("need to specify a reason the Interval is invalid");var o=r instanceof ne?r:new ne(r,i);if(N.throwOnInvalid)throw new ua(o);return new n({invalid:o})},n.fromDateTimes=function(r,i){var o=kt(r),s=kt(i),a=Mu(o,s);return a==null?new n({start:o,end:s}):a},n.after=function(r,i){var o=Fe(i),s=kt(r);return n.fromDateTimes(s,s.plus(o))},n.before=function(r,i){var o=Fe(i),s=kt(r);return n.fromDateTimes(s.minus(o),s)},n.fromISO=function(r,i){var o=(r||"").split("/",2),s=o[0],a=o[1];if(s&&a){var c,l;try{c=M.fromISO(s,i),l=c.isValid}catch(g){l=!1}var u,d;try{u=M.fromISO(a,i),d=u.isValid}catch(g){d=!1}if(l&&d)return n.fromDateTimes(c,u);if(l){var f=H.fromISO(a,i);if(f.isValid)return n.after(c,f)}else if(d){var p=H.fromISO(s,i);if(p.isValid)return n.before(u,p)}}return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.isInterval=function(r){return r&&r.isLuxonInterval||!1};var e=n.prototype;return e.length=function(r){return r===void 0&&(r="milliseconds"),this.isValid?this.toDuration.apply(this,[r]).get(r):NaN},e.count=function(r){if(r===void 0&&(r="milliseconds"),!this.isValid)return NaN;var i=this.start.startOf(r),o=this.end.startOf(r);return Math.floor(o.diff(i,r).get(r))+1},e.hasSame=function(r){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,r):!1},e.isEmpty=function(){return this.s.valueOf()===this.e.valueOf()},e.isAfter=function(r){return this.isValid?this.s>r:!1},e.isBefore=function(r){return this.isValid?this.e<=r:!1},e.contains=function(r){return this.isValid?this.s<=r&&this.e>r:!1},e.set=function(r){var i=r===void 0?{}:r,o=i.start,s=i.end;return this.isValid?n.fromDateTimes(o||this.s,s||this.e):this},e.splitAt=function(){var r=this;if(!this.isValid)return[];for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];for(var a=o.map(kt).filter(function(p){return r.contains(p)}).sort(),c=[],l=this.s,u=0;l<this.e;){var d=a[u]||this.e,f=+d>+this.e?this.e:d;c.push(n.fromDateTimes(l,f)),l=f,u+=1}return c},e.splitBy=function(r){var i=Fe(r);if(!this.isValid||!i.isValid||i.as("milliseconds")===0)return[];for(var o=this.s,s=1,a,c=[];o<this.e;){var l=this.start.plus(i.mapUnits(function(u){return u*s}));a=+l>+this.e?this.e:l,c.push(n.fromDateTimes(o,a)),o=a,s+=1}return c},e.divideEqually=function(r){return this.isValid?this.splitBy(this.length()/r).slice(0,r):[]},e.overlaps=function(r){return this.e>r.s&&this.s<r.e},e.abutsStart=function(r){return this.isValid?+this.e==+r.s:!1},e.abutsEnd=function(r){return this.isValid?+r.e==+this.s:!1},e.engulfs=function(r){return this.isValid?this.s<=r.s&&this.e>=r.e:!1},e.equals=function(r){return!this.isValid||!r.isValid?!1:this.s.equals(r.s)&&this.e.equals(r.e)},e.intersection=function(r){if(!this.isValid)return this;var i=this.s>r.s?this.s:r.s,o=this.e<r.e?this.e:r.e;return i>=o?null:n.fromDateTimes(i,o)},e.union=function(r){if(!this.isValid)return this;var i=this.s<r.s?this.s:r.s,o=this.e>r.e?this.e:r.e;return n.fromDateTimes(i,o)},n.merge=function(r){var i=r.sort(function(a,c){return a.s-c.s}).reduce(function(a,c){var l=a[0],u=a[1];return u?u.overlaps(c)||u.abutsStart(c)?[l,u.union(c)]:[l.concat([u]),c]:[l,c]},[[],null]),o=i[0],s=i[1];return s&&o.push(s),o},n.xor=function(r){for(var i,o=null,s=0,a=[],c=r.map(function(g){return[{time:g.s,type:"s"},{time:g.e,type:"e"}]}),l=(i=Array.prototype).concat.apply(i,c),u=l.sort(function(g,v){return g.time-v.time}),d=Te(u),f;!(f=d()).done;){var p=f.value;s+=p.type==="s"?1:-1,s===1?o=p.time:(o&&+o!=+p.time&&a.push(n.fromDateTimes(o,p.time)),o=null)}return n.merge(a)},e.difference=function(){for(var r=this,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return n.xor([this].concat(o)).map(function(a){return r.intersection(a)}).filter(function(a){return a&&!a.isEmpty()})},e.toString=function(){return this.isValid?"["+this.s.toISO()+" \u2013 "+this.e.toISO()+")":Dt},e.toISO=function(r){return this.isValid?this.s.toISO(r)+"/"+this.e.toISO(r):Dt},e.toISODate=function(){return this.isValid?this.s.toISODate()+"/"+this.e.toISODate():Dt},e.toISOTime=function(r){return this.isValid?this.s.toISOTime(r)+"/"+this.e.toISOTime(r):Dt},e.toFormat=function(r,i){var o=i===void 0?{}:i,s=o.separator,a=s===void 0?" \u2013 ":s;return this.isValid?""+this.s.toFormat(r)+a+this.e.toFormat(r):Dt},e.toDuration=function(r,i){return this.isValid?this.e.diff(this.s,r,i):H.invalid(this.invalidReason)},e.mapEndpoints=function(r){return n.fromDateTimes(r(this.s),r(this.e))},ie(n,[{key:"start",get:function(){return this.isValid?this.s:null}},{key:"end",get:function(){return this.isValid?this.e:null}},{key:"isValid",get:function(){return this.invalidReason===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),n})(),Nt=(function(){function n(){}return n.hasDST=function(t){t===void 0&&(t=N.defaultZone);var r=M.now().setZone(t).set({month:12});return!t.universal&&r.offset!==r.set({month:6}).offset},n.isValidIANAZone=function(t){return ce.isValidSpecifier(t)&&ce.isValidZone(t)},n.normalizeZone=function(t){return Me(t,N.defaultZone)},n.months=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l,d=i.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t)},n.monthsFormat=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l,d=i.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t,!0)},n.weekdays=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t)},n.weekdaysFormat=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t,!0)},n.meridiems=function(t){var r=t===void 0?{}:t,i=r.locale,o=i===void 0?null:i;return B.create(o).meridiems()},n.eras=function(t,r){t===void 0&&(t="short");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o;return B.create(s,null,"gregory").eras(t)},n.features=function(){var t=!1,r=!1,i=!1,o=!1;if(de()){t=!0,r=Ft(),o=ki();try{i=new Intl.DateTimeFormat("en",{timeZone:"America/New_York"}).resolvedOptions().timeZone==="America/New_York"}catch(s){i=!1}}return{intl:t,intlTokens:r,zones:i,relative:o}},n})();function di(n,e){var t=function(o){return o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf()},r=t(e)-t(n);return Math.floor(H.fromMillis(r).as("days"))}function Fu(n,e,t){for(var r=[["years",function(v,w){return w.year-v.year}],["quarters",function(v,w){return w.quarter-v.quarter}],["months",function(v,w){return w.month-v.month+(w.year-v.year)*12}],["weeks",function(v,w){var y=di(v,w);return(y-y%7)/7}],["days",di]],i={},o,s,a=0,c=r;a<c.length;a++){var l=c[a],u=l[0],d=l[1];if(t.indexOf(u)>=0){var f;o=u;var p=d(n,e);if(s=n.plus((f={},f[u]=p,f)),s>e){var g;n=n.plus((g={},g[u]=p-1,g)),p-=1}else n=s;i[u]=p}}return[n,i,s,o]}function Pu(n,e,t,r){var i=Fu(n,e,t),o=i[0],s=i[1],a=i[2],c=i[3],l=e-o,u=t.filter(function(g){return["hours","minutes","seconds","milliseconds"].indexOf(g)>=0});if(u.length===0){if(a<e){var d;a=o.plus((d={},d[c]=1,d))}a!==o&&(s[c]=(s[c]||0)+l/(a-o))}var f=H.fromObject(Object.assign(s,r));if(u.length>0){var p;return(p=H.fromMillis(l,r)).shiftTo.apply(p,u).plus(f)}else return f}var mn={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"},fi={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]},Bu=mn.hanidec.replace(/[\[|\]]/g,"").split("");function _u(n){var e=parseInt(n,10);if(isNaN(e)){e="";for(var t=0;t<n.length;t++){var r=n.charCodeAt(t);if(n[t].search(mn.hanidec)!==-1)e+=Bu.indexOf(n[t]);else for(var i in fi){var o=fi[i],s=o[0],a=o[1];r>=s&&r<=a&&(e+=r-s)}}return parseInt(e,10)}else return e}function te(n,e){var t=n.numberingSystem;return e===void 0&&(e=""),new RegExp(""+mn[t||"latn"]+e)}var Ru="missing Intl.DateTimeFormat.formatToParts support";function b(n,e){return e===void 0&&(e=function(r){return r}),{regex:n,deser:function(r){var i=r[0];return e(_u(i))}}}var Lu="\xA0",Yi="( |"+Lu+")",Ki=new RegExp(Yi,"g");function Uu(n){return n.replace(/\./g,"\\.?").replace(Ki,Yi)}function hi(n){return n.replace(/\./g,"").replace(Ki," ").toLowerCase()}function re(n,e){return n===null?null:{regex:RegExp(n.map(Uu).join("|")),deser:function(r){var i=r[0];return n.findIndex(function(o){return hi(i)===hi(o)})+e}}}function pi(n,e){return{regex:n,deser:function(r){var i=r[1],o=r[2];return sr(i,o)},groups:e}}function mi(n){return{regex:n,deser:function(t){var r=t[0];return r}}}function Gu(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Vu(n,e){var t=te(e),r=te(e,"{2}"),i=te(e,"{3}"),o=te(e,"{4}"),s=te(e,"{6}"),a=te(e,"{1,2}"),c=te(e,"{1,3}"),l=te(e,"{1,6}"),u=te(e,"{1,9}"),d=te(e,"{2,4}"),f=te(e,"{4,6}"),p=function(y){return{regex:RegExp(Gu(y.val)),deser:function(ae){var D=ae[0];return D},literal:!0}},g=function(y){if(n.literal)return p(y);switch(y.val){case"G":return re(e.eras("short",!1),0);case"GG":return re(e.eras("long",!1),0);case"y":return b(l);case"yy":return b(d,_r);case"yyyy":return b(o);case"yyyyy":return b(f);case"yyyyyy":return b(s);case"M":return b(a);case"MM":return b(r);case"MMM":return re(e.months("short",!0,!1),1);case"MMMM":return re(e.months("long",!0,!1),1);case"L":return b(a);case"LL":return b(r);case"LLL":return re(e.months("short",!1,!1),1);case"LLLL":return re(e.months("long",!1,!1),1);case"d":return b(a);case"dd":return b(r);case"o":return b(c);case"ooo":return b(i);case"HH":return b(r);case"H":return b(a);case"hh":return b(r);case"h":return b(a);case"mm":return b(r);case"m":return b(a);case"q":return b(a);case"qq":return b(r);case"s":return b(a);case"ss":return b(r);case"S":return b(c);case"SSS":return b(i);case"u":return mi(u);case"a":return re(e.meridiems(),0);case"kkkk":return b(o);case"kk":return b(d,_r);case"W":return b(a);case"WW":return b(r);case"E":case"c":return b(t);case"EEE":return re(e.weekdays("short",!1,!1),1);case"EEEE":return re(e.weekdays("long",!1,!1),1);case"ccc":return re(e.weekdays("short",!0,!1),1);case"cccc":return re(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return pi(new RegExp("([+-]"+a.source+")(?::("+r.source+"))?"),2);case"ZZZ":return pi(new RegExp("([+-]"+a.source+")("+r.source+")?"),2);case"z":return mi(/[a-z_+-/]{1,256}?/i);default:return p(y)}},v=g(n)||{invalidReason:Ru};return v.token=n,v}var Hu={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",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"}};function $u(n,e,t){var r=n.type,i=n.value;if(r==="literal")return{literal:!0,val:i};var o=t[r],s=Hu[r];if(typeof s=="object"&&(s=s[o]),s)return{literal:!1,val:s}}function ju(n){var e=n.map(function(t){return t.regex}).reduce(function(t,r){return t+"("+r.source+")"},"");return["^"+e+"$",n]}function zu(n,e,t){var r=n.match(e);if(r){var i={},o=1;for(var s in t)if(Qe(t,s)){var a=t[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(o,o+c))),o+=c}return[r,i]}else return[r,{}]}function qu(n){var e=function(o){switch(o){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}},t;A(n.Z)?A(n.z)?t=null:t=ce.create(n.z):t=new $(n.Z),A(n.q)||(n.M=(n.q-1)*3+1),A(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),A(n.u)||(n.S=ln(n.u));var r=Object.keys(n).reduce(function(i,o){var s=e(o);return s&&(i[s]=n[o]),i},{});return[r,t]}var Nr=null;function Zu(){return Nr||(Nr=M.fromMillis(1555555555555)),Nr}function Wu(n,e){if(n.literal)return n;var t=le.macroTokenToFormatOpts(n.val);if(!t)return n;var r=le.create(e,t),i=r.formatDateTimeParts(Zu()),o=i.map(function(s){return $u(s,e,t)});return o.includes(void 0)?n:o}function Yu(n,e){var t;return(t=Array.prototype).concat.apply(t,n.map(function(r){return Wu(r,e)}))}function Ji(n,e,t){var r=Yu(le.parseFormat(t),n),i=r.map(function(w){return Vu(w,n)}),o=i.find(function(w){return w.invalidReason});if(o)return{input:e,tokens:r,invalidReason:o.invalidReason};var s=ju(i),a=s[0],c=s[1],l=RegExp(a,"i"),u=zu(e,l,c),d=u[0],f=u[1],p=f?qu(f):[null,null],g=p[0],v=p[1];if(Qe(f,"a")&&Qe(f,"H"))throw new Ot("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:l,rawMatches:d,matches:f,result:g,zone:v}}function Ku(n,e,t){var r=Ji(n,e,t),i=r.result,o=r.zone,s=r.invalidReason;return[i,o,s]}var Qi=[0,31,59,90,120,151,181,212,243,273,304,334],Xi=[0,31,60,91,121,152,182,213,244,274,305,335];function Y(n,e){return new ne("unit out of range","you specified "+e+" (of type "+typeof e+") as a "+n+", which is invalid")}function eo(n,e,t){var r=new Date(Date.UTC(n,e-1,t)).getUTCDay();return r===0?7:r}function to(n,e,t){return t+(Pt(n)?Xi:Qi)[e-1]}function ro(n,e){var t=Pt(n)?Xi:Qi,r=t.findIndex(function(o){return o<e}),i=e-t[r];return{month:r+1,day:i}}function Hr(n){var e=n.year,t=n.month,r=n.day,i=to(e,t,r),o=eo(e,t,r),s=Math.floor((i-o+10)/7),a;return s<1?(a=e-1,s=rr(a)):s>rr(e)?(a=e+1,s=1):a=e,Object.assign({weekYear:a,weekNumber:s,weekday:o},ar(n))}function gi(n){var e=n.weekYear,t=n.weekNumber,r=n.weekday,i=eo(e,1,4),o=xt(e),s=t*7+r-i-3,a;s<1?(a=e-1,s+=xt(a)):s>o?(a=e+1,s-=xt(e)):a=e;var c=ro(a,s),l=c.month,u=c.day;return Object.assign({year:a,month:l,day:u},ar(n))}function xr(n){var e=n.year,t=n.month,r=n.day,i=to(e,t,r);return Object.assign({year:e,ordinal:i},ar(n))}function yi(n){var e=n.year,t=n.ordinal,r=ro(e,t),i=r.month,o=r.day;return Object.assign({year:e,month:i,day:o},ar(n))}function Ju(n){var e=or(n.weekYear),t=pe(n.weekNumber,1,rr(n.weekYear)),r=pe(n.weekday,1,7);return e?t?r?!1:Y("weekday",n.weekday):Y("week",n.week):Y("weekYear",n.weekYear)}function Qu(n){var e=or(n.year),t=pe(n.ordinal,1,xt(n.year));return e?t?!1:Y("ordinal",n.ordinal):Y("year",n.year)}function no(n){var e=or(n.year),t=pe(n.month,1,12),r=pe(n.day,1,tr(n.year,n.month));return e?t?r?!1:Y("day",n.day):Y("month",n.month):Y("year",n.year)}function io(n){var e=n.hour,t=n.minute,r=n.second,i=n.millisecond,o=pe(e,0,23)||e===24&&t===0&&r===0&&i===0,s=pe(t,0,59),a=pe(r,0,59),c=pe(i,0,999);return o?s?a?c?!1:Y("millisecond",i):Y("second",r):Y("minute",t):Y("hour",e)}var Mr="Invalid DateTime",vi=864e13;function Yt(n){return new ne("unsupported zone",'the zone "'+n.name+'" is not supported')}function Fr(n){return n.weekData===null&&(n.weekData=Hr(n.c)),n.weekData}function St(n,e){var t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new M(Object.assign({},t,e,{old:t}))}function oo(n,e,t){var r=n-e*60*1e3,i=t.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;var o=t.offset(r);return i===o?[r,i]:[n-Math.min(i,o)*60*1e3,Math.max(i,o)]}function wi(n,e){n+=e*60*1e3;var t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Qt(n,e,t){return oo(dn(n),e,t)}function Ei(n,e){var t=n.o,r=n.c.year+Math.trunc(e.years),i=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o=Object.assign({},n.c,{year:r,month:i,day:Math.min(n.c.day,tr(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7}),s=H.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"),a=dn(o),c=oo(a,t,n.zone),l=c[0],u=c[1];return s!==0&&(l+=s,u=n.zone.offset(l)),{ts:l,o:u}}function It(n,e,t,r,i){var o=t.setZone,s=t.zone;if(n&&Object.keys(n).length!==0){var a=e||s,c=M.fromObject(Object.assign(n,t,{zone:a,setZone:void 0}));return o?c:c.setZone(s)}else return M.invalid(new ne("unparsable",'the input "'+i+`" can't be parsed as `+r))}function Ye(n,e,t){return t===void 0&&(t=!0),n.isValid?le.create(B.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function Ti(n,e){var t=e.suppressSeconds,r=t===void 0?!1:t,i=e.suppressMilliseconds,o=i===void 0?!1:i,s=e.includeOffset,a=e.includePrefix,c=a===void 0?!1:a,l=e.includeZone,u=l===void 0?!1:l,d=e.spaceZone,f=d===void 0?!1:d,p=e.format,g=p===void 0?"extended":p,v=g==="basic"?"HHmm":"HH:mm";(!r||n.second!==0||n.millisecond!==0)&&(v+=g==="basic"?"ss":":ss",(!o||n.millisecond!==0)&&(v+=".SSS")),(u||s)&&f&&(v+=" "),u?v+="z":s&&(v+=g==="basic"?"ZZZ":"ZZ");var w=Ye(n,v);return c&&(w="T"+w),w}var so={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Xu={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},el={ordinal:1,hour:0,minute:0,second:0,millisecond:0},ao=["year","month","day","hour","minute","second","millisecond"],tl=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],rl=["year","ordinal","hour","minute","second","millisecond"];function Ai(n){var 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"}[n.toLowerCase()];if(!e)throw new Di(n);return e}function bi(n,e){for(var t=Te(ao),r;!(r=t()).done;){var i=r.value;A(n[i])&&(n[i]=so[i])}var o=no(n)||io(n);if(o)return M.invalid(o);var s=N.now(),a=e.offset(s),c=Qt(n,a,e),l=c[0],u=c[1];return new M({ts:l,zone:e,o:u})}function Ci(n,e,t){var r=A(t.round)?!0:t.round,i=function(d,f){d=cn(d,r||t.calendary?0:2,!0);var p=e.loc.clone(t).relFormatter(t);return p.format(d,f)},o=function(d){return t.calendary?e.hasSame(n,d)?0:e.startOf(d).diff(n.startOf(d),d).get(d):e.diff(n,d).get(d)};if(t.unit)return i(o(t.unit),t.unit);for(var s=Te(t.units),a;!(a=s()).done;){var c=a.value,l=o(c);if(Math.abs(l)>=1)return i(l,c)}return i(n>e?-0:0,t.units[t.units.length-1])}var M=(function(){function n(t){var r=t.zone||N.defaultZone,i=t.invalid||(Number.isNaN(t.ts)?new ne("invalid input"):null)||(r.isValid?null:Yt(r));this.ts=A(t.ts)?N.now():t.ts;var o=null,s=null;if(!i){var a=t.old&&t.old.ts===this.ts&&t.old.zone.equals(r);if(a){var c=[t.old.c,t.old.o];o=c[0],s=c[1]}else{var l=r.offset(this.ts);o=wi(this.ts,l),i=Number.isNaN(o.year)?new ne("invalid input"):null,o=i?null:o,s=i?null:l}}this._zone=r,this.loc=t.loc||B.create(),this.invalid=i,this.weekData=null,this.c=o,this.o=s,this.isLuxonDateTime=!0}n.now=function(){return new n({})},n.local=function(r,i,o,s,a,c,l){return A(r)?n.now():bi({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},N.defaultZone)},n.utc=function(r,i,o,s,a,c,l){return A(r)?new n({ts:N.now(),zone:$.utcInstance}):bi({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},$.utcInstance)},n.fromJSDate=function(r,i){i===void 0&&(i={});var o=da(r)?r.valueOf():NaN;if(Number.isNaN(o))return n.invalid("invalid input");var s=Me(i.zone,N.defaultZone);return s.isValid?new n({ts:o,zone:s,loc:B.fromObject(i)}):n.invalid(Yt(s))},n.fromMillis=function(r,i){if(i===void 0&&(i={}),Pe(r))return r<-vi||r>vi?n.invalid("Timestamp out of range"):new n({ts:r,zone:Me(i.zone,N.defaultZone),loc:B.fromObject(i)});throw new W("fromMillis requires a numerical input, but received a "+typeof r+" with value "+r)},n.fromSeconds=function(r,i){if(i===void 0&&(i={}),Pe(r))return new n({ts:r*1e3,zone:Me(i.zone,N.defaultZone),loc:B.fromObject(i)});throw new W("fromSeconds requires a numerical input")},n.fromObject=function(r){var i=Me(r.zone,N.defaultZone);if(!i.isValid)return n.invalid(Yt(i));var o=N.now(),s=i.offset(o),a=nr(r,Ai,["zone","locale","outputCalendar","numberingSystem"]),c=!A(a.ordinal),l=!A(a.year),u=!A(a.month)||!A(a.day),d=l||u,f=a.weekYear||a.weekNumber,p=B.fromObject(r);if((d||c)&&f)throw new Ot("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new Ot("Can't mix ordinal dates with month/day");var g=f||a.weekday&&!d,v,w,y=wi(o,s);g?(v=tl,w=Xu,y=Hr(y)):c?(v=rl,w=el,y=xr(y)):(v=ao,w=so);for(var S=!1,ae=Te(v),D;!(D=ae()).done;){var L=D.value,Dr=a[L];A(Dr)?S?a[L]=w[L]:a[L]=y[L]:S=!0}var Vs=g?Ju(a):c?Qu(a):no(a),Bn=Vs||io(a);if(Bn)return n.invalid(Bn);var Hs=g?gi(a):c?yi(a):a,_n=Qt(Hs,s,i),$s=_n[0],js=_n[1],Sr=new n({ts:$s,zone:i,o:js,loc:p});return a.weekday&&d&&r.weekday!==Sr.weekday?n.invalid("mismatched weekday","you can't specify both a weekday of "+a.weekday+" and a date of "+Sr.toISO()):Sr},n.fromISO=function(r,i){i===void 0&&(i={});var o=mu(r),s=o[0],a=o[1];return It(s,a,i,"ISO 8601",r)},n.fromRFC2822=function(r,i){i===void 0&&(i={});var o=gu(r),s=o[0],a=o[1];return It(s,a,i,"RFC 2822",r)},n.fromHTTP=function(r,i){i===void 0&&(i={});var o=yu(r),s=o[0],a=o[1];return It(s,a,i,"HTTP",i)},n.fromFormat=function(r,i,o){if(o===void 0&&(o={}),A(r)||A(i))throw new W("fromFormat requires an input string and a format");var s=o,a=s.locale,c=a===void 0?null:a,l=s.numberingSystem,u=l===void 0?null:l,d=B.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0}),f=Ku(d,r,i),p=f[0],g=f[1],v=f[2];return v?n.invalid(v):It(p,g,o,"format "+i,r)},n.fromString=function(r,i,o){return o===void 0&&(o={}),n.fromFormat(r,i,o)},n.fromSQL=function(r,i){i===void 0&&(i={});var o=Du(r),s=o[0],a=o[1];return It(s,a,i,"SQL",r)},n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new W("need to specify a reason the DateTime is invalid");var o=r instanceof ne?r:new ne(r,i);if(N.throwOnInvalid)throw new aa(o);return new n({invalid:o})},n.isDateTime=function(r){return r&&r.isLuxonDateTime||!1};var e=n.prototype;return e.get=function(r){return this[r]},e.resolvedLocaleOpts=function(r){r===void 0&&(r={});var i=le.create(this.loc.clone(r),r).resolvedOptions(this),o=i.locale,s=i.numberingSystem,a=i.calendar;return{locale:o,numberingSystem:s,outputCalendar:a}},e.toUTC=function(r,i){return r===void 0&&(r=0),i===void 0&&(i={}),this.setZone($.instance(r),i)},e.toLocal=function(){return this.setZone(N.defaultZone)},e.setZone=function(r,i){var o=i===void 0?{}:i,s=o.keepLocalTime,a=s===void 0?!1:s,c=o.keepCalendarTime,l=c===void 0?!1:c;if(r=Me(r,N.defaultZone),r.equals(this.zone))return this;if(r.isValid){var u=this.ts;if(a||l){var d=r.offset(this.ts),f=this.toObject(),p=Qt(f,d,r);u=p[0]}return St(this,{ts:u,zone:r})}else return n.invalid(Yt(r))},e.reconfigure=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.outputCalendar,c=this.loc.clone({locale:o,numberingSystem:s,outputCalendar:a});return St(this,{loc:c})},e.setLocale=function(r){return this.reconfigure({locale:r})},e.set=function(r){if(!this.isValid)return this;var i=nr(r,Ai,[]),o=!A(i.weekYear)||!A(i.weekNumber)||!A(i.weekday),s=!A(i.ordinal),a=!A(i.year),c=!A(i.month)||!A(i.day),l=a||c,u=i.weekYear||i.weekNumber;if((l||s)&&u)throw new Ot("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new Ot("Can't mix ordinal dates with month/day");var d;o?d=gi(Object.assign(Hr(this.c),i)):A(i.ordinal)?(d=Object.assign(this.toObject(),i),A(i.day)&&(d.day=Math.min(tr(d.year,d.month),d.day))):d=yi(Object.assign(xr(this.c),i));var f=Qt(d,this.o,this.zone),p=f[0],g=f[1];return St(this,{ts:p,o:g})},e.plus=function(r){if(!this.isValid)return this;var i=Fe(r);return St(this,Ei(this,i))},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r).negate();return St(this,Ei(this,i))},e.startOf=function(r){if(!this.isValid)return this;var i={},o=H.normalizeUnit(r);switch(o){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(o==="weeks"&&(i.weekday=1),o==="quarters"){var s=Math.ceil(this.month/3);i.month=(s-1)*3+1}return this.set(i)},e.endOf=function(r){var i;return this.isValid?this.plus((i={},i[r]=1,i)).startOf(r).minus(1):this},e.toFormat=function(r,i){return i===void 0&&(i={}),this.isValid?le.create(this.loc.redefaultToEN(i)).formatDateTimeFromString(this,r):Mr},e.toLocaleString=function(r){return r===void 0&&(r=er),this.isValid?le.create(this.loc.clone(r),r).formatDateTime(this):Mr},e.toLocaleParts=function(r){return r===void 0&&(r={}),this.isValid?le.create(this.loc.clone(r),r).formatDateTimeParts(this):[]},e.toISO=function(r){return r===void 0&&(r={}),this.isValid?this.toISODate(r)+"T"+this.toISOTime(r):null},e.toISODate=function(r){var i=r===void 0?{}:r,o=i.format,s=o===void 0?"extended":o,a=s==="basic"?"yyyyMMdd":"yyyy-MM-dd";return this.year>9999&&(a="+"+a),Ye(this,a)},e.toISOWeekDate=function(){return Ye(this,"kkkk-'W'WW-c")},e.toISOTime=function(r){var i=r===void 0?{}:r,o=i.suppressMilliseconds,s=o===void 0?!1:o,a=i.suppressSeconds,c=a===void 0?!1:a,l=i.includeOffset,u=l===void 0?!0:l,d=i.includePrefix,f=d===void 0?!1:d,p=i.format,g=p===void 0?"extended":p;return Ti(this,{suppressSeconds:c,suppressMilliseconds:s,includeOffset:u,includePrefix:f,format:g})},e.toRFC2822=function(){return Ye(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)},e.toHTTP=function(){return Ye(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")},e.toSQLDate=function(){return Ye(this,"yyyy-MM-dd")},e.toSQLTime=function(r){var i=r===void 0?{}:r,o=i.includeOffset,s=o===void 0?!0:o,a=i.includeZone,c=a===void 0?!1:a;return Ti(this,{includeOffset:s,includeZone:c,spaceZone:!0})},e.toSQL=function(r){return r===void 0&&(r={}),this.isValid?this.toSQLDate()+" "+this.toSQLTime(r):null},e.toString=function(){return this.isValid?this.toISO():Mr},e.valueOf=function(){return this.toMillis()},e.toMillis=function(){return this.isValid?this.ts:NaN},e.toSeconds=function(){return this.isValid?this.ts/1e3:NaN},e.toJSON=function(){return this.toISO()},e.toBSON=function(){return this.toJSDate()},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var i=Object.assign({},this.c);return r.includeConfig&&(i.outputCalendar=this.outputCalendar,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale),i},e.toJSDate=function(){return new Date(this.isValid?this.ts:NaN)},e.diff=function(r,i,o){if(i===void 0&&(i="milliseconds"),o===void 0&&(o={}),!this.isValid||!r.isValid)return H.invalid(this.invalid||r.invalid,"created by diffing an invalid DateTime");var s=Object.assign({locale:this.locale,numberingSystem:this.numberingSystem},o),a=fa(i).map(H.normalizeUnit),c=r.valueOf()>this.valueOf(),l=c?this:r,u=c?r:this,d=Pu(l,u,a,s);return c?d.negate():d},e.diffNow=function(r,i){return r===void 0&&(r="milliseconds"),i===void 0&&(i={}),this.diff(n.now(),r,i)},e.until=function(r){return this.isValid?Mt.fromDateTimes(this,r):this},e.hasSame=function(r,i){if(!this.isValid)return!1;var o=r.valueOf(),s=this.setZone(r.zone,{keepLocalTime:!0});return s.startOf(i)<=o&&o<=s.endOf(i)},e.equals=function(r){return this.isValid&&r.isValid&&this.valueOf()===r.valueOf()&&this.zone.equals(r.zone)&&this.loc.equals(r.loc)},e.toRelative=function(r){if(r===void 0&&(r={}),!this.isValid)return null;var i=r.base||n.fromObject({zone:this.zone}),o=r.padding?this<i?-r.padding:r.padding:0,s=["years","months","days","hours","minutes","seconds"],a=r.unit;return Array.isArray(r.unit)&&(s=r.unit,a=void 0),Ci(i,this.plus(o),Object.assign(r,{numeric:"always",units:s,unit:a}))},e.toRelativeCalendar=function(r){return r===void 0&&(r={}),this.isValid?Ci(r.base||n.fromObject({zone:this.zone}),this,Object.assign(r,{numeric:"auto",units:["years","months","days"],calendary:!0})):null},n.min=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!i.every(n.isDateTime))throw new W("min requires all arguments be DateTimes");return ni(i,function(s){return s.valueOf()},Math.min)},n.max=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!i.every(n.isDateTime))throw new W("max requires all arguments be DateTimes");return ni(i,function(s){return s.valueOf()},Math.max)},n.fromFormatExplain=function(r,i,o){o===void 0&&(o={});var s=o,a=s.locale,c=a===void 0?null:a,l=s.numberingSystem,u=l===void 0?null:l,d=B.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0});return Ji(d,r,i)},n.fromStringExplain=function(r,i,o){return o===void 0&&(o={}),n.fromFormatExplain(r,i,o)},ie(n,[{key:"isValid",get:function(){return this.invalid===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}},{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"outputCalendar",get:function(){return this.isValid?this.loc.outputCalendar:null}},{key:"zone",get:function(){return this._zone}},{key:"zoneName",get:function(){return this.isValid?this.zone.name:null}},{key:"year",get:function(){return this.isValid?this.c.year:NaN}},{key:"quarter",get:function(){return this.isValid?Math.ceil(this.c.month/3):NaN}},{key:"month",get:function(){return this.isValid?this.c.month:NaN}},{key:"day",get:function(){return this.isValid?this.c.day:NaN}},{key:"hour",get:function(){return this.isValid?this.c.hour:NaN}},{key:"minute",get:function(){return this.isValid?this.c.minute:NaN}},{key:"second",get:function(){return this.isValid?this.c.second:NaN}},{key:"millisecond",get:function(){return this.isValid?this.c.millisecond:NaN}},{key:"weekYear",get:function(){return this.isValid?Fr(this).weekYear:NaN}},{key:"weekNumber",get:function(){return this.isValid?Fr(this).weekNumber:NaN}},{key:"weekday",get:function(){return this.isValid?Fr(this).weekday:NaN}},{key:"ordinal",get:function(){return this.isValid?xr(this.c).ordinal:NaN}},{key:"monthShort",get:function(){return this.isValid?Nt.months("short",{locObj:this.loc})[this.month-1]:null}},{key:"monthLong",get:function(){return this.isValid?Nt.months("long",{locObj:this.loc})[this.month-1]:null}},{key:"weekdayShort",get:function(){return this.isValid?Nt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}},{key:"weekdayLong",get:function(){return this.isValid?Nt.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}},{key:"offset",get:function(){return this.isValid?+this.o:NaN}},{key:"offsetNameShort",get:function(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}},{key:"offsetNameLong",get:function(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}},{key:"isOffsetFixed",get:function(){return this.isValid?this.zone.universal:null}},{key:"isInDST",get:function(){return this.isOffsetFixed?!1:this.offset>this.set({month:1}).offset||this.offset>this.set({month:5}).offset}},{key:"isInLeapYear",get:function(){return Pt(this.year)}},{key:"daysInMonth",get:function(){return tr(this.year,this.month)}},{key:"daysInYear",get:function(){return this.isValid?xt(this.year):NaN}},{key:"weeksInWeekYear",get:function(){return this.isValid?rr(this.weekYear):NaN}}],[{key:"DATE_SHORT",get:function(){return er}},{key:"DATE_MED",get:function(){return $r}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return Si}},{key:"DATE_FULL",get:function(){return jr}},{key:"DATE_HUGE",get:function(){return zr}},{key:"TIME_SIMPLE",get:function(){return qr}},{key:"TIME_WITH_SECONDS",get:function(){return Zr}},{key:"TIME_WITH_SHORT_OFFSET",get:function(){return Wr}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return Yr}},{key:"TIME_24_SIMPLE",get:function(){return Kr}},{key:"TIME_24_WITH_SECONDS",get:function(){return Jr}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return Qr}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return Xr}},{key:"DATETIME_SHORT",get:function(){return en}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return tn}},{key:"DATETIME_MED",get:function(){return rn}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return nn}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return Ii}},{key:"DATETIME_FULL",get:function(){return on}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return sn}},{key:"DATETIME_HUGE",get:function(){return an}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return un}}]),n})();function kt(n){if(M.isDateTime(n))return n;if(n&&n.valueOf&&Pe(n.valueOf()))return M.fromJSDate(n);if(n&&typeof n=="object")return M.fromObject(n);throw new W("Unknown datetime argument: "+n+", of type "+typeof n)}var nl="1.28.1";z.DateTime=M;z.Duration=H;z.FixedOffsetZone=$;z.IANAZone=ce;z.Info=Nt;z.Interval=Mt;z.InvalidZone=Rr;z.LocalZone=Gi;z.Settings=N;z.VERSION=nl;z.Zone=Xe});var bl={};Js(bl,{Account:()=>G,AccountType:()=>F,AccountsDataTableBuilder:()=>ut,Agent:()=>lt,Amount:()=>E,App:()=>ve,Backlog:()=>Et,Balance:()=>ke,BalanceType:()=>Ae,BalancesDataTableBuilder:()=>he,BalancesReport:()=>vt,Billing:()=>ht,Bkper:()=>k,BkperError:()=>ue,Book:()=>Q,BooksDataTableBuilder:()=>Cr,BotResponse:()=>ft,BotResponseType:()=>ot,Collaborator:()=>ct,Collection:()=>De,Connection:()=>je,DecimalSeparator:()=>He,Event:()=>pt,EventList:()=>mt,EventType:()=>fr,File:()=>Ie,Group:()=>J,GroupsDataTableBuilder:()=>Tt,Integration:()=>X,MenuOpenMode:()=>it,Month:()=>dr,Period:()=>cr,Periodicity:()=>Rt,Permission:()=>nt,Query:()=>wt,Template:()=>bt,Transaction:()=>se,TransactionList:()=>gt,TransactionStatus:()=>me,TransactionsDataTableBuilder:()=>At,User:()=>Se,Visibility:()=>lr});var ue=class extends Error{constructor(e,t,r){super(t),this.name="BkperError",this.code=e,this.reason=r}};var ea=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},qe=class{constructor(e){this.params=[],this.headers={},this.method="GET",this.payload=null,this.url=e}setMethod(e){return this.method=e,this}setHeader(e,t){return this.headers[e]=t,this}addParam(e,t){return this.params.push({name:e,value:t}),this}setPayload(e){return this.payload=e,this}getUrl(){let e=this.url;if(this.params!=null){let i=0;e.indexOf("?")<0?e+="?":i++;for(let o of this.params){i>0&&(e+="&");var t=o.name,r=o.value;r!=null&&(e+=t+"="+encodeURIComponent(r),i++)}}return e}execute(){return ea(this,void 0,void 0,function*(){let e=this.getUrl(),t={method:this.method,headers:this.headers};this.payload&&this.method!=="GET"&&(typeof this.payload=="string"?t.body=this.payload:(t.body=JSON.stringify(this.payload),!this.headers["Content-Type"]&&!this.headers["content-type"]&&(t.headers=Object.assign(Object.assign({},this.headers),{"Content-Type":"application/json"}))));let r=yield fetch(e,t),i,o=r.headers.get("content-type");return o&&o.includes("application/json")?i=yield r.json():i=yield r.text(),{data:i,status:r.status,headers:r.headers}})}};var Ct=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ta="https://api.bkper.app";function ra(n){return n.apiBaseUrl?n.apiBaseUrl:ta}var ee=class extends qe{constructor(e,t){let r=ra(t);super(`${r}/${e}`),this.retry=0,this.config=t,this.requestPath=e}fetch(){let e=Object.create(null,{execute:{get:()=>super.execute}});return Ct(this,void 0,void 0,function*(){this.addCustomHeaders(),yield this.addAgentIdHeader(),this.setHeader("Authorization",`Bearer ${yield this.getAccessToken()}`),yield this.addApiKeyHeader();try{let t=yield e.execute.call(this);if(t.status>=200&&t.status<300)return t;if(t.status==404){let r={response:{status:t.status,data:t.data}};throw this.handleError(r)}else if(this.shouldRetry(t.status)&&this.retry<3){this.retry++;let r=this.config;return r.requestRetryHandler?yield r.requestRetryHandler(t.status,t.data,this.retry):console.log(`${JSON.stringify(t.data)} - Retrying ${this.retry}/3... `),yield this.fetch()}else{let r={response:{status:t.status,data:t.data}};throw this.handleError(r)}}catch(t){if(t instanceof ue||t.response)throw t;if(this.isNetworkError(t)&&this.retry<3){this.retry++;let r=this.config;return r.requestRetryHandler?yield r.requestRetryHandler(520,t,this.retry):console.log(`${this.formatNetworkErrorMessage(t)} - Retrying ${this.retry}/3... `),yield this.fetch()}throw this.handleError(t)}})}shouldRetry(e){return e==401||e==403||e==408||e==429||e!=null&&e>=500}isNetworkError(e){return e instanceof TypeError&&e.message.toLowerCase().includes("fetch")}formatNetworkErrorMessage(e){var t,r,i,o,s;let a=[];return!((t=e.cause)===null||t===void 0)&&t.code&&a.push(e.cause.code),!((r=e.cause)===null||r===void 0)&&r.hostname?a.push(e.cause.hostname):!((i=e.cause)===null||i===void 0)&&i.address&&a.push(e.cause.address),((o=e.cause)===null||o===void 0?void 0:o.port)!==void 0&&a.push(`port=${e.cause.port}`),!((s=e.cause)===null||s===void 0)&&s.syscall&&a.push(`syscall=${e.cause.syscall}`),a.length>0?`Network error calling ${this.requestPath}: ${e.message} (${a.join(", ")})`:`Network error calling ${this.requestPath}: ${e.message}`}handleError(e){var t,r,i,o,s,a,c,l,u;let d=this.config,f=d.requestErrorHandler?d.requestErrorHandler(e):void 0;if(f)return f;if(e instanceof ue)return e;if(this.isNetworkError(e))return new ue(((t=e.response)===null||t===void 0?void 0:t.status)||((r=e.response)===null||r===void 0?void 0:r.code)||e.status||e.code||0,this.formatNetworkErrorMessage(e),void 0);{let p=((o=(i=e.response)===null||i===void 0?void 0:i.data)===null||o===void 0?void 0:o.error)||((s=e.data)===null||s===void 0?void 0:s.error)||e.error;return p?new ue(p.code,p.message,(c=(a=p.errors)===null||a===void 0?void 0:a[0])===null||c===void 0?void 0:c.reason):new ue(((l=e.response)===null||l===void 0?void 0:l.status)||((u=e.response)===null||u===void 0?void 0:u.code)||e.status||e.code||0,e.message||String(e),void 0)}}addCustomHeaders(){return Ct(this,void 0,void 0,function*(){let e=this.config;if(e.requestHeadersProvider){let t=yield e.requestHeadersProvider();Object.entries(t).forEach(([r,i])=>this.setHeader(r,i))}})}addAgentIdHeader(){return Ct(this,void 0,void 0,function*(){let e=this.config;if(e.agentIdProvider){let t=yield e.agentIdProvider();t&&this.setHeader("bkper-agent-id",t)}})}addApiKeyHeader(){return Ct(this,void 0,void 0,function*(){let e=this.config;if(e.apiKeyProvider){let t=yield e.apiKeyProvider();t&&this.setHeader("bkper-api-key",t)}})}getAccessToken(){return Ct(this,void 0,void 0,function*(){let e,t=this.config;return t.oauthTokenProvider?e=yield t.oauthTokenProvider():console.warn("Token provider NOT configured!"),e&&(e=e.replace("Bearer ",""),e=e.replace("bearer ","")),e})}},m=class extends ee{constructor(e,t){super(`v5/books/${e}`,t)}},O=class extends ee{constructor(e,t){super(`v5/${e}`,t)}};var we=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ln(n,e,t){return we(this,void 0,void 0,function*(){var r=yield new m(`${n}/accounts`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Un(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Gn(n,e,t){return we(this,void 0,void 0,function*(){var r=e,i=yield new m(`${n}/accounts`,t).setMethod("PUT").setPayload(r).fetch();return i.data})}function Vn(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/batch`,t).setMethod("PUT").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Hn(n,e,t){return we(this,void 0,void 0,function*(){var r=yield new m(`${n}/accounts/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function $n(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/delete/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function jn(n,e,t){return we(this,void 0,void 0,function*(){return(yield new m(`${n}/accounts/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function zn(n,e){return we(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/accounts`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var Oe=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Zn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Wn(n,e,t){return Oe(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/groups/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Yn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Kn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function Jn(n,e){return Oe(this,void 0,void 0,function*(){var t=yield new m(`${n}/groups`,e).setMethod("GET").fetch(),r=t.data;return r!=null&&r.items?r.items:[]})}function Qn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups/${encodeURIComponent(e)}`,t).setMethod("GET").fetch();return r.data})}function Xn(n,e,t){return Oe(this,void 0,void 0,function*(){if(!e)return[];var r=yield new m(`${n}/groups/${encodeURIComponent(e)}/accounts`,t).setMethod("GET").fetch(),i=r.data;return i!=null&&i.items?i.items:[]})}var Lt=Qs(uo(),1);var il=20,ol=1,Le=1e6,lo=1e6,sl=-7,al=21,ul=!1,Bt="[big.js] ",Ue=Bt+"Invalid ",ur=Ue+"decimal places",ll=Ue+"rounding mode",co=Bt+"Division by zero",C={},fe=void 0,cl=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function fo(){function n(e){var t=this;if(!(t instanceof n))return e===fe?fo():new n(e);if(e instanceof n)t.s=e.s,t.e=e.e,t.c=e.c.slice();else{if(typeof e!="string"){if(n.strict===!0&&typeof e!="bigint")throw TypeError(Ue+"value");e=e===0&&1/e<0?"-0":String(e)}dl(t,e)}t.constructor=n}return n.prototype=C,n.DP=il,n.RM=ol,n.NE=sl,n.PE=al,n.strict=ul,n.roundDown=0,n.roundHalfUp=1,n.roundHalfEven=2,n.roundUp=3,n}function dl(n,e){var t,r,i;if(!cl.test(e))throw Error(Ue+"number");for(n.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),i=e.length,r=0;r<i&&e.charAt(r)=="0";)++r;if(r==i)n.c=[n.e=0];else{for(;i>0&&e.charAt(--i)=="0";);for(n.e=t-r-1,n.c=[],t=0;r<=i;)n.c[t++]=+e.charAt(r++)}return n}function Ge(n,e,t,r){var i=n.c;if(t===fe&&(t=n.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(ll);if(e<1)r=t===3&&(r||!!i[0])||e===0&&(t===1&&i[0]>=5||t===2&&(i[0]>5||i[0]===5&&(r||i[1]!==fe))),i.length=1,r?(n.e=n.e-e+1,i[0]=1):i[0]=n.e=0;else if(e<i.length){if(r=t===1&&i[e]>=5||t===2&&(i[e]>5||i[e]===5&&(r||i[e+1]!==fe||i[e-1]&1))||t===3&&(r||!!i[0]),i.length=e,r){for(;++i[--e]>9;)if(i[e]=0,e===0){++n.e,i.unshift(1);break}}for(e=i.length;!i[--e];)i.pop()}return n}function Ve(n,e,t){var r=n.e,i=n.c.join(""),o=i.length;if(e)i=i.charAt(0)+(o>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)i="0"+i;i="0."+i}else if(r>0)if(++r>o)for(r-=o;r--;)i+="0";else r<o&&(i=i.slice(0,r)+"."+i.slice(r));else o>1&&(i=i.charAt(0)+"."+i.slice(1));return n.s<0&&t?"-"+i:i}C.abs=function(){var n=new this.constructor(this);return n.s=1,n};C.cmp=function(n){var e,t=this,r=t.c,i=(n=new t.constructor(n)).c,o=t.s,s=n.s,a=t.e,c=n.e;if(!r[0]||!i[0])return r[0]?o:i[0]?-s:0;if(o!=s)return o;if(e=o<0,a!=c)return a>c^e?1:-1;for(s=(a=r.length)<(c=i.length)?a:c,o=-1;++o<s;)if(r[o]!=i[o])return r[o]>i[o]^e?1:-1;return a==c?0:a>c^e?1:-1};C.div=function(n){var e=this,t=e.constructor,r=e.c,i=(n=new t(n)).c,o=e.s==n.s?1:-1,s=t.DP;if(s!==~~s||s<0||s>Le)throw Error(ur);if(!i[0])throw Error(co);if(!r[0])return n.s=o,n.c=[n.e=0],n;var a,c,l,u,d,f=i.slice(),p=a=i.length,g=r.length,v=r.slice(0,a),w=v.length,y=n,S=y.c=[],ae=0,D=s+(y.e=e.e-n.e)+1;for(y.s=o,o=D<0?0:D,f.unshift(0);w++<a;)v.push(0);do{for(l=0;l<10;l++){if(a!=(w=v.length))u=a>w?1:-1;else for(d=-1,u=0;++d<a;)if(i[d]!=v[d]){u=i[d]>v[d]?1:-1;break}if(u<0){for(c=w==a?i:f;w;){if(v[--w]<c[w]){for(d=w;d&&!v[--d];)v[d]=9;--v[d],v[w]+=10}v[w]-=c[w]}for(;!v[0];)v.shift()}else break}S[ae++]=u?l:++l,v[0]&&u?v[w]=r[p]||0:v=[r[p]]}while((p++<g||v[0]!==fe)&&o--);return!S[0]&&ae!=1&&(S.shift(),y.e--,D--),ae>D&&Ge(y,D,t.RM,v[0]!==fe),y};C.eq=function(n){return this.cmp(n)===0};C.gt=function(n){return this.cmp(n)>0};C.gte=function(n){return this.cmp(n)>-1};C.lt=function(n){return this.cmp(n)<0};C.lte=function(n){return this.cmp(n)<1};C.minus=C.sub=function(n){var e,t,r,i,o=this,s=o.constructor,a=o.s,c=(n=new s(n)).s;if(a!=c)return n.s=-c,o.plus(n);var l=o.c.slice(),u=o.e,d=n.c,f=n.e;if(!l[0]||!d[0])return d[0]?n.s=-c:l[0]?n=new s(o):n.s=1,n;if(a=u-f){for((i=a<0)?(a=-a,r=l):(f=u,r=d),r.reverse(),c=a;c--;)r.push(0);r.reverse()}else for(t=((i=l.length<d.length)?l:d).length,a=c=0;c<t;c++)if(l[c]!=d[c]){i=l[c]<d[c];break}if(i&&(r=l,l=d,d=r,n.s=-n.s),(c=(t=d.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;t>a;){if(l[--t]<d[t]){for(e=t;e&&!l[--e];)l[e]=9;--l[e],l[t]+=10}l[t]-=d[t]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--f;return l[0]||(n.s=1,l=[f=0]),n.c=l,n.e=f,n};C.mod=function(n){var e,t=this,r=t.constructor,i=t.s,o=(n=new r(n)).s;if(!n.c[0])throw Error(co);return t.s=n.s=1,e=n.cmp(t)==1,t.s=i,n.s=o,e?new r(t):(i=r.DP,o=r.RM,r.DP=r.RM=0,t=t.div(n),r.DP=i,r.RM=o,this.minus(t.times(n)))};C.neg=function(){var n=new this.constructor(this);return n.s=-n.s,n};C.plus=C.add=function(n){var e,t,r,i=this,o=i.constructor;if(n=new o(n),i.s!=n.s)return n.s=-n.s,i.minus(n);var s=i.e,a=i.c,c=n.e,l=n.c;if(!a[0]||!l[0])return l[0]||(a[0]?n=new o(i):n.s=i.s),n;if(a=a.slice(),e=s-c){for(e>0?(c=s,r=l):(e=-e,r=a),r.reverse();e--;)r.push(0);r.reverse()}for(a.length-l.length<0&&(r=l,l=a,a=r),e=l.length,t=0;e;a[e]%=10)t=(a[--e]=a[e]+l[e]+t)/10|0;for(t&&(a.unshift(t),++c),e=a.length;a[--e]===0;)a.pop();return n.c=a,n.e=c,n};C.pow=function(n){var e=this,t=new e.constructor("1"),r=t,i=n<0;if(n!==~~n||n<-lo||n>lo)throw Error(Ue+"exponent");for(i&&(n=-n);n&1&&(r=r.times(e)),n>>=1,!!n;)e=e.times(e);return i?t.div(r):r};C.prec=function(n,e){if(n!==~~n||n<1||n>Le)throw Error(Ue+"precision");return Ge(new this.constructor(this),n,e)};C.round=function(n,e){if(n===fe)n=0;else if(n!==~~n||n<-Le||n>Le)throw Error(ur);return Ge(new this.constructor(this),n+this.e+1,e)};C.sqrt=function(){var n,e,t,r=this,i=r.constructor,o=r.s,s=r.e,a=new i("0.5");if(!r.c[0])return new i(r);if(o<0)throw Error(Bt+"No square root");o=Math.sqrt(+Ve(r,!0,!0)),o===0||o===1/0?(e=r.c.join(""),e.length+s&1||(e+="0"),o=Math.sqrt(e),s=((s+1)/2|0)-(s<0||s&1),n=new i((o==1/0?"5e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+s)):n=new i(o+""),s=n.e+(i.DP+=4);do t=n,n=a.times(t.plus(r.div(t)));while(t.c.slice(0,s).join("")!==n.c.slice(0,s).join(""));return Ge(n,(i.DP-=4)+n.e+1,i.RM)};C.times=C.mul=function(n){var e,t=this,r=t.constructor,i=t.c,o=(n=new r(n)).c,s=i.length,a=o.length,c=t.e,l=n.e;if(n.s=t.s==n.s?1:-1,!i[0]||!o[0])return n.c=[n.e=0],n;for(n.e=c+l,s<a&&(e=i,i=o,o=e,l=s,s=a,a=l),e=new Array(l=s+a);l--;)e[l]=0;for(c=a;c--;){for(a=0,l=s+c;l>c;)a=e[l]+o[c]*i[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=a}for(a?++n.e:e.shift(),c=e.length;!e[--c];)e.pop();return n.c=e,n};C.toExponential=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Le)throw Error(ur);for(t=Ge(new t.constructor(t),++n,e);t.c.length<n;)t.c.push(0)}return Ve(t,!0,!!r)};C.toFixed=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Le)throw Error(ur);for(t=Ge(new t.constructor(t),n+t.e+1,e),n=n+t.e+1;t.c.length<n;)t.c.push(0)}return Ve(t,!1,!!r)};C[Symbol.for("nodejs.util.inspect.custom")]=C.toJSON=C.toString=function(){var n=this,e=n.constructor;return Ve(n,n.e<=e.NE||n.e>=e.PE,!!n.c[0])};C.toNumber=function(){var n=+Ve(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(n.toString()))throw Error(Bt+"Imprecise conversion");return n};C.toPrecision=function(n,e){var t=this,r=t.constructor,i=t.c[0];if(n!==fe){if(n!==~~n||n<1||n>Le)throw Error(Ue+"precision");for(t=Ge(new r(t),n,e);t.c.length<n;)t.c.push(0)}return Ve(t,n<=t.e||t.e<=r.NE||t.e>=r.PE,!!i)};C.valueOf=function(){var n=this,e=n.constructor;if(e.strict===!0)throw Error(Bt+"valueOf disallowed");return Ve(n,n.e<=e.NE||n.e>=e.PE,!0)};var fl=fo(),_t=fl;var E=class n{constructor(e){this.checkNumberNotNull(e),typeof e=="string"?this.big=new _t(e):e instanceof n?this.big=new _t(e.big):e.toString?this.big=new _t(e.toString()):this.big=new _t(+e)}abs(){let e=this.big.abs();return this.wrap(e)}cmp(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.cmp(e):e instanceof n?this.big.cmp(e.big):e.toString?this.big.cmp(e.toString()):this.big.cmp(+e)}div(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.div(e):e instanceof n?t=this.big.div(e.big):e.toString?t=this.big.div(e.toString()):t=this.big.div(+e),this.wrap(t)}eq(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.eq(e):e instanceof n?this.big.eq(e.big):e.toString?this.big.eq(e.toString()):this.big.eq(+e)}gt(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.gt(e):e instanceof n?this.big.gt(e.big):e.toString?this.big.gt(e.toString()):this.big.gt(+e)}gte(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.gte(e):e instanceof n?this.big.gte(e.big):e.toString?this.big.gte(e.toString()):this.big.gte(+e)}lt(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.lt(e):e instanceof n?this.big.lt(e.big):e.toString?this.big.lt(e.toString()):this.big.lt(+e)}lte(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.lte(e):e instanceof n?this.big.lte(e.big):e.toString?this.big.lte(e.toString()):this.big.lte(+e)}plus(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.plus(e):e instanceof n?t=this.big.plus(e.big):e.toString?t=this.big.plus(e.toString()):t=this.big.plus(+e),this.wrap(t)}minus(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.minus(e):e instanceof n?t=this.big.minus(e.big):e.toString?t=this.big.minus(e.toString()):t=this.big.minus(+e),this.wrap(t)}mod(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.mod(e):e instanceof n?t=this.big.mod(e.big):e.toString?t=this.big.mod(e.toString()):t=this.big.mod(+e),this.wrap(t)}round(e){let t=this.big.round(e);return this.wrap(t)}times(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.times(e):e instanceof n?t=this.big.times(e.big):e.toString?t=this.big.times(e.toString()):t=this.big.times(+e),this.wrap(t)}toFixed(e){return this.big.toFixed(e)}toString(){return this.big.toString()}toNumber(){return this.big.toNumber()}checkNumberNotNull(e){if(e==null)throw new Error("Invalid number: null")}static create(){return Object.create(this.prototype)}wrap(e){let t=n.create();return t.big=e,t}};var Rt;(function(n){n.DAILY="DAILY",n.MONTHLY="MONTHLY",n.YEARLY="YEARLY"})(Rt||(Rt={}));var He;(function(n){n.COMMA="COMMA",n.DOT="DOT"})(He||(He={}));var nt;(function(n){n.NONE="NONE",n.VIEWER="VIEWER",n.RECORDER="RECORDER",n.POSTER="POSTER",n.EDITOR="EDITOR",n.OWNER="OWNER"})(nt||(nt={}));var lr;(function(n){n.PUBLIC="PUBLIC",n.PRIVATE="PRIVATE"})(lr||(lr={}));var F;(function(n){n.ASSET="ASSET",n.LIABILITY="LIABILITY",n.INCOMING="INCOMING",n.OUTGOING="OUTGOING"})(F||(F={}));var Ae;(function(n){n.TOTAL="TOTAL",n.PERIOD="PERIOD",n.CUMULATIVE="CUMULATIVE"})(Ae||(Ae={}));var cr;(function(n){n.MONTH="MONTH",n.QUARTER="QUARTER",n.YEAR="YEAR"})(cr||(cr={}));var dr;(function(n){n.JANUARY="JANUARY",n.FEBRUARY="FEBRUARY",n.MARCH="MARCH",n.APRIL="APRIL",n.MAY="MAY",n.JUNE="JUNE",n.JULY="JULY",n.AUGUST="AUGUST",n.SEPTEMBER="SEPTEMBER",n.OCTOBER="OCTOBER",n.NOVEMBER="NOVEMBER",n.DECEMBER="DECEMBER"})(dr||(dr={}));var me;(function(n){n.TRASHED="TRASHED",n.DRAFT="DRAFT",n.UNCHECKED="UNCHECKED",n.CHECKED="CHECKED"})(me||(me={}));var it;(function(n){n.SIDEBAR="SIDEBAR",n.EXPANDED="EXPANDED",n.NEW_TAB="NEW_TAB"})(it||(it={}));var ot;(function(n){n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR"})(ot||(ot={}));var fr;(function(n){n.FILE_CREATED="FILE_CREATED",n.FILE_UPDATED="FILE_UPDATED",n.TRANSACTION_CREATED="TRANSACTION_CREATED",n.TRANSACTION_UPDATED="TRANSACTION_UPDATED",n.TRANSACTION_DELETED="TRANSACTION_DELETED",n.TRANSACTION_POSTED="TRANSACTION_POSTED",n.TRANSACTION_CHECKED="TRANSACTION_CHECKED",n.TRANSACTION_UNCHECKED="TRANSACTION_UNCHECKED",n.TRANSACTION_RESTORED="TRANSACTION_RESTORED",n.ACCOUNT_CREATED="ACCOUNT_CREATED",n.ACCOUNT_UPDATED="ACCOUNT_UPDATED",n.ACCOUNT_DELETED="ACCOUNT_DELETED",n.QUERY_CREATED="QUERY_CREATED",n.QUERY_UPDATED="QUERY_UPDATED",n.QUERY_DELETED="QUERY_DELETED",n.GROUP_CREATED="GROUP_CREATED",n.GROUP_UPDATED="GROUP_UPDATED",n.GROUP_DELETED="GROUP_DELETED",n.COMMENT_CREATED="COMMENT_CREATED",n.COMMENT_DELETED="COMMENT_DELETED",n.COLLABORATOR_ADDED="COLLABORATOR_ADDED",n.COLLABORATOR_UPDATED="COLLABORATOR_UPDATED",n.COLLABORATOR_REMOVED="COLLABORATOR_REMOVED",n.INTEGRATION_CREATED="INTEGRATION_CREATED",n.INTEGRATION_UPDATED="INTEGRATION_UPDATED",n.INTEGRATION_DELETED="INTEGRATION_DELETED",n.BOOK_UPDATED="BOOK_UPDATED",n.BOOK_DELETED="BOOK_DELETED"})(fr||(fr={}));function pr(n,e){return e<=0?"":e===1?n:n+pr(n,e-1)}function po(n){if(!n||typeof n!="string")return[];let e=/#([a-zA-Z0-9_]+)/g,t=new Set,r;for(;(r=e.exec(n))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}var hr=null;function mr(n,e){return n==null&&(n=new E("0")),e?new E(n).round(e):new E(n).round(2)}function ge(n,e,t){if(n==null)return"";if(typeof n=="string"){if(n.trim()=="")return"";n=new E(n)}if(n==null)return"";t==null&&(t=2);var r=n.toFixed(t)+"";return e==He.DOT?r.replace(/\,/g,"."):r.replace(/\./g,",")}function gr(n,e){if(n!=null){if(!isNaN(+n)&&isFinite(+n))return new E(n);e==He.DOT?n=n.replace(/\,/g,""):n=n.replace(/\./g,"").replace(/\,/g,".");try{return new E(n)}catch(t){return}}}function mo(n,e){if(!n)return new Date;var t=n/1e4,r=n/100%100,i=n%100,o=yn(t,r,i,e);return o}function yn(n,e,t,r){var i=new Date(n,e-1,t);return r||(r=0),i.setTime(i.getTime()+r*60*1e3),i}function Ut(n,e,t){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!t||t=="")&&(t="UTC"),e?Lt.DateTime.fromJSDate(n,{zone:t}).toFormat(e):$e(n,t))}function $e(n,e){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!e||e=="")&&(e="UTC"),Lt.DateTime.fromJSDate(n,{zone:e}).toISODate())}function st(n){return+n.replace(/-/g,"")}function yr(n,e,t){e||(e="yyyy-MM-dd");let r=Lt.DateTime.fromFormat(n,e,{zone:t}).toJSDate();return r instanceof Date&&!isNaN(r.getTime())?r:Lt.DateTime.fromFormat(n,"yyyy-MM-dd",{zone:t}).toJSDate()}function q(n,e){return n==null?new E(0):e!=null&&!e?n.times(-1):n}function be(n){for(var e=0,t=0;t<n.length;t++)n[t].length>e&&(e=n[t].length);for(var t=0;t<n.length;t++)for(;n[t].length<e;)n[t].push(null);return n}function ye(n){return Gt(n,"_")}function Gt(n,e){return!n||typeof n!="string"?"":(e&&(n=n.replace(new RegExp(e,"g")," ")),n=n.replace(new RegExp("-","g")," "),n=n.replace(/ +(?= )/g,""),n=hl(n.trim().toLowerCase()),e&&(n=n.replace(new RegExp(" ","g"),e)),n)}function hl(n){for(var e=n.split(""),t="",r=0;r<e.length;r++)t+=e[r]in ho()?ho()[e[r]]:e[r];return t}function ho(){if(hr==null){hr={};for(var n=0;n<gn.length;n++)for(var e=gn[n].letters.split(""),t=0;t<e.length;t++)hr[e[t]]=gn[n].base}return hr}var gn=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}];var P=class{constructor(e){this.payload=e||{}}json(){return Object.assign({},this.payload)}};var U=class extends P{isHiddenProperty(e){return e.endsWith("_")}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}setProperties(e){return this.payload.properties=Object.assign({},e),this}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}setProperty(e,t){return e==null||e.trim()==""?this:(this.payload.properties==null&&(this.payload.properties={}),t||(t=""),this.payload.properties[e]=t,this)}deleteProperty(e){return this.setProperty(e,null),this}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}setVisibleProperty(e,t){return this.isHiddenProperty(e)?this:this.setProperty(e,t)}setVisibleProperties(e){if(e==null)return this;let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.isHiddenProperty(r)||(t[r]=e[r]));return this.setProperties(t)}getVisibleProperties(){let e=this.getProperties(),t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.isHiddenProperty(r)||(t[r]=e[r]));return t}};var Vt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},J=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.children=new Map,this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}isBalanceVerified(){return Vt(this,void 0,void 0,function*(){let e=yield this.getAccounts();for(let t of e)if(!t.isBalanceVerified())return!1;return!0})}isLocked(){return this.payload.locked==null?!1:this.payload.locked}setLocked(e){return this.payload.locked=e,this}getNormalizedName(){return this.payload.normalizedName?this.payload.normalizedName:Gt(this.getName())}getAccounts(){return Vt(this,void 0,void 0,function*(){if(this.accounts)return Array.from(this.accounts.values());let e=this.getId();if(!e)return[];let t=yield Xn(this.book.getId(),e,this.getConfig());return t?t.map(i=>new G(this.book,i)):[]})}getType(){return this.payload.type}isHidden(){return this.payload.hidden}setHidden(e){return this.payload.hidden=e,this}isCredit(){return this.payload.credit}isMixed(){return this.payload.mixed}isPermanent(){return this.payload.permanent}getParent(){return this.parent}setParent(e){return e?this.payload.parent={id:e.getId(),name:e.getName(),normalizedName:e.getNormalizedName()}:this.payload.parent=void 0,this}hasParent(){return this.payload.parent!=null}getChildren(){return Array.from(this.children.values())||[]}addChild(e){let t=e.getId();t&&this.children.set(t,e)}getDescendants(){let e=new Set;return this.traverseDescendants(this,e),e}getDescendantTreeIds(){return new Set(Array.from(this.getDescendants()).map(e=>e.getId()||""))}hasChildren(){return this.getChildren().length>0}isLeaf(){return this.getChildren().length===0}isRoot(){return this.getParent()==null}getDepth(){return this.depth==null&&(this.parent?this.depth=this.parent.getDepth()+1:this.depth=0),this.depth}getRoot(){return this.root==null&&(this.parent!=null?this.root=this.parent.getRoot():this.root=this),this.root}getRootName(){let e=this.getRoot();return e!=null&&e.getName()||""}traverseDescendants(e,t){t.add(e);let r=e.getChildren();if(r.length>0)for(let i of r)this.traverseDescendants(i,t)}buildGroupTree(e){if(this.parent=void 0,this.depth=void 0,this.root=void 0,this.payload.parent){let t=e.get(this.payload.parent.id||"");t&&(this.parent=t,t.addChild(this))}}addAccount(e){let t=e==null?void 0:e.getId();t&&(this.accounts||(this.accounts=new Map),this.accounts.set(t,e))}hasAccounts(){return this.payload.hasAccounts}create(){return Vt(this,void 0,void 0,function*(){return this.payload=yield Zn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}update(){return Vt(this,void 0,void 0,function*(){return this.payload=yield Yn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}remove(){return Vt(this,void 0,void 0,function*(){return this.payload=yield Kn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(!0),this})}updateGroupCache(e){this.book.setGroup(this.payload,e),this.book.clearCache()}};var at=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},G=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}isBalanceVerified(){return this.payload.balanceVerified}getNormalizedName(){return this.payload.normalizedName?this.payload.normalizedName:Gt(this.getName())}getType(){return this.payload.type}setType(e){return this.payload.type=e,this}isArchived(){return this.payload.archived}setArchived(e){return this.payload.archived=e,this}hasTransactionPosted(){return this.payload.hasTransactionPosted}isPermanent(){return this.payload.permanent}isCredit(){return this.payload.credit}getGroups(){return at(this,void 0,void 0,function*(){if(!this.getId())return[];if(yield this.book.getGroups(),this.payload.groups!=null){let t=[];for(let r of this.payload.groups){let i=yield this.book.getGroup(r.id);i&&t.push(i)}return t}return[]})}setGroups(e){return this.payload.groups=void 0,e!=null&&e.forEach(t=>this.addGroup(t)),this}addGroup(e){return this.payload.groups||(this.payload.groups=[]),e instanceof J?this.payload.groups.push(e.json()):this.payload.groups.push(e),this}removeGroup(e){return at(this,void 0,void 0,function*(){if(this.payload.groups!=null){let t;if(e instanceof J?t=e:typeof e=="string"&&(t=yield this.book.getGroup(e)),t)for(let r=0;r<this.payload.groups.length;r++)this.payload.groups[r].id==t.getId()&&this.payload.groups.splice(r,1)}return this})}isInGroup(e){return at(this,void 0,void 0,function*(){if(e==null)return!1;if(e instanceof J)return this.isInGroupObject_(e);var t=yield this.book.getGroup(e);return t==null?!1:this.isInGroupObject_(t)})}isInGroupObject_(e){if(this.payload.groups==null)return!1;for(var t=0;t<this.payload.groups.length;t++)if(this.payload.groups[t]==e.getId())return!0;return!1}create(){return at(this,void 0,void 0,function*(){return this.payload=yield Ln(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}update(){return at(this,void 0,void 0,function*(){return this.payload=yield Gn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}remove(){return at(this,void 0,void 0,function*(){return this.payload=yield Hn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(!0),this})}updateAccountCache(e){this.book.setAccount(this.payload,e),this.book.clearCache()}};var go=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ut=class{constructor(e){this.accounts=e,this.shouldIncludeArchived=!1,this.shouldAddGroups=!1,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.propertyKeys=[]}archived(e){return this.shouldIncludeArchived=e,this}groups(e){return this.shouldAddGroups=e,this}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}getPropertyKeys(){if(this.propertyKeys.length===0){for(let e of this.accounts)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}return this.propertyKeys}getTypeIndex(e){return e===F.ASSET?0:e===F.LIABILITY?1:e===F.INCOMING?2:3}getMaxNumberOfGroups(){return go(this,void 0,void 0,function*(){let e=0;for(let t of this.accounts){let r=yield t.getGroups();r.length>e&&(e=r.length)}return e})}sortGroupsHierarchyPath_(e){let t=[],r=[];for(let a of e)a.getParent()!=null||a.hasChildren()?t.push(a):r.push(a);let i=new Map;for(let a of t){let l=a.getRoot().getId()||"";i.has(l)||i.set(l,[]),i.get(l).push(a)}let o=Array.from(i.entries()).sort((a,c)=>{let l=a[1][0].getRoot(),u=c[1][0].getRoot();return l.getNormalizedName().localeCompare(u.getNormalizedName())}).map(([a,c])=>c.sort((l,u)=>l.getDepth()-u.getDepth()));r.sort((a,c)=>a.getNormalizedName().localeCompare(c.getNormalizedName()));let s=[];for(let a of o)s.push(...a);return s.push(...r),s}build(){return go(this,void 0,void 0,function*(){let e=new Array,t=this.accounts;this.shouldIncludeArchived||(t=this.accounts.filter(o=>!o.isArchived()));let r=[];if(this.shouldAddIds&&r.push("Account Id"),r.push("Name"),r.push("Type"),this.shouldAddGroups){let o=yield this.getMaxNumberOfGroups();for(let s=0;s<o;s++)r.push("Group")}t.sort((o,s)=>{let a=this.getTypeIndex(o.getType())-this.getTypeIndex(s.getType());return a===0&&(a=o.getNormalizedName().localeCompare(s.getNormalizedName())),a});let i=[];this.shouldAddProperties&&(i=this.getPropertyKeys());for(let o of t){let s=[];if(this.shouldAddIds&&s.push(o.getId()),s.push(o.getName()),s.push(o.getType()),this.shouldAddGroups){let a=this.sortGroupsHierarchyPath_(yield o.getGroups());for(let c of a)s.push(c.getName())}if(this.shouldAddGroups&&this.shouldAddProperties){let a=r.length-s.length;for(let c=0;c<a;c++)s.push("")}if(this.shouldAddProperties){let a=o.getProperties();for(let c of i){let l=a[c];if(l){s.push(l);continue}s.push("")}}e.push(s)}return this.shouldAddProperties&&(r=r.concat(i)),e.unshift(r),be(e),e})}};var lt=class{constructor(e){this.payload=e||{}}json(){return Object.assign({},this.payload)}getId(){return this.payload.id}getName(){return this.payload.name}getLogoUrl(){return this.payload.logo}getLogoUrlDark(){return this.payload.logoDark}};var wr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function yo(n){return wr(this,void 0,void 0,function*(){let e=yield new ee("v5/apps",n).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}function vo(n,e){return wr(this,void 0,void 0,function*(){return(yield new ee(`v5/apps/${n}`,e).setMethod("GET").fetch()).data})}function wo(n,e){return wr(this,void 0,void 0,function*(){var t=yield new ee("v5/apps",e).setMethod("POST").setPayload(n).fetch();return t.data})}function Eo(n,e){return wr(this,void 0,void 0,function*(){var t=yield new ee("v5/apps",e).setMethod("PUT").setPayload(n).fetch();return t.data})}var Ce=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ao(n,e){return Ce(this,void 0,void 0,function*(){let t=new m("",e);n&&t.addParam("query",n);let r=yield t.fetch();if(r.data==null)return[];let o=r.data.items;return o==null?[]:o})}function bo(n,e,t,r){return Ce(this,void 0,void 0,function*(){if(n==null)throw new Error("Book id null!");return e=e||!1,t=t||!1,(yield new m(n,r).addParam("loadAccounts",e).addParam("loadGroups",t).fetch()).data})}function Co(n,e){return Ce(this,void 0,void 0,function*(){return(yield new m("",e).setMethod("POST").setPayload(n).fetch()).data})}function Do(n,e,t){return Ce(this,void 0,void 0,function*(){var r=yield new m(`${n}`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function So(n,e){return Ce(this,void 0,void 0,function*(){new m(`${n}/audit`,e).setMethod("PATCH").fetch()})}function Io(n,e){return Ce(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/apps`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function ko(n,e,t,r,i){return Ce(this,void 0,void 0,function*(){let o=new m(`${n}/copy`,i).setMethod("POST").addParam("name",e);return t&&(o.addParam("copyTransactions",t),r&&o.addParam("fromDate",r)),(yield o.fetch()).data})}function Oo(n,e){return Ce(this,void 0,void 0,function*(){return(yield new m(`${n}`,e).setMethod("DELETE").fetch()).data})}var Er=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function xo(n,e){return Er(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/queries`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Mo(n,e,t){return Er(this,void 0,void 0,function*(){return(yield new m(`${n}/queries`,t).setMethod("POST").setPayload(e).fetch()).data})}function Fo(n,e,t){return Er(this,void 0,void 0,function*(){return(yield new m(`${n}/queries`,t).setMethod("PUT").setPayload(e).fetch()).data})}function Po(n,e,t){return Er(this,void 0,void 0,function*(){return(yield new m(`${n}/queries/${e}`,t).setMethod("DELETE").fetch()).data})}var pl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function _o(n,e,t){return pl(this,void 0,void 0,function*(){var r;let i=yield new m(`${n}/balances`,t).addParam("query",e).addParam("time",Date.now()).fetch(),o=(r=i.data)===null||r===void 0?void 0:r.balancesUrl;if(o){let s=yield new qe(o).setMethod("GET").execute();i={data:s.data,status:s.status}}return i.data})}var vn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ro(n,e,t){return vn(this,void 0,void 0,function*(){var r=yield new m(`${n}/files`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Tr(n,e,t){return vn(this,void 0,void 0,function*(){var r=yield new m(`${n}/files/${e}`,t).setMethod("GET").fetch();return r.data})}function Lo(n,e,t){return vn(this,void 0,void 0,function*(){return(yield new m(`${n}/files`,t).setMethod("PUT").setPayload(e).fetch()).data})}var Ar=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Go(n,e){return Ar(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function wn(n,e,t){return Ar(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations`,t).setPayload(e).setMethod("POST").fetch()).data})}function En(n,e,t){return Ar(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations`,t).setPayload(e).setMethod("PUT").fetch()).data})}function Vo(n,e,t){return Ar(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations/${e}`,t).setMethod("DELETE").fetch()).data})}var _=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function $o(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function jo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/post/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function zo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;return r=yield(yield new m(`${n}/transactions/batch`,t).setMethod("POST").setPayload(i).fetch()).data,r!=null&&r.items!=null?r.items:[]})}function qo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;return i=yield(yield new m(`${n}/transactions/batch`,r).setMethod("PUT").setPayload(o).addParam("updateChecked",t).fetch()).data,i!=null&&i.items!=null?i.items:[]})}function Zo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/check/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Wo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/uncheck/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Yo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;i=yield(yield new m(`${n}/transactions/trash/batch`,r).setMethod("PATCH").setPayload(o).addParam("trashChecked",t).fetch()).data})}function Ko(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;r=yield(yield new m(`${n}/transactions/untrash/batch`,t).setMethod("PATCH").setPayload(i).fetch()).data})}function Jo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Qo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/post`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function Xo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/check`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function es(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/uncheck`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ts(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/trash`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function rs(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/restore`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ns(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/${e}`,t).setMethod("GET").fetch();return r.data})}function is(n,e,t,r,i){return _(this,void 0,void 0,function*(){e||(e=""),t||(t=100);var o=new m(`${n}/transactions`,i);o.addParam("query",e),o.addParam("limit",t),r!=null&&o.setHeader("cursor",r);var s=yield o.fetch();return s.data})}function os(n,e,t){return _(this,void 0,void 0,function*(){let r=Object.assign({},e);return(yield new m(`${n}/transactions/merge`,t).setMethod("PATCH").setPayload(r).fetch()).data})}function ss(n,e,t){return _(this,void 0,void 0,function*(){return(yield new m(`${n}/transactions/count`,t).setMethod("GET").addParam("query",e).fetch()).data})}var Ht=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function us(n,e,t,r,i,o,s,a){return Ht(this,void 0,void 0,function*(){let c=new m(`${n.getId()}/events`,a);c.addParam("after",e),c.addParam("before",t),c.addParam("error",r),c.addParam("resoureId",i),c.addParam("limit",o),s!=null&&c.setHeader("cursor",s);var l=yield c.fetch();return l.data})}function ls(n,e,t,r){return Ht(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("PUT").fetch()).data})}function cs(n,e,t,r){return Ht(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("DELETE").fetch()).data})}function ds(n,e,t,r){return Ht(this,void 0,void 0,function*(){let i=new m(`${n.getId()}/events/replay/batch`,r).setMethod("PATCH").setPayload(e);t&&i.addParam("errorsOnly",t),yield i.fetch()})}function fs(n,e){return Ht(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/backlog`,e).setMethod("GET").fetch()).data})}var Tn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function ps(n,e){return Tn(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/collaborators`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function An(n,e,t,r){return Tn(this,void 0,void 0,function*(){let i=new m(`${n}/collaborators`,r).setMethod("POST").setPayload(e);return t&&(i=i.addParam("message",t)),(yield i.fetch()).data})}function ms(n,e,t){return Tn(this,void 0,void 0,function*(){return(yield new m(`${n}/collaborators/${e}`,t).setMethod("DELETE").fetch()).data})}var bn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ct=class extends P{constructor(e,t){super(t),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getEmail(){return this.payload.email}setEmail(e){return this.payload.email=e,this}getPermission(){return this.payload.permission}setPermission(e){return this.payload.permission=e,this}create(e){return bn(this,void 0,void 0,function*(){return this.payload=yield An(this.book.getId(),this.payload,e,this.getConfig()),this.book.clearCollaboratorCache(),this})}update(){return bn(this,void 0,void 0,function*(){return this.payload=yield An(this.book.getId(),this.payload,void 0,this.getConfig()),this.book.clearCollaboratorCache(),this})}remove(){return bn(this,void 0,void 0,function*(){let e=this.getEmail();if(!e)throw new Error("Collaborator email is required");return this.payload=yield ms(this.book.getId(),e,this.getConfig()),this.book.clearCollaboratorCache(),this})}};var dt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function ys(n){return dt(this,void 0,void 0,function*(){var e;let t=yield new O("collections",n).fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function vs(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("POST").setPayload(n).fetch()).data})}function ws(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("PUT").setPayload(n).fetch()).data})}function Es(n,e){return dt(this,void 0,void 0,function*(){var t;let r=yield new O(`collections/${n.id}`,e).setMethod("DELETE").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Ts(n,e,t){return dt(this,void 0,void 0,function*(){var r;let i=yield new O(`collections/${n}/books/add`,t).setMethod("PATCH").setPayload(e).fetch();return((r=i==null?void 0:i.data)===null||r===void 0?void 0:r.items)||[]})}function As(n,e,t){return dt(this,void 0,void 0,function*(){var r;let i=yield new O(`collections/${n}/books/remove`,t).setMethod("PATCH").setPayload(e).fetch();return((r=i==null?void 0:i.data)===null||r===void 0?void 0:r.items)||[]})}var $t=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},De=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getOwnerUsername(){return this.payload.ownerUsername}getPermission(){return this.payload.permission?this.payload.permission:void 0}getBooks(){let e=[];if(this.payload.books==null)return e;for(let t of this.payload.books){let r=new Q(t,this.config);e.push(r)}return e}addBooks(e){return $t(this,void 0,void 0,function*(){let t=this.getId();if(t&&e.length>0){let r={items:e.map(o=>o.json())};return(yield Ts(t,r,this.getConfig())).map(o=>new Q(o,this.config))}return[]})}removeBooks(e){return $t(this,void 0,void 0,function*(){let t=this.getId();if(t&&e.length>0){let r={items:e.map(o=>o.json())};return(yield As(t,r,this.getConfig())).map(o=>new Q(o,this.config))}return[]})}getUpdatedAt(){return this.payload.updatedAt}create(){return $t(this,void 0,void 0,function*(){return this.payload=yield vs(this.payload,this.getConfig()),this})}update(){return $t(this,void 0,void 0,function*(){return this.payload=yield ws(this.payload,this.getConfig()),this})}remove(){return $t(this,void 0,void 0,function*(){return(yield Es(this.payload,this.getConfig())).map(t=>new Q(t,this.config))})}};var Cs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ft=class{constructor(e,t){this.event=e,this.payload=t||{}}getType(){return this.payload.type}getAgentId(){return this.payload.agentId}getMessage(){return this.payload.message}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}getEvent(){return this.event}replay(){return Cs(this,void 0,void 0,function*(){let e=this.event.getId();if(e==null)throw new Error("Event id null!");let t=this.getAgentId();if(t==null)throw new Error("Agent id null!");let r=yield ls(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}remove(){return Cs(this,void 0,void 0,function*(){let e=this.event.getId();if(e==null)throw new Error("Event id null!");let t=this.getAgentId();if(t==null)throw new Error("Agent id null!");let r=yield cs(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}updateCache(e){var t;this.event.payload=e,this.event.clearCache();let r=(t=e==null?void 0:e.botResponses)===null||t===void 0?void 0:t.find(i=>i.agentId&&i.agentId===this.getAgentId());this.payload=r||{}}};var jt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ds(n,e){return jt(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("GET").fetch()).data})}function Ss(n){return jt(this,void 0,void 0,function*(){var e;let t=yield new O("user/connections",n).setMethod("GET").fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function Is(n,e){return jt(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("POST").fetch()).data})}function ks(n,e){return jt(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("DELETE").fetch()).data})}function Os(n,e){return jt(this,void 0,void 0,function*(){var t;let r=yield new O(`user/connections/${n}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var gl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},X=class extends U{constructor(e,t){super(e||{}),this.config=t}getConfig(){return this.config||k.globalConfig}getBookId(){return this.payload.bookId}getId(){return this.payload.id}getName(){return this.payload.name}getAddedBy(){return this.payload.addedBy}getAgentId(){return this.payload.agentId}getLogo(){return this.payload.logo}getLogoUrl(){return this.payload.logo}getLogoUrlDark(){return this.payload.logoDark}getDateAddedMs(){return this.payload.dateAddedMs}getLastUpdateMs(){return this.payload.lastUpdateMs}remove(){return gl(this,void 0,void 0,function*(){let e=this.getBookId(),t=this.getId();return e&&t&&(this.payload=yield Vo(e,t,this.getConfig())),this})}};var Cn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},je=class extends U{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getAgentId(){return this.payload.agentId}setAgentId(e){return this.payload.agentId=e,this}getName(){return this.payload.name}getLogo(){return this.payload.logo}getDateAddedMs(){return this.payload.dateAddedMs}getEmail(){return this.payload.email}setName(e){return this.payload.name=e,this}setUUID(e){return this.payload.uuid=e,this}getUUID(){return this.payload.uuid}getType(){return this.payload.type}setType(e){return this.payload.type=e,this}clearTokenProperties(){this.getPropertyKeys().filter(e=>e.includes("token")).forEach(e=>this.deleteProperty(e))}getIntegrations(){return Cn(this,void 0,void 0,function*(){let e=this.getId();return e?(yield Os(e,this.getConfig())).map(i=>new X(i,this.config)):[]})}create(){return Cn(this,void 0,void 0,function*(){return this.payload=yield Is(this.payload,this.getConfig()),this})}remove(){return Cn(this,void 0,void 0,function*(){let e=this.getId();return e&&(this.payload=yield ks(e,this.getConfig())),this})}};var zt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function xs(n){return zt(this,void 0,void 0,function*(){return(yield new O("user",n).setMethod("GET").fetch()).data})}function Ms(n){return zt(this,void 0,void 0,function*(){return(yield new O("user/billing",n).setMethod("GET").fetch()).data})}function Fs(n){return zt(this,void 0,void 0,function*(){return(yield new O("user/billing/counts",n).setMethod("GET").fetch()).data})}function Ps(n,e){return zt(this,void 0,void 0,function*(){return(yield new O("user/billing/portal",e).addParam("returnUrl",n).fetch()).data})}function Bs(n,e,t,r,i){return zt(this,void 0,void 0,function*(){let o=new O("user/billing/checkout",i).addParam("plan",n);return r&&o.addParam("cycle",r),e&&o.addParam("successUrl",e),t&&o.addParam("cancelUrl",t),(yield o.fetch()).data})}var Sn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ht=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}isEnabled(){return this.payload.enabled}getEmail(){return this.payload.email}getHostedDomain(){return this.payload.hostedDomain}getPlan(){return this.payload.plan}isPlanOverdue(){return this.payload.planOverdue}getAdminEmail(){return this.payload.adminEmail}hasStartedTrial(){return this.payload.startedTrial}getDaysLeftInTrial(){return this.payload.daysLeftInTrial}getTotalTransactionsThisMonth(){return this.payload.totalTransactionsThisMonth}getTotalTransactionsThisYear(){return this.payload.totalTransactionsThisYear}getCounts(){return Sn(this,void 0,void 0,function*(){return yield Fs(this.getConfig())})}getPortalUrl(e){return Sn(this,void 0,void 0,function*(){let t=yield Ps(e,this.getConfig());return t==null?void 0:t.url})}getCheckoutUrl(e,t,r,i){return Sn(this,void 0,void 0,function*(){let o=yield Bs(e,t,r,i,this.getConfig());return o==null?void 0:o.url})}};var In=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Se=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getGivenName(){return this.payload.givenName}getName(){return this.payload.name}getAvatarUrl(){return this.payload.avatarUrl}getFullName(){return this.payload.fullName}getEmail(){return this.payload.email}getHostedDomain(){return this.payload.hostedDomain}getUsername(){return this.payload.username}getBilling(){return In(this,void 0,void 0,function*(){let e=yield Ms(this.getConfig());return new ht(e,this.config)})}hasUsedConnections(){return this.payload.bankConnections}getConnections(){return In(this,void 0,void 0,function*(){return(yield Ss(this.getConfig())).map(t=>new je(t,this.config))})}getConnection(e){return In(this,void 0,void 0,function*(){let t=yield Ds(e,this.getConfig());return new je(t,this.config)})}};var pt=class{constructor(e,t){this.book=e,this.payload=t||{}}json(){return Object.assign({},this.payload)}getBook(){return this.book}getId(){return this.payload.id}getUser(){return this.payload.user?new Se(this.payload.user,this.book.getConfig()):void 0}getAgent(){return this.payload.agent?new lt(this.payload.agent):void 0}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}getType(){return this.payload.type}getBotResponses(){if(this.botResponses!==void 0)return this.botResponses;let e=[];if(this.payload.botResponses)for(let t of this.payload.botResponses)e.push(new ft(this,t));return this.botResponses=e,this.botResponses}hasErrorResponse(){let e=this.getBotResponses();for(let t of e)if(t.getType()===ot.ERROR)return!0;return!1}clearCache(){this.botResponses=void 0}};var mt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.map(t=>new pt(this.book,t)))||[]}};var kn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Ie=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.book=e}getBook(){return this.book}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getContentType(){return this.payload.contentType}setContentType(e){return this.payload.contentType=e,this}getContent(){return kn(this,void 0,void 0,function*(){let e=this.getId();return this.getId()!=null&&(this.payload==null||this.payload.content==null)&&this.book&&e&&(this.payload=yield Tr(this.book.getId(),e,this.getConfig())),this.payload.content})}setContent(e){return this.payload.content=e,this}getUrl(){return this.payload.url}getSize(){return this.payload.size}create(){return kn(this,void 0,void 0,function*(){return this.payload=yield Ro(this.book.getId(),this.payload,this.getConfig()),this})}update(){return kn(this,void 0,void 0,function*(){return this.payload=yield Lo(this.book.getId(),this.payload,this.getConfig()),this})}};var R=[];for(let n=0;n<256;++n)R.push((n+256).toString(16).slice(1));function _s(n,e=0){return(R[n[e+0]]+R[n[e+1]]+R[n[e+2]]+R[n[e+3]]+"-"+R[n[e+4]]+R[n[e+5]]+"-"+R[n[e+6]]+R[n[e+7]]+"-"+R[n[e+8]]+R[n[e+9]]+"-"+R[n[e+10]]+R[n[e+11]]+R[n[e+12]]+R[n[e+13]]+R[n[e+14]]+R[n[e+15]]).toLowerCase()}var On,yl=new Uint8Array(16);function Nn(){if(!On){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");On=crypto.getRandomValues.bind(crypto)}return On(yl)}var vl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xn={randomUUID:vl};function wl(n,e,t){var i,o,s;if(xn.randomUUID&&!e&&!n)return xn.randomUUID();n=n||{};let r=(s=(o=n.random)!=null?o:(i=n.rng)==null?void 0:i.call(n))!=null?s:Nn();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[t+a]=r[a];return e}return _s(r)}var Mn=wl;var x=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},se=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.pendingFiles=new Map,this.book=e}getConfig(){return this.book.getConfig()}getBook(){return this.book}getId(){return this.payload.id}getAgentId(){return this.payload.agentId}getAgentName(){return this.payload.agentName}getAgentLogoUrl(){return this.payload.agentLogo}getAgentLogoUrlDark(){return this.payload.agentLogoDark}getRemoteIds(){return this.payload.remoteIds||[]}addRemoteId(e){return this.payload.remoteIds==null&&(this.payload.remoteIds=[]),e&&this.payload.remoteIds.push(e),this}isPosted(){return this.payload.posted}isChecked(){return this.payload.checked}setChecked(e){return this.payload.checked=e,this}isTrashed(){return this.payload.trashed}isLocked(){let e=this.getDate()||$e(new Date,this.book.getTimeZone()),t=this.book.getMostRecentLockDate_();return t!=null&&st(t)>=st(e)}getStatus(){return this.isTrashed()?me.TRASHED:this.isPosted()?this.isChecked()?me.CHECKED:me.UNCHECKED:me.DRAFT}getTags(){if(this.payload.tags&&this.payload.tags.length>0)return this.payload.tags;let e=this.getDescription();return e&&e.includes("#")?po(e):[]}getUrls(){return this.payload.urls||[]}setUrls(e){return this.payload.urls=void 0,e&&e.forEach(t=>{this.addUrl(t)}),this}addUrl(e){return this.payload.urls==null&&(this.payload.urls=[]),e&&this.payload.urls.push(e),this}getFiles(){return this.payload.files&&this.payload.files.length>0?this.payload.files.map(t=>new Ie(this.book,t)):[]}removeFile(e){let t=e.getId();return t&&(this.payload.files!=null&&(this.payload.files=this.payload.files.filter(r=>r.id!==t)),this.pendingFiles.delete(t)),this}addFile(e){var t;this.payload.files==null&&(this.payload.files=[]);let r=e.getId(),i=(t=e.getBook())===null||t===void 0?void 0:t.getId();return(r==null||i!=this.book.getId())&&(r==null&&(e.payload.id=`temporary_${Mn()}`),this.pendingFiles.set(e.getId(),e)),this.payload.files.push(e.json()),this}createPendingFiles(){return x(this,void 0,void 0,function*(){if(this.pendingFiles.size===0)return;this.payload.files==null&&(this.payload.files=[]);let e=Array.from(this.pendingFiles.entries()).map(r=>x(this,[r],void 0,function*([i,o]){o.book=this.book,o.setProperty("upload_method","attachment");let s=yield o.create();return{fileId:i,createdFile:s}})),t=yield Promise.all(e);for(let{fileId:r,createdFile:i}of t){let o=this.payload.files.findIndex(s=>s.id===r);o>=0?this.payload.files[o]=i.json():this.payload.files.push(i.json())}this.pendingFiles.clear()})}hasTag(e){for(var t=this.getTags(),r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}getCreditAccount(){return x(this,void 0,void 0,function*(){if(this.payload.creditAccount)return yield this.book.getAccount(this.payload.creditAccount.id)})}getCreditAccountName(){return x(this,void 0,void 0,function*(){var e;return(yield this.getCreditAccount())!=null?(e=yield this.getCreditAccount())===null||e===void 0?void 0:e.getName():""})}setCreditAccount(e){return e==null?(this.payload.creditAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.creditAccount=e.json()):e.id!=null&&(this.payload.creditAccount=e),this)}from(e){return this.setCreditAccount(e)}getDebitAccount(){return x(this,void 0,void 0,function*(){if(this.payload.debitAccount)return yield this.book.getAccount(this.payload.debitAccount.id)})}getDebitAccountName(){return x(this,void 0,void 0,function*(){var e;return(yield this.getDebitAccount())!=null?(e=yield this.getDebitAccount())===null||e===void 0?void 0:e.getName():""})}setDebitAccount(e){return e==null?(this.payload.debitAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.debitAccount={id:e.getId(),name:e.getName()}):e.id!=null&&(this.payload.debitAccount={id:e.id,name:e.name}),this)}to(e){return this.setDebitAccount(e)}getAmount(){return this.payload.amount!=null&&this.payload.amount.trim()!=""?new E(this.payload.amount):void 0}getAmountFormatted(){let e=this.getAmount();if(e)return this.book.formatValue(e)}setAmount(e){return typeof e=="string"?(e=gr(e,this.book.getDecimalSeparator())+"",this.payload.amount=e.toString(),this):(e=new E(e),e.eq(0)?(this.payload.amount=void 0,this):(this.payload.amount=e.abs().toString(),this))}getCreditAmount(e){return x(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return this.getAmount()})}getDebitAmount(e){return x(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isDebit(t))return this.getAmount()})}getOtherAccount(e){return x(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return yield this.getDebitAccount();if(yield this.isDebit(t))return yield this.getCreditAccount()})}getOtherAccountName(e){return x(this,void 0,void 0,function*(){var t=yield this.getOtherAccount(e);return t!=null?t.getName():""})}isCredit(e){return x(this,void 0,void 0,function*(){var t;return(yield this.getCreditAccount())!=null&&e!=null&&((t=yield this.getCreditAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}isDebit(e){return x(this,void 0,void 0,function*(){var t;return(yield this.getDebitAccount())!=null&&e!=null&&((t=yield this.getDebitAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}getAccount_(e){return x(this,void 0,void 0,function*(){return e==null||e instanceof G?e:yield this.book.getAccount(e)})}getDescription(){return this.payload.description==null?"":this.payload.description}setDescription(e){return this.payload.description=e,this}getDate(){return this.payload.date}setDate(e){if(typeof e=="string")if(e.indexOf("/")>0){let t=yr(e,this.book.getDatePattern(),this.book.getTimeZone());this.payload.date=$e(t,this.book.getTimeZone())}else e.indexOf("-")>=0&&(this.payload.date=e);else Object.prototype.toString.call(e)==="[object Date]"&&(this.payload.date=$e(e,this.book.getTimeZone()));return this}getDateObject(){return mo(this.getDateValue(),this.book.getTimeZoneOffset())}getDateValue(){return this.payload.dateValue}getDateFormatted(){return this.payload.dateFormatted}getCreatedAt(){return new Date(new Number(this.payload.createdAt).valueOf())}getCreatedAtFormatted(){return Ut(this.getCreatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCreatedBy(){return this.payload.createdBy}getUpdatedAt(){return new Date(new Number(this.payload.updatedAt).valueOf())}getUpdatedAtFormatted(){return Ut(this.getUpdatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCaEvolvedBalance_(){return this.payload.creditAccount!=null&&this.payload.creditAccount.balance!=null?new E(this.payload.creditAccount.balance):void 0}getDaEvolvedBalance_(){return this.payload.debitAccount!=null&&this.payload.debitAccount.balance!=null?new E(this.payload.debitAccount.balance):void 0}getAccountBalance(e){return x(this,void 0,void 0,function*(){var t=this.getCaEvolvedBalance_(),r=!0;if(t==null&&(t=this.getDaEvolvedBalance_(),r=!1),t!=null){if(!e){var i=r?yield this.getCreditAccount():yield this.getDebitAccount();t=q(t,i==null?void 0:i.isCredit())}return mr(t,this.book.getFractionDigits())}else return})}create(){return x(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield $o(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}update(){return x(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield Jo(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}check(){return x(this,void 0,void 0,function*(){var e;let t=yield Xo(this.book.getId(),this.payload,this.getConfig());return this.payload.checked=(e=t.transaction)===null||e===void 0?void 0:e.checked,this})}uncheck(){return x(this,void 0,void 0,function*(){var e;let t=yield es(this.book.getId(),this.payload,this.getConfig());return this.payload.checked=(e=t.transaction)===null||e===void 0?void 0:e.checked,this})}post(){return x(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield Qo(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}trash(){return x(this,void 0,void 0,function*(){var e;let t=yield ts(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}untrash(){return x(this,void 0,void 0,function*(){var e;let t=yield rs(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}};var El=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},gt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getAccount(){return El(this,void 0,void 0,function*(){if(this.payload.account)return yield this.book.getAccount(this.payload.account)})}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;let t=[];for(let r of(e=this.payload.items)!==null&&e!==void 0?e:[])t.push(new se(this.book,r));return t}};var ke=class{constructor(e,t){this.container=e,this.payload=t}getDay(){return this.payload.day}getMonth(){return this.payload.month}getYear(){return this.payload.year}getDate(){var e=this.getYear(),t=this.getMonth(),r=this.getDay();(t==null||t==0)&&e++,(r==null||r==0)&&t++;var i=yn(e,t,r,this.container.getBalancesReport().getBook().getTimeZoneOffset());return i}getFuzzyDate(){return this.payload.fuzzyDate}getCumulativeBalance(){return q(this.getCumulativeBalanceRaw(),this.container.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit)}getPeriodBalance(){return q(this.getPeriodBalanceRaw(),this.container.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance)}getPeriodCredit(){return new E(this.payload.periodCredit)}getPeriodDebit(){return new E(this.payload.periodDebit)}};var he=class{constructor(e,t,r){this.maxDepth=0,this.expandAllAccounts=!1,this.expandAllGroups=!1,this.skipRoot=!1,this.book=e,this.balancesContainers=t,this.periodicity=r,this.balanceType=Ae.TOTAL,this.shouldFormatDate=!1,this.shouldHideDates=!1,this.shouldHideNames=!1,this.shouldFormatValue=!1,this.shouldTranspose=!1,this.shouldTrial=!1,this.shouldPeriod=!1,this.shouldRaw=!1,this.shouldAddProperties=!1,this.shouldAddHiddenProperties=!1}getBalance(e,t){return this.getRepresentativeBalance(e,t).toNumber()}getRepresentativeBalance(e,t){return e==null?new E(0):t?e.times(-1):e}getBalanceText(e,t){return this.book.formatValue(this.getRepresentativeBalance(e,t))}formatDates(e){return this.shouldFormatDate=e,this}formatValues(e){return this.shouldFormatValue=e,this}expanded(e){return typeof e=="boolean"&&e==!0?(this.maxDepth=1,this.skipRoot=!0):e==-1?this.expandAllGroups=!0:e==-2?this.expandAllAccounts=!0:typeof e=="number"&&e>0&&(this.maxDepth=e),this}type(e){return this.balanceType=e,this}transposed(e){return this.shouldTranspose=e,this}hideDates(e){return this.shouldHideDates=e,this}hideNames(e){return this.shouldHideNames=e,this}properties(e){return this.shouldAddProperties=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}trial(e){return this.shouldTrial=e,this}period(e){return this.shouldPeriod=e,this}raw(e){return this.shouldRaw=e,this}build(){return this.balanceType==Ae.TOTAL?this.buildTotalDataTable_():this.buildTimeDataTable_()}addPropertyKeys(e,t){for(let r of t.getPropertyKeys())!this.shouldAddHiddenProperties&&r.endsWith("_")||e.indexOf(r)<=-1&&e.push(r)}flattenContainers(e,t){for(let r of this.balancesContainers)this.expandAllAccounts?(this.flattenAllAccounts(r,e,t),e.sort(this.sortContainersFunction)):r.isFromGroup()&&this.expandAllGroups?this.flattenAllGroups(r,e,t):this.flattenMaxDepth(r,e,t)}flattenAllAccounts(e,t,r){if(e.isFromGroup())for(let i of e.getBalancesContainers())this.flattenAllAccounts(i,t,r);else t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e)}sortContainersFunction(e,t){let r=0;e.isPermanent()&&!t.isPermanent()?r=-1:!e.isPermanent()&&t.isPermanent()&&(r=1),r==0&&(e.getParent()&&!t.getParent()?r=-1:!e.getParent()&&t.getParent()&&(r=1)),r==0&&(r=i(e)-i(t)),r==0&&(r=e.getName().toLowerCase().localeCompare(t.getName().toLowerCase()));function i(o){return o.isPermanent()&&!o.isCredit()?0:o.isPermanent()&&o.isCredit()?1:!o.isPermanent()&&o.isCredit()?2:!o.isPermanent()&&!o.isCredit()?3:4}return r}flattenMaxDepth(e,t,r){let i=e.getDepth();if(i<=this.maxDepth){!this.skipRoot&&!this.shouldTranspose&&(e.payload.name=pr(" ",i*4)+e.payload.name),(!this.skipRoot||i!=0)&&(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e));let o=e.getBalancesContainers();if(o&&o.length>0){o.sort(this.sortContainersFunction);for(let s of o)this.flattenMaxDepth(s,t,r)}}}flattenAllGroups(e,t,r){if(e.isFromGroup()){if(!this.shouldTranspose){let i=e.getDepth();e.payload.name=pr(" ",i*4)+e.payload.name}if(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e),e.hasGroupBalances()){let i=e.getBalancesContainers();i.sort(this.sortContainersFunction);for(let o of i)this.flattenAllGroups(o,t,r)}}}buildTotalDataTable_(){var e=new Array;if(this.balancesContainers==null)return e;this.balancesContainers.sort((c,l)=>c!=null&&l!=null?c.getName().toLowerCase().localeCompare(l.getName().toLowerCase()):-1);let t=[],r=new Array;if(this.flattenContainers(r,t),this.shouldAddProperties){t.sort();let c=["name","balance"];for(let l of t)c.push(l);e.push(c)}for(var i=0;i<r.length;i++){var o=r[i];if(o!=null){var s=new Array,a=o.getName();if(s.push(a),this.shouldTrial?this.shouldFormatValue?this.shouldPeriod?(s.push(o.getPeriodDebitText()),s.push(o.getPeriodCreditText())):(s.push(o.getCumulativeDebitText()),s.push(o.getCumulativeCreditText())):this.shouldPeriod?(s.push(o.getPeriodDebit().toNumber()),s.push(o.getPeriodCredit().toNumber())):(s.push(o.getCumulativeDebit().toNumber()),s.push(o.getCumulativeCredit().toNumber())):this.shouldFormatValue?this.shouldPeriod?this.shouldRaw?s.push(o.getPeriodBalanceRawText()):s.push(this.getBalanceText(o.getPeriodBalanceRaw(),o.isPermanent())):this.shouldRaw?s.push(o.getCumulativeBalanceRawText()):s.push(this.getBalanceText(o.getCumulativeBalanceRaw(),o.isPermanent())):this.shouldPeriod?this.shouldRaw?s.push(o.getPeriodBalanceRaw().toNumber()):s.push(this.getBalance(o.getPeriodBalanceRaw(),o.isPermanent())):this.shouldRaw?s.push(o.getCumulativeBalanceRaw().toNumber()):s.push(this.getBalance(o.getCumulativeBalanceRaw(),o.isPermanent())),this.shouldAddProperties){let c=o.getProperties();for(let l of t){let u=c[l];if(u){s.push(u);continue}s.push("")}}e.push(s)}}return this.shouldHideNames&&(e=e.map(c=>c.slice(1))),this.shouldTranspose&&e.length>0&&(e=e[0].map((c,l)=>e.map(u=>u[l]))),e}buildTimeDataTable_(){var e=new Array,t=new Object,r=this.balanceType==Ae.CUMULATIVE,i=new Array;if(i.push(""),this.balancesContainers==null)return e;let o=[],s=new Array;this.flattenContainers(s,o);for(let D of s){i.push(D.getName());var a=D.getBalances();if(a!=null)for(let L of a){var c=L.getFuzzyDate(),l=t[c];l==null&&(l={},l.date=L.getDate(),t[c]=l);var u;r?u=L.getCumulativeBalanceRaw():u=L.getPeriodBalanceRaw(),l[D.getName()]=this.shouldRaw?u:this.getRepresentativeBalance(u,D.isPermanent())}}e.push(i);var d=new Array;for(var f in t){var p=t[f],g=new Array;g.push(p.date);for(let D of s){var u=p[D.getName()];u==null?u="null_amount":(u=new E(u),this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber()),g.push(u)}d.push(g)}d.sort(function(D,L){return D[0].getTime()-L[0].getTime()});for(var v=null,w=0;w<d.length;w++){var g=d[w];if(w==0)for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}else for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"&&r)v&&(g[y]=v[y]);else if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}v=g,e.push(g)}if(this.shouldFormatDate&&e.length>0)for(var y=1;y<e.length;y++){var g=e[y];g.length>0&&(g[0]=$e(g[0],this.book.getTimeZone()))}if(this.shouldAddProperties){o.sort();for(let D of o){var ae=[D];for(let L of s)ae.push(L.getProperty(D)||"");e.push(ae)}}return this.shouldHideNames&&e.shift(),this.shouldHideDates&&(e=e.map(D=>D.slice(1))),!this.shouldTranspose&&e.length>0&&(e=e[0].map((D,L)=>e.map(Dr=>Dr[L]))),e}};var Rs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},yt=class{constructor(e,t,r){this.parent=e,this.balancesReport=t,this.payload=r}getBalancesReport(){return this.balancesReport}getName(){return this.payload.name}getNormalizedName(){return this.payload.normalizedName}getGroup(){return Rs(this,void 0,void 0,function*(){return null})}getAccount(){return Rs(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getAccount(this.getNormalizedName()))||null})}getParent(){return this.parent}getDepth(){if(this.depth==null){let e=this.getParent();this.depth=e!=null?e.getDepth()+1:0}return this.depth}isCredit(){return this.payload.credit}isPermanent(){return this.payload.permanent||!1}isFromAccount(){return!0}isFromGroup(){return!1}hasGroupBalances(){return!1}getCumulativeBalance(){return q(new E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return q(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}createDataTable(){return new he(this.balancesReport.getBook(),[this],this.balancesReport.getPeriodicity())}getBalancesContainers(){return[]}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainer(e){let t=ye(e);if(this.getNormalizedName()==t)return this;throw`${e} does not match ${this.getName()}`}};var Ls=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},br=class n{constructor(e,t,r){this.parent=e,this.balancesReport=t,this.payload=r}getBalancesReport(){return this.balancesReport}getName(){return this.payload.name}getNormalizedName(){return this.payload.normalizedName}getGroup(){return Ls(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getGroup(this.getNormalizedName()))||null})}getAccount(){return Ls(this,void 0,void 0,function*(){return null})}getParent(){return this.parent}getDepth(){if(this.depth==null){let e=this.getParent();this.depth=e!=null?e.getDepth()+1:0}return this.depth}isCredit(){return this.payload.credit||!1}isPermanent(){return this.payload.permanent||!1}isFromAccount(){return!1}isFromGroup(){return!0}hasGroupBalances(){let e=this.getGroupContainers();return e!=null&&e.length>0}getCumulativeBalance(){return q(new E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return q(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}createDataTable(){return new he(this.balancesReport.getBook(),this.getBalancesContainers(),this.balancesReport.getPeriodicity())}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainers(){let e=[],t=this.getGroupContainers();t&&t.length>0&&(e=e.concat(t));let r=this.getAccountContainers();return r&&r.length>0&&(e=e.concat(r)),e}getGroupContainers(){let e=this.payload.groupBalances;if(this.groupBalances==null&&e!=null){this.groupBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.groupBalances.push(new n(this,this.balancesReport,r))}}return this.groupBalances||[]}getAccountContainers(){let e=this.payload.accountBalances;if(this.accountBalances==null&&e!=null){this.accountBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.accountBalances.push(new yt(this,this.balancesReport,r))}}return this.accountBalances||[]}getBalancesContainer(e){var t;let r=ye(e),i=this.getBalancesContainers();if(i==null||i.length===0)throw`${e} not found on group ${this.getName()}`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,i));let o=(t=this.balancesContainersMap)===null||t===void 0?void 0:t.get(r);if(!o)throw`${e} not found on group ${this.getName()}`;return o}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let i=t[r],o=i.getNormalizedName();o&&(e.has(o)||e.set(o,i));let s=i.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var vt=class{constructor(e,t){this.book=e,this.payload=t}getBook(){return this.book}createDataTable(){return new he(this.book,this.getBalancesContainers(),this.getPeriodicity())}getPeriodicity(){return this.payload.periodicity}getBalancesContainers(){let e=[],t=this.getRootAccountBalancesContainers();t!=null&&t.length>0&&(e=e.concat(t));let r=this.getGroupBalancesContainers();return r!=null&&r.length>0&&(e=e.concat(r)),e}getBalancesContainer(e){var t;let r=ye(e),i=this.getBalancesContainers();if(i==null||i.length===0)throw`${e} not found`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,i));let o=(t=this.balancesContainersMap)===null||t===void 0?void 0:t.get(r);if(!o)throw`${e} not found`;return o}getRootAccountBalancesContainers(){if(this.accountBalancesContainers==null&&this.payload.accountBalances!=null){this.accountBalancesContainers=[];for(let e=0;e<this.payload.accountBalances.length;e++){let t=this.payload.accountBalances[e],r=new yt(null,this,t);this.accountBalancesContainers.push(r)}}return this.accountBalancesContainers||[]}getGroupBalancesContainers(){if(this.groupBalancesContainers==null&&this.payload.groupBalances!=null){this.groupBalancesContainers=[];for(let e=0;e<this.payload.groupBalances.length;e++){let t=this.payload.groupBalances[e],r=new br(null,this,t);this.groupBalancesContainers.push(r)}}return this.groupBalancesContainers||[]}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let i=t[r],o=i.getNormalizedName();o&&(e.has(o)||e.set(o,i));let s=i.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var Fn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},wt=class extends P{constructor(e,t){super(t),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getTitle(){return this.payload.title}setTitle(e){return this.payload.title=e,this}getQuery(){return this.payload.query}setQuery(e){return this.payload.query=e,this}create(){return Fn(this,void 0,void 0,function*(){return this.payload=yield Mo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}update(){return Fn(this,void 0,void 0,function*(){return this.payload=yield Fo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}remove(){return Fn(this,void 0,void 0,function*(){let e=this.getId();if(!e)throw new Error("Query id null!");return this.payload=yield Po(this.book.getId(),e,this.getConfig()),this.updateQueryCache(!0),this})}updateQueryCache(e){this.book.queries&&(this.book.queries=this.book.queries.filter(t=>t.getId()!==this.getId()),e||this.book.queries.push(this))}};var Et=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getCount(){return this.payload.count}};var Tt=class{constructor(e){this.COMPARATOR=(t,r)=>{let i=this.getTypeIndex(this.getStringType(t))-this.getTypeIndex(this.getStringType(r));return i===0&&(i=this.getHasChildrenIndex(t.hasChildren())-this.getHasChildrenIndex(r.hasChildren())),i===0&&(i=t.getNormalizedName().localeCompare(r.getNormalizedName())),i},this.groups=e,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.shouldShowTree=!1,this.propertyKeys=[]}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}tree(e){return this.shouldShowTree=e,this}mapPropertyKeys(){this.propertyKeys=[];for(let e of this.groups)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}getStringType(e){let t=e.getType()?e.getType()+"":void 0;return t||(t=e.isPermanent()?F.ASSET+"_"+F.LIABILITY:F.INCOMING+"_"+F.OUTGOING),t}getTypeIndex(e){return e===F.ASSET+"_"+F.LIABILITY?0:e===F.ASSET?1:e===F.LIABILITY?2:e===F.INCOMING+"_"+F.OUTGOING?3:e===F.INCOMING?4:5}getHasChildrenIndex(e){return e?0:1}build(){let e=new Array,t=this.groups;t.sort(this.COMPARATOR);let r=[];this.shouldAddIds&&r.push("Group Id"),r.push("Name"),r.push("Type"),this.shouldShowTree||r.push("Parent"),this.shouldAddProperties&&this.mapPropertyKeys();for(let i of t)i.isHidden()||i.getParent()||(e.push(this.buildGroupLine(i,0)),e=this.traverse(i,e,1));return this.shouldAddProperties&&(r=r.concat(this.propertyKeys)),e.unshift(r),be(e),e}buildGroupLine(e,t){let r=[];this.shouldAddIds&&r.push(e.getId());let i=this.shouldShowTree?" ".repeat(t)+e.getName():e.getName();if(r.push(i),r.push(this.getStringType(e)),!this.shouldShowTree){let o=e.getParent()?e.getParent().getName():"";r.push(o)}if(this.shouldAddProperties){let o=e.getProperties();for(let s of this.propertyKeys){let a=o[s];if(a){r.push(a);continue}r.push("")}}return r}traverse(e,t,r){let i=e.getChildren();i.sort(this.COMPARATOR);for(let o of i)t.push(this.buildGroupLine(o,r)),o.hasChildren()&&this.traverse(o,t,r+1);return t}};var Pn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},At=class{constructor(e,t,r){this.shouldFormatDates=!1,this.shouldFormatValues=!1,this.shouldAddUrls=!1,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddRecordedAt=!0,this.shouldAddHiddenProperties=!1,this.book=e,this.transactions=t,this.account=r}formatDates(e){return this.shouldFormatDates=e,this}formatValues(e){return this.shouldFormatValues=e,this}urls(e){return this.shouldAddUrls=e,this}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}recordedAt(e){return this.shouldAddRecordedAt=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}includeUrls(e){return this.urls(e)}includeProperties(e){return this.properties(e)}includeIds(e){return this.ids(e)}getAccount(){return this.account}build(){return Pn(this,void 0,void 0,function*(){let e=this.getHeaderLine(),t=yield this.get2DArray_();return t.length>0?(t.splice(0,0,e),be(t),t):[e]})}getHeaderLine(){let e=[];if(this.shouldAddIds&&e.push("Transaction Id"),e.push("Status"),e.push("Date"),e.push("Origin"),e.push("Destination"),e.push("Description"),e.push("Amount"),this.shouldShowBalances()&&e.push("Balance"),this.shouldAddRecordedAt&&e.push("Recorded at"),this.shouldAddProperties)for(let t of this.getPropertyKeys())e.push(t);if(this.shouldAddIds)for(let t of this.getRemoteIdHeaders())e.push(t);if(this.shouldAddUrls)for(let t of this.getAttachmentHeaders())e.push(t);return e}get2DArray_(){return Pn(this,void 0,void 0,function*(){let e=[];for(let t of this.transactions){let r=[];this.shouldAddIds&&r.push(t.getId()),r.push(t.getStatus()),this.shouldFormatDates?r.push(t.getDateFormatted()):r.push(t.getDateObject()),r.push(yield t.getCreditAccountName()),r.push(yield t.getDebitAccountName()),r.push(t.getDescription());let i=t.getAmount();if(i!=null){if(this.shouldShowBalances()&&this.account){let o=yield this.isCreditOnTransaction_(t,this.account);i=q(i,!o)}this.shouldFormatValues?r.push(ge(i,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(i.toNumber())}else r.push("");if(this.shouldShowBalances()){let o=yield t.getAccountBalance();o!=null?this.shouldFormatValues?r.push(ge(o,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(o.toNumber()):r.push("")}this.shouldAddRecordedAt&&(this.shouldFormatDates?r.push(t.getCreatedAtFormatted()):r.push(t.getCreatedAt())),this.shouldAddProperties&&this.addPropertiesToLine(r,t),this.shouldAddIds&&this.addRemoteIdsToLine(r,t),this.shouldAddUrls&&this.addUrlsToLine(r,t),e.push(r)}return e})}shouldShowBalances(){return this.account!=null&&this.account.isPermanent()===!0}isCreditOnTransaction_(e,t){return Pn(this,void 0,void 0,function*(){let r=yield e.getCreditAccount();return t==null||r==null?!1:r.getId()===t.getId()})}getPropertyKeys(){if(this.propertyKeys==null){this.propertyKeys=[];for(let e of this.transactions)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}return this.propertyKeys}getAttachmentHeaders(){if(this.attachmentHeaders==null){this.attachmentHeaders=[];for(let e of this.transactions){let t=this.getUrls(e);t.length>this.attachmentHeaders.length&&(this.attachmentHeaders=[],t.forEach(()=>this.attachmentHeaders.push("Attachment")))}}return this.attachmentHeaders}getRemoteIdHeaders(){if(this.remoteIdHeaders==null){this.remoteIdHeaders=[];for(let e of this.transactions){let t=e.getRemoteIds();t&&t.length>this.remoteIdHeaders.length&&(this.remoteIdHeaders=[],t.forEach(()=>this.remoteIdHeaders.push("Remote Id")))}}return this.remoteIdHeaders}addPropertiesToLine(e,t){let r=e.length;for(let i of this.getPropertyKeys())e.push("");for(let i of t.getPropertyKeys()){if(!this.shouldAddHiddenProperties&&i.endsWith("_"))continue;let o=this.getPropertyKeys().indexOf(i)+r;e[o]=t.getProperty(i)}}addRemoteIdsToLine(e,t){let r=e.length;for(let o of this.getRemoteIdHeaders())e.push("");let i=t.getRemoteIds();if(i)for(let o=r;o<r+i.length;o++)e[o]=i[o-r]}addUrlsToLine(e,t){let r=e.length;for(let o of this.getAttachmentHeaders())e.push("");let i=this.getUrls(t);for(let o=r;o<r+i.length;o++)e[o]=i[o-r]}getUrls(e){let t=e.getUrls();t==null&&(t=[]);let r=e.getFiles();return r!=null&&(t=t.concat(r.map(i=>i.getUrl()).filter(i=>i!=null))),t}};var T=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Q=class n extends U{constructor(e,t){super(e),this.allGroupsLoaded=!1,this.allAccountsLoaded=!1,this.config=t,this.payload.permission==nt.RECORDER&&(this.payload.groups=this.payload.groups||[],this.payload.accounts=this.payload.accounts||[]),this.allGroupsLoaded=this.mapGroups(this.payload.groups),this.allAccountsLoaded=this.mapAccounts(this.payload.accounts)}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id||""}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getFractionDigits(){return this.payload.fractionDigits}getDecimalPlaces(){return this.getFractionDigits()}setFractionDigits(e){return this.payload.fractionDigits=e,this}getPeriod(){return this.payload.period}setPeriod(e){return this.payload.period=e,this}getPeriodStartMonth(){return this.payload.periodStartMonth}setPeriodStartMonth(e){return this.payload.periodStartMonth=e,this}getPageSize(){return this.payload.pageSize}setPageSize(e){return this.payload.pageSize=e,this}getOwnerName(){return this.payload.ownerName}getLogoUrl(){return this.payload.logoUrl}getPermission(){return this.payload.permission}getCollection(){return this.payload.collection!=null&&this.collection==null&&(this.collection=new De(this.payload.collection,this.config)),this.collection}getDatePattern(){return this.payload.datePattern}setDatePattern(e){return this.payload.datePattern=e,this}getLockDate(){return this.payload.lockDate}setLockDate(e){return e==null&&(e="1900-00-00"),this.payload.lockDate=e,this}getClosingDate(){return this.payload.closingDate}setClosingDate(e){return e==null&&(e="1900-00-00"),this.payload.closingDate=e,this}getDecimalSeparator(){return this.payload.decimalSeparator}setDecimalSeparator(e){return this.payload.decimalSeparator=e,this}getTimeZone(){return this.payload.timeZone}setTimeZone(e){return this.payload.timeZone=e,this}getTimeZoneOffset(){return this.payload.timeZoneOffset}getAutoPost(){return this.payload.autoPost}setAutoPost(e){return this.payload.autoPost=e,this}getLastUpdateMs(){return this.payload.lastUpdateMs?+this.payload.lastUpdateMs:void 0}getTotalTransactions(){return this.payload.totalTransactions?+this.payload.totalTransactions:0}getTotalTransactionsCurrentMonth(){return this.payload.totalTransactionsCurrentMonth?+this.payload.totalTransactionsCurrentMonth:0}getTotalTransactionsCurrentYear(){return this.payload.totalTransactionsCurrentYear?+this.payload.totalTransactionsCurrentYear:0}getVisibility(){return this.payload.visibility}setVisibility(e){return this.payload.visibility=e,this}formatDate(e,t){return(t==null||t.trim()=="")&&(t=this.getTimeZone()),Ut(e,this.getDatePattern(),t)}parseDate(e){return yr(e,this.getDatePattern(),this.getTimeZone())}formatValue(e){return e?ge(e,this.getDecimalSeparator(),this.getFractionDigits()):""}parseValue(e){return gr(e,this.getDecimalSeparator())}round(e){return mr(e,this.getFractionDigits())}batchCreateTransactions(e){return T(this,void 0,void 0,function*(){let t=[];return e.forEach(r=>t.push(r.json())),t=yield zo(this.getId(),t,this.getConfig()),e=t.map(r=>new se(this,r)),e})}batchPostTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield jo(this.getId(),t,this.getConfig())})}batchUpdateTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];return e.forEach(i=>r.push(i.json())),r=yield qo(this.getId(),r,t,this.getConfig()),e=r.map(i=>new se(this,i)),e})}batchCheckTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Zo(this.getId(),t,this.getConfig())})}batchUncheckTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Wo(this.getId(),t,this.getConfig())})}batchTrashTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];e.forEach(i=>r.push(i.json())),yield Yo(this.getId(),r,t,this.getConfig())})}batchUntrashTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Ko(this.getId(),t,this.getConfig())})}mergeTransactions(e,t){return T(this,void 0,void 0,function*(){let r={items:[e.json(),t.json()]},i=yield os(this.getId(),r,this.getConfig());return new se(this,i.transaction||{})})}batchReplayEvents(e,t){return T(this,void 0,void 0,function*(){let o={items:e.map(s=>s.getId()).map(s=>({id:s}))};yield ds(this,o,t,this.getConfig())})}batchCreateAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:yield Promise.all(e.map(o=>this.normalizeAccountPayloadForBatchCreate_(o)))},r=yield Un(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}normalizeAccountPayloadForBatchCreate_(e){return T(this,void 0,void 0,function*(){let t=e.json();if(!t.groups||t.groups.length===0)return t;let r=[];for(let i of t.groups){let o=i.id||i.name;if(!o||o.trim()==="")throw new Error("Account group reference must include id or name");let s=yield this.getGroup(o);if(!s)throw new Error(`Group not found: ${o}`);r.push(s.json())}return t.groups=r,t})}batchUpdateAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Vn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}batchDeleteAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield $n(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o,!0)}return this.clearCache(),i}return[]})}batchCreateGroups(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Wn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new J(this,o);i.push(s),this.setGroup(o)}return this.clearCache(),i}return[]})}audit(){So(this.getId(),this.getConfig())}getApps(){return T(this,void 0,void 0,function*(){if(this.apps!=null)return this.apps;let e=yield Io(this.getId(),this.getConfig());return this.apps=e.map(t=>new ve(t,this.config)),this.apps})}getIntegrations(){return T(this,void 0,void 0,function*(){return(yield Go(this.getId(),this.getConfig())).map(r=>new X(r,this.config))})}createIntegration(e){return T(this,void 0,void 0,function*(){return e instanceof X?e=yield wn(this.getId(),e.json(),this.getConfig()):e=yield wn(this.getId(),e,this.getConfig()),new X(e,this.config)})}updateIntegration(e){return T(this,void 0,void 0,function*(){return e instanceof X?e=yield En(this.getId(),e.json(),this.getConfig()):e=yield En(this.getId(),e,this.getConfig()),new X(e,this.config)})}getAccount(e){return T(this,void 0,void 0,function*(){if(!e||e.trim()=="")return;let t;if(this.idAccountMap&&(t=this.idAccountMap.get(e)),!t&&this.nameAccountMap&&(t=this.nameAccountMap.get(ye(e))),!t){let r=yield jn(this.getId(),e,this.getConfig());r&&(t=new G(this,r),this.updateAccountCache(t))}return t})}updateGroupCache(e){this.updateGroupIdMap(e),this.updateGroupNameMap(e)}updateGroupIdMap(e){this.idGroupMap=this.idGroupMap||new Map;let t=e.getId();t&&this.idGroupMap.set(t,e)}updateGroupNameMap(e){this.nameGroupMap=this.nameGroupMap||new Map;let t=e.getNormalizedName();t&&this.nameGroupMap.set(t,e)}updateAccountCache(e){this.updateAccountIdMap(e),this.updateAccountNameMap(e)}updateAccountIdMap(e){this.idAccountMap=this.idAccountMap||new Map;let t=e.getId();t&&this.idAccountMap.set(t,e)}updateAccountNameMap(e){this.nameAccountMap=this.nameAccountMap||new Map;let t=e.getNormalizedName();t&&this.nameAccountMap.set(t,e)}getMostRecentLockDate_(){let e=this.getClosingDate(),t=this.getLockDate();return!e&&!t?null:!e&&t?t:e&&!t||st(e)>st(t)?e:t}getGroup(e){return T(this,void 0,void 0,function*(){if(!e||e.trim()=="")return;let t;if(this.idGroupMap&&(t=this.idGroupMap.get(e)),!t&&this.nameGroupMap&&(t=this.nameGroupMap.get(ye(e))),!t){let r=yield Qn(this.getId(),e,this.getConfig());r&&(t=new J(this,r),this.updateGroupCache(t))}return t})}getGroups(){return T(this,void 0,void 0,function*(){var e,t;if(this.idGroupMap&&this.allGroupsLoaded)return Array.from(((e=this.idGroupMap)===null||e===void 0?void 0:e.values())||[]);let r=yield Jn(this.getId(),this.getConfig());return this.allGroupsLoaded=this.mapGroups(r),Array.from(((t=this.idGroupMap)===null||t===void 0?void 0:t.values())||[])})}mapGroups(e){if(!e)return!1;let t=e.map(r=>new J(this,r));this.idGroupMap=new Map,this.nameGroupMap=new Map;for(let r of t)this.updateGroupCache(r),r.buildGroupTree(this.idGroupMap);for(let r of t)r.buildGroupTree(this.idGroupMap);return!0}getAccounts(){return T(this,void 0,void 0,function*(){var e,t;if(this.idAccountMap&&this.allAccountsLoaded)return Array.from(((e=this.idAccountMap)===null||e===void 0?void 0:e.values())||[]);yield this.getGroups();let r=yield zn(this.getId(),this.getConfig());return this.allAccountsLoaded=this.mapAccounts(r),Array.from(((t=this.idAccountMap)===null||t===void 0?void 0:t.values())||[])})}mapAccounts(e){if(!e)return!1;let t=e.map(r=>new G(this,r));this.idAccountMap=new Map,this.nameAccountMap=new Map;for(let r of t)this.updateAccountCache(r),this.linkAccountsAndGroups(r);return this.ensureGroupsAccountMapsLoaded(),!0}linkAccountsAndGroups(e){var t;let r=e.json().groups||[];for(let i of r){let o=(t=this.idGroupMap)===null||t===void 0?void 0:t.get(i.id||"");o!=null&&o.addAccount(e)}}ensureGroupsAccountMapsLoaded(){if(this.idGroupMap)for(let e of this.idGroupMap.values())e.accounts==null&&(e.accounts=new Map)}clearCache(){this.clearGroupCache(),this.clearAccountCache()}clearGroupCache(){this.allGroupsLoaded=!1,this.idGroupMap=void 0,this.nameGroupMap=void 0}clearAccountCache(){this.allAccountsLoaded=!1,this.idAccountMap=void 0,this.nameAccountMap=void 0}clearCollaboratorCache(){this.collaborators=void 0}setAccount(e,t){let r=this.payload.accounts||[];t?this.payload.accounts=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.accounts=r.map(o=>o.id===e.id?e:o):this.payload.accounts=[...r,e]}setGroup(e,t){let r=this.payload.groups||[];t?this.payload.groups=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.groups=r.map(o=>o.id===e.id?e:o):this.payload.groups=[...r,e]}listTransactions(e,t,r){return T(this,void 0,void 0,function*(){let i=yield is(this.getId(),e,t,r,this.getConfig());return new gt(this,i)})}countTransactions(e){return T(this,void 0,void 0,function*(){return(yield ss(this.getId(),e,this.getConfig())).total})}listEvents(e,t,r,i,o,s){return T(this,void 0,void 0,function*(){let a=yield us(this,e,t,r,i,o,s,this.getConfig());return new mt(this,a)})}getTransaction(e){return T(this,void 0,void 0,function*(){let t=yield ns(this.getId(),e,this.getConfig());return t?new se(this,t):void 0})}getFile(e){return T(this,void 0,void 0,function*(){let t=yield Tr(this.getId(),e,this.getConfig());return t?new Ie(this,t):void 0})}create(){return T(this,void 0,void 0,function*(){return this.payload=yield Co(this.payload,this.getConfig()),this})}copy(e,t,r){return T(this,void 0,void 0,function*(){let i=yield ko(this.getId(),e,t,r,this.getConfig());return new n(i,this.config)})}update(){return T(this,void 0,void 0,function*(){return this.payload=yield Do(this.getId(),this.payload,this.getConfig()),this})}remove(){return T(this,void 0,void 0,function*(){return this.payload=yield Oo(this.getId(),this.getConfig()),this})}getBalancesReport(e){return T(this,void 0,void 0,function*(){let t=yield _o(this.getId(),e,this.getConfig());return new vt(this,t)})}getSavedQueries(){return T(this,void 0,void 0,function*(){if(this.queries==null){let e=yield xo(this.getId(),this.getConfig());this.queries=e.map(t=>new wt(this,t))}return this.queries})}getCollaborators(){return T(this,void 0,void 0,function*(){if(!this.collaborators){let e=yield ps(this.getId(),this.getConfig());this.collaborators=e.map(t=>new ct(this,t))}return this.collaborators})}getBacklog(){return T(this,void 0,void 0,function*(){let e=yield fs(this,this.getConfig());return new Et(e,this.config)})}createAccountsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getAccounts()),new ut(e)})}createGroupsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getGroups()),new Tt(e)})}createTransactionsDataTable(e,t){return new At(this,e,t)}};var Tl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Us(n){return Tl(this,void 0,void 0,function*(){let e=yield new ee("v5/templates",n).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}var bt=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getName(){return this.payload.name}getDescription(){return this.payload.description}getImageUrl(){return this.payload.imageUrl}getCategory(){return this.payload.category}getTimesUsed(){return this.payload.timesUsed||0}getBookId(){return this.payload.bookId}getBookLink(){return this.payload.bookLink}getSheetsLink(){return this.payload.sheetsLink}};var ze=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},k=class n{static setConfig(e){n.globalConfig=e}constructor(e){this.config=e||n.globalConfig}getConfig(){return this.config}getBook(e,t,r){return ze(this,void 0,void 0,function*(){let i=yield bo(e,t,r,this.config);return new Q(i,this.config)})}getBooks(e){return ze(this,void 0,void 0,function*(){return(yield Ao(e,this.config)).map(r=>new Q(r,this.config))})}getCollections(){return ze(this,void 0,void 0,function*(){return(yield ys(this.config)).map(t=>new De(t,this.config))})}getApps(){return ze(this,void 0,void 0,function*(){return(yield yo(this.config)).map(t=>new ve(t,this.config))})}getApp(e){return ze(this,void 0,void 0,function*(){let t=yield vo(e,this.config);return new ve(t,this.config)})}getTemplates(){return ze(this,void 0,void 0,function*(){return(yield Us(this.config)).map(t=>new bt(t,this.config))})}getUser(){return ze(this,void 0,void 0,function*(){let e=yield xs(this.config);return new Se(e,this.config)})}};k.globalConfig={};var Gs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ve=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}setWebhookUrlDev(e){return this.payload.webhookUrlDev=e,this}getId(){return this.payload.id}getName(){return this.payload.name}hasEvents(){return(this.getEvents()||[]).length>0}getEvents(){return this.payload.events}isPublished(){return this.payload.published||!1}isInstallable(){return this.payload.installable||!1}getLogoUrl(){return this.payload.logoUrl}getLogoUrlDark(){return this.payload.logoUrlDark}getDescription(){return this.payload.description}setUsers(e){return this.payload.users=e,this}getUsers(){return this.payload.users}getMenuUrl(){return this.payload.menuUrl}getMenuUrlDev(){return this.payload.menuUrlDev}getMenuText(){return this.payload.menuText}getMenuOpenMode(){return this.payload.menuOpenMode||it.SIDEBAR}setMenuOpenMode(e){return this.payload.menuOpenMode=e,this}getMenuPopupWidth(){return this.payload.menuPopupWidth}getMenuPopupHeight(){return this.payload.menuPopupHeight}getOwnerName(){return this.payload.ownerName}getOwnerLogoUrl(){return this.payload.ownerLogoUrl}getOwnerWebsiteUrl(){return this.payload.ownerWebsite}getFilePatterns(){return this.payload.filePatterns}setDevelopers(e){return this.payload.developers=e,this}getDevelopers(){return this.payload.developers}setClientSecret(e){return this.payload.clientSecret=e,this}getWebsiteUrl(){return this.payload.website}isRepositoryPrivate(){return this.payload.repoPrivate}getRepositoryUrl(){return this.payload.repoUrl}getReadme(){return this.payload.readmeMd||this.payload.readme}setReadme(e){return this.payload.readmeMd=e,this}create(){return Gs(this,void 0,void 0,function*(){return yield wo(this.payload,this.getConfig()),this})}update(){return Gs(this,void 0,void 0,function*(){return yield Eo(this.payload,this.getConfig()),this})}};var Cr=class{constructor(e){this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.propertyKeys=[],this.books=e}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}mapPropertyKeys(){this.propertyKeys=[];for(let e of this.books)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}build(){var e,t;let r=new Array;this.books.sort((o,s)=>{var a,c;let l=(a=o.getCollection())===null||a===void 0?void 0:a.getName(),u=(c=s.getCollection())===null||c===void 0?void 0:c.getName();if(l&&!u)return-1;if(!l&&u)return 1;let d=(l||"").localeCompare(u||"");return d===0&&(d=(o.getName()||"").localeCompare(s.getName()||"")),d});let i=[];this.shouldAddIds&&i.push("Book Id"),i.push("Name"),i.push("Collection"),i.push("Date Pattern"),i.push("Decimal Separator"),i.push("Fraction Digits"),i.push("Period"),i.push("Owner"),this.shouldAddProperties&&(this.mapPropertyKeys(),i=i.concat(this.propertyKeys));for(let o of this.books){let s=[];if(this.shouldAddIds&&s.push(o.getId()),s.push(o.getName()||""),s.push(((e=o.getCollection())===null||e===void 0?void 0:e.getName())||""),s.push(o.getDatePattern()||""),s.push(o.getDecimalSeparator()||""),s.push((t=o.getFractionDigits())!==null&&t!==void 0?t:""),s.push(o.getPeriod()||""),s.push(o.getOwnerName()||""),this.shouldAddProperties){let a=o.getProperties();for(let c of this.propertyKeys)s.push(a[c]||"")}r.push(s)}return r.unshift(i),be(r),r}};return Xs(bl);})();
3
3
  //# sourceMappingURL=bkper.min.js.map