diff --git a/app/Api/V2/Controllers/Autocomplete/AccountController.php b/app/Api/V2/Controllers/Autocomplete/AccountController.php index 5e777b6893..5da7fc8381 100644 --- a/app/Api/V2/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V2/Controllers/Autocomplete/AccountController.php @@ -32,7 +32,7 @@ use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; -use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; +use http\Env\Response; use Illuminate\Http\JsonResponse; /** @@ -41,7 +41,6 @@ use Illuminate\Http\JsonResponse; class AccountController extends Controller { use AccountFilter; - use ValidatesUserGroupTrait; private AdminAccountRepositoryInterface $adminRepository; private array $balanceTypes; @@ -86,15 +85,14 @@ class AccountController extends Controller */ public function accounts(AutocompleteRequest $request): JsonResponse { - $data = $request->getData(); - $types = $data['types']; - $query = $data['query']; - $date = $this->parameters->get('date') ?? today(config('app.timezone')); - - $return = []; + $data = $request->getData(); + $types = $data['types']; + $query = $data['query']; + $date = $this->parameters->get('date') ?? today(config('app.timezone')); $result = $this->adminRepository->searchAccount((string)$query, $types, $data['limit']); $defaultCurrency = app('amount')->getDefaultCurrency(); + $allItems = []; /** @var Account $account */ foreach ($result as $account) { $nameWithBalance = $account->name; @@ -104,11 +102,17 @@ class AccountController extends Controller $balance = app('steam')->balance($account, $date); $nameWithBalance = sprintf('%s (%s)', $account->name, app('amount')->formatAnything($currency, $balance, false)); } - - $return[] = [ + $type = (string)trans(sprintf('firefly.%s', $account->accountType->type)); + $groupedResult[$type] = $groupedResult[$type] ?? [ + 'group ' => $type, + 'items' => [], + ]; + $allItems[] = [ 'id' => (string)$account->id, + 'value' => (string)$account->id, 'name' => $account->name, 'name_with_balance' => $nameWithBalance, + 'label' => $nameWithBalance, 'type' => $account->accountType->type, 'currency_id' => (string)$currency->id, 'currency_name' => $currency->name, @@ -118,10 +122,9 @@ class AccountController extends Controller ]; } - // custom order. usort( - $return, - function ($a, $b) { + $allItems, + function (array $a, array $b): int { $order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE]; $pos_a = array_search($a['type'], $order, true); $pos_b = array_search($b['type'], $order, true); @@ -129,7 +132,6 @@ class AccountController extends Controller return $pos_a - $pos_b; } ); - - return response()->json($return); + return response()->json($allItems); } } diff --git a/app/Api/V2/Controllers/Autocomplete/TransactionController.php b/app/Api/V2/Controllers/Autocomplete/TransactionController.php new file mode 100644 index 0000000000..175e787969 --- /dev/null +++ b/app/Api/V2/Controllers/Autocomplete/TransactionController.php @@ -0,0 +1,94 @@ +. + */ + +declare(strict_types=1); + +namespace FireflyIII\Api\V2\Controllers\Autocomplete; + +use FireflyIII\Api\V2\Controllers\Controller; +use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest; +use FireflyIII\Models\TransactionJournal; +use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface; +use Illuminate\Http\JsonResponse; + +/** + * Class TransactionController + */ +class TransactionController extends Controller +{ + private JournalRepositoryInterface $repository; + + /** + * AccountController constructor. + */ + public function __construct() + { + parent::__construct(); + $this->middleware( + function ($request, $next) { + $this->repository = app(JournalRepositoryInterface::class); + + $userGroup = $this->validateUserGroup($request); + if (null !== $userGroup) { + $this->repository->setUserGroup($userGroup); + } + + return $next($request); + } + ); + } + + /** + * Documentation for this endpoint: + * TODO list of checks + * 1. use dates from ParameterBag + * 2. Request validates dates + * 3. Request includes user_group_id + * 4. Endpoint is documented. + * 5. Collector uses user_group_id + * + * + * @return JsonResponse + */ + public function transactionDescriptions(AutocompleteRequest $request): JsonResponse + { + $data = $request->getData(); + $result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']); + + // limit and unique + $filtered = $result->unique('description'); + $array = []; + + /** @var TransactionJournal $journal */ + foreach ($filtered as $journal) { + $array[] = [ + 'id' => (string)$journal->id, + 'transaction_group_id' => (string)$journal->transaction_group_id, + 'name' => $journal->description, + 'description' => $journal->description, + ]; + } + + return response()->json($array); + + } + +} diff --git a/app/Api/V2/Controllers/Controller.php b/app/Api/V2/Controllers/Controller.php index 294a8e72b6..6783b2e812 100644 --- a/app/Api/V2/Controllers/Controller.php +++ b/app/Api/V2/Controllers/Controller.php @@ -27,6 +27,7 @@ namespace FireflyIII\Api\V2\Controllers; use Carbon\Carbon; use Carbon\Exceptions\InvalidDateException; use Carbon\Exceptions\InvalidFormatException; +use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Transformers\V2\AbstractTransformer; use Illuminate\Database\Eloquent\Model; use Illuminate\Pagination\LengthAwarePaginator; @@ -48,6 +49,8 @@ use Symfony\Component\HttpFoundation\ParameterBag; */ class Controller extends BaseController { + use ValidatesUserGroupTrait; + protected const CONTENT_TYPE = 'application/vnd.api+json'; protected ParameterBag $parameters; diff --git a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php index 3b7426e6a7..9da06a81be 100644 --- a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php +++ b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php @@ -28,6 +28,7 @@ use FireflyIII\Models\AccountType; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\User; +use FireflyIII\Validation\Administration\ValidatesAdministrationAccess; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Validator; @@ -38,6 +39,7 @@ class AutocompleteRequest extends FormRequest { use ConvertsDataTypes; use ChecksLogin; + protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS]; /** @@ -75,21 +77,4 @@ class AutocompleteRequest extends FormRequest 'limit' => 'min:0|max:1337', ]; } - - /** - * Configure the validator instance with special rules for after the basic validation rules. - * - * @param Validator $validator - * - * @return void - */ - public function withValidator(Validator $validator): void - { - $validator->after( - function (Validator $validator) { - // validate if the account can access this administration - $this->validateAdministration($validator, [UserRoleEnum::MANAGE_TRANSACTIONS]); - } - ); - } } diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php index 8a2ae5ae89..ee81ca6102 100644 --- a/app/Providers/JournalServiceProvider.php +++ b/app/Providers/JournalServiceProvider.php @@ -31,6 +31,8 @@ use FireflyIII\Repositories\Journal\JournalCLIRepository; use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepository; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; +use FireflyIII\Repositories\UserGroups\Journal\JournalRepository as GroupJournalRepository; +use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface as GroupJournalRepositoryInterface; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepository; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface; use Illuminate\Foundation\Application; @@ -44,9 +46,7 @@ class JournalServiceProvider extends ServiceProvider /** * Bootstrap the application services. */ - public function boot(): void - { - } + public function boot(): void {} /** * Register the application services. @@ -76,6 +76,19 @@ class JournalServiceProvider extends ServiceProvider } ); + $this->app->bind( + GroupJournalRepositoryInterface::class, + static function (Application $app) { + /** @var GroupJournalRepositoryInterface $repository */ + $repository = app(GroupJournalRepository::class); + if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + $repository->setUser(auth()->user()); + } + + return $repository; + } + ); + // also bind new API repository $this->app->bind( JournalAPIRepositoryInterface::class, diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 7b2a2b5f88..859c8f953e 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -245,7 +245,7 @@ class JournalRepository implements JournalRepositoryInterface { $query = $this->user->transactionJournals() ->orderBy('date', 'DESC'); - if ('' !== $query) { + if ('' !== $search) { $query->where('description', 'LIKE', sprintf('%%%s%%', $search)); } diff --git a/app/Repositories/UserGroups/Journal/JournalRepository.php b/app/Repositories/UserGroups/Journal/JournalRepository.php new file mode 100644 index 0000000000..387438df74 --- /dev/null +++ b/app/Repositories/UserGroups/Journal/JournalRepository.php @@ -0,0 +1,49 @@ +. + */ + +declare(strict_types=1); + +namespace FireflyIII\Repositories\UserGroups\Journal; + +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; +use Illuminate\Support\Collection; + +/** + * Class JournalRepository + */ +class JournalRepository implements JournalRepositoryInterface +{ + use UserGroupTrait; + + /** + * @inheritDoc + */ + public function searchJournalDescriptions(string $search, int $limit): Collection + { + $query = $this->userGroup->transactionJournals() + ->orderBy('date', 'DESC'); + if ('' !== $search) { + $query->where('description', 'LIKE', sprintf('%%%s%%', $search)); + } + + return $query->take($limit)->get(); + } +} diff --git a/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php b/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php new file mode 100644 index 0000000000..5a2cd1b938 --- /dev/null +++ b/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php @@ -0,0 +1,42 @@ +. + */ + +declare(strict_types=1); + +namespace FireflyIII\Repositories\UserGroups\Journal; + +use Illuminate\Support\Collection; + +/** + * Interface JournalRepositoryInterface + */ +interface JournalRepositoryInterface +{ + /** + * Search in journal descriptions. + * + * @param string $search + * @param int $limit + * + * @return Collection + */ + public function searchJournalDescriptions(string $search, int $limit): Collection; +} diff --git a/app/Support/Http/Api/ValidatesUserGroupTrait.php b/app/Support/Http/Api/ValidatesUserGroupTrait.php index a7f1f16bc7..abc8666155 100644 --- a/app/Support/Http/Api/ValidatesUserGroupTrait.php +++ b/app/Support/Http/Api/ValidatesUserGroupTrait.php @@ -29,6 +29,9 @@ use FireflyIII\Models\UserGroup; use FireflyIII\User; use Illuminate\Http\Request; +/** + * Trait ValidatesUserGroupTrait + */ trait ValidatesUserGroupTrait { /** diff --git a/public/build/assets/dashboard-2100f404.js b/public/build/assets/dashboard-808f5a4b.js similarity index 98% rename from public/build/assets/dashboard-2100f404.js rename to public/build/assets/dashboard-808f5a4b.js index c2677f9434..e2f429bdca 100644 --- a/public/build/assets/dashboard-2100f404.js +++ b/public/build/assets/dashboard-808f5a4b.js @@ -15,7 +15,7 @@ ${a?'Expression: "'+a+`" * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */const elementMap=new Map,Data={set(t,e,a){elementMap.has(t)||elementMap.set(t,new Map);const n=elementMap.get(t);if(!n.has(e)&&n.size!==0){console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`);return}n.set(e,a)},get(t,e){return elementMap.has(t)&&elementMap.get(t).get(e)||null},remove(t,e){if(!elementMap.has(t))return;const a=elementMap.get(t);a.delete(e),a.size===0&&elementMap.delete(t)}},MAX_UID=1e6,MILLISECONDS_MULTIPLIER=1e3,TRANSITION_END="transitionend",parseSelector=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,(e,a)=>`#${CSS.escape(a)}`)),t),toType=t=>t==null?`${t}`:Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase(),getUID=t=>{do t+=Math.floor(Math.random()*MAX_UID);while(document.getElementById(t));return t},getTransitionDurationFromElement=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:a}=window.getComputedStyle(t);const n=Number.parseFloat(e),r=Number.parseFloat(a);return!n&&!r?0:(e=e.split(",")[0],a=a.split(",")[0],(Number.parseFloat(e)+Number.parseFloat(a))*MILLISECONDS_MULTIPLIER)},triggerTransitionEnd=t=>{t.dispatchEvent(new Event(TRANSITION_END))},isElement=t=>!t||typeof t!="object"?!1:(typeof t.jquery<"u"&&(t=t[0]),typeof t.nodeType<"u"),getElement=t=>isElement(t)?t.jquery?t[0]:t:typeof t=="string"&&t.length>0?document.querySelector(parseSelector(t)):null,isVisible=t=>{if(!isElement(t)||t.getClientRects().length===0)return!1;const e=getComputedStyle(t).getPropertyValue("visibility")==="visible",a=t.closest("details:not([open])");if(!a)return e;if(a!==t){const n=t.closest("summary");if(n&&n.parentNode!==a||n===null)return!1}return e},isDisabled=t=>!t||t.nodeType!==Node.ELEMENT_NODE||t.classList.contains("disabled")?!0:typeof t.disabled<"u"?t.disabled:t.hasAttribute("disabled")&&t.getAttribute("disabled")!=="false",findShadowRoot=t=>{if(!document.documentElement.attachShadow)return null;if(typeof t.getRootNode=="function"){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?findShadowRoot(t.parentNode):null},noop$3=()=>{},reflow=t=>{t.offsetHeight},getjQuery=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,DOMContentLoadedCallbacks=[],onDOMContentLoaded=t=>{document.readyState==="loading"?(DOMContentLoadedCallbacks.length||document.addEventListener("DOMContentLoaded",()=>{for(const e of DOMContentLoadedCallbacks)e()}),DOMContentLoadedCallbacks.push(t)):t()},isRTL=()=>document.documentElement.dir==="rtl",defineJQueryPlugin=t=>{onDOMContentLoaded(()=>{const e=getjQuery();if(e){const a=t.NAME,n=e.fn[a];e.fn[a]=t.jQueryInterface,e.fn[a].Constructor=t,e.fn[a].noConflict=()=>(e.fn[a]=n,t.jQueryInterface)}})},execute=(t,e=[],a=t)=>typeof t=="function"?t(...e):a,executeAfterTransition=(t,e,a=!0)=>{if(!a){execute(t);return}const n=5,r=getTransitionDurationFromElement(e)+n;let i=!1;const o=({target:s})=>{s===e&&(i=!0,e.removeEventListener(TRANSITION_END,o),execute(t))};e.addEventListener(TRANSITION_END,o),setTimeout(()=>{i||triggerTransitionEnd(e)},r)},getNextActiveElement=(t,e,a,n)=>{const r=t.length;let i=t.indexOf(e);return i===-1?!a&&n?t[r-1]:t[0]:(i+=a?1:-1,n&&(i=(i+r)%r),t[Math.max(0,Math.min(i,r-1))])},namespaceRegex=/[^.]*(?=\..*)\.|.*/,stripNameRegex=/\..*/,stripUidRegex=/::\d+$/,eventRegistry={};let uidEvent=1;const customEvents={mouseenter:"mouseover",mouseleave:"mouseout"},nativeEvents=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function makeEventUid(t,e){return e&&`${e}::${uidEvent++}`||t.uidEvent||uidEvent++}function getElementEvents(t){const e=makeEventUid(t);return t.uidEvent=e,eventRegistry[e]=eventRegistry[e]||{},eventRegistry[e]}function bootstrapHandler(t,e){return function a(n){return hydrateObj(n,{delegateTarget:t}),a.oneOff&&EventHandler.off(t,n.type,e),e.apply(t,[n])}}function bootstrapDelegationHandler(t,e,a){return function n(r){const i=t.querySelectorAll(e);for(let{target:o}=r;o&&o!==this;o=o.parentNode)for(const s of i)if(s===o)return hydrateObj(r,{delegateTarget:o}),n.oneOff&&EventHandler.off(t,r.type,e,a),a.apply(o,[r])}}function findHandler(t,e,a=null){return Object.values(t).find(n=>n.callable===e&&n.delegationSelector===a)}function normalizeParameters(t,e,a){const n=typeof e=="string",r=n?a:e||a;let i=getTypeEvent(t);return nativeEvents.has(i)||(i=t),[n,r,i]}function addHandler(t,e,a,n,r){if(typeof e!="string"||!t)return;let[i,o,s]=normalizeParameters(e,a,n);e in customEvents&&(o=(p=>function(v){if(!v.relatedTarget||v.relatedTarget!==v.delegateTarget&&!v.delegateTarget.contains(v.relatedTarget))return p.call(this,v)})(o));const l=getElementEvents(t),u=l[s]||(l[s]={}),c=findHandler(u,o,i?a:null);if(c){c.oneOff=c.oneOff&&r;return}const d=makeEventUid(o,e.replace(namespaceRegex,"")),h=i?bootstrapDelegationHandler(t,a,o):bootstrapHandler(t,o);h.delegationSelector=i?a:null,h.callable=o,h.oneOff=r,h.uidEvent=d,u[d]=h,t.addEventListener(s,h,i)}function removeHandler(t,e,a,n,r){const i=findHandler(e[a],n,r);i&&(t.removeEventListener(a,i,!!r),delete e[a][i.uidEvent])}function removeNamespacedHandlers(t,e,a,n){const r=e[a]||{};for(const[i,o]of Object.entries(r))i.includes(n)&&removeHandler(t,e,a,o.callable,o.delegationSelector)}function getTypeEvent(t){return t=t.replace(stripNameRegex,""),customEvents[t]||t}const EventHandler={on(t,e,a,n){addHandler(t,e,a,n,!1)},one(t,e,a,n){addHandler(t,e,a,n,!0)},off(t,e,a,n){if(typeof e!="string"||!t)return;const[r,i,o]=normalizeParameters(e,a,n),s=o!==e,l=getElementEvents(t),u=l[o]||{},c=e.startsWith(".");if(typeof i<"u"){if(!Object.keys(u).length)return;removeHandler(t,l,o,i,r?a:null);return}if(c)for(const d of Object.keys(l))removeNamespacedHandlers(t,l,d,e.slice(1));for(const[d,h]of Object.entries(u)){const m=d.replace(stripUidRegex,"");(!s||e.includes(m))&&removeHandler(t,l,o,h.callable,h.delegationSelector)}},trigger(t,e,a){if(typeof e!="string"||!t)return null;const n=getjQuery(),r=getTypeEvent(e),i=e!==r;let o=null,s=!0,l=!0,u=!1;i&&n&&(o=n.Event(e,a),n(t).trigger(o),s=!o.isPropagationStopped(),l=!o.isImmediatePropagationStopped(),u=o.isDefaultPrevented());const c=hydrateObj(new Event(e,{bubbles:s,cancelable:!0}),a);return u&&c.preventDefault(),l&&t.dispatchEvent(c),c.defaultPrevented&&o&&o.preventDefault(),c}};function hydrateObj(t,e={}){for(const[a,n]of Object.entries(e))try{t[a]=n}catch{Object.defineProperty(t,a,{configurable:!0,get(){return n}})}return t}function normalizeData(t){if(t==="true")return!0;if(t==="false")return!1;if(t===Number(t).toString())return Number(t);if(t===""||t==="null")return null;if(typeof t!="string")return t;try{return JSON.parse(decodeURIComponent(t))}catch{return t}}function normalizeDataKey(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}const Manipulator={setDataAttribute(t,e,a){t.setAttribute(`data-bs-${normalizeDataKey(e)}`,a)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${normalizeDataKey(e)}`)},getDataAttributes(t){if(!t)return{};const e={},a=Object.keys(t.dataset).filter(n=>n.startsWith("bs")&&!n.startsWith("bsConfig"));for(const n of a){let r=n.replace(/^bs/,"");r=r.charAt(0).toLowerCase()+r.slice(1,r.length),e[r]=normalizeData(t.dataset[n])}return e},getDataAttribute(t,e){return normalizeData(t.getAttribute(`data-bs-${normalizeDataKey(e)}`))}};let Config$1=class{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,a){const n=isElement(a)?Manipulator.getDataAttribute(a,"config"):{};return{...this.constructor.Default,...typeof n=="object"?n:{},...isElement(a)?Manipulator.getDataAttributes(a):{},...typeof e=="object"?e:{}}}_typeCheckConfig(e,a=this.constructor.DefaultType){for(const[n,r]of Object.entries(a)){const i=e[n],o=isElement(i)?"element":toType(i);if(!new RegExp(r).test(o))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${o}" but expected type "${r}".`)}}};const VERSION="5.3.2";class BaseComponent extends Config$1{constructor(e,a){super(),e=getElement(e),e&&(this._element=e,this._config=this._getConfig(a),Data.set(this._element,this.constructor.DATA_KEY,this))}dispose(){Data.remove(this._element,this.constructor.DATA_KEY),EventHandler.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,a,n=!0){executeAfterTransition(e,a,n)}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return Data.get(getElement(e),this.DATA_KEY)}static getOrCreateInstance(e,a={}){return this.getInstance(e)||new this(e,typeof a=="object"?a:null)}static get VERSION(){return VERSION}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const getSelector=t=>{let e=t.getAttribute("data-bs-target");if(!e||e==="#"){let a=t.getAttribute("href");if(!a||!a.includes("#")&&!a.startsWith("."))return null;a.includes("#")&&!a.startsWith("#")&&(a=`#${a.split("#")[1]}`),e=a&&a!=="#"?parseSelector(a.trim()):null}return e},SelectorEngine={find(t,e=document.documentElement){return[].concat(...Element.prototype.querySelectorAll.call(e,t))},findOne(t,e=document.documentElement){return Element.prototype.querySelector.call(e,t)},children(t,e){return[].concat(...t.children).filter(a=>a.matches(e))},parents(t,e){const a=[];let n=t.parentNode.closest(e);for(;n;)a.push(n),n=n.parentNode.closest(e);return a},prev(t,e){let a=t.previousElementSibling;for(;a;){if(a.matches(e))return[a];a=a.previousElementSibling}return[]},next(t,e){let a=t.nextElementSibling;for(;a;){if(a.matches(e))return[a];a=a.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(a=>`${a}:not([tabindex^="-"])`).join(",");return this.find(e,t).filter(a=>!isDisabled(a)&&isVisible(a))},getSelectorFromElement(t){const e=getSelector(t);return e&&SelectorEngine.findOne(e)?e:null},getElementFromSelector(t){const e=getSelector(t);return e?SelectorEngine.findOne(e):null},getMultipleElementsFromSelector(t){const e=getSelector(t);return e?SelectorEngine.find(e):[]}},enableDismissTrigger=(t,e="hide")=>{const a=`click.dismiss${t.EVENT_KEY}`,n=t.NAME;EventHandler.on(document,a,`[data-bs-dismiss="${n}"]`,function(r){if(["A","AREA"].includes(this.tagName)&&r.preventDefault(),isDisabled(this))return;const i=SelectorEngine.getElementFromSelector(this)||this.closest(`.${n}`);t.getOrCreateInstance(i)[e]()})},NAME$f="alert",DATA_KEY$a="bs.alert",EVENT_KEY$b=`.${DATA_KEY$a}`,EVENT_CLOSE=`close${EVENT_KEY$b}`,EVENT_CLOSED=`closed${EVENT_KEY$b}`,CLASS_NAME_FADE$5="fade",CLASS_NAME_SHOW$8="show";class Alert extends BaseComponent{static get NAME(){return NAME$f}close(){if(EventHandler.trigger(this._element,EVENT_CLOSE).defaultPrevented)return;this._element.classList.remove(CLASS_NAME_SHOW$8);const a=this._element.classList.contains(CLASS_NAME_FADE$5);this._queueCallback(()=>this._destroyElement(),this._element,a)}_destroyElement(){this._element.remove(),EventHandler.trigger(this._element,EVENT_CLOSED),this.dispose()}static jQueryInterface(e){return this.each(function(){const a=Alert.getOrCreateInstance(this);if(typeof e=="string"){if(a[e]===void 0||e.startsWith("_")||e==="constructor")throw new TypeError(`No method named "${e}"`);a[e](this)}})}}enableDismissTrigger(Alert,"close");defineJQueryPlugin(Alert);const NAME$e="button",DATA_KEY$9="bs.button",EVENT_KEY$a=`.${DATA_KEY$9}`,DATA_API_KEY$6=".data-api",CLASS_NAME_ACTIVE$3="active",SELECTOR_DATA_TOGGLE$5='[data-bs-toggle="button"]',EVENT_CLICK_DATA_API$6=`click${EVENT_KEY$a}${DATA_API_KEY$6}`;class Button extends BaseComponent{static get NAME(){return NAME$e}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle(CLASS_NAME_ACTIVE$3))}static jQueryInterface(e){return this.each(function(){const a=Button.getOrCreateInstance(this);e==="toggle"&&a[e]()})}}EventHandler.on(document,EVENT_CLICK_DATA_API$6,SELECTOR_DATA_TOGGLE$5,t=>{t.preventDefault();const e=t.target.closest(SELECTOR_DATA_TOGGLE$5);Button.getOrCreateInstance(e).toggle()});defineJQueryPlugin(Button);const NAME$d="swipe",EVENT_KEY$9=".bs.swipe",EVENT_TOUCHSTART=`touchstart${EVENT_KEY$9}`,EVENT_TOUCHMOVE=`touchmove${EVENT_KEY$9}`,EVENT_TOUCHEND=`touchend${EVENT_KEY$9}`,EVENT_POINTERDOWN=`pointerdown${EVENT_KEY$9}`,EVENT_POINTERUP=`pointerup${EVENT_KEY$9}`,POINTER_TYPE_TOUCH="touch",POINTER_TYPE_PEN="pen",CLASS_NAME_POINTER_EVENT="pointer-event",SWIPE_THRESHOLD=40,Default$c={endCallback:null,leftCallback:null,rightCallback:null},DefaultType$c={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class Swipe extends Config$1{constructor(e,a){super(),this._element=e,!(!e||!Swipe.isSupported())&&(this._config=this._getConfig(a),this._deltaX=0,this._supportPointerEvents=!!window.PointerEvent,this._initEvents())}static get Default(){return Default$c}static get DefaultType(){return DefaultType$c}static get NAME(){return NAME$d}dispose(){EventHandler.off(this._element,EVENT_KEY$9)}_start(e){if(!this._supportPointerEvents){this._deltaX=e.touches[0].clientX;return}this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX)}_end(e){this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX-this._deltaX),this._handleSwipe(),execute(this._config.endCallback)}_move(e){this._deltaX=e.touches&&e.touches.length>1?0:e.touches[0].clientX-this._deltaX}_handleSwipe(){const e=Math.abs(this._deltaX);if(e<=SWIPE_THRESHOLD)return;const a=e/this._deltaX;this._deltaX=0,a&&execute(a>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(EventHandler.on(this._element,EVENT_POINTERDOWN,e=>this._start(e)),EventHandler.on(this._element,EVENT_POINTERUP,e=>this._end(e)),this._element.classList.add(CLASS_NAME_POINTER_EVENT)):(EventHandler.on(this._element,EVENT_TOUCHSTART,e=>this._start(e)),EventHandler.on(this._element,EVENT_TOUCHMOVE,e=>this._move(e)),EventHandler.on(this._element,EVENT_TOUCHEND,e=>this._end(e)))}_eventIsPointerPenTouch(e){return this._supportPointerEvents&&(e.pointerType===POINTER_TYPE_PEN||e.pointerType===POINTER_TYPE_TOUCH)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const NAME$c="carousel",DATA_KEY$8="bs.carousel",EVENT_KEY$8=`.${DATA_KEY$8}`,DATA_API_KEY$5=".data-api",ARROW_LEFT_KEY$1="ArrowLeft",ARROW_RIGHT_KEY$1="ArrowRight",TOUCHEVENT_COMPAT_WAIT=500,ORDER_NEXT="next",ORDER_PREV="prev",DIRECTION_LEFT="left",DIRECTION_RIGHT="right",EVENT_SLIDE=`slide${EVENT_KEY$8}`,EVENT_SLID=`slid${EVENT_KEY$8}`,EVENT_KEYDOWN$1=`keydown${EVENT_KEY$8}`,EVENT_MOUSEENTER$1=`mouseenter${EVENT_KEY$8}`,EVENT_MOUSELEAVE$1=`mouseleave${EVENT_KEY$8}`,EVENT_DRAG_START=`dragstart${EVENT_KEY$8}`,EVENT_LOAD_DATA_API$3=`load${EVENT_KEY$8}${DATA_API_KEY$5}`,EVENT_CLICK_DATA_API$5=`click${EVENT_KEY$8}${DATA_API_KEY$5}`,CLASS_NAME_CAROUSEL="carousel",CLASS_NAME_ACTIVE$2="active",CLASS_NAME_SLIDE="slide",CLASS_NAME_END="carousel-item-end",CLASS_NAME_START="carousel-item-start",CLASS_NAME_NEXT="carousel-item-next",CLASS_NAME_PREV="carousel-item-prev",SELECTOR_ACTIVE=".active",SELECTOR_ITEM=".carousel-item",SELECTOR_ACTIVE_ITEM=SELECTOR_ACTIVE+SELECTOR_ITEM,SELECTOR_ITEM_IMG=".carousel-item img",SELECTOR_INDICATORS=".carousel-indicators",SELECTOR_DATA_SLIDE="[data-bs-slide], [data-bs-slide-to]",SELECTOR_DATA_RIDE='[data-bs-ride="carousel"]',KEY_TO_DIRECTION={[ARROW_LEFT_KEY$1]:DIRECTION_RIGHT,[ARROW_RIGHT_KEY$1]:DIRECTION_LEFT},Default$b={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},DefaultType$b={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class Carousel extends BaseComponent{constructor(e,a){super(e,a),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=SelectorEngine.findOne(SELECTOR_INDICATORS,this._element),this._addEventListeners(),this._config.ride===CLASS_NAME_CAROUSEL&&this.cycle()}static get Default(){return Default$b}static get DefaultType(){return DefaultType$b}static get NAME(){return NAME$c}next(){this._slide(ORDER_NEXT)}nextWhenVisible(){!document.hidden&&isVisible(this._element)&&this.next()}prev(){this._slide(ORDER_PREV)}pause(){this._isSliding&&triggerTransitionEnd(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval(()=>this.nextWhenVisible(),this._config.interval)}_maybeEnableCycle(){if(this._config.ride){if(this._isSliding){EventHandler.one(this._element,EVENT_SLID,()=>this.cycle());return}this.cycle()}}to(e){const a=this._getItems();if(e>a.length-1||e<0)return;if(this._isSliding){EventHandler.one(this._element,EVENT_SLID,()=>this.to(e));return}const n=this._getItemIndex(this._getActive());if(n===e)return;const r=e>n?ORDER_NEXT:ORDER_PREV;this._slide(r,a[e])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(e){return e.defaultInterval=e.interval,e}_addEventListeners(){this._config.keyboard&&EventHandler.on(this._element,EVENT_KEYDOWN$1,e=>this._keydown(e)),this._config.pause==="hover"&&(EventHandler.on(this._element,EVENT_MOUSEENTER$1,()=>this.pause()),EventHandler.on(this._element,EVENT_MOUSELEAVE$1,()=>this._maybeEnableCycle())),this._config.touch&&Swipe.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const n of SelectorEngine.find(SELECTOR_ITEM_IMG,this._element))EventHandler.on(n,EVENT_DRAG_START,r=>r.preventDefault());const a={leftCallback:()=>this._slide(this._directionToOrder(DIRECTION_LEFT)),rightCallback:()=>this._slide(this._directionToOrder(DIRECTION_RIGHT)),endCallback:()=>{this._config.pause==="hover"&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout(()=>this._maybeEnableCycle(),TOUCHEVENT_COMPAT_WAIT+this._config.interval))}};this._swipeHelper=new Swipe(this._element,a)}_keydown(e){if(/input|textarea/i.test(e.target.tagName))return;const a=KEY_TO_DIRECTION[e.key];a&&(e.preventDefault(),this._slide(this._directionToOrder(a)))}_getItemIndex(e){return this._getItems().indexOf(e)}_setActiveIndicatorElement(e){if(!this._indicatorsElement)return;const a=SelectorEngine.findOne(SELECTOR_ACTIVE,this._indicatorsElement);a.classList.remove(CLASS_NAME_ACTIVE$2),a.removeAttribute("aria-current");const n=SelectorEngine.findOne(`[data-bs-slide-to="${e}"]`,this._indicatorsElement);n&&(n.classList.add(CLASS_NAME_ACTIVE$2),n.setAttribute("aria-current","true"))}_updateInterval(){const e=this._activeElement||this._getActive();if(!e)return;const a=Number.parseInt(e.getAttribute("data-bs-interval"),10);this._config.interval=a||this._config.defaultInterval}_slide(e,a=null){if(this._isSliding)return;const n=this._getActive(),r=e===ORDER_NEXT,i=a||getNextActiveElement(this._getItems(),n,r,this._config.wrap);if(i===n)return;const o=this._getItemIndex(i),s=m=>EventHandler.trigger(this._element,m,{relatedTarget:i,direction:this._orderToDirection(e),from:this._getItemIndex(n),to:o});if(s(EVENT_SLIDE).defaultPrevented||!n||!i)return;const u=!!this._interval;this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(o),this._activeElement=i;const c=r?CLASS_NAME_START:CLASS_NAME_END,d=r?CLASS_NAME_NEXT:CLASS_NAME_PREV;i.classList.add(d),reflow(i),n.classList.add(c),i.classList.add(c);const h=()=>{i.classList.remove(c,d),i.classList.add(CLASS_NAME_ACTIVE$2),n.classList.remove(CLASS_NAME_ACTIVE$2,d,c),this._isSliding=!1,s(EVENT_SLID)};this._queueCallback(h,n,this._isAnimated()),u&&this.cycle()}_isAnimated(){return this._element.classList.contains(CLASS_NAME_SLIDE)}_getActive(){return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM,this._element)}_getItems(){return SelectorEngine.find(SELECTOR_ITEM,this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(e){return isRTL()?e===DIRECTION_LEFT?ORDER_PREV:ORDER_NEXT:e===DIRECTION_LEFT?ORDER_NEXT:ORDER_PREV}_orderToDirection(e){return isRTL()?e===ORDER_PREV?DIRECTION_LEFT:DIRECTION_RIGHT:e===ORDER_PREV?DIRECTION_RIGHT:DIRECTION_LEFT}static jQueryInterface(e){return this.each(function(){const a=Carousel.getOrCreateInstance(this,e);if(typeof e=="number"){a.to(e);return}if(typeof e=="string"){if(a[e]===void 0||e.startsWith("_")||e==="constructor")throw new TypeError(`No method named "${e}"`);a[e]()}})}}EventHandler.on(document,EVENT_CLICK_DATA_API$5,SELECTOR_DATA_SLIDE,function(t){const e=SelectorEngine.getElementFromSelector(this);if(!e||!e.classList.contains(CLASS_NAME_CAROUSEL))return;t.preventDefault();const a=Carousel.getOrCreateInstance(e),n=this.getAttribute("data-bs-slide-to");if(n){a.to(n),a._maybeEnableCycle();return}if(Manipulator.getDataAttribute(this,"slide")==="next"){a.next(),a._maybeEnableCycle();return}a.prev(),a._maybeEnableCycle()});EventHandler.on(window,EVENT_LOAD_DATA_API$3,()=>{const t=SelectorEngine.find(SELECTOR_DATA_RIDE);for(const e of t)Carousel.getOrCreateInstance(e)});defineJQueryPlugin(Carousel);const NAME$b="collapse",DATA_KEY$7="bs.collapse",EVENT_KEY$7=`.${DATA_KEY$7}`,DATA_API_KEY$4=".data-api",EVENT_SHOW$6=`show${EVENT_KEY$7}`,EVENT_SHOWN$6=`shown${EVENT_KEY$7}`,EVENT_HIDE$6=`hide${EVENT_KEY$7}`,EVENT_HIDDEN$6=`hidden${EVENT_KEY$7}`,EVENT_CLICK_DATA_API$4=`click${EVENT_KEY$7}${DATA_API_KEY$4}`,CLASS_NAME_SHOW$7="show",CLASS_NAME_COLLAPSE="collapse",CLASS_NAME_COLLAPSING="collapsing",CLASS_NAME_COLLAPSED="collapsed",CLASS_NAME_DEEPER_CHILDREN=`:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`,CLASS_NAME_HORIZONTAL="collapse-horizontal",WIDTH="width",HEIGHT="height",SELECTOR_ACTIVES=".collapse.show, .collapse.collapsing",SELECTOR_DATA_TOGGLE$4='[data-bs-toggle="collapse"]',Default$a={parent:null,toggle:!0},DefaultType$a={parent:"(null|element)",toggle:"boolean"};class Collapse extends BaseComponent{constructor(e,a){super(e,a),this._isTransitioning=!1,this._triggerArray=[];const n=SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);for(const r of n){const i=SelectorEngine.getSelectorFromElement(r),o=SelectorEngine.find(i).filter(s=>s===this._element);i!==null&&o.length&&this._triggerArray.push(r)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return Default$a}static get DefaultType(){return DefaultType$a}static get NAME(){return NAME$b}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let e=[];if(this._config.parent&&(e=this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(s=>s!==this._element).map(s=>Collapse.getOrCreateInstance(s,{toggle:!1}))),e.length&&e[0]._isTransitioning||EventHandler.trigger(this._element,EVENT_SHOW$6).defaultPrevented)return;for(const s of e)s.hide();const n=this._getDimension();this._element.classList.remove(CLASS_NAME_COLLAPSE),this._element.classList.add(CLASS_NAME_COLLAPSING),this._element.style[n]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const r=()=>{this._isTransitioning=!1,this._element.classList.remove(CLASS_NAME_COLLAPSING),this._element.classList.add(CLASS_NAME_COLLAPSE,CLASS_NAME_SHOW$7),this._element.style[n]="",EventHandler.trigger(this._element,EVENT_SHOWN$6)},o=`scroll${n[0].toUpperCase()+n.slice(1)}`;this._queueCallback(r,this._element,!0),this._element.style[n]=`${this._element[o]}px`}hide(){if(this._isTransitioning||!this._isShown()||EventHandler.trigger(this._element,EVENT_HIDE$6).defaultPrevented)return;const a=this._getDimension();this._element.style[a]=`${this._element.getBoundingClientRect()[a]}px`,reflow(this._element),this._element.classList.add(CLASS_NAME_COLLAPSING),this._element.classList.remove(CLASS_NAME_COLLAPSE,CLASS_NAME_SHOW$7);for(const r of this._triggerArray){const i=SelectorEngine.getElementFromSelector(r);i&&!this._isShown(i)&&this._addAriaAndCollapsedClass([r],!1)}this._isTransitioning=!0;const n=()=>{this._isTransitioning=!1,this._element.classList.remove(CLASS_NAME_COLLAPSING),this._element.classList.add(CLASS_NAME_COLLAPSE),EventHandler.trigger(this._element,EVENT_HIDDEN$6)};this._element.style[a]="",this._queueCallback(n,this._element,!0)}_isShown(e=this._element){return e.classList.contains(CLASS_NAME_SHOW$7)}_configAfterMerge(e){return e.toggle=!!e.toggle,e.parent=getElement(e.parent),e}_getDimension(){return this._element.classList.contains(CLASS_NAME_HORIZONTAL)?WIDTH:HEIGHT}_initializeChildren(){if(!this._config.parent)return;const e=this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4);for(const a of e){const n=SelectorEngine.getElementFromSelector(a);n&&this._addAriaAndCollapsedClass([a],this._isShown(n))}}_getFirstLevelChildren(e){const a=SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN,this._config.parent);return SelectorEngine.find(e,this._config.parent).filter(n=>!a.includes(n))}_addAriaAndCollapsedClass(e,a){if(e.length)for(const n of e)n.classList.toggle(CLASS_NAME_COLLAPSED,!a),n.setAttribute("aria-expanded",a)}static jQueryInterface(e){const a={};return typeof e=="string"&&/show|hide/.test(e)&&(a.toggle=!1),this.each(function(){const n=Collapse.getOrCreateInstance(this,a);if(typeof e=="string"){if(typeof n[e]>"u")throw new TypeError(`No method named "${e}"`);n[e]()}})}}EventHandler.on(document,EVENT_CLICK_DATA_API$4,SELECTOR_DATA_TOGGLE$4,function(t){(t.target.tagName==="A"||t.delegateTarget&&t.delegateTarget.tagName==="A")&&t.preventDefault();for(const e of SelectorEngine.getMultipleElementsFromSelector(this))Collapse.getOrCreateInstance(e,{toggle:!1}).toggle()});defineJQueryPlugin(Collapse);const NAME$a="dropdown",DATA_KEY$6="bs.dropdown",EVENT_KEY$6=`.${DATA_KEY$6}`,DATA_API_KEY$3=".data-api",ESCAPE_KEY$2="Escape",TAB_KEY$1="Tab",ARROW_UP_KEY$1="ArrowUp",ARROW_DOWN_KEY$1="ArrowDown",RIGHT_MOUSE_BUTTON=2,EVENT_HIDE$5=`hide${EVENT_KEY$6}`,EVENT_HIDDEN$5=`hidden${EVENT_KEY$6}`,EVENT_SHOW$5=`show${EVENT_KEY$6}`,EVENT_SHOWN$5=`shown${EVENT_KEY$6}`,EVENT_CLICK_DATA_API$3=`click${EVENT_KEY$6}${DATA_API_KEY$3}`,EVENT_KEYDOWN_DATA_API=`keydown${EVENT_KEY$6}${DATA_API_KEY$3}`,EVENT_KEYUP_DATA_API=`keyup${EVENT_KEY$6}${DATA_API_KEY$3}`,CLASS_NAME_SHOW$6="show",CLASS_NAME_DROPUP="dropup",CLASS_NAME_DROPEND="dropend",CLASS_NAME_DROPSTART="dropstart",CLASS_NAME_DROPUP_CENTER="dropup-center",CLASS_NAME_DROPDOWN_CENTER="dropdown-center",SELECTOR_DATA_TOGGLE$3='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',SELECTOR_DATA_TOGGLE_SHOWN=`${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`,SELECTOR_MENU=".dropdown-menu",SELECTOR_NAVBAR=".navbar",SELECTOR_NAVBAR_NAV=".navbar-nav",SELECTOR_VISIBLE_ITEMS=".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",PLACEMENT_TOP=isRTL()?"top-end":"top-start",PLACEMENT_TOPEND=isRTL()?"top-start":"top-end",PLACEMENT_BOTTOM=isRTL()?"bottom-end":"bottom-start",PLACEMENT_BOTTOMEND=isRTL()?"bottom-start":"bottom-end",PLACEMENT_RIGHT=isRTL()?"left-start":"right-start",PLACEMENT_LEFT=isRTL()?"right-start":"left-start",PLACEMENT_TOPCENTER="top",PLACEMENT_BOTTOMCENTER="bottom",Default$9={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},DefaultType$9={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class Dropdown extends BaseComponent{constructor(e,a){super(e,a),this._popper=null,this._parent=this._element.parentNode,this._menu=SelectorEngine.next(this._element,SELECTOR_MENU)[0]||SelectorEngine.prev(this._element,SELECTOR_MENU)[0]||SelectorEngine.findOne(SELECTOR_MENU,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return Default$9}static get DefaultType(){return DefaultType$9}static get NAME(){return NAME$a}toggle(){return this._isShown()?this.hide():this.show()}show(){if(isDisabled(this._element)||this._isShown())return;const e={relatedTarget:this._element};if(!EventHandler.trigger(this._element,EVENT_SHOW$5,e).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(SELECTOR_NAVBAR_NAV))for(const n of[].concat(...document.body.children))EventHandler.on(n,"mouseover",noop$3);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(CLASS_NAME_SHOW$6),this._element.classList.add(CLASS_NAME_SHOW$6),EventHandler.trigger(this._element,EVENT_SHOWN$5,e)}}hide(){if(isDisabled(this._element)||!this._isShown())return;const e={relatedTarget:this._element};this._completeHide(e)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(e){if(!EventHandler.trigger(this._element,EVENT_HIDE$5,e).defaultPrevented){if("ontouchstart"in document.documentElement)for(const n of[].concat(...document.body.children))EventHandler.off(n,"mouseover",noop$3);this._popper&&this._popper.destroy(),this._menu.classList.remove(CLASS_NAME_SHOW$6),this._element.classList.remove(CLASS_NAME_SHOW$6),this._element.setAttribute("aria-expanded","false"),Manipulator.removeDataAttribute(this._menu,"popper"),EventHandler.trigger(this._element,EVENT_HIDDEN$5,e)}}_getConfig(e){if(e=super._getConfig(e),typeof e.reference=="object"&&!isElement(e.reference)&&typeof e.reference.getBoundingClientRect!="function")throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return e}_createPopper(){if(typeof Popper>"u")throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let e=this._element;this._config.reference==="parent"?e=this._parent:isElement(this._config.reference)?e=getElement(this._config.reference):typeof this._config.reference=="object"&&(e=this._config.reference);const a=this._getPopperConfig();this._popper=createPopper(e,this._menu,a)}_isShown(){return this._menu.classList.contains(CLASS_NAME_SHOW$6)}_getPlacement(){const e=this._parent;if(e.classList.contains(CLASS_NAME_DROPEND))return PLACEMENT_RIGHT;if(e.classList.contains(CLASS_NAME_DROPSTART))return PLACEMENT_LEFT;if(e.classList.contains(CLASS_NAME_DROPUP_CENTER))return PLACEMENT_TOPCENTER;if(e.classList.contains(CLASS_NAME_DROPDOWN_CENTER))return PLACEMENT_BOTTOMCENTER;const a=getComputedStyle(this._menu).getPropertyValue("--bs-position").trim()==="end";return e.classList.contains(CLASS_NAME_DROPUP)?a?PLACEMENT_TOPEND:PLACEMENT_TOP:a?PLACEMENT_BOTTOMEND:PLACEMENT_BOTTOM}_detectNavbar(){return this._element.closest(SELECTOR_NAVBAR)!==null}_getOffset(){const{offset:e}=this._config;return typeof e=="string"?e.split(",").map(a=>Number.parseInt(a,10)):typeof e=="function"?a=>e(a,this._element):e}_getPopperConfig(){const e={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||this._config.display==="static")&&(Manipulator.setDataAttribute(this._menu,"popper","static"),e.modifiers=[{name:"applyStyles",enabled:!1}]),{...e,...execute(this._config.popperConfig,[e])}}_selectMenuItem({key:e,target:a}){const n=SelectorEngine.find(SELECTOR_VISIBLE_ITEMS,this._menu).filter(r=>isVisible(r));n.length&&getNextActiveElement(n,a,e===ARROW_DOWN_KEY$1,!n.includes(a)).focus()}static jQueryInterface(e){return this.each(function(){const a=Dropdown.getOrCreateInstance(this,e);if(typeof e=="string"){if(typeof a[e]>"u")throw new TypeError(`No method named "${e}"`);a[e]()}})}static clearMenus(e){if(e.button===RIGHT_MOUSE_BUTTON||e.type==="keyup"&&e.key!==TAB_KEY$1)return;const a=SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);for(const n of a){const r=Dropdown.getInstance(n);if(!r||r._config.autoClose===!1)continue;const i=e.composedPath(),o=i.includes(r._menu);if(i.includes(r._element)||r._config.autoClose==="inside"&&!o||r._config.autoClose==="outside"&&o||r._menu.contains(e.target)&&(e.type==="keyup"&&e.key===TAB_KEY$1||/input|select|option|textarea|form/i.test(e.target.tagName)))continue;const s={relatedTarget:r._element};e.type==="click"&&(s.clickEvent=e),r._completeHide(s)}}static dataApiKeydownHandler(e){const a=/input|textarea/i.test(e.target.tagName),n=e.key===ESCAPE_KEY$2,r=[ARROW_UP_KEY$1,ARROW_DOWN_KEY$1].includes(e.key);if(!r&&!n||a&&!n)return;e.preventDefault();const i=this.matches(SELECTOR_DATA_TOGGLE$3)?this:SelectorEngine.prev(this,SELECTOR_DATA_TOGGLE$3)[0]||SelectorEngine.next(this,SELECTOR_DATA_TOGGLE$3)[0]||SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3,e.delegateTarget.parentNode),o=Dropdown.getOrCreateInstance(i);if(r){e.stopPropagation(),o.show(),o._selectMenuItem(e);return}o._isShown()&&(e.stopPropagation(),o.hide(),i.focus())}}EventHandler.on(document,EVENT_KEYDOWN_DATA_API,SELECTOR_DATA_TOGGLE$3,Dropdown.dataApiKeydownHandler);EventHandler.on(document,EVENT_KEYDOWN_DATA_API,SELECTOR_MENU,Dropdown.dataApiKeydownHandler);EventHandler.on(document,EVENT_CLICK_DATA_API$3,Dropdown.clearMenus);EventHandler.on(document,EVENT_KEYUP_DATA_API,Dropdown.clearMenus);EventHandler.on(document,EVENT_CLICK_DATA_API$3,SELECTOR_DATA_TOGGLE$3,function(t){t.preventDefault(),Dropdown.getOrCreateInstance(this).toggle()});defineJQueryPlugin(Dropdown);const NAME$9="backdrop",CLASS_NAME_FADE$4="fade",CLASS_NAME_SHOW$5="show",EVENT_MOUSEDOWN=`mousedown.bs.${NAME$9}`,Default$8={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},DefaultType$8={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class Backdrop extends Config$1{constructor(e){super(),this._config=this._getConfig(e),this._isAppended=!1,this._element=null}static get Default(){return Default$8}static get DefaultType(){return DefaultType$8}static get NAME(){return NAME$9}show(e){if(!this._config.isVisible){execute(e);return}this._append();const a=this._getElement();this._config.isAnimated&&reflow(a),a.classList.add(CLASS_NAME_SHOW$5),this._emulateAnimation(()=>{execute(e)})}hide(e){if(!this._config.isVisible){execute(e);return}this._getElement().classList.remove(CLASS_NAME_SHOW$5),this._emulateAnimation(()=>{this.dispose(),execute(e)})}dispose(){this._isAppended&&(EventHandler.off(this._element,EVENT_MOUSEDOWN),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const e=document.createElement("div");e.className=this._config.className,this._config.isAnimated&&e.classList.add(CLASS_NAME_FADE$4),this._element=e}return this._element}_configAfterMerge(e){return e.rootElement=getElement(e.rootElement),e}_append(){if(this._isAppended)return;const e=this._getElement();this._config.rootElement.append(e),EventHandler.on(e,EVENT_MOUSEDOWN,()=>{execute(this._config.clickCallback)}),this._isAppended=!0}_emulateAnimation(e){executeAfterTransition(e,this._getElement(),this._config.isAnimated)}}const NAME$8="focustrap",DATA_KEY$5="bs.focustrap",EVENT_KEY$5=`.${DATA_KEY$5}`,EVENT_FOCUSIN$2=`focusin${EVENT_KEY$5}`,EVENT_KEYDOWN_TAB=`keydown.tab${EVENT_KEY$5}`,TAB_KEY="Tab",TAB_NAV_FORWARD="forward",TAB_NAV_BACKWARD="backward",Default$7={autofocus:!0,trapElement:null},DefaultType$7={autofocus:"boolean",trapElement:"element"};class FocusTrap extends Config$1{constructor(e){super(),this._config=this._getConfig(e),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return Default$7}static get DefaultType(){return DefaultType$7}static get NAME(){return NAME$8}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),EventHandler.off(document,EVENT_KEY$5),EventHandler.on(document,EVENT_FOCUSIN$2,e=>this._handleFocusin(e)),EventHandler.on(document,EVENT_KEYDOWN_TAB,e=>this._handleKeydown(e)),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,EventHandler.off(document,EVENT_KEY$5))}_handleFocusin(e){const{trapElement:a}=this._config;if(e.target===document||e.target===a||a.contains(e.target))return;const n=SelectorEngine.focusableChildren(a);n.length===0?a.focus():this._lastTabNavDirection===TAB_NAV_BACKWARD?n[n.length-1].focus():n[0].focus()}_handleKeydown(e){e.key===TAB_KEY&&(this._lastTabNavDirection=e.shiftKey?TAB_NAV_BACKWARD:TAB_NAV_FORWARD)}}const SELECTOR_FIXED_CONTENT=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",SELECTOR_STICKY_CONTENT=".sticky-top",PROPERTY_PADDING="padding-right",PROPERTY_MARGIN="margin-right";class ScrollBarHelper{constructor(){this._element=document.body}getWidth(){const e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}hide(){const e=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,PROPERTY_PADDING,a=>a+e),this._setElementAttributes(SELECTOR_FIXED_CONTENT,PROPERTY_PADDING,a=>a+e),this._setElementAttributes(SELECTOR_STICKY_CONTENT,PROPERTY_MARGIN,a=>a-e)}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,PROPERTY_PADDING),this._resetElementAttributes(SELECTOR_FIXED_CONTENT,PROPERTY_PADDING),this._resetElementAttributes(SELECTOR_STICKY_CONTENT,PROPERTY_MARGIN)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(e,a,n){const r=this.getWidth(),i=o=>{if(o!==this._element&&window.innerWidth>o.clientWidth+r)return;this._saveInitialAttribute(o,a);const s=window.getComputedStyle(o).getPropertyValue(a);o.style.setProperty(a,`${n(Number.parseFloat(s))}px`)};this._applyManipulationCallback(e,i)}_saveInitialAttribute(e,a){const n=e.style.getPropertyValue(a);n&&Manipulator.setDataAttribute(e,a,n)}_resetElementAttributes(e,a){const n=r=>{const i=Manipulator.getDataAttribute(r,a);if(i===null){r.style.removeProperty(a);return}Manipulator.removeDataAttribute(r,a),r.style.setProperty(a,i)};this._applyManipulationCallback(e,n)}_applyManipulationCallback(e,a){if(isElement(e)){a(e);return}for(const n of SelectorEngine.find(e,this._element))a(n)}}const NAME$7="modal",DATA_KEY$4="bs.modal",EVENT_KEY$4=`.${DATA_KEY$4}`,DATA_API_KEY$2=".data-api",ESCAPE_KEY$1="Escape",EVENT_HIDE$4=`hide${EVENT_KEY$4}`,EVENT_HIDE_PREVENTED$1=`hidePrevented${EVENT_KEY$4}`,EVENT_HIDDEN$4=`hidden${EVENT_KEY$4}`,EVENT_SHOW$4=`show${EVENT_KEY$4}`,EVENT_SHOWN$4=`shown${EVENT_KEY$4}`,EVENT_RESIZE$1=`resize${EVENT_KEY$4}`,EVENT_CLICK_DISMISS=`click.dismiss${EVENT_KEY$4}`,EVENT_MOUSEDOWN_DISMISS=`mousedown.dismiss${EVENT_KEY$4}`,EVENT_KEYDOWN_DISMISS$1=`keydown.dismiss${EVENT_KEY$4}`,EVENT_CLICK_DATA_API$2=`click${EVENT_KEY$4}${DATA_API_KEY$2}`,CLASS_NAME_OPEN="modal-open",CLASS_NAME_FADE$3="fade",CLASS_NAME_SHOW$4="show",CLASS_NAME_STATIC="modal-static",OPEN_SELECTOR$1=".modal.show",SELECTOR_DIALOG=".modal-dialog",SELECTOR_MODAL_BODY=".modal-body",SELECTOR_DATA_TOGGLE$2='[data-bs-toggle="modal"]',Default$6={backdrop:!0,focus:!0,keyboard:!0},DefaultType$6={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class Modal extends BaseComponent{constructor(e,a){super(e,a),this._dialog=SelectorEngine.findOne(SELECTOR_DIALOG,this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new ScrollBarHelper,this._addEventListeners()}static get Default(){return Default$6}static get DefaultType(){return DefaultType$6}static get NAME(){return NAME$7}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){this._isShown||this._isTransitioning||EventHandler.trigger(this._element,EVENT_SHOW$4,{relatedTarget:e}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(CLASS_NAME_OPEN),this._adjustDialog(),this._backdrop.show(()=>this._showElement(e)))}hide(){!this._isShown||this._isTransitioning||EventHandler.trigger(this._element,EVENT_HIDE$4).defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(CLASS_NAME_SHOW$4),this._queueCallback(()=>this._hideModal(),this._element,this._isAnimated()))}dispose(){EventHandler.off(window,EVENT_KEY$4),EventHandler.off(this._dialog,EVENT_KEY$4),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new Backdrop({isVisible:!!this._config.backdrop,isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new FocusTrap({trapElement:this._element})}_showElement(e){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const a=SelectorEngine.findOne(SELECTOR_MODAL_BODY,this._dialog);a&&(a.scrollTop=0),reflow(this._element),this._element.classList.add(CLASS_NAME_SHOW$4);const n=()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,EventHandler.trigger(this._element,EVENT_SHOWN$4,{relatedTarget:e})};this._queueCallback(n,this._dialog,this._isAnimated())}_addEventListeners(){EventHandler.on(this._element,EVENT_KEYDOWN_DISMISS$1,e=>{if(e.key===ESCAPE_KEY$1){if(this._config.keyboard){this.hide();return}this._triggerBackdropTransition()}}),EventHandler.on(window,EVENT_RESIZE$1,()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()}),EventHandler.on(this._element,EVENT_MOUSEDOWN_DISMISS,e=>{EventHandler.one(this._element,EVENT_CLICK_DISMISS,a=>{if(!(this._element!==e.target||this._element!==a.target)){if(this._config.backdrop==="static"){this._triggerBackdropTransition();return}this._config.backdrop&&this.hide()}})})}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide(()=>{document.body.classList.remove(CLASS_NAME_OPEN),this._resetAdjustments(),this._scrollBar.reset(),EventHandler.trigger(this._element,EVENT_HIDDEN$4)})}_isAnimated(){return this._element.classList.contains(CLASS_NAME_FADE$3)}_triggerBackdropTransition(){if(EventHandler.trigger(this._element,EVENT_HIDE_PREVENTED$1).defaultPrevented)return;const a=this._element.scrollHeight>document.documentElement.clientHeight,n=this._element.style.overflowY;n==="hidden"||this._element.classList.contains(CLASS_NAME_STATIC)||(a||(this._element.style.overflowY="hidden"),this._element.classList.add(CLASS_NAME_STATIC),this._queueCallback(()=>{this._element.classList.remove(CLASS_NAME_STATIC),this._queueCallback(()=>{this._element.style.overflowY=n},this._dialog)},this._dialog),this._element.focus())}_adjustDialog(){const e=this._element.scrollHeight>document.documentElement.clientHeight,a=this._scrollBar.getWidth(),n=a>0;if(n&&!e){const r=isRTL()?"paddingLeft":"paddingRight";this._element.style[r]=`${a}px`}if(!n&&e){const r=isRTL()?"paddingRight":"paddingLeft";this._element.style[r]=`${a}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(e,a){return this.each(function(){const n=Modal.getOrCreateInstance(this,e);if(typeof e=="string"){if(typeof n[e]>"u")throw new TypeError(`No method named "${e}"`);n[e](a)}})}}EventHandler.on(document,EVENT_CLICK_DATA_API$2,SELECTOR_DATA_TOGGLE$2,function(t){const e=SelectorEngine.getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),EventHandler.one(e,EVENT_SHOW$4,r=>{r.defaultPrevented||EventHandler.one(e,EVENT_HIDDEN$4,()=>{isVisible(this)&&this.focus()})});const a=SelectorEngine.findOne(OPEN_SELECTOR$1);a&&Modal.getInstance(a).hide(),Modal.getOrCreateInstance(e).toggle(this)});enableDismissTrigger(Modal);defineJQueryPlugin(Modal);const NAME$6="offcanvas",DATA_KEY$3="bs.offcanvas",EVENT_KEY$3=`.${DATA_KEY$3}`,DATA_API_KEY$1=".data-api",EVENT_LOAD_DATA_API$2=`load${EVENT_KEY$3}${DATA_API_KEY$1}`,ESCAPE_KEY="Escape",CLASS_NAME_SHOW$3="show",CLASS_NAME_SHOWING$1="showing",CLASS_NAME_HIDING="hiding",CLASS_NAME_BACKDROP="offcanvas-backdrop",OPEN_SELECTOR=".offcanvas.show",EVENT_SHOW$3=`show${EVENT_KEY$3}`,EVENT_SHOWN$3=`shown${EVENT_KEY$3}`,EVENT_HIDE$3=`hide${EVENT_KEY$3}`,EVENT_HIDE_PREVENTED=`hidePrevented${EVENT_KEY$3}`,EVENT_HIDDEN$3=`hidden${EVENT_KEY$3}`,EVENT_RESIZE=`resize${EVENT_KEY$3}`,EVENT_CLICK_DATA_API$1=`click${EVENT_KEY$3}${DATA_API_KEY$1}`,EVENT_KEYDOWN_DISMISS=`keydown.dismiss${EVENT_KEY$3}`,SELECTOR_DATA_TOGGLE$1='[data-bs-toggle="offcanvas"]',Default$5={backdrop:!0,keyboard:!0,scroll:!1},DefaultType$5={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class Offcanvas extends BaseComponent{constructor(e,a){super(e,a),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return Default$5}static get DefaultType(){return DefaultType$5}static get NAME(){return NAME$6}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown||EventHandler.trigger(this._element,EVENT_SHOW$3,{relatedTarget:e}).defaultPrevented)return;this._isShown=!0,this._backdrop.show(),this._config.scroll||new ScrollBarHelper().hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(CLASS_NAME_SHOWING$1);const n=()=>{(!this._config.scroll||this._config.backdrop)&&this._focustrap.activate(),this._element.classList.add(CLASS_NAME_SHOW$3),this._element.classList.remove(CLASS_NAME_SHOWING$1),EventHandler.trigger(this._element,EVENT_SHOWN$3,{relatedTarget:e})};this._queueCallback(n,this._element,!0)}hide(){if(!this._isShown||EventHandler.trigger(this._element,EVENT_HIDE$3).defaultPrevented)return;this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(CLASS_NAME_HIDING),this._backdrop.hide();const a=()=>{this._element.classList.remove(CLASS_NAME_SHOW$3,CLASS_NAME_HIDING),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||new ScrollBarHelper().reset(),EventHandler.trigger(this._element,EVENT_HIDDEN$3)};this._queueCallback(a,this._element,!0)}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const e=()=>{if(this._config.backdrop==="static"){EventHandler.trigger(this._element,EVENT_HIDE_PREVENTED);return}this.hide()},a=!!this._config.backdrop;return new Backdrop({className:CLASS_NAME_BACKDROP,isVisible:a,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:a?e:null})}_initializeFocusTrap(){return new FocusTrap({trapElement:this._element})}_addEventListeners(){EventHandler.on(this._element,EVENT_KEYDOWN_DISMISS,e=>{if(e.key===ESCAPE_KEY){if(this._config.keyboard){this.hide();return}EventHandler.trigger(this._element,EVENT_HIDE_PREVENTED)}})}static jQueryInterface(e){return this.each(function(){const a=Offcanvas.getOrCreateInstance(this,e);if(typeof e=="string"){if(a[e]===void 0||e.startsWith("_")||e==="constructor")throw new TypeError(`No method named "${e}"`);a[e](this)}})}}EventHandler.on(document,EVENT_CLICK_DATA_API$1,SELECTOR_DATA_TOGGLE$1,function(t){const e=SelectorEngine.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),isDisabled(this))return;EventHandler.one(e,EVENT_HIDDEN$3,()=>{isVisible(this)&&this.focus()});const a=SelectorEngine.findOne(OPEN_SELECTOR);a&&a!==e&&Offcanvas.getInstance(a).hide(),Offcanvas.getOrCreateInstance(e).toggle(this)});EventHandler.on(window,EVENT_LOAD_DATA_API$2,()=>{for(const t of SelectorEngine.find(OPEN_SELECTOR))Offcanvas.getOrCreateInstance(t).show()});EventHandler.on(window,EVENT_RESIZE,()=>{for(const t of SelectorEngine.find("[aria-modal][class*=show][class*=offcanvas-]"))getComputedStyle(t).position!=="fixed"&&Offcanvas.getOrCreateInstance(t).hide()});enableDismissTrigger(Offcanvas);defineJQueryPlugin(Offcanvas);const ARIA_ATTRIBUTE_PATTERN=/^aria-[\w-]*$/i,DefaultAllowlist={"*":["class","dir","id","lang","role",ARIA_ATTRIBUTE_PATTERN],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},uriAttributes=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),SAFE_URL_PATTERN=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,allowedAttribute=(t,e)=>{const a=t.nodeName.toLowerCase();return e.includes(a)?uriAttributes.has(a)?!!SAFE_URL_PATTERN.test(t.nodeValue):!0:e.filter(n=>n instanceof RegExp).some(n=>n.test(a))};function sanitizeHtml(t,e,a){if(!t.length)return t;if(a&&typeof a=="function")return a(t);const r=new window.DOMParser().parseFromString(t,"text/html"),i=[].concat(...r.body.querySelectorAll("*"));for(const o of i){const s=o.nodeName.toLowerCase();if(!Object.keys(e).includes(s)){o.remove();continue}const l=[].concat(...o.attributes),u=[].concat(e["*"]||[],e[s]||[]);for(const c of l)allowedAttribute(c,u)||o.removeAttribute(c.nodeName)}return r.body.innerHTML}const NAME$5="TemplateFactory",Default$4={allowList:DefaultAllowlist,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"
"},DefaultType$4={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},DefaultContentType={entry:"(string|element|function|null)",selector:"(string|element)"};class TemplateFactory extends Config$1{constructor(e){super(),this._config=this._getConfig(e)}static get Default(){return Default$4}static get DefaultType(){return DefaultType$4}static get NAME(){return NAME$5}getContent(){return Object.values(this._config.content).map(e=>this._resolvePossibleFunction(e)).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(e){return this._checkContent(e),this._config.content={...this._config.content,...e},this}toHtml(){const e=document.createElement("div");e.innerHTML=this._maybeSanitize(this._config.template);for(const[r,i]of Object.entries(this._config.content))this._setContent(e,i,r);const a=e.children[0],n=this._resolvePossibleFunction(this._config.extraClass);return n&&a.classList.add(...n.split(" ")),a}_typeCheckConfig(e){super._typeCheckConfig(e),this._checkContent(e.content)}_checkContent(e){for(const[a,n]of Object.entries(e))super._typeCheckConfig({selector:a,entry:n},DefaultContentType)}_setContent(e,a,n){const r=SelectorEngine.findOne(n,e);if(r){if(a=this._resolvePossibleFunction(a),!a){r.remove();return}if(isElement(a)){this._putElementInTemplate(getElement(a),r);return}if(this._config.html){r.innerHTML=this._maybeSanitize(a);return}r.textContent=a}}_maybeSanitize(e){return this._config.sanitize?sanitizeHtml(e,this._config.allowList,this._config.sanitizeFn):e}_resolvePossibleFunction(e){return execute(e,[this])}_putElementInTemplate(e,a){if(this._config.html){a.innerHTML="",a.append(e);return}a.textContent=e.textContent}}const NAME$4="tooltip",DISALLOWED_ATTRIBUTES=new Set(["sanitize","allowList","sanitizeFn"]),CLASS_NAME_FADE$2="fade",CLASS_NAME_MODAL="modal",CLASS_NAME_SHOW$2="show",SELECTOR_TOOLTIP_INNER=".tooltip-inner",SELECTOR_MODAL=`.${CLASS_NAME_MODAL}`,EVENT_MODAL_HIDE="hide.bs.modal",TRIGGER_HOVER="hover",TRIGGER_FOCUS="focus",TRIGGER_CLICK="click",TRIGGER_MANUAL="manual",EVENT_HIDE$2="hide",EVENT_HIDDEN$2="hidden",EVENT_SHOW$2="show",EVENT_SHOWN$2="shown",EVENT_INSERTED="inserted",EVENT_CLICK$1="click",EVENT_FOCUSIN$1="focusin",EVENT_FOCUSOUT$1="focusout",EVENT_MOUSEENTER="mouseenter",EVENT_MOUSELEAVE="mouseleave",AttachmentMap={AUTO:"auto",TOP:"top",RIGHT:isRTL()?"left":"right",BOTTOM:"bottom",LEFT:isRTL()?"right":"left"},Default$3={allowList:DefaultAllowlist,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,6],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'=P/2&&J++;do{if(I=0,T=b(q,V,Q,H),T<0){if(G=V[0],Q!=H&&(G=G*P+(V[1]||0)),I=mathfloor(G/J),I>1)for(I>=P&&(I=P-1),W=g(q,I,P),z=W.length,H=V.length;b(W,V,z,H)==1;)I--,$(W,Q=10;Z/=10,A++);N(U,M+(U.e=A+x*LOG_BASE-1)+1,D,L)}else U.e=x,U.r=+L;return U}}();function C(g,b,$,S){var E,M,D,P,T;if($==null?$=s:intCheck($,0,8),!g.c)return g.toString();if(E=g.c[0],D=g.e,b==null)T=coeffToString(g.c),T=S==1||S==2&&(D<=l||D>=u)?toExponential(T,D):toFixedPoint(T,D,"0");else if(g=N(new _(g),b,$),M=g.e,T=coeffToString(g.c),P=T.length,S==1||S==2&&(b<=M||M<=l)){for(;PP){if(--b>0)for(T+=".";b--;T+="0");}else if(b+=M-P,b>0)for(M+1==P&&(T+=".");b--;T+="0");return g.s<0&&E?"-"+T:T}function O(g,b){for(var $,S,E=1,M=new _(g[0]);E =10;E/=10,S++);return($=S+$*LOG_BASE-1)>d?g.c=g.e=null:$ =10;P/=10,E++);if(M=b-E,M<0)M+=LOG_BASE,D=b,T=L[x=0],A=mathfloor(T/I[E-D-1]%10);else if(x=mathceil((M+1)/LOG_BASE),x>=L.length)if(S){for(;L.length<=x;L.push(0));T=A=0,E=1,M%=LOG_BASE,D=M-LOG_BASE+1}else break e;else{for(T=P=L[x],E=1;P>=10;P/=10,E++);M%=LOG_BASE,D=M-LOG_BASE+E,A=D<0?0:mathfloor(T/I[E-D-1]%10)}if(S=S||b<0||L[x+1]!=null||(D<0?T:T%I[E-D-1]),S=$<4?(A||S)&&($==0||$==(g.s<0?3:2)):A>5||A==5&&($==4||S||$==6&&(M>0?D>0?T/I[E-D]:0:L[x-1])%10&1||$==(g.s<0?8:7)),b<1||!L[0])return L.length=0,S?(b-=g.e+1,L[0]=I[(LOG_BASE-b%LOG_BASE)%LOG_BASE],g.e=-b||0):L[0]=g.e=0,g;if(M==0?(L.length=x,P=1,x--):(L.length=x+1,P=I[LOG_BASE-M],L[x]=D>0?mathfloor(T/I[E-D]%I[D])*P:0),S)for(;;)if(x==0){for(M=1,D=L[0];D>=10;D/=10,M++);for(D=L[0]+=P,P=1;D>=10;D/=10,P++);M!=P&&(g.e++,L[0]==BASE&&(L[0]=1));break}else{if(L[x]+=P,L[x]!=BASE)break;L[x--]=0,P=1}for(M=L.length;L[--M]===0;L.pop());}g.e>d?g.c=g.e=null:g.e =u?toExponential(b,$):toFixedPoint(b,$,"0"),g.s<0?"-"+b:b)}return r.absoluteValue=r.abs=function(){var g=new _(this);return g.s<0&&(g.s=1),g},r.comparedTo=function(g,b){return compare(this,new _(g,b))},r.decimalPlaces=r.dp=function(g,b){var $,S,E,M=this;if(g!=null)return intCheck(g,0,MAX),b==null?b=s:intCheck(b,0,8),N(new _(M),g+M.e+1,b);if(!($=M.c))return null;if(S=((E=$.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,E=$[E])for(;E%10==0;E/=10,S--);return S<0&&(S=0),S},r.dividedBy=r.div=function(g,b){return e(this,new _(g,b),o,s)},r.dividedToIntegerBy=r.idiv=function(g,b){return e(this,new _(g,b),0,1)},r.exponentiatedBy=r.pow=function(g,b){var $,S,E,M,D,P,T,x,A,L=this;if(g=new _(g),g.c&&!g.isInteger())throw Error(bignumberError+"Exponent not an integer: "+F(g));if(b!=null&&(b=new _(b)),P=g.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!g.c||!g.c[0])return A=new _(Math.pow(+F(L),P?g.s*(2-isOdd(g)):+F(g))),b?A.mod(b):A;if(T=g.s<0,b){if(b.c?!b.c[0]:!b.s)return new _(NaN);S=!T&&L.isInteger()&&b.isInteger(),S&&(L=L.mod(b))}else{if(g.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||P&&L.c[1]>=24e7:L.c[0]<8e13||P&&L.c[0]<=9999975e7)))return M=L.s<0&&isOdd(g)?-0:0,L.e>-1&&(M=1/M),new _(T?1/M:M);p&&(M=mathceil(p/LOG_BASE+2))}for(P?($=new _(.5),T&&(g.s=1),x=isOdd(g)):(E=Math.abs(+F(g)),x=E%2),A=new _(i);;){if(x){if(A=A.times(L),!A.c)break;M?A.c.length>M&&(A.c.length=M):S&&(A=A.mod(b))}if(E){if(E=mathfloor(E/2),E===0)break;x=E%2}else if(g=g.times($),N(g,g.e+1,1),g.e>14)x=isOdd(g);else{if(E=+F(g),E===0)break;x=E%2}L=L.times(L),M?L.c&&L.c.length>M&&(L.c.length=M):S&&(L=L.mod(b))}return S?A:(T&&(A=i.div(A)),b?A.mod(b):M?N(A,p,s,D):A)},r.integerValue=function(g){var b=new _(this);return g==null?g=s:intCheck(g,0,8),N(b,b.e+1,g)},r.isEqualTo=r.eq=function(g,b){return compare(this,new _(g,b))===0},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(g,b){return compare(this,new _(g,b))>0},r.isGreaterThanOrEqualTo=r.gte=function(g,b){return(b=compare(this,new _(g,b)))===1||b===0},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(g,b){return compare(this,new _(g,b))<0},r.isLessThanOrEqualTo=r.lte=function(g,b){return(b=compare(this,new _(g,b)))===-1||b===0},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return this.s>0},r.isZero=function(){return!!this.c&&this.c[0]==0},r.minus=function(g,b){var $,S,E,M,D=this,P=D.s;if(g=new _(g,b),b=g.s,!P||!b)return new _(NaN);if(P!=b)return g.s=-b,D.plus(g);var T=D.e/LOG_BASE,x=g.e/LOG_BASE,A=D.c,L=g.c;if(!T||!x){if(!A||!L)return A?(g.s=-b,g):new _(L?D:NaN);if(!A[0]||!L[0])return L[0]?(g.s=-b,g):new _(A[0]?D:s==3?-0:0)}if(T=bitFloor(T),x=bitFloor(x),A=A.slice(),P=T-x){for((M=P<0)?(P=-P,E=A):(x=T,E=L),E.reverse(),b=P;b--;E.push(0));E.reverse()}else for(S=(M=(P=A.length)<(b=L.length))?P:b,P=b=0;b 0)for(;b--;A[$++]=0);for(b=BASE-1;S>P;){if(A[--S]=0;){for($=0,I=G[E]%B,W=G[E]/B|0,D=T,M=E+D;M>E;)x=H[--D]%B,A=H[D]/B|0,P=W*x+A*I,x=I*x+P%B*B+z[M]+$,$=(x/U|0)+(P/B|0)+W*A,z[M--]=x%U;z[M]=$}return $?++S:z.splice(0,1),k(g,z,S)},r.negated=function(){var g=new _(this);return g.s=-g.s||null,g},r.plus=function(g,b){var $,S=this,E=S.s;if(g=new _(g,b),b=g.s,!E||!b)return new _(NaN);if(E!=b)return g.s=-b,S.minus(g);var M=S.e/LOG_BASE,D=g.e/LOG_BASE,P=S.c,T=g.c;if(!M||!D){if(!P||!T)return new _(E/0);if(!P[0]||!T[0])return T[0]?g:new _(P[0]?S:E*0)}if(M=bitFloor(M),D=bitFloor(D),P=P.slice(),E=M-D){for(E>0?(D=M,$=T):(E=-E,$=P),$.reverse();E--;$.push(0));$.reverse()}for(E=P.length,b=T.length,E-b<0&&($=T,T=P,P=$,b=E),E=0;b;)E=(P[--b]=P[b]+T[b]+E)/BASE|0,P[b]=BASE===P[b]?0:P[b]%BASE;return E&&(P=[E].concat(P),++D),k(g,P,D)},r.precision=r.sd=function(g,b){var $,S,E,M=this;if(g!=null&&g!==!!g)return intCheck(g,1,MAX),b==null?b=s:intCheck(b,0,8),N(new _(M),g,b);if(!($=M.c))return null;if(E=$.length-1,S=E*LOG_BASE+1,E=$[E]){for(;E%10==0;E/=10,S--);for(E=$[0];E>=10;E/=10,S++);}return g&&M.e+1>S&&(S=M.e+1),S},r.shiftedBy=function(g){return intCheck(g,-MAX_SAFE_INTEGER$1,MAX_SAFE_INTEGER$1),this.times("1e"+g)},r.squareRoot=r.sqrt=function(){var g,b,$,S,E,M=this,D=M.c,P=M.s,T=M.e,x=o+4,A=new _("0.5");if(P!==1||!D||!D[0])return new _(!P||P<0&&(!D||D[0])?NaN:D?M:1/0);if(P=Math.sqrt(+F(M)),P==0||P==1/0?(b=coeffToString(D),(b.length+T)%2==0&&(b+="0"),P=Math.sqrt(+b),T=bitFloor((T+1)/2)-(T<0||T%2),P==1/0?b="5e"+T:(b=P.toExponential(),b=b.slice(0,b.indexOf("e")+1)+T),$=new _(b)):$=new _(P+""),$.c[0]){for(T=$.e,P=T+x,P<3&&(P=0);;)if(E=$,$=A.times(E.plus(e(M,E,x,1))),coeffToString(E.c).slice(0,P)===(b=coeffToString($.c)).slice(0,P))if($.e 0&&z>0){for(M=z%P||P,A=W.substr(0,M);M 0&&(A+=x+W.slice(M)),I&&(A="-"+A)}S=L?A+($.decimalSeparator||"")+((T=+$.fractionGroupSize)?L.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+($.fractionGroupSeparator||"")):L):A}return($.prefix||"")+S+($.suffix||"")},r.toFraction=function(g){var b,$,S,E,M,D,P,T,x,A,L,I,W=this,z=W.c;if(g!=null&&(P=new _(g),!P.isInteger()&&(P.c||P.s!==1)||P.lt(i)))throw Error(bignumberError+"Argument "+(P.isInteger()?"out of range: ":"not an integer: ")+F(P));if(!z)return new _(W);for(b=new _(i),x=$=new _(i),S=T=new _(i),I=coeffToString(z),M=b.e=I.length-W.e-1,b.c[0]=POWS_TEN[(D=M%LOG_BASE)<0?LOG_BASE+D:D],g=!g||P.comparedTo(b)>0?M>0?b:x:P,D=d,d=1/0,P=new _(I),T.c[0]=0;A=e(P,b,0,1),E=$.plus(A.times(S)),E.comparedTo(g)!=1;)$=S,S=E,x=T.plus(A.times(E=x)),T=E,b=P.minus(A.times(E=b)),P=E;return E=e(g.minus($),S,0,1),T=T.plus(E.times(x)),$=$.plus(E.times(S)),T.s=x.s=W.s,M=M*2,L=e(x,S,M,s).minus(W).abs().comparedTo(e(T,$,M,s).minus(W).abs())<1?[x,S]:[T,$],d=D,L},r.toNumber=function(){return+F(this)},r.toPrecision=function(g,b){return g!=null&&intCheck(g,1,MAX),C(this,g,b,2)},r.toString=function(g){var b,$=this,S=$.s,E=$.e;return E===null?S?(b="Infinity",S<0&&(b="-"+b)):b="NaN":(g==null?b=E<=l||E>=u?toExponential(coeffToString($.c),E):toFixedPoint(coeffToString($.c),E,"0"):g===10&&w?($=N(new _($),o+E+1,s),b=toFixedPoint(coeffToString($.c),$.e,"0")):(intCheck(g,2,y.length,"Base"),b=a(toFixedPoint(coeffToString($.c),E,"0"),10,g,S,!0)),S<0&&$.c[0]&&(b="-"+b)),b},r.valueOf=r.toJSON=function(){return F(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,t!=null&&_.set(t),_}function bitFloor(t){var e=t|0;return t>0||t===e?e:e-1}function coeffToString(t){for(var e,a,n=1,r=t.length,i=t[0]+"";n u^a?1:-1;for(s=(l=r.length)<(u=i.length)?l:u,o=0;o i[o]^a?1:-1;return l==u?0:l>u^a?1:-1}function intCheck(t,e,a,n){if(ta||t!==mathfloor(t))throw Error(bignumberError+(n||"Argument")+(typeof t=="number"?t a?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function isOdd(t){var e=t.c.length-1;return bitFloor(t.e/LOG_BASE)==e&&t.c[e]%2!=0}function toExponential(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function toFixedPoint(t,e,a){var n,r;if(e<0){for(r=a+".";++e;r+=a);t=r+t}else if(n=t.length,++e>n){for(r=a,e-=n;--e;r+=a);t+=r}else e MAX_SAFE_INTEGER)return a;do e%2&&(a+=t),e=nativeFloor(e/2),e&&(t+=t);while(e);return a}var _baseRepeat=baseRepeat$1,isFunction=isFunction_1,isLength$1=isLength_1;function isArrayLike$4(t){return t!=null&&isLength$1(t.length)&&!isFunction(t)}var isArrayLike_1=isArrayLike$4,eq$1=eq_1,isArrayLike$3=isArrayLike_1,isIndex$1=_isIndex,isObject$2=isObject_1;function isIterateeCall$3(t,e,a){if(!isObject$2(a))return!1;var n=typeof e;return(n=="number"?isArrayLike$3(a)&&isIndex$1(e,a.length):n=="string"&&e in a)?eq$1(a[e],t):!1}var _isIterateeCall=isIterateeCall$3,reWhitespace=/\s/;function trimmedEndIndex$1(t){for(var e=t.length;e--&&reWhitespace.test(t.charAt(e)););return e}var _trimmedEndIndex=trimmedEndIndex$1,trimmedEndIndex=_trimmedEndIndex,reTrimStart=/^\s+/;function baseTrim$1(t){return t&&t.slice(0,trimmedEndIndex(t)+1).replace(reTrimStart,"")}var _baseTrim=baseTrim$1,baseTrim=_baseTrim,isObject$1=isObject_1,isSymbol$1=isSymbol_1,NAN=0/0,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber$1(t){if(typeof t=="number")return t;if(isSymbol$1(t))return NAN;if(isObject$1(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=isObject$1(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=baseTrim(t);var a=reIsBinary.test(t);return a||reIsOctal.test(t)?freeParseInt(t.slice(2),a?2:8):reIsBadHex.test(t)?NAN:+t}var toNumber_1=toNumber$1,toNumber=toNumber_1,INFINITY$1=1/0,MAX_INTEGER=17976931348623157e292;function toFinite$2(t){if(!t)return t===0?t:0;if(t=toNumber(t),t===INFINITY$1||t===-INFINITY$1){var e=t<0?-1:1;return e*MAX_INTEGER}return t===t?t:0}var toFinite_1=toFinite$2,toFinite$1=toFinite_1;function toInteger$1(t){var e=toFinite$1(t),a=e%1;return e===e?a?e-a:e:0}var toInteger_1=toInteger$1,baseRepeat=_baseRepeat,isIterateeCall$2=_isIterateeCall,toInteger=toInteger_1,toString=toString_1;function repeat(t,e,a){return(a?isIterateeCall$2(t,e,a):e===void 0)?e=1:e=toInteger(e),baseRepeat(toString(t),e)}var repeat_1=repeat;const repeat$1=getDefaultExportFromCjs(repeat_1);function digitCount(t){return t.isZero()?1:Math.floor(Math.log10(t.abs().toNumber())+1)}function getAbsolutePrecision(t,{precision:e,significant:a}){return a&&e!==null&&e>0?e-digitCount(t):e}function roundNumber(t,e){const a=getAbsolutePrecision(t,e);if(a===null)return t.toString();const n=expandRoundMode(e.roundMode);if(a>=0)return t.toFixed(a,n);const r=Math.pow(10,Math.abs(a));return t=new BigNumber(t.div(r).toFixed(0,n)).times(r),t.toString()}function replaceInFormat(t,{formattedNumber:e,unit:a}){return t.replace("%n",e).replace("%u",a)}function computeSignificand({significand:t,whole:e,precision:a}){if(e==="0"||a===null)return t;const n=Math.max(0,a-e.length);return(t??"").substr(0,n)}function formatNumber(t,e){var a,n,r;const i=new BigNumber(t);if(e.raise&&!i.isFinite())throw new Error(`"${t}" is not a valid numeric value`);const o=roundNumber(i,e),s=new BigNumber(o),l=s.lt(0),u=s.isZero();let[c,d]=o.split(".");const h=[];let m;const p=(a=e.format)!==null&&a!==void 0?a:"%n",v=(n=e.negativeFormat)!==null&&n!==void 0?n:`-${p}`,y=l&&!u?v:p;for(c=c.replace("-","");c.length>0;)h.unshift(c.substr(Math.max(0,c.length-3),3)),c=c.substr(0,c.length-3);return c=h.join(""),m=h.join(e.delimiter),e.significant?d=computeSignificand({whole:c,significand:d,precision:e.precision}):d=d??repeat$1("0",(r=e.precision)!==null&&r!==void 0?r:0),e.stripInsignificantZeros&&d&&(d=d.replace(/0+$/,"")),i.isNaN()&&(m=t.toString()),d&&i.isFinite()&&(m+=(e.separator||".")+d),replaceInFormat(y,{formattedNumber:m,unit:e.unit})}function getFullScope(t,e,a){let n="";return(e instanceof String||typeof e=="string")&&(n=e),e instanceof Array&&(n=e.join(t.defaultSeparator)),a.scope&&(n=[a.scope,n].join(t.defaultSeparator)),n}function inferType(t){var e,a;if(t===null)return"null";const n=typeof t;return n!=="object"?n:((a=(e=t==null?void 0:t.constructor)===null||e===void 0?void 0:e.name)===null||a===void 0?void 0:a.toLowerCase())||"object"}function interpolate(t,e,a){a=Object.keys(a).reduce((r,i)=>(r[t.transformKey(i)]=a[i],r),{});const n=e.match(t.placeholder);if(!n)return e;for(;n.length;){let r;const i=n.shift(),o=i.replace(t.placeholder,"$1");isSet(a[o])?r=a[o].toString().replace(/\$/gm,"_#$#_"):o in a?r=t.nullPlaceholder(t,i,e,a):r=t.missingPlaceholder(t,i,e,a);const s=new RegExp(i.replace(/\{/gm,"\\{").replace(/\}/gm,"\\}"));e=e.replace(s,r)}return e.replace(/_#\$#_/g,"$")}function lookup(t,e,a={}){a=Object.assign({},a);const n="locale"in a?a.locale:t.locale,r=inferType(n),i=t.locales.get(r==="string"?n:typeof n).slice();e=getFullScope(t,e,a).split(t.defaultSeparator).map(s=>t.transformKey(s)).join(".");const o=i.map(s=>get$2(t.translations,[s,e].join(".")));return o.push(a.defaultValue),o.find(s=>isSet(s))}function numberToDelimited(t,e){const a=new BigNumber(t);if(!a.isFinite())return t.toString();if(!e.delimiterPattern.global)throw new Error(`options.delimiterPattern must be a global regular expression; received ${e.delimiterPattern}`);let[n,r]=a.toString().split(".");return n=n.replace(e.delimiterPattern,i=>`${i}${e.delimiter}`),[n,r].filter(Boolean).join(e.separator)}function arrayPush$2(t,e){for(var a=-1,n=e.length,r=t.length;++a 0&&a(s)?e>1?baseFlatten$2(s,e-1,a,n,r):arrayPush$1(r,s):n||(r[r.length]=s)}return r}var _baseFlatten=baseFlatten$2,ListCache$2=_ListCache;function stackClear$1(){this.__data__=new ListCache$2,this.size=0}var _stackClear=stackClear$1;function stackDelete$1(t){var e=this.__data__,a=e.delete(t);return this.size=e.size,a}var _stackDelete=stackDelete$1;function stackGet$1(t){return this.__data__.get(t)}var _stackGet=stackGet$1;function stackHas$1(t){return this.__data__.has(t)}var _stackHas=stackHas$1,ListCache$1=_ListCache,Map$2=_Map,MapCache=_MapCache,LARGE_ARRAY_SIZE=200;function stackSet$1(t,e){var a=this.__data__;if(a instanceof ListCache$1){var n=a.__data__;if(!Map$2||n.length s))return!1;var u=i.get(t),c=i.get(e);if(u&&c)return u==e&&c==t;var d=-1,h=!0,m=a&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(i.set(t,e),i.set(e,t);++d e||i&&o&&l&&!s&&!u||n&&o&&l||!a&&l||!r)return 1;if(!n&&!i&&!u&&t=s)return l;var u=a[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}var _compareMultiple=compareMultiple$1,arrayMap=_arrayMap,baseGet=_baseGet,baseIteratee=_baseIteratee,baseMap=_baseMap,baseSortBy=_baseSortBy,baseUnary=_baseUnary,compareMultiple=_compareMultiple,identity$2=identity_1,isArray=isArray_1;function baseOrderBy$1(t,e,a){e.length?e=arrayMap(e,function(i){return isArray(i)?function(o){return baseGet(o,i.length===1?i[0]:i)}:i}):e=[identity$2];var n=-1;e=arrayMap(e,baseUnary(baseIteratee));var r=baseMap(t,function(i,o,s){var l=arrayMap(e,function(u){return u(i)});return{criteria:l,index:++n,value:i}});return baseSortBy(r,function(i,o){return compareMultiple(i,o,a)})}var _baseOrderBy=baseOrderBy$1;function apply$1(t,e,a){switch(a.length){case 0:return t.call(e);case 1:return t.call(e,a[0]);case 2:return t.call(e,a[0],a[1]);case 3:return t.call(e,a[0],a[1],a[2])}return t.apply(e,a)}var _apply=apply$1,apply=_apply,nativeMax$1=Math.max;function overRest$1(t,e,a){return e=nativeMax$1(e===void 0?t.length-1:e,0),function(){for(var n=arguments,r=-1,i=nativeMax$1(n.length-e,0),o=Array(i);++r0){if(++e>=HOT_COUNT)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var _shortOut=shortOut$1,baseSetToString=_baseSetToString,shortOut=_shortOut,setToString$1=shortOut(baseSetToString),_setToString=setToString$1,identity=identity_1,overRest=_overRest,setToString=_setToString;function baseRest$1(t,e){return setToString(overRest(t,e,identity),t+"")}var _baseRest=baseRest$1,baseFlatten$1=_baseFlatten,baseOrderBy=_baseOrderBy,baseRest=_baseRest,isIterateeCall$1=_isIterateeCall,sortBy=baseRest(function(t,e){if(t==null)return[];var a=e.length;return a>1&&isIterateeCall$1(t,e[0],e[1])?e=[]:a>2&&isIterateeCall$1(e[0],e[1],e[2])&&(e=[e[0]]),baseOrderBy(t,baseFlatten$1(e,1),[])}),sortBy_1=sortBy;const sortBy$1=getDefaultExportFromCjs(sortBy_1);function baseZipObject$1(t,e,a){for(var n=-1,r=t.length,i=e.length,o={};++n parseInt(t,10)));function numberToHuman(t,e,a){const n={roundMode:a.roundMode,precision:a.precision,significant:a.significant};let r;if(inferType(a.units)==="string"){const d=a.units;if(r=lookup(t,d),!r)throw new Error(`The scope "${t.locale}${t.defaultSeparator}${getFullScope(t,d,{})}" couldn't be found`)}else r=a.units;let i=roundNumber(new BigNumber(e),n);const o=d=>sortBy$1(Object.keys(d).map(h=>INVERTED_DECIMAL_UNITS[h]),h=>h*-1),s=(d,h)=>{const m=d.isZero()?0:Math.floor(Math.log10(d.abs().toNumber()));return o(h).find(p=>m>=p)||0},l=(d,h)=>{const m=DECIMAL_UNITS[h.toString()];return d[m]||""},u=s(new BigNumber(i),r),c=l(r,u);if(i=roundNumber(new BigNumber(i).div(Math.pow(10,u)),n),a.stripInsignificantZeros){let[d,h]=i.split(".");h=(h||"").replace(/0+$/,""),i=d,h&&(i+=`${a.separator}${h}`)}return a.format.replace("%n",i||"0").replace("%u",c).trim()}const STORAGE_UNITS=["byte","kb","mb","gb","tb","pb","eb"];function numberToHumanSize(t,e,a){const n=expandRoundMode(a.roundMode),r=1024,i=new BigNumber(e).abs(),o=i.lt(r);let s;const l=(p,v)=>{const y=v.length-1,w=new BigNumber(Math.log(p.toNumber())).div(Math.log(r)).integerValue(BigNumber.ROUND_DOWN).toNumber();return Math.min(y,w)},u=p=>`number.human.storage_units.units.${o?"byte":p[c]}`,c=l(i,STORAGE_UNITS);o?s=i.integerValue():s=new BigNumber(roundNumber(i.div(Math.pow(r,c)),{significant:a.significant,precision:a.precision,roundMode:a.roundMode}));const d=t.translate("number.human.storage_units.format",{defaultValue:"%n %u"}),h=t.translate(u(STORAGE_UNITS),{count:i.integerValue().toNumber()});let m=s.toFixed(a.precision,n);return a.stripInsignificantZeros&&(m=m.replace(/(\..*?)0+$/,"$1").replace(/\.$/,"")),d.replace("%n",m).replace("%u",h)}function parseDate(t){if(t instanceof Date)return t;if(typeof t=="number"){const n=new Date;return n.setTime(t),n}const e=new String(t).match(/(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{2}):(\d{2}):(\d{2})(?:[.,](\d{1,3}))?)?(Z|\+00:?00)?/);if(e){const n=e.slice(1,8).map(h=>parseInt(h,10)||0);n[1]-=1;const[r,i,o,s,l,u,c]=n;return e[8]?new Date(Date.UTC(r,i,o,s,l,u,c)):new Date(r,i,o,s,l,u,c)}t.match(/([A-Z][a-z]{2}) ([A-Z][a-z]{2}) (\d+) (\d+:\d+:\d+) ([+-]\d+) (\d+)/)&&new Date().setTime(Date.parse([RegExp.$1,RegExp.$2,RegExp.$3,RegExp.$6,RegExp.$4,RegExp.$5].join(" ")));const a=new Date;return a.setTime(Date.parse(t)),a}function pluralize({i18n:t,count:e,scope:a,options:n,baseScope:r}){n=Object.assign({},n);let i,o;if(typeof a=="object"&&a?i=a:i=lookup(t,a,n),!i)return t.missingTranslation.get(a,n);const l=t.pluralization.get(n.locale)(t,e),u=[];for(;l.length;){const c=l.shift();if(isSet(i[c])){o=i[c];break}u.push(c)}return isSet(o)?(n.count=e,t.interpolate(t,o,n)):t.missingTranslation.get(r.split(t.defaultSeparator).concat([u[0]]),n)}var baseFlatten=_baseFlatten,INFINITY=1/0;function flattenDeep(t){var e=t==null?0:t.length;return e?baseFlatten(t,INFINITY):[]}var flattenDeep_1=flattenDeep;const flattenDeep$1=getDefaultExportFromCjs(flattenDeep_1);class PropertyFlatList{constructor(e){this.target=e}call(){const e=flattenDeep$1(Object.keys(this.target).map(a=>this.compute(this.target[a],a)));return e.sort(),e}compute(e,a){return!Array.isArray(e)&&isObject$7(e)?Object.keys(e).map(n=>this.compute(e[n],`${a}.${n}`)):a}}function propertyFlatList(t){return new PropertyFlatList(t).call()}const DEFAULT_OPTIONS={meridian:{am:"AM",pm:"PM"},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:[null,"January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]};function strftime(t,e,a={}){const{abbrDayNames:n,dayNames:r,abbrMonthNames:i,monthNames:o,meridian:s}=Object.assign(Object.assign({},DEFAULT_OPTIONS),a);if(isNaN(t.getTime()))throw new Error("strftime() requires a valid date object, but received an invalid date.");const l=t.getDay(),u=t.getDate(),c=t.getFullYear(),d=t.getMonth()+1,h=t.getHours();let m=h;const p=h>11?"pm":"am",v=t.getSeconds(),y=t.getMinutes(),w=t.getTimezoneOffset(),_=Math.floor(Math.abs(w/60)),C=Math.abs(w)-_*60,O=(w>0?"-":"+")+(_.toString().length<2?"0"+_:_)+(C.toString().length<2?"0"+C:C);return m>12?m=m-12:m===0&&(m=12),e=e.replace("%a",n[l]),e=e.replace("%A",r[l]),e=e.replace("%b",i[d]),e=e.replace("%B",o[d]),e=e.replace("%d",u.toString().padStart(2,"0")),e=e.replace("%e",u.toString()),e=e.replace("%-d",u.toString()),e=e.replace("%H",h.toString().padStart(2,"0")),e=e.replace("%-H",h.toString()),e=e.replace("%k",h.toString()),e=e.replace("%I",m.toString().padStart(2,"0")),e=e.replace("%-I",m.toString()),e=e.replace("%l",m.toString()),e=e.replace("%m",d.toString().padStart(2,"0")),e=e.replace("%-m",d.toString()),e=e.replace("%M",y.toString().padStart(2,"0")),e=e.replace("%-M",y.toString()),e=e.replace("%p",s[p]),e=e.replace("%P",s[p].toLowerCase()),e=e.replace("%S",v.toString().padStart(2,"0")),e=e.replace("%-S",v.toString()),e=e.replace("%w",l.toString()),e=e.replace("%y",c.toString().padStart(2,"0").substr(-2)),e=e.replace("%-y",c.toString().padStart(2,"0").substr(-2).replace(/^0+/,"")),e=e.replace("%Y",c.toString()),e=e.replace(/%z/i,O),e}var nativeCeil=Math.ceil,nativeMax=Math.max;function baseRange$1(t,e,a,n){for(var r=-1,i=nativeMax(nativeCeil((e-t)/(a||1)),0),o=Array(i);i--;)o[n?i:++r]=t,t+=a;return o}var _baseRange=baseRange$1,baseRange=_baseRange,isIterateeCall=_isIterateeCall,toFinite=toFinite_1;function createRange$1(t){return function(e,a,n){return n&&typeof n!="number"&&isIterateeCall(e,a,n)&&(a=n=void 0),e=toFinite(e),a===void 0?(a=e,e=0):a=toFinite(a),n=n===void 0?ea>=t&&a<=e;function timeAgoInWords(t,e,a,n={}){const r=n.scope||"datetime.distance_in_words",i=(F,g=0)=>t.t(F,{count:g,scope:r});e=parseDate(e),a=parseDate(a);let o=e.getTime()/1e3,s=a.getTime()/1e3;o>s&&([e,a,o,s]=[a,e,s,o]);const l=Math.round(s-o),u=Math.round((s-o)/60),d=u/60/24,h=Math.round(u/60),m=Math.round(d),p=Math.round(m/30);if(within(0,1,u))return n.includeSeconds?within(0,4,l)?i("less_than_x_seconds",5):within(5,9,l)?i("less_than_x_seconds",10):within(10,19,l)?i("less_than_x_seconds",20):within(20,39,l)?i("half_a_minute"):within(40,59,l)?i("less_than_x_minutes",1):i("x_minutes",1):u===0?i("less_than_x_minutes",1):i("x_minutes",u);if(within(2,44,u))return i("x_minutes",u);if(within(45,89,u))return i("about_x_hours",1);if(within(90,1439,u))return i("about_x_hours",h);if(within(1440,2519,u))return i("x_days",1);if(within(2520,43199,u))return i("x_days",m);if(within(43200,86399,u))return i("about_x_months",Math.round(u/43200));if(within(86400,525599,u))return i("x_months",p);let v=e.getFullYear();e.getMonth()+1>=3&&(v+=1);let y=a.getFullYear();a.getMonth()+1<3&&(y-=1);const w=v>y?0:range$1(v,y).filter(F=>new Date(F,1,29).getMonth()==1).length,_=525600,C=w*1440,O=u-C,k=Math.trunc(O/_),N=parseFloat((O/_-k).toPrecision(3));return N<.25?i("about_x_years",k):N<.75?i("over_x_years",k):i("almost_x_years",k+1)}const guessStrategy=function(t,e){e instanceof Array&&(e=e.join(t.defaultSeparator));const a=e.split(t.defaultSeparator).slice(-1)[0];return t.missingTranslationPrefix+a.replace("_"," ").replace(/([a-z])([A-Z])/g,(n,r,i)=>`${r} ${i.toLowerCase()}`)},messageStrategy=(t,e,a)=>{const n=getFullScope(t,e,a),r="locale"in a?a.locale:t.locale,i=inferType(r);return`[missing "${[i=="string"?r:i,n].join(t.defaultSeparator)}" translation]`},errorStrategy=(t,e,a)=>{const n=getFullScope(t,e,a),r=[t.locale,n].join(t.defaultSeparator);throw new Error(`Missing translation: ${r}`)};class MissingTranslation{constructor(e){this.i18n=e,this.registry={},this.register("guess",guessStrategy),this.register("message",messageStrategy),this.register("error",errorStrategy)}register(e,a){this.registry[e]=a}get(e,a){var n;return this.registry[(n=a.missingBehavior)!==null&&n!==void 0?n:this.i18n.missingBehavior](this.i18n,e,a)}}var __awaiter=globalThis&&globalThis.__awaiter||function(t,e,a,n){function r(i){return i instanceof a?i:new a(function(o){o(i)})}return new(a||(a=Promise))(function(i,o){function s(c){try{u(n.next(c))}catch(d){o(d)}}function l(c){try{u(n.throw(c))}catch(d){o(d)}}function u(c){c.done?i(c.value):r(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})};const DEFAULT_I18N_OPTIONS={defaultLocale:"en",availableLocales:["en"],locale:"en",defaultSeparator:".",placeholder:/(?:\{\{|%\{)(.*?)(?:\}\}?)/gm,enableFallback:!1,missingBehavior:"message",missingTranslationPrefix:"",missingPlaceholder:(t,e)=>`[missing "${e}" value]`,nullPlaceholder:(t,e,a,n)=>t.missingPlaceholder(t,e,a,n),transformKey:t=>t};class I18n{constructor(e={},a={}){this._locale=DEFAULT_I18N_OPTIONS.locale,this._defaultLocale=DEFAULT_I18N_OPTIONS.defaultLocale,this._version=0,this.onChangeHandlers=[],this.translations={},this.availableLocales=[],this.t=this.translate,this.p=this.pluralize,this.l=this.localize,this.distanceOfTimeInWords=this.timeAgoInWords;const{locale:n,enableFallback:r,missingBehavior:i,missingTranslationPrefix:o,missingPlaceholder:s,nullPlaceholder:l,defaultLocale:u,defaultSeparator:c,placeholder:d,transformKey:h}=Object.assign(Object.assign({},DEFAULT_I18N_OPTIONS),a);this.locale=n,this.defaultLocale=u,this.defaultSeparator=c,this.enableFallback=r,this.locale=n,this.missingBehavior=i,this.missingTranslationPrefix=o,this.missingPlaceholder=s,this.nullPlaceholder=l,this.placeholder=d,this.pluralization=new Pluralization(this),this.locales=new Locales(this),this.missingTranslation=new MissingTranslation(this),this.transformKey=h,this.interpolate=interpolate,this.store(e)}store(e){propertyFlatList(e).forEach(n=>setWith$1(this.translations,n,get$2(e,n),Object)),this.hasChanged()}get locale(){return this._locale||this.defaultLocale||"en"}set locale(e){if(typeof e!="string")throw new Error(`Expected newLocale to be a string; got ${inferType(e)}`);const a=this._locale!==e;this._locale=e,a&&this.hasChanged()}get defaultLocale(){return this._defaultLocale||"en"}set defaultLocale(e){if(typeof e!="string")throw new Error(`Expected newLocale to be a string; got ${inferType(e)}`);const a=this._defaultLocale!==e;this._defaultLocale=e,a&&this.hasChanged()}translate(e,a){a=Object.assign({},a);const n=createTranslationOptions(this,e,a);let r;return n.some(o=>(isSet(o.scope)?r=lookup(this,o.scope,a):isSet(o.message)&&(r=o.message),r!=null))?(typeof r=="string"?r=this.interpolate(this,r,a):typeof r=="object"&&r&&isSet(a.count)&&(r=pluralize({i18n:this,count:a.count||0,scope:r,options:a,baseScope:getFullScope(this,e,a)})),a&&r instanceof Array&&(r=r.map(o=>typeof o=="string"?interpolate(this,o,a):o)),r):this.missingTranslation.get(e,a)}pluralize(e,a,n){return pluralize({i18n:this,count:e,scope:a,options:Object.assign({},n),baseScope:getFullScope(this,a,n??{})})}localize(e,a,n){if(n=Object.assign({},n),a==null)return"";switch(e){case"currency":return this.numberToCurrency(a);case"number":return formatNumber(a,Object.assign({delimiter:",",precision:3,separator:".",significant:!1,stripInsignificantZeros:!1},lookup(this,"number.format")));case"percentage":return this.numberToPercentage(a);default:{let r;return e.match(/^(date|time)/)?r=this.toTime(e,a):r=a.toString(),interpolate(this,r,n)}}}toTime(e,a){const n=parseDate(a),r=lookup(this,e);return n.toString().match(/invalid/i)||!r?n.toString():this.strftime(n,r)}numberToCurrency(e,a={}){return formatNumber(e,Object.assign(Object.assign(Object.assign({delimiter:",",format:"%u%n",precision:2,separator:".",significant:!1,stripInsignificantZeros:!1,unit:"$"},camelCaseKeys(this.get("number.format"))),camelCaseKeys(this.get("number.currency.format"))),a))}numberToPercentage(e,a={}){return formatNumber(e,Object.assign(Object.assign(Object.assign({delimiter:"",format:"%n%",precision:3,stripInsignificantZeros:!1,separator:".",significant:!1},camelCaseKeys(this.get("number.format"))),camelCaseKeys(this.get("number.percentage.format"))),a))}numberToHumanSize(e,a={}){return numberToHumanSize(this,e,Object.assign(Object.assign(Object.assign({delimiter:"",precision:3,significant:!0,stripInsignificantZeros:!0,units:{billion:"Billion",million:"Million",quadrillion:"Quadrillion",thousand:"Thousand",trillion:"Trillion",unit:""}},camelCaseKeys(this.get("number.human.format"))),camelCaseKeys(this.get("number.human.storage_units"))),a))}numberToHuman(e,a={}){return numberToHuman(this,e,Object.assign(Object.assign(Object.assign({delimiter:"",separator:".",precision:3,significant:!0,stripInsignificantZeros:!0,format:"%n %u",roundMode:"default",units:{billion:"Billion",million:"Million",quadrillion:"Quadrillion",thousand:"Thousand",trillion:"Trillion",unit:""}},camelCaseKeys(this.get("number.human.format"))),camelCaseKeys(this.get("number.human.decimal_units"))),a))}numberToRounded(e,a){return formatNumber(e,Object.assign({unit:"",precision:3,significant:!1,separator:".",delimiter:"",stripInsignificantZeros:!1},a))}numberToDelimited(e,a={}){return numberToDelimited(e,Object.assign({delimiterPattern:/(\d)(?=(\d\d\d)+(?!\d))/g,delimiter:",",separator:"."},a))}withLocale(e,a){return __awaiter(this,void 0,void 0,function*(){const n=this.locale;try{this.locale=e,yield a()}finally{this.locale=n}})}strftime(e,a,n={}){return strftime(e,a,Object.assign(Object.assign(Object.assign({},camelCaseKeys(lookup(this,"date"))),{meridian:{am:lookup(this,"time.am")||"AM",pm:lookup(this,"time.pm")||"PM"}}),n))}update(e,a,n={strict:!1}){if(n.strict&&!has$1(this.translations,e))throw new Error(`The path "${e}" is not currently defined`);const r=get$2(this.translations,e),i=inferType(r),o=inferType(a);if(n.strict&&i!==o)throw new Error(`The current type for "${e}" is "${i}", but you're trying to override it with "${o}"`);let s;o==="object"?s=Object.assign(Object.assign({},r),a):s=a,set$1(this.translations,e,s),this.hasChanged()}toSentence(e,a={}){const{wordsConnector:n,twoWordsConnector:r,lastWordConnector:i}=Object.assign(Object.assign({wordsConnector:", ",twoWordsConnector:" and ",lastWordConnector:", and "},camelCaseKeys(lookup(this,"support.array"))),a),o=e.length;switch(o){case 0:return"";case 1:return`${e[0]}`;case 2:return e.join(r);default:return[e.slice(0,o-1).join(n),i,e[o-1]].join("")}}timeAgoInWords(e,a,n={}){return timeAgoInWords(this,e,a,n)}onChange(e){return this.onChangeHandlers.push(e),()=>{this.onChangeHandlers.splice(this.onChangeHandlers.indexOf(e),1)}}get version(){return this._version}formatNumber(e,a){return formatNumber(e,a)}get(e){return lookup(this,e)}runCallbacks(){this.onChangeHandlers.forEach(e=>e(this))}hasChanged(){this._version+=1,this.runCallbacks()}}async function loadTranslations(t,e){{const n=await(await fetch(`./v2/i18n/${e}.json`)).json();t.store(n)}}let currencies$1=[],chart$2=null,chartData$1=null,afterPromises$4=!1,i18n$3;const budgets=()=>({loading:!1,autoConversion:!1,loadChart(){if(this.loading!==!0){if(this.loading=!0,chartData$1!==null){this.drawChart(this.generateOptions(chartData$1)),this.loading=!1;return}this.getFreshData()}},drawChart(t){if(chart$2!==null){chart$2.data.datasets=t.data.datasets,chart$2.update();return}chart$2=new Chart(document.querySelector("#budget-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey("dashboard-budgets-chart",t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){chartData$1=r,this.drawChart(this.generateOptions(chartData$1)),this.loading=!1;return}new Dashboard$1().dashboard(t,e,null).then(o=>{chartData$1=o.data,this.drawChart(this.generateOptions(chartData$1)),window.store.set(a,chartData$1),this.loading=!1})},generateOptions(t){currencies$1=[];let e=getDefaultChartSettings("column");e.options.locale=window.store.get("locale").replace("_","-"),e.options.plugins={tooltip:{callbacks:{title:function(a){return a.label},label:function(a){let n=a.dataset.label||"";return n&&(n+=": "),n+" "+formatMoney(a.parsed.y,currencies$1[a.parsed.x]??"EUR")}}}},e.data={labels:[],datasets:[{label:i18n$3.t("firefly.spent"),data:[],borderWidth:1,stack:1,backgroundColor:getColors("spent","background"),borderColor:getColors("spent","border")},{label:i18n$3.t("firefly.left"),data:[],borderWidth:1,stack:1,backgroundColor:getColors("left","background"),borderColor:getColors("left","border")},{label:i18n$3.t("firefly.overspent"),data:[],borderWidth:1,stack:1,backgroundColor:getColors("overspent","background"),borderColor:getColors("overspent","border")}]};for(const a in t)if(t.hasOwnProperty(a)){let n=t[a],r=n.label+" ("+n.currency_code+")";e.data.labels.push(r),this.autoConversion&&(currencies$1.push(n.native_currency_code),e.data.datasets[0].data.push(parseFloat(n.native_entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(n.native_entries.left)),e.data.datasets[2].data.push(parseFloat(n.native_entries.overspent))),this.autoConversion||(currencies$1.push(n.currency_code),e.data.datasets[0].data.push(parseFloat(n.entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(n.entries.left)),e.data.datasets[2].data.push(parseFloat(n.entries.overspent)))}return e.options.scales={y:{ticks:{callback:function(a){return formatMoney(a,currencies$1[0]??"EUR")}}}},e},init(){Promise.all([getVariable("autoConversion",!1),getVariable("language","en-US")]).then(t=>{i18n$3=new I18n,i18n$3.locale=t[1],loadTranslations(i18n$3,t[1]).then(()=>{this.autoConversion=t[0],afterPromises$4=!0,this.loading===!1&&this.loadChart()})}),window.store.observe("end",()=>{afterPromises$4&&this.loading===!1&&(chartData$1=null,this.loadChart())}),window.store.observe("autoConversion",t=>{afterPromises$4&&(this.autoConversion=t,this.loading===!1&&this.loadChart())})}});class Dashboard{dashboard(e,a){let n=format$1(e,"y-MM-dd"),r=format$1(a,"y-MM-dd");return api.get("/api/v2/chart/category/dashboard",{params:{start:n,end:r}})}}let currencies=[],chart$1=null,chartData=null,afterPromises$3=!1;const categories=()=>({loading:!1,autoConversion:!1,generateOptions(t){currencies=[];let e=getDefaultChartSettings("column"),a={};for(const r in t)if(t.hasOwnProperty(r)){let i=t[r],o=i.currency_code;this.autoConversion&&(o=i.native_currency_code),a.hasOwnProperty(o)||(a[o]={name:o,yAxisID:"",data:{}},currencies.push(o))}for(const r in t)if(t.hasOwnProperty(r)){let i=t[r],o=i.currency_code;this.autoConversion&&(o=i.native_currency_code);for(const s in a)if(a.hasOwnProperty(s)){let l=0;o===s&&(l=parseFloat(i.amount),""+i.currency_code,this.autoConversion&&(l=parseFloat(i.native_amount),""+i.native_currency_code)),a[s].data.hasOwnProperty(i.label)&&(a[s].data[i.label]=a[s].data[i.label]+l),a[s].data.hasOwnProperty(i.label)||(a[s].data[i.label]=l)}e.data.labels.includes(i.label)||e.data.labels.push(i.label)}let n=0;for(const r in a){let i="y"+r,o={label:r,currency_code:r,yAxisID:i,data:[]};for(const s in a[r].data)o.data.push(a[r].data[s]);e.data.datasets.push(o),e.options.scales.hasOwnProperty(i)||(e.options.scales[i]={beginAtZero:!0,type:"linear",position:n===1?"right":"left",ticks:{callback:function(s,l,u){return formatMoney(s,r)}}},n++)}return e},drawChart(t){if(chart$1!==null){chart$1.options=t.options,chart$1.data=t.data,chart$1.update();return}chart$1=new Chart(document.querySelector("#category-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey("dashboard-categories-chart",t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){chartData=r,this.drawChart(this.generateOptions(chartData)),this.loading=!1;return}new Dashboard().dashboard(t,e,null).then(o=>{chartData=o.data,this.drawChart(this.generateOptions(o.data)),window.store.set(a,chartData),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,chartData!==null){this.drawChart(this.generateOptions(chartData)),this.loading=!1;return}this.getFreshData()}},init(){Promise.all([getVariable("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],afterPromises$3=!0,this.loadChart()}),window.store.observe("end",()=>{afterPromises$3&&(this.chartData=null,this.loadChart())}),window.store.observe("autoConversion",t=>{afterPromises$3&&(this.autoConversion=t,this.loadChart())})}});let Get$2=class{get(e){return api.get("/api/v2/transactions",{params:e})}};/*! +`):t}function createTooltipItem(t,e){const{element:a,datasetIndex:n,index:r}=e,i=t.getDatasetMeta(n).controller,{label:o,value:s}=i.getLabelAndValue(r);return{chart:t,label:o,parsed:i.getParsed(r),raw:t.data.datasets[n].data[r],formattedValue:s,dataset:i.getDataset(),dataIndex:r,datasetIndex:n,element:a}}function getTooltipSize(t,e){const a=t.chart.ctx,{body:n,footer:r,title:i}=t,{boxWidth:o,boxHeight:s}=e,l=toFont(e.bodyFont),u=toFont(e.titleFont),c=toFont(e.footerFont),d=i.length,h=r.length,m=n.length,p=toPadding(e.padding);let v=p.height,y=0,w=n.reduce((O,k)=>O+k.before.length+k.lines.length+k.after.length,0);if(w+=t.beforeBody.length+t.afterBody.length,d&&(v+=d*u.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),w){const O=e.displayColors?Math.max(s,l.lineHeight):l.lineHeight;v+=m*O+(w-m)*l.lineHeight+(w-1)*e.bodySpacing}h&&(v+=e.footerMarginTop+h*c.lineHeight+(h-1)*e.footerSpacing);let _=0;const C=function(O){y=Math.max(y,a.measureText(O).width+_)};return a.save(),a.font=u.string,each(t.title,C),a.font=l.string,each(t.beforeBody.concat(t.afterBody),C),_=e.displayColors?o+2+e.boxPadding:0,each(n,O=>{each(O.before,C),each(O.lines,C),each(O.after,C)}),_=0,a.font=c.string,each(t.footer,C),a.restore(),y+=p.width,{width:y,height:v}}function determineYAlign(t,e){const{y:a,height:n}=e;return a t.height-n/2?"bottom":"center"}function doesNotFitWithAlign(t,e,a,n){const{x:r,width:i}=n,o=a.caretSize+a.caretPadding;if(t==="left"&&r+i+o>e.width||t==="right"&&r-i-o<0)return!0}function determineXAlign(t,e,a,n){const{x:r,width:i}=a,{width:o,chartArea:{left:s,right:l}}=t;let u="center";return n==="center"?u=r<=(s+l)/2?"left":"right":r<=i/2?u="left":r>=o-i/2&&(u="right"),doesNotFitWithAlign(u,t,e,a)&&(u="center"),u}function determineAlignment(t,e,a){const n=a.yAlign||e.yAlign||determineYAlign(t,a);return{xAlign:a.xAlign||e.xAlign||determineXAlign(t,e,a,n),yAlign:n}}function alignX(t,e){let{x:a,width:n}=t;return e==="right"?a-=n:e==="center"&&(a-=n/2),a}function alignY(t,e,a){let{y:n,height:r}=t;return e==="top"?n+=a:e==="bottom"?n-=r+a:n-=r/2,n}function getBackgroundPoint(t,e,a,n){const{caretSize:r,caretPadding:i,cornerRadius:o}=t,{xAlign:s,yAlign:l}=a,u=r+i,{topLeft:c,topRight:d,bottomLeft:h,bottomRight:m}=toTRBLCorners(o);let p=alignX(e,s);const v=alignY(e,l,u);return l==="center"?s==="left"?p+=u:s==="right"&&(p-=u):s==="left"?p-=Math.max(c,h)+r:s==="right"&&(p+=Math.max(d,m)+r),{x:_limitValue(p,0,n.width-e.width),y:_limitValue(v,0,n.height-e.height)}}function getAlignedX(t,e,a){const n=toPadding(a.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-n.right:t.x+n.left}function getBeforeAfterBodyLines(t){return pushOrConcat([],splitNewlines(t))}function createTooltipContext(t,e,a){return createContext(t,{tooltip:e,tooltipItems:a,type:"tooltip"})}function overrideCallbacks(t,e){const a=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return a?t.override(a):t}const defaultCallbacks={beforeTitle:noop$2,title(t){if(t.length>0){const e=t[0],a=e.chart.data.labels,n=a?a.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex "u"?defaultCallbacks[e].call(a,n):r}class Tooltip extends Element$1{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const a=this.chart,n=this.options.setContext(this.getContext()),r=n.enabled&&a.options.animation&&n.animations,i=new Animations(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=createTooltipContext(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,a){const{callbacks:n}=a,r=invokeCallbackWithFallback(n,"beforeTitle",this,e),i=invokeCallbackWithFallback(n,"title",this,e),o=invokeCallbackWithFallback(n,"afterTitle",this,e);let s=[];return s=pushOrConcat(s,splitNewlines(r)),s=pushOrConcat(s,splitNewlines(i)),s=pushOrConcat(s,splitNewlines(o)),s}getBeforeBody(e,a){return getBeforeAfterBodyLines(invokeCallbackWithFallback(a.callbacks,"beforeBody",this,e))}getBody(e,a){const{callbacks:n}=a,r=[];return each(e,i=>{const o={before:[],lines:[],after:[]},s=overrideCallbacks(n,i);pushOrConcat(o.before,splitNewlines(invokeCallbackWithFallback(s,"beforeLabel",this,i))),pushOrConcat(o.lines,invokeCallbackWithFallback(s,"label",this,i)),pushOrConcat(o.after,splitNewlines(invokeCallbackWithFallback(s,"afterLabel",this,i))),r.push(o)}),r}getAfterBody(e,a){return getBeforeAfterBodyLines(invokeCallbackWithFallback(a.callbacks,"afterBody",this,e))}getFooter(e,a){const{callbacks:n}=a,r=invokeCallbackWithFallback(n,"beforeFooter",this,e),i=invokeCallbackWithFallback(n,"footer",this,e),o=invokeCallbackWithFallback(n,"afterFooter",this,e);let s=[];return s=pushOrConcat(s,splitNewlines(r)),s=pushOrConcat(s,splitNewlines(i)),s=pushOrConcat(s,splitNewlines(o)),s}_createItems(e){const a=this._active,n=this.chart.data,r=[],i=[],o=[];let s=[],l,u;for(l=0,u=a.length;le.filter(c,d,h,n))),e.itemSort&&(s=s.sort((c,d)=>e.itemSort(c,d,n))),each(s,c=>{const d=overrideCallbacks(e.callbacks,c);r.push(invokeCallbackWithFallback(d,"labelColor",this,c)),i.push(invokeCallbackWithFallback(d,"labelPointStyle",this,c)),o.push(invokeCallbackWithFallback(d,"labelTextColor",this,c))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=o,this.dataPoints=s,s}update(e,a){const n=this.options.setContext(this.getContext()),r=this._active;let i,o=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{const s=positioners[n.position].call(this,r,this._eventPosition);o=this._createItems(n),this.title=this.getTitle(o,n),this.beforeBody=this.getBeforeBody(o,n),this.body=this.getBody(o,n),this.afterBody=this.getAfterBody(o,n),this.footer=this.getFooter(o,n);const l=this._size=getTooltipSize(this,n),u=Object.assign({},s,l),c=determineAlignment(this.chart,n,u),d=getBackgroundPoint(n,u,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,i={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:s.x,caretY:s.y}}this._tooltipItems=o,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:a})}drawCaret(e,a,n,r){const i=this.getCaretPosition(e,n,r);a.lineTo(i.x1,i.y1),a.lineTo(i.x2,i.y2),a.lineTo(i.x3,i.y3)}getCaretPosition(e,a,n){const{xAlign:r,yAlign:i}=this,{caretSize:o,cornerRadius:s}=n,{topLeft:l,topRight:u,bottomLeft:c,bottomRight:d}=toTRBLCorners(s),{x:h,y:m}=e,{width:p,height:v}=a;let y,w,_,C,O,k;return i==="center"?(O=m+v/2,r==="left"?(y=h,w=y-o,C=O+o,k=O-o):(y=h+p,w=y+o,C=O-o,k=O+o),_=y):(r==="left"?w=h+Math.max(l,c)+o:r==="right"?w=h+p-Math.max(u,d)-o:w=this.caretX,i==="top"?(C=m,O=C-o,y=w-o,_=w+o):(C=m+v,O=C+o,y=w+o,_=w-o),k=C),{x1:y,x2:w,x3:_,y1:C,y2:O,y3:k}}drawTitle(e,a,n){const r=this.title,i=r.length;let o,s,l;if(i){const u=getRtlAdapter(n.rtl,this.x,this.width);for(e.x=getAlignedX(this,n.titleAlign,n),a.textAlign=u.textAlign(n.titleAlign),a.textBaseline="middle",o=toFont(n.titleFont),s=n.titleSpacing,a.fillStyle=n.titleColor,a.font=o.string,l=0;l_!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,addRoundedRectPath(e,{x:v,y:p,w:u,h:l,radius:w}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),addRoundedRectPath(e,{x:y,y:p+1,w:u-2,h:l-2,radius:w}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(v,p,u,l),e.strokeRect(v,p,u,l),e.fillStyle=o.backgroundColor,e.fillRect(y,p+1,u-2,l-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,a,n){const{body:r}=this,{bodySpacing:i,bodyAlign:o,displayColors:s,boxHeight:l,boxWidth:u,boxPadding:c}=n,d=toFont(n.bodyFont);let h=d.lineHeight,m=0;const p=getRtlAdapter(n.rtl,this.x,this.width),v=function(g){a.fillText(g,p.x(e.x+m),e.y+h/2),e.y+=h+i},y=p.textAlign(o);let w,_,C,O,k,N,F;for(a.textAlign=o,a.textBaseline="middle",a.font=d.string,e.x=getAlignedX(this,y,n),a.fillStyle=n.bodyColor,each(this.beforeBody,v),m=s&&y!=="right"?o==="center"?u/2+c:u+2+c:0,O=0,N=r.length;O 0&&a.stroke()}_updateAnimationTarget(e){const a=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){const o=positioners[e.position].call(this,this._active,this._eventPosition);if(!o)return;const s=this._size=getTooltipSize(this,e),l=Object.assign({},o,this._size),u=determineAlignment(a,e,l),c=getBackgroundPoint(e,l,u,a);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=s.width,this.height=s.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){const a=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(a);const r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const o=toPadding(a.padding),s=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;a.enabled&&s&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,a),overrideTextDirection(e,a.textDirection),i.y+=o.top,this.drawTitle(i,e,a),this.drawBody(i,e,a),this.drawFooter(i,e,a),restoreTextDirection(e,a.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,a){const n=this._active,r=e.map(({datasetIndex:s,index:l})=>{const u=this.chart.getDatasetMeta(s);if(!u)throw new Error("Cannot find a dataset at index "+s);return{datasetIndex:s,element:u.data[l],index:l}}),i=!_elementsEqual(n,r),o=this._positionChanged(r,a);(i||o)&&(this._active=r,this._eventPosition=a,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,a,n=!0){if(a&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,i=this._active||[],o=this._getActiveElements(e,i,a,n),s=this._positionChanged(o,e),l=a||!_elementsEqual(o,i)||s;return l&&(this._active=o,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,a))),l}_getActiveElements(e,a,n,r){const i=this.options;if(e.type==="mouseout")return[];if(!r)return a;const o=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&o.reverse(),o}_positionChanged(e,a){const{caretX:n,caretY:r,options:i}=this,o=positioners[i.position].call(this,e,a);return o!==!1&&(n!==o.x||r!==o.y)}}R(Tooltip,"positioners",positioners);var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners,afterInit(t,e,a){a&&(t.tooltip=new Tooltip({chart:t,options:a}))},beforeUpdate(t,e,a){t.tooltip&&t.tooltip.initialize(a)},reset(t,e,a){t.tooltip&&t.tooltip.initialize(a)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const a={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...a,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",a)}},afterEvent(t,e){if(t.tooltip){const a=e.replay;t.tooltip.handleEvent(e.event,a,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const addIfString=(t,e,a,n)=>(typeof e=="string"?(a=t.push(e)-1,n.unshift({index:a,label:e})):isNaN(e)&&(a=null),a);function findOrAddLabel(t,e,a,n){const r=t.indexOf(e);if(r===-1)return addIfString(t,e,a,n);const i=t.lastIndexOf(e);return r!==i?a:r}const validIndex=(t,e)=>t===null?null:_limitValue(Math.round(t),0,e);function _getLabelForValue(t){const e=this.getLabels();return t>=0&&t a.length-1?null:this.getPixelForValue(a[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}R(CategoryScale,"id","category"),R(CategoryScale,"defaults",{ticks:{callback:_getLabelForValue}});function generateTicks$1(t,e){const a=[],{bounds:r,step:i,min:o,max:s,precision:l,count:u,maxTicks:c,maxDigits:d,includeBounds:h}=t,m=i||1,p=c-1,{min:v,max:y}=e,w=!isNullOrUndef(o),_=!isNullOrUndef(s),C=!isNullOrUndef(u),O=(y-v)/(d+1);let k=niceNum((y-v)/p/m)*m,N,F,g,b;if(k<1e-14&&!w&&!_)return[{value:v},{value:y}];b=Math.ceil(y/k)-Math.floor(v/k),b>p&&(k=niceNum(b*k/p/m)*m),isNullOrUndef(l)||(N=Math.pow(10,l),k=Math.ceil(k*N)/N),r==="ticks"?(F=Math.floor(v/k)*k,g=Math.ceil(y/k)*k):(F=v,g=y),w&&_&&i&&almostWhole((s-o)/i,k/1e3)?(b=Math.round(Math.min((s-o)/k,c)),k=(s-o)/b,F=o,g=s):C?(F=w?o:F,g=_?s:g,b=u-1,k=(g-F)/b):(b=(g-F)/k,almostEquals(b,Math.round(b),k/1e3)?b=Math.round(b):b=Math.ceil(b));const $=Math.max(_decimalPlaces(k),_decimalPlaces(F));N=Math.pow(10,isNullOrUndef(l)?$:l),F=Math.round(F*N)/N,g=Math.round(g*N)/N;let S=0;for(w&&(h&&F!==o?(a.push({value:o}),F s)break;a.push({value:E})}return _&&h&&g!==s?a.length&&almostEquals(a[a.length-1].value,s,relativeLabelSize(s,O,t))?a[a.length-1].value=s:a.push({value:s}):(!_||g===s)&&a.push({value:g}),a}function relativeLabelSize(t,e,{horizontal:a,minRotation:n}){const r=toRadians(n),i=(a?Math.sin(r):Math.cos(r))||.001,o=.75*e*(""+t).length;return Math.min(e/i,o)}class LinearScaleBase extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,a){return isNullOrUndef(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:a,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this;const o=l=>r=a?r:l,s=l=>i=n?i:l;if(e){const l=sign(r),u=sign(i);l<0&&u<0?s(0):l>0&&u>0&&o(0)}if(r===i){let l=i===0?1:Math.abs(i*.05);s(i+l),e||o(r-l)}this.min=r,this.max=i}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:a,stepSize:n}=e,r;return n?(r=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),a=a||11),a&&(r=Math.min(a,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,a=e.ticks;let n=this.getTickLimit();n=Math.max(2,n);const r={maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:a.precision,step:a.stepSize,count:a.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:a.minRotation||0,includeBounds:a.includeBounds!==!1},i=this._range||this,o=generateTicks$1(r,i);return e.bounds==="ticks"&&_setMinAndMaxByKey(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let a=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){const r=(n-a)/Math.max(e.length-1,1)/2;a-=r,n+=r}this._startValue=a,this._endValue=n,this._valueRange=n-a}getLabelForValue(e){return formatNumber$1(e,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{determineDataLimits(){const{min:e,max:a}=this.getMinMax(!0);this.min=isNumberFinite(e)?e:0,this.max=isNumberFinite(a)?a:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),a=e?this.width:this.height,n=toRadians(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(a/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}R(LinearScale,"id","linear"),R(LinearScale,"defaults",{ticks:{callback:Ticks.formatters.numeric}});const log10Floor=t=>Math.floor(log10(t)),changeExponent=(t,e)=>Math.pow(10,log10Floor(t)+e);function isMajor(t){return t/Math.pow(10,log10Floor(t))===1}function steps(t,e,a){const n=Math.pow(10,a),r=Math.floor(t/n);return Math.ceil(e/n)-r}function startExp(t,e){const a=e-t;let n=log10Floor(a);for(;steps(t,e,n)>10;)n++;for(;steps(t,e,n)<10;)n--;return Math.min(n,log10Floor(t))}function generateTicks(t,{min:e,max:a}){e=finiteOrDefault(t.min,e);const n=[],r=log10Floor(e);let i=startExp(e,a),o=i<0?Math.pow(10,Math.abs(i)):1;const s=Math.pow(10,i),l=r>i?Math.pow(10,r):0,u=Math.round((e-l)*o)/o,c=Math.floor((e-l)/s/10)*s*10;let d=Math.floor((u-c)/Math.pow(10,i)),h=finiteOrDefault(t.min,Math.round((l+c+d*Math.pow(10,i))*o)/o);for(;h=10?d=d<15?15:20:d++,d>=20&&(i++,d=2,o=i>=0?1:o),h=Math.round((l+c+d*Math.pow(10,i))*o)/o;const m=finiteOrDefault(t.max,h);return n.push({value:m,major:isMajor(m),significand:d}),n}class LogarithmicScale extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,a){const n=LinearScaleBase.prototype.parse.apply(this,[e,a]);if(n===0){this._zero=!0;return}return isNumberFinite(n)&&n>0?n:null}determineDataLimits(){const{min:e,max:a}=this.getMinMax(!0);this.min=isNumberFinite(e)?Math.max(0,e):null,this.max=isNumberFinite(a)?Math.max(0,a):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!isNumberFinite(this._userMin)&&(this.min=e===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:a}=this.getUserBounds();let n=this.min,r=this.max;const i=s=>n=e?n:s,o=s=>r=a?r:s;n===r&&(n<=0?(i(1),o(10)):(i(changeExponent(n,-1)),o(changeExponent(r,1)))),n<=0&&i(changeExponent(r,-1)),r<=0&&o(changeExponent(n,1)),this.min=n,this.max=r}buildTicks(){const e=this.options,a={min:this._userMin,max:this._userMax},n=generateTicks(a,this);return e.bounds==="ticks"&&_setMinAndMaxByKey(n,this,"value"),e.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(e){return e===void 0?"0":formatNumber$1(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=log10(e),this._valueRange=log10(this.max)-log10(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(log10(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const a=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+a*this._valueRange)}}R(LogarithmicScale,"id","logarithmic"),R(LogarithmicScale,"defaults",{ticks:{callback:Ticks.formatters.logarithmic,major:{enabled:!0}}});function getTickBackdropHeight(t){const e=t.ticks;if(e.display&&t.display){const a=toPadding(e.backdropPadding);return valueOrDefault(e.font&&e.font.size,defaults.font.size)+a.height}return 0}function measureLabelSize(t,e,a){return a=isArray$b(a)?a:[a],{w:_longestText(t,e.string,a),h:a.length*e.lineHeight}}function determineLimits(t,e,a,n,r){return t===n||t===r?{start:e-a/2,end:e+a/2}:t r?{start:e-a,end:e}:{start:e,end:e+a}}function fitWithPointLabels(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},a=Object.assign({},e),n=[],r=[],i=t._pointLabels.length,o=t.options.pointLabels,s=o.centerPointLabels?PI/i:0;for(let l=0;le.r&&(s=(n.end-e.r)/i,t.r=Math.max(t.r,e.r+s)),r.start e.b&&(l=(r.end-e.b)/o,t.b=Math.max(t.b,e.b+l))}function createPointLabelItem(t,e,a){const n=t.drawingArea,{extra:r,additionalAngle:i,padding:o,size:s}=a,l=t.getPointPosition(e,n+r+o,i),u=Math.round(toDegrees(_normalizeAngle(l.angle+HALF_PI))),c=yForAngle(l.y,s.h,u),d=getTextAlignForAngle(u),h=leftForTextAlign(l.x,s.w,d);return{visible:!0,x:l.x,y:c,textAlign:d,left:h,top:c,right:h+s.w,bottom:c+s.h}}function isNotOverlapped(t,e){if(!e)return!0;const{left:a,top:n,right:r,bottom:i}=t;return!(_isPointInArea({x:a,y:n},e)||_isPointInArea({x:a,y:i},e)||_isPointInArea({x:r,y:n},e)||_isPointInArea({x:r,y:i},e))}function buildPointLabelItems(t,e,a){const n=[],r=t._pointLabels.length,i=t.options,{centerPointLabels:o,display:s}=i.pointLabels,l={extra:getTickBackdropHeight(i)/2,additionalAngle:o?PI/r:0};let u;for(let c=0;c 270||a<90)&&(t-=e),t}function drawPointLabelBox(t,e,a){const{left:n,top:r,right:i,bottom:o}=a,{backdropColor:s}=e;if(!isNullOrUndef(s)){const l=toTRBLCorners(e.borderRadius),u=toPadding(e.backdropPadding);t.fillStyle=s;const c=n-u.left,d=r-u.top,h=i-n+u.width,m=o-r+u.height;Object.values(l).some(p=>p!==0)?(t.beginPath(),addRoundedRectPath(t,{x:c,y:d,w:h,h:m,radius:l}),t.fill()):t.fillRect(c,d,h,m)}}function drawPointLabels(t,e){const{ctx:a,options:{pointLabels:n}}=t;for(let r=e-1;r>=0;r--){const i=t._pointLabelItems[r];if(!i.visible)continue;const o=n.setContext(t.getPointLabelContext(r));drawPointLabelBox(a,o,i);const s=toFont(o.font),{x:l,y:u,textAlign:c}=i;renderText(a,t._pointLabels[r],l,u+s.lineHeight/2,s,{color:o.color,textAlign:c,textBaseline:"middle"})}}function pathRadiusLine(t,e,a,n){const{ctx:r}=t;if(a)r.arc(t.xCenter,t.yCenter,e,0,TAU);else{let i=t.getPointPosition(0,e);r.moveTo(i.x,i.y);for(let o=1;o {const r=callback(this.options.pointLabels.callback,[a,n],this);return r||r===0?r:""}).filter((a,n)=>this.chart.getDataVisibility(n))}fit(){const e=this.options;e.display&&e.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,a,n,r){this.xCenter+=Math.floor((e-a)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,a,n,r))}getIndexAngle(e){const a=TAU/(this._pointLabels.length||1),n=this.options.startAngle||0;return _normalizeAngle(e*a+toRadians(n))}getDistanceFromCenterForValue(e){if(isNullOrUndef(e))return NaN;const a=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*a:(e-this.min)*a}getValueForDistanceFromCenter(e){if(isNullOrUndef(e))return NaN;const a=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-a:this.min+a}getPointLabelContext(e){const a=this._pointLabels||[];if(e>=0&&e {if(d!==0){l=this.getDistanceFromCenterForValue(c.value);const h=this.getContext(d),m=r.setContext(h),p=i.setContext(h);drawRadiusLine(this,m,l,o,p)}}),n.display){for(e.save(),s=o-1;s>=0;s--){const c=n.setContext(this.getPointLabelContext(s)),{color:d,lineWidth:h}=c;!h||!d||(e.lineWidth=h,e.strokeStyle=d,e.setLineDash(c.borderDash),e.lineDashOffset=c.borderDashOffset,l=this.getDistanceFromCenterForValue(a.ticks.reverse?this.min:this.max),u=this.getPointPosition(s,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(u.x,u.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,a=this.options,n=a.ticks;if(!n.display)return;const r=this.getIndexAngle(0);let i,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((s,l)=>{if(l===0&&!a.reverse)return;const u=n.setContext(this.getContext(l)),c=toFont(u.font);if(i=this.getDistanceFromCenterForValue(this.ticks[l].value),u.showLabelBackdrop){e.font=c.string,o=e.measureText(s.label).width,e.fillStyle=u.backdropColor;const d=toPadding(u.backdropPadding);e.fillRect(-o/2-d.left,-i-c.size/2-d.top,o+d.width,c.size+d.height)}renderText(e,s.label,0,-i,c,{color:u.color,strokeColor:u.textStrokeColor,strokeWidth:u.textStrokeWidth})}),e.restore()}drawTitle(){}}R(RadialLinearScale,"id","radialLinear"),R(RadialLinearScale,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),R(RadialLinearScale,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),R(RadialLinearScale,"descriptors",{angleLines:{_fallback:"grid"}});const INTERVALS={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},UNITS=Object.keys(INTERVALS);function sorter(t,e){return t-e}function parse(t,e){if(isNullOrUndef(e))return null;const a=t._adapter,{parser:n,round:r,isoWeekday:i}=t._parseOpts;let o=e;return typeof n=="function"&&(o=n(o)),isNumberFinite(o)||(o=typeof n=="string"?a.parse(o,n):a.parse(o)),o===null?null:(r&&(o=r==="week"&&(isNumber(i)||i===!0)?a.startOf(o,"isoWeek",i):a.startOf(o,r)),+o)}function determineUnitForAutoTicks(t,e,a,n){const r=UNITS.length;for(let i=UNITS.indexOf(t);i =UNITS.indexOf(a);i--){const o=UNITS[i];if(INTERVALS[o].common&&t._adapter.diff(r,n,o)>=e-1)return o}return UNITS[a?UNITS.indexOf(a):0]}function determineMajorUnit(t){for(let e=UNITS.indexOf(t)+1,a=UNITS.length;e=e?a[n]:a[r];t[i]=!0}}function setMajorTicks(t,e,a,n){const r=t._adapter,i=+r.startOf(e[0].value,n),o=e[e.length-1].value;let s,l;for(s=i;s<=o;s=+r.add(s,1,n))l=a[s],l>=0&&(e[l].major=!0);return e}function ticksFromTimestamps(t,e,a){const n=[],r={},i=e.length;let o,s;for(o=0;o+e.value))}initOffsets(e=[]){let a=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),e.length===1?a=1-r:a=(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),e.length===1?n=i:n=(i-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;a=_limitValue(a,0,o),n=_limitValue(n,0,o),this._offsets={start:a,end:n,factor:1/(a+1+n)}}_generate(){const e=this._adapter,a=this.min,n=this.max,r=this.options,i=r.time,o=i.unit||determineUnitForAutoTicks(i.minUnit,a,n,this._getLabelCapacity(a)),s=valueOrDefault(r.ticks.stepSize,1),l=o==="week"?i.isoWeekday:!1,u=isNumber(l)||l===!0,c={};let d=a,h,m;if(u&&(d=+e.startOf(d,"isoWeek",l)),d=+e.startOf(d,u?"day":o),e.diff(n,a,o)>1e5*s)throw new Error(a+" and "+n+" are too far apart with stepSize of "+s+" "+o);const p=r.ticks.source==="data"&&this.getDataTimestamps();for(h=d,m=0;h +v)}getLabelForValue(e){const a=this._adapter,n=this.options.time;return n.tooltipFormat?a.format(e,n.tooltipFormat):a.format(e,n.displayFormats.datetime)}format(e,a){const r=this.options.time.displayFormats,i=this._unit,o=a||r[i];return this._adapter.format(e,o)}_tickFormatFunction(e,a,n,r){const i=this.options,o=i.ticks.callback;if(o)return callback(o,[e,a,n],this);const s=i.time.displayFormats,l=this._unit,u=this._majorUnit,c=l&&s[l],d=u&&s[u],h=n[a],m=u&&d&&h&&h.major;return this._adapter.format(e,r||(m?d:c))}generateTickLabels(e){let a,n,r;for(a=0,n=e.length;a 0?s:1}getDataTimestamps(){let e=this._cache.data||[],a,n;if(e.length)return e;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(a=0,n=r.length;a =t[n].pos&&e<=t[r].pos&&({lo:n,hi:r}=_lookupByKey(t,"pos",e)),{pos:i,time:s}=t[n],{pos:o,time:l}=t[r]):(e>=t[n].time&&e<=t[r].time&&({lo:n,hi:r}=_lookupByKey(t,"time",e)),{time:i,pos:s}=t[n],{time:o,pos:l}=t[r]);const u=o-i;return u?s+(l-s)*(e-i)/u:s}class TimeSeriesScale extends TimeScale{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),a=this._table=this.buildLookupTable(e);this._minPos=interpolate$1(a,this.min),this._tableRange=interpolate$1(a,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:a,max:n}=this,r=[],i=[];let o,s,l,u,c;for(o=0,s=e.length;o =a&&u<=n&&r.push(u);if(r.length<2)return[{time:a,pos:0},{time:n,pos:1}];for(o=0,s=r.length;or-i)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const a=this.getDataTimestamps(),n=this.getLabelTimestamps();return a.length&&n.length?e=this.normalize(a.concat(n)):e=a.length?a:n,e=this._cache.all=e,e}getDecimalForValue(e){return(interpolate$1(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const a=this._offsets,n=this.getDecimalForPixel(e)/a.factor-a.end;return interpolate$1(this._table,n*this._tableRange+this._minPos,!0)}}R(TimeSeriesScale,"id","timeseries"),R(TimeSeriesScale,"defaults",TimeScale.defaults);function getDefaultChartSettings(t){return t==="sankey"?{type:"sankey",data:{datasets:[]},options:{animations:!1}}:t==="pie"?{type:"pie",data:{datasets:[]}}:t==="column"?{type:"bar",data:{labels:[],datasets:[]},options:{plugins:{tooltip:{callbacks:{label:function(e){let a=e.dataset.currency_code;return formatMoney(e.raw,a)}}}},maintainAspectRatio:!1,scales:{}}}:t==="line"?{options:{plugins:{tooltip:{callbacks:{label:function(e){let a=e.dataset.currency_code;return formatMoney(e.raw,a)}}}},maintainAspectRatio:!1,scales:{x:{type:"time",time:{tooltipFormat:"PP"}}}},type:"line",data:{labels:[],datasets:[]}}:{}}let blue=new Color("#36a2eb"),red=new Color("#ff6384"),green=new Color("#4bc0c0"),orange=new Color("#ff9f40"),purple=new Color("#9966ff"),yellow=new Color("#ffcd56"),grey=new Color("#c9cbcf"),index=0;window.theme==="dark"&&(red.darken(.3).desaturate(.3),green.darken(.3).desaturate(.3),blue.darken(.3).desaturate(.3),orange.darken(.3).desaturate(.3));let allColors=[red,orange,blue,green,purple,yellow,grey,green];function getColors(t,e){let a={borderColor:red.rgbString(),backgroundColor:red.rgbString()},n;switch(t){default:let i=Math.floor(index/2)%allColors.length;n=new Color(allColors[i].rgbString()),n.lighten(.38),a={borderColor:allColors[i].hexString(),backgroundColor:n.hexString()};break;case"spent":n=new Color(blue.rgbString()),n.lighten(.38),a={borderColor:blue.rgbString(),backgroundColor:n.rgbString()};break;case"left":n=new Color(green.rgbString()),n.lighten(.38),a={borderColor:green.rgbString(),backgroundColor:n.rgbString()};break;case"overspent":n=new Color(red.rgbString()),n.lighten(.22),a={borderColor:red.rgbString(),backgroundColor:n.rgbString()};break}return index++,e==="border"?a.borderColor:e==="background"?a.backgroundColor:"#FF0000"}let currencies$2=[],chart$3=null,chartData$2=null,afterPromises$5=!1;const accounts=()=>({loading:!1,loadingAccounts:!1,accountList:[],autoConversion:!1,chartOptions:null,switchAutoConversion(){this.autoConversion=!this.autoConversion,setVariable("autoConversion",this.autoConversion)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey("dashboard-accounts-chart",t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){console.log(r),this.drawChart(this.generateOptions(r)),this.loading=!1;return}new Dashboard$2().dashboard(t,e,null).then(o=>{this.chartData=o.data,window.store.set(a,o.data),console.log(o.data),this.drawChart(this.generateOptions(this.chartData)),this.loading=!1})},generateOptions(t){currencies$2=[];let e=getDefaultChartSettings("line");for(let a=0;a0){this.loadingAccounts=!1;return}const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey("dashboard-accounts-data",t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){this.accountList=r,this.loadingAccounts=!1;return}const i=10;let o=0,s=0,l=[];Promise.all([getVariable("frontpageAccounts")]).then(u=>{o=u[0].length;for(let c in u[0]){let d=u[0];if(d.hasOwnProperty(c)){let h=d[c];new Get$3().get(h,new Date(window.store.get("end"))).then(m=>{let p=m.data.data;const v={page:1,start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))};new Get$3().transactions(p.id,v).then(y=>{let w=[];for(let _=0;_ =i);_++){let C=y.data.data[_],O={title:C.attributes.group_title===null?"":C.attributes.group_title,id:C.id,transactions:[]};for(let k=0;k _.order-C.order),this.accountList=l,this.loadingAccounts=!1,window.store.set(a,l))})})}}})},init(){Promise.all([getVariable("viewRange","1M"),getVariable("autoConversion",!1),getVariable("language","en_US")]).then(t=>{this.autoConversion=t[1],afterPromises$5=!0,this.loadChart(),this.loadAccounts()}),window.store.observe("end",()=>{afterPromises$5&&(chartData$2=null,this.accountList=[],this.loadChart(),this.loadAccounts())}),window.store.observe("autoConversion",()=>{afterPromises$5&&(this.loadChart(),this.loadAccounts())})}});let Dashboard$1=class{dashboard(e,a){let n=format$1(e,"y-MM-dd"),r=format$1(a,"y-MM-dd");return api.get("/api/v2/chart/budget/dashboard",{params:{start:n,end:r}})}};var isArray$a=Array.isArray,isArray_1=isArray$a,freeGlobal$1=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$8=freeGlobal||freeSelf||Function("return this")(),_root=root$8,root$7=_root,Symbol$6=root$7.Symbol,_Symbol=Symbol$6,Symbol$5=_Symbol,objectProto$d=Object.prototype,hasOwnProperty$a=objectProto$d.hasOwnProperty,nativeObjectToString$1=objectProto$d.toString,symToStringTag$1=Symbol$5?Symbol$5.toStringTag:void 0;function getRawTag$1(t){var e=hasOwnProperty$a.call(t,symToStringTag$1),a=t[symToStringTag$1];try{t[symToStringTag$1]=void 0;var n=!0}catch{}var r=nativeObjectToString$1.call(t);return n&&(e?t[symToStringTag$1]=a:delete t[symToStringTag$1]),r}var _getRawTag=getRawTag$1,objectProto$c=Object.prototype,nativeObjectToString=objectProto$c.toString;function objectToString$1(t){return nativeObjectToString.call(t)}var _objectToString=objectToString$1,Symbol$4=_Symbol,getRawTag=_getRawTag,objectToString=_objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$4?Symbol$4.toStringTag:void 0;function baseGetTag$5(t){return t==null?t===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(t)?getRawTag(t):objectToString(t)}var _baseGetTag=baseGetTag$5;function isObjectLike$5(t){return t!=null&&typeof t=="object"}var isObjectLike_1=isObjectLike$5,baseGetTag$4=_baseGetTag,isObjectLike$4=isObjectLike_1,symbolTag$1="[object Symbol]";function isSymbol$5(t){return typeof t=="symbol"||isObjectLike$4(t)&&baseGetTag$4(t)==symbolTag$1}var isSymbol_1=isSymbol$5,isArray$9=isArray_1,isSymbol$4=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$3(t,e){if(isArray$9(t))return!1;var a=typeof t;return a=="number"||a=="symbol"||a=="boolean"||t==null||isSymbol$4(t)?!0:reIsPlainProp.test(t)||!reIsDeepProp.test(t)||e!=null&&t in Object(e)}var _isKey=isKey$3;function isObject$6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var isObject_1=isObject$6;const isObject$7=getDefaultExportFromCjs(isObject_1);var baseGetTag$3=_baseGetTag,isObject$5=isObject_1,asyncTag="[object AsyncFunction]",funcTag$1="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$2(t){if(!isObject$5(t))return!1;var e=baseGetTag$3(t);return e==funcTag$1||e==genTag||e==asyncTag||e==proxyTag}var isFunction_1=isFunction$2,root$6=_root,coreJsData$1=root$6["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=_coreJsData,maskSrcKey=function(){var t=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function isMasked$1(t){return!!maskSrcKey&&maskSrcKey in t}var _isMasked=isMasked$1,funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource$2(t){if(t!=null){try{return funcToString$1.call(t)}catch{}try{return t+""}catch{}}return""}var _toSource=toSource$2,isFunction$1=isFunction_1,isMasked=_isMasked,isObject$4=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$b=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$9=objectProto$b.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$9).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(t){if(!isObject$4(t)||isMasked(t))return!1;var e=isFunction$1(t)?reIsNative:reIsHostCtor;return e.test(toSource$1(t))}var _baseIsNative=baseIsNative$1;function getValue$1(t,e){return t==null?void 0:t[e]}var _getValue=getValue$1,baseIsNative=_baseIsNative,getValue=_getValue;function getNative$7(t,e){var a=getValue(t,e);return baseIsNative(a)?a:void 0}var _getNative=getNative$7,getNative$6=_getNative,nativeCreate$4=getNative$6(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$a=Object.prototype,hasOwnProperty$8=objectProto$a.hasOwnProperty;function hashGet$1(t){var e=this.__data__;if(nativeCreate$2){var a=e[t];return a===HASH_UNDEFINED$2?void 0:a}return hasOwnProperty$8.call(e,t)?e[t]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$9=Object.prototype,hasOwnProperty$7=objectProto$9.hasOwnProperty;function hashHas$1(t){var e=this.__data__;return nativeCreate$1?e[t]!==void 0:hasOwnProperty$7.call(e,t)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet$1(t,e){var a=this.__data__;return this.size+=this.has(t)?0:1,a[t]=nativeCreate&&e===void 0?HASH_UNDEFINED$1:e,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=_hashHas,hashSet=_hashSet;function Hash$1(t){var e=-1,a=t==null?0:t.length;for(this.clear();++e-1}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(t,e){var a=this.__data__,n=assocIndexOf(a,t);return n<0?(++this.size,a.push([t,e])):a[n][1]=e,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=_listCacheDelete,listCacheGet=_listCacheGet,listCacheHas=_listCacheHas,listCacheSet=_listCacheSet;function ListCache$4(t){var e=-1,a=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t -1&&t%1==0&&t<=MAX_SAFE_INTEGER$2}var isLength_1=isLength$3,castPath$1=_castPath,isArguments$2=isArguments_1,isArray$6=isArray_1,isIndex$3=_isIndex,isLength$2=isLength_1,toKey$3=_toKey;function hasPath$2(t,e,a){e=castPath$1(e,t);for(var n=-1,r=e.length,i=!1;++n -1}var _arrayIncludes=arrayIncludes$1;function arrayIncludesWith$1(t,e,a){for(var n=-1,r=t==null?0:t.length;++n =LARGE_ARRAY_SIZE$1){var u=e?null:createSet(t);if(u)return setToArray$1(u);o=!1,r=cacheHas$1,l=new SetCache$1}else l=e?[]:s;e:for(;++n{const a=[],n=[];return a.push(e),e||a.push(t.locale),t.enableFallback&&a.push(t.defaultLocale),a.filter(Boolean).map(r=>r.toString()).forEach(function(r){if(n.includes(r)||n.push(r),!t.enableFallback)return;const i=r.split("-");i.length===3&&n.push(`${i[0]}-${i[1]}`),n.push(i[0])}),uniq$1(n)};class Locales{constructor(e){this.i18n=e,this.registry={},this.register("default",defaultLocaleResolver)}register(e,a){if(typeof a!="function"){const n=a;a=()=>n}this.registry[e]=a}get(e){let a=this.registry[e]||this.registry[this.i18n.locale]||this.registry.default;return typeof a=="function"&&(a=a(this.i18n,e)),a instanceof Array||(a=[a]),a}}const en=(t,e)=>{const a=String(t).split("."),n=!a[1],r=Number(a[0])==t,i=r&&a[0].slice(-1),o=r&&a[0].slice(-2);return e?i==1&&o!=11?"one":i==2&&o!=12?"two":i==3&&o!=13?"few":"other":t==1&&n?"one":"other"};function useMakePlural({pluralizer:t,includeZero:e=!0,ordinal:a=!1}){return function(n,r){return[e&&r===0?"zero":"",t(r,a)].filter(Boolean)}}const defaultPluralizer=useMakePlural({pluralizer:en,includeZero:!0});class Pluralization{constructor(e){this.i18n=e,this.registry={},this.register("default",defaultPluralizer)}register(e,a){this.registry[e]=a}get(e){return this.registry[e]||this.registry[this.i18n.locale]||this.registry.default}}function baseSlice$1(t,e,a){var n=-1,r=t.length;e<0&&(e=-e>r?0:r+e),a=a>r?r:a,a<0&&(a+=r),r=e>a?0:a-e>>>0,e>>>=0;for(var i=Array(r);++n =n?t:baseSlice(t,e,a)}var _castSlice=castSlice$1,rsAstralRange$2="\\ud800-\\udfff",rsComboMarksRange$3="\\u0300-\\u036f",reComboHalfMarksRange$3="\\ufe20-\\ufe2f",rsComboSymbolsRange$3="\\u20d0-\\u20ff",rsComboRange$3=rsComboMarksRange$3+reComboHalfMarksRange$3+rsComboSymbolsRange$3,rsVarRange$2="\\ufe0e\\ufe0f",rsZWJ$2="\\u200d",reHasUnicode=RegExp("["+rsZWJ$2+rsAstralRange$2+rsComboRange$3+rsVarRange$2+"]");function hasUnicode$2(t){return reHasUnicode.test(t)}var _hasUnicode=hasUnicode$2;function asciiToArray$1(t){return t.split("")}var _asciiToArray=asciiToArray$1,rsAstralRange$1="\\ud800-\\udfff",rsComboMarksRange$2="\\u0300-\\u036f",reComboHalfMarksRange$2="\\ufe20-\\ufe2f",rsComboSymbolsRange$2="\\u20d0-\\u20ff",rsComboRange$2=rsComboMarksRange$2+reComboHalfMarksRange$2+rsComboSymbolsRange$2,rsVarRange$1="\\ufe0e\\ufe0f",rsAstral="["+rsAstralRange$1+"]",rsCombo$2="["+rsComboRange$2+"]",rsFitz$1="\\ud83c[\\udffb-\\udfff]",rsModifier$1="(?:"+rsCombo$2+"|"+rsFitz$1+")",rsNonAstral$1="[^"+rsAstralRange$1+"]",rsRegional$1="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair$1="[\\ud800-\\udbff][\\udc00-\\udfff]",rsZWJ$1="\\u200d",reOptMod$1=rsModifier$1+"?",rsOptVar$1="["+rsVarRange$1+"]?",rsOptJoin$1="(?:"+rsZWJ$1+"(?:"+[rsNonAstral$1,rsRegional$1,rsSurrPair$1].join("|")+")"+rsOptVar$1+reOptMod$1+")*",rsSeq$1=rsOptVar$1+reOptMod$1+rsOptJoin$1,rsSymbol="(?:"+[rsNonAstral$1+rsCombo$2+"?",rsCombo$2,rsRegional$1,rsSurrPair$1,rsAstral].join("|")+")",reUnicode=RegExp(rsFitz$1+"(?="+rsFitz$1+")|"+rsSymbol+rsSeq$1,"g");function unicodeToArray$1(t){return t.match(reUnicode)||[]}var _unicodeToArray=unicodeToArray$1,asciiToArray=_asciiToArray,hasUnicode$1=_hasUnicode,unicodeToArray=_unicodeToArray;function stringToArray$1(t){return hasUnicode$1(t)?unicodeToArray(t):asciiToArray(t)}var _stringToArray=stringToArray$1,castSlice=_castSlice,hasUnicode=_hasUnicode,stringToArray=_stringToArray,toString$4=toString_1;function createCaseFirst$1(t){return function(e){e=toString$4(e);var a=hasUnicode(e)?stringToArray(e):void 0,n=a?a[0]:e.charAt(0),r=a?castSlice(a,1).join(""):e.slice(1);return n[t]()+r}}var _createCaseFirst=createCaseFirst$1,createCaseFirst=_createCaseFirst,upperFirst$1=createCaseFirst("toUpperCase"),upperFirst_1=upperFirst$1,toString$3=toString_1,upperFirst=upperFirst_1;function capitalize$1(t){return upperFirst(toString$3(t).toLowerCase())}var capitalize_1=capitalize$1;function arrayReduce$1(t,e,a,n){var r=-1,i=t==null?0:t.length;for(n&&i&&(a=t[++r]);++r(e[camelCase$1(a)]=t[a],e),{}):{}}function isSet(t){return t!=null}function createTranslationOptions(t,e,a){let n=[{scope:e}];if(isSet(a.defaults)&&(n=n.concat(a.defaults)),isSet(a.defaultValue)){const r=typeof a.defaultValue=="function"?a.defaultValue(t,e,a):a.defaultValue;n.push({message:r}),delete a.defaultValue}return n}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER$1=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(t){var e,a,n,r=_.prototype={constructor:_,toString:null,valueOf:null},i=new _(1),o=20,s=4,l=-7,u=21,c=-1e7,d=1e7,h=!1,m=1,p=0,v={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},y="0123456789abcdefghijklmnopqrstuvwxyz",w=!0;function _(g,b){var $,S,E,M,D,P,T,x,A=this;if(!(A instanceof _))return new _(g,b);if(b==null){if(g&&g._isBigNumber===!0){A.s=g.s,!g.c||g.e>d?A.c=A.e=null:g.e =10;D/=10,M++);M>d?A.c=A.e=null:(A.e=M,A.c=[g]);return}x=String(g)}else{if(!isNumeric.test(x=String(g)))return n(A,x,P);A.s=x.charCodeAt(0)==45?(x=x.slice(1),-1):1}(M=x.indexOf("."))>-1&&(x=x.replace(".","")),(D=x.search(/e/i))>0?(M<0&&(M=D),M+=+x.slice(D+1),x=x.substring(0,D)):M<0&&(M=x.length)}else{if(intCheck(b,2,y.length,"Base"),b==10&&w)return A=new _(g),N(A,o+A.e+1,s);if(x=String(g),P=typeof g=="number"){if(g*0!=0)return n(A,x,P,b);if(A.s=1/g<0?(x=x.slice(1),-1):1,_.DEBUG&&x.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+g)}else A.s=x.charCodeAt(0)===45?(x=x.slice(1),-1):1;for($=y.slice(0,b),M=D=0,T=x.length;D M){M=T;continue}}else if(!E&&(x==x.toUpperCase()&&(x=x.toLowerCase())||x==x.toLowerCase()&&(x=x.toUpperCase()))){E=!0,D=-1,M=0;continue}return n(A,String(g),P,b)}P=!1,x=a(x,b,10,A.s),(M=x.indexOf("."))>-1?x=x.replace(".",""):M=x.length}for(D=0;x.charCodeAt(D)===48;D++);for(T=x.length;x.charCodeAt(--T)===48;);if(x=x.slice(D,++T)){if(T-=D,P&&_.DEBUG&&T>15&&(g>MAX_SAFE_INTEGER$1||g!==mathfloor(g)))throw Error(tooManyDigits+A.s*g);if((M=M-D-1)>d)A.c=A.e=null;else if(M =-MAX&&E<=MAX&&E===mathfloor(E)){if(S[0]===0){if(E===0&&S.length===1)return!0;break e}if(b=(E+1)%LOG_BASE,b<1&&(b+=LOG_BASE),String(S[0]).length==b){for(b=0;b =BASE||$!==mathfloor($))break e;if($!==0)return!0}}}else if(S===null&&E===null&&(M===null||M===1||M===-1))return!0;throw Error(bignumberError+"Invalid BigNumber: "+g)},_.maximum=_.max=function(){return O(arguments,-1)},_.minimum=_.min=function(){return O(arguments,1)},_.random=function(){var g=9007199254740992,b=Math.random()*g&2097151?function(){return mathfloor(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function($){var S,E,M,D,P,T=0,x=[],A=new _(i);if($==null?$=o:intCheck($,0,MAX),D=mathceil($/LOG_BASE),h)if(crypto.getRandomValues){for(S=crypto.getRandomValues(new Uint32Array(D*=2));T >>11),P>=9e15?(E=crypto.getRandomValues(new Uint32Array(2)),S[T]=E[0],S[T+1]=E[1]):(x.push(P%1e14),T+=2);T=D/2}else if(crypto.randomBytes){for(S=crypto.randomBytes(D*=7);T =9e15?crypto.randomBytes(7).copy(S,T):(x.push(P%1e14),T+=7);T=D/7}else throw h=!1,Error(bignumberError+"crypto unavailable");if(!h)for(;T =10;P/=10,T++);T E-1&&(P[D+1]==null&&(P[D+1]=0),P[D+1]+=P[D]/E|0,P[D]%=E)}return P.reverse()}return function($,S,E,M,D){var P,T,x,A,L,I,W,z,U=$.indexOf("."),B=o,V=s;for(U>=0&&(A=p,p=0,$=$.replace(".",""),z=new _(S),I=z.pow($.length-U),p=A,z.c=b(toFixedPoint(coeffToString(I.c),I.e,"0"),10,E,g),z.e=z.c.length),W=b($,S,E,D?(P=y,g):(P=g,y)),x=A=W.length;W[--A]==0;W.pop());if(!W[0])return P.charAt(0);if(U<0?--x:(I.c=W,I.e=x,I.s=M,I=e(I,z,B,V,E),W=I.c,L=I.r,x=I.e),T=x+B+1,U=W[T],A=E/2,L=L||T<0||W[T+1]!=null,L=V<4?(U!=null||L)&&(V==0||V==(I.s<0?3:2)):U>A||U==A&&(V==4||L||V==6&&W[T-1]&1||V==(I.s<0?8:7)),T<1||!W[0])$=L?toFixedPoint(P.charAt(1),-B,P.charAt(0)):P.charAt(0);else{if(W.length=T,L)for(--E;++W[--T]>E;)W[T]=0,T||(++x,W=[1].concat(W));for(A=W.length;!W[--A];);for(U=0,$="";U<=A;$+=P.charAt(W[U++]));$=toFixedPoint($,x,P.charAt(0))}return $}}(),e=function(){function g(S,E,M){var D,P,T,x,A=0,L=S.length,I=E%SQRT_BASE,W=E/SQRT_BASE|0;for(S=S.slice();L--;)T=S[L]%SQRT_BASE,x=S[L]/SQRT_BASE|0,D=W*T+x*I,P=I*T+D%SQRT_BASE*SQRT_BASE+A,A=(P/M|0)+(D/SQRT_BASE|0)+W*x,S[L]=P%M;return A&&(S=[A].concat(S)),S}function b(S,E,M,D){var P,T;if(M!=D)T=M>D?1:-1;else for(P=T=0;P E[P]?1:-1;break}return T}function $(S,E,M,D){for(var P=0;M--;)S[M]-=P,P=S[M] 1;S.splice(0,1));}return function(S,E,M,D,P){var T,x,A,L,I,W,z,U,B,V,H,G,K,Y,J,Q,ee,Z=S.s==E.s?1:-1,X=S.c,q=E.c;if(!X||!X[0]||!q||!q[0])return new _(!S.s||!E.s||(X?q&&X[0]==q[0]:!q)?NaN:X&&X[0]==0||!q?Z*0:Z/0);for(U=new _(Z),B=U.c=[],x=S.e-E.e,Z=M+x+1,P||(P=BASE,x=bitFloor(S.e/LOG_BASE)-bitFloor(E.e/LOG_BASE),Z=Z/LOG_BASE|0),A=0;q[A]==(X[A]||0);A++);if(q[A]>(X[A]||0)&&x--,Z<0)B.push(1),L=!0;else{for(Y=X.length,Q=q.length,A=0,Z+=2,I=mathfloor(P/(q[0]+1)),I>1&&(q=g(q,I,P),X=g(X,I,P),Q=q.length,Y=X.length),K=Q,V=X.slice(0,Q),H=V.length;H =P/2&&J++;do{if(I=0,T=b(q,V,Q,H),T<0){if(G=V[0],Q!=H&&(G=G*P+(V[1]||0)),I=mathfloor(G/J),I>1)for(I>=P&&(I=P-1),W=g(q,I,P),z=W.length,H=V.length;b(W,V,z,H)==1;)I--,$(W,Q=10;Z/=10,A++);N(U,M+(U.e=A+x*LOG_BASE-1)+1,D,L)}else U.e=x,U.r=+L;return U}}();function C(g,b,$,S){var E,M,D,P,T;if($==null?$=s:intCheck($,0,8),!g.c)return g.toString();if(E=g.c[0],D=g.e,b==null)T=coeffToString(g.c),T=S==1||S==2&&(D<=l||D>=u)?toExponential(T,D):toFixedPoint(T,D,"0");else if(g=N(new _(g),b,$),M=g.e,T=coeffToString(g.c),P=T.length,S==1||S==2&&(b<=M||M<=l)){for(;PP){if(--b>0)for(T+=".";b--;T+="0");}else if(b+=M-P,b>0)for(M+1==P&&(T+=".");b--;T+="0");return g.s<0&&E?"-"+T:T}function O(g,b){for(var $,S,E=1,M=new _(g[0]);E =10;E/=10,S++);return($=S+$*LOG_BASE-1)>d?g.c=g.e=null:$ =10;P/=10,E++);if(M=b-E,M<0)M+=LOG_BASE,D=b,T=L[x=0],A=mathfloor(T/I[E-D-1]%10);else if(x=mathceil((M+1)/LOG_BASE),x>=L.length)if(S){for(;L.length<=x;L.push(0));T=A=0,E=1,M%=LOG_BASE,D=M-LOG_BASE+1}else break e;else{for(T=P=L[x],E=1;P>=10;P/=10,E++);M%=LOG_BASE,D=M-LOG_BASE+E,A=D<0?0:mathfloor(T/I[E-D-1]%10)}if(S=S||b<0||L[x+1]!=null||(D<0?T:T%I[E-D-1]),S=$<4?(A||S)&&($==0||$==(g.s<0?3:2)):A>5||A==5&&($==4||S||$==6&&(M>0?D>0?T/I[E-D]:0:L[x-1])%10&1||$==(g.s<0?8:7)),b<1||!L[0])return L.length=0,S?(b-=g.e+1,L[0]=I[(LOG_BASE-b%LOG_BASE)%LOG_BASE],g.e=-b||0):L[0]=g.e=0,g;if(M==0?(L.length=x,P=1,x--):(L.length=x+1,P=I[LOG_BASE-M],L[x]=D>0?mathfloor(T/I[E-D]%I[D])*P:0),S)for(;;)if(x==0){for(M=1,D=L[0];D>=10;D/=10,M++);for(D=L[0]+=P,P=1;D>=10;D/=10,P++);M!=P&&(g.e++,L[0]==BASE&&(L[0]=1));break}else{if(L[x]+=P,L[x]!=BASE)break;L[x--]=0,P=1}for(M=L.length;L[--M]===0;L.pop());}g.e>d?g.c=g.e=null:g.e =u?toExponential(b,$):toFixedPoint(b,$,"0"),g.s<0?"-"+b:b)}return r.absoluteValue=r.abs=function(){var g=new _(this);return g.s<0&&(g.s=1),g},r.comparedTo=function(g,b){return compare(this,new _(g,b))},r.decimalPlaces=r.dp=function(g,b){var $,S,E,M=this;if(g!=null)return intCheck(g,0,MAX),b==null?b=s:intCheck(b,0,8),N(new _(M),g+M.e+1,b);if(!($=M.c))return null;if(S=((E=$.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,E=$[E])for(;E%10==0;E/=10,S--);return S<0&&(S=0),S},r.dividedBy=r.div=function(g,b){return e(this,new _(g,b),o,s)},r.dividedToIntegerBy=r.idiv=function(g,b){return e(this,new _(g,b),0,1)},r.exponentiatedBy=r.pow=function(g,b){var $,S,E,M,D,P,T,x,A,L=this;if(g=new _(g),g.c&&!g.isInteger())throw Error(bignumberError+"Exponent not an integer: "+F(g));if(b!=null&&(b=new _(b)),P=g.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!g.c||!g.c[0])return A=new _(Math.pow(+F(L),P?g.s*(2-isOdd(g)):+F(g))),b?A.mod(b):A;if(T=g.s<0,b){if(b.c?!b.c[0]:!b.s)return new _(NaN);S=!T&&L.isInteger()&&b.isInteger(),S&&(L=L.mod(b))}else{if(g.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||P&&L.c[1]>=24e7:L.c[0]<8e13||P&&L.c[0]<=9999975e7)))return M=L.s<0&&isOdd(g)?-0:0,L.e>-1&&(M=1/M),new _(T?1/M:M);p&&(M=mathceil(p/LOG_BASE+2))}for(P?($=new _(.5),T&&(g.s=1),x=isOdd(g)):(E=Math.abs(+F(g)),x=E%2),A=new _(i);;){if(x){if(A=A.times(L),!A.c)break;M?A.c.length>M&&(A.c.length=M):S&&(A=A.mod(b))}if(E){if(E=mathfloor(E/2),E===0)break;x=E%2}else if(g=g.times($),N(g,g.e+1,1),g.e>14)x=isOdd(g);else{if(E=+F(g),E===0)break;x=E%2}L=L.times(L),M?L.c&&L.c.length>M&&(L.c.length=M):S&&(L=L.mod(b))}return S?A:(T&&(A=i.div(A)),b?A.mod(b):M?N(A,p,s,D):A)},r.integerValue=function(g){var b=new _(this);return g==null?g=s:intCheck(g,0,8),N(b,b.e+1,g)},r.isEqualTo=r.eq=function(g,b){return compare(this,new _(g,b))===0},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(g,b){return compare(this,new _(g,b))>0},r.isGreaterThanOrEqualTo=r.gte=function(g,b){return(b=compare(this,new _(g,b)))===1||b===0},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(g,b){return compare(this,new _(g,b))<0},r.isLessThanOrEqualTo=r.lte=function(g,b){return(b=compare(this,new _(g,b)))===-1||b===0},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return this.s>0},r.isZero=function(){return!!this.c&&this.c[0]==0},r.minus=function(g,b){var $,S,E,M,D=this,P=D.s;if(g=new _(g,b),b=g.s,!P||!b)return new _(NaN);if(P!=b)return g.s=-b,D.plus(g);var T=D.e/LOG_BASE,x=g.e/LOG_BASE,A=D.c,L=g.c;if(!T||!x){if(!A||!L)return A?(g.s=-b,g):new _(L?D:NaN);if(!A[0]||!L[0])return L[0]?(g.s=-b,g):new _(A[0]?D:s==3?-0:0)}if(T=bitFloor(T),x=bitFloor(x),A=A.slice(),P=T-x){for((M=P<0)?(P=-P,E=A):(x=T,E=L),E.reverse(),b=P;b--;E.push(0));E.reverse()}else for(S=(M=(P=A.length)<(b=L.length))?P:b,P=b=0;b 0)for(;b--;A[$++]=0);for(b=BASE-1;S>P;){if(A[--S]=0;){for($=0,I=G[E]%B,W=G[E]/B|0,D=T,M=E+D;M>E;)x=H[--D]%B,A=H[D]/B|0,P=W*x+A*I,x=I*x+P%B*B+z[M]+$,$=(x/U|0)+(P/B|0)+W*A,z[M--]=x%U;z[M]=$}return $?++S:z.splice(0,1),k(g,z,S)},r.negated=function(){var g=new _(this);return g.s=-g.s||null,g},r.plus=function(g,b){var $,S=this,E=S.s;if(g=new _(g,b),b=g.s,!E||!b)return new _(NaN);if(E!=b)return g.s=-b,S.minus(g);var M=S.e/LOG_BASE,D=g.e/LOG_BASE,P=S.c,T=g.c;if(!M||!D){if(!P||!T)return new _(E/0);if(!P[0]||!T[0])return T[0]?g:new _(P[0]?S:E*0)}if(M=bitFloor(M),D=bitFloor(D),P=P.slice(),E=M-D){for(E>0?(D=M,$=T):(E=-E,$=P),$.reverse();E--;$.push(0));$.reverse()}for(E=P.length,b=T.length,E-b<0&&($=T,T=P,P=$,b=E),E=0;b;)E=(P[--b]=P[b]+T[b]+E)/BASE|0,P[b]=BASE===P[b]?0:P[b]%BASE;return E&&(P=[E].concat(P),++D),k(g,P,D)},r.precision=r.sd=function(g,b){var $,S,E,M=this;if(g!=null&&g!==!!g)return intCheck(g,1,MAX),b==null?b=s:intCheck(b,0,8),N(new _(M),g,b);if(!($=M.c))return null;if(E=$.length-1,S=E*LOG_BASE+1,E=$[E]){for(;E%10==0;E/=10,S--);for(E=$[0];E>=10;E/=10,S++);}return g&&M.e+1>S&&(S=M.e+1),S},r.shiftedBy=function(g){return intCheck(g,-MAX_SAFE_INTEGER$1,MAX_SAFE_INTEGER$1),this.times("1e"+g)},r.squareRoot=r.sqrt=function(){var g,b,$,S,E,M=this,D=M.c,P=M.s,T=M.e,x=o+4,A=new _("0.5");if(P!==1||!D||!D[0])return new _(!P||P<0&&(!D||D[0])?NaN:D?M:1/0);if(P=Math.sqrt(+F(M)),P==0||P==1/0?(b=coeffToString(D),(b.length+T)%2==0&&(b+="0"),P=Math.sqrt(+b),T=bitFloor((T+1)/2)-(T<0||T%2),P==1/0?b="5e"+T:(b=P.toExponential(),b=b.slice(0,b.indexOf("e")+1)+T),$=new _(b)):$=new _(P+""),$.c[0]){for(T=$.e,P=T+x,P<3&&(P=0);;)if(E=$,$=A.times(E.plus(e(M,E,x,1))),coeffToString(E.c).slice(0,P)===(b=coeffToString($.c)).slice(0,P))if($.e 0&&z>0){for(M=z%P||P,A=W.substr(0,M);M 0&&(A+=x+W.slice(M)),I&&(A="-"+A)}S=L?A+($.decimalSeparator||"")+((T=+$.fractionGroupSize)?L.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+($.fractionGroupSeparator||"")):L):A}return($.prefix||"")+S+($.suffix||"")},r.toFraction=function(g){var b,$,S,E,M,D,P,T,x,A,L,I,W=this,z=W.c;if(g!=null&&(P=new _(g),!P.isInteger()&&(P.c||P.s!==1)||P.lt(i)))throw Error(bignumberError+"Argument "+(P.isInteger()?"out of range: ":"not an integer: ")+F(P));if(!z)return new _(W);for(b=new _(i),x=$=new _(i),S=T=new _(i),I=coeffToString(z),M=b.e=I.length-W.e-1,b.c[0]=POWS_TEN[(D=M%LOG_BASE)<0?LOG_BASE+D:D],g=!g||P.comparedTo(b)>0?M>0?b:x:P,D=d,d=1/0,P=new _(I),T.c[0]=0;A=e(P,b,0,1),E=$.plus(A.times(S)),E.comparedTo(g)!=1;)$=S,S=E,x=T.plus(A.times(E=x)),T=E,b=P.minus(A.times(E=b)),P=E;return E=e(g.minus($),S,0,1),T=T.plus(E.times(x)),$=$.plus(E.times(S)),T.s=x.s=W.s,M=M*2,L=e(x,S,M,s).minus(W).abs().comparedTo(e(T,$,M,s).minus(W).abs())<1?[x,S]:[T,$],d=D,L},r.toNumber=function(){return+F(this)},r.toPrecision=function(g,b){return g!=null&&intCheck(g,1,MAX),C(this,g,b,2)},r.toString=function(g){var b,$=this,S=$.s,E=$.e;return E===null?S?(b="Infinity",S<0&&(b="-"+b)):b="NaN":(g==null?b=E<=l||E>=u?toExponential(coeffToString($.c),E):toFixedPoint(coeffToString($.c),E,"0"):g===10&&w?($=N(new _($),o+E+1,s),b=toFixedPoint(coeffToString($.c),$.e,"0")):(intCheck(g,2,y.length,"Base"),b=a(toFixedPoint(coeffToString($.c),E,"0"),10,g,S,!0)),S<0&&$.c[0]&&(b="-"+b)),b},r.valueOf=r.toJSON=function(){return F(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,t!=null&&_.set(t),_}function bitFloor(t){var e=t|0;return t>0||t===e?e:e-1}function coeffToString(t){for(var e,a,n=1,r=t.length,i=t[0]+"";n u^a?1:-1;for(s=(l=r.length)<(u=i.length)?l:u,o=0;o i[o]^a?1:-1;return l==u?0:l>u^a?1:-1}function intCheck(t,e,a,n){if(ta||t!==mathfloor(t))throw Error(bignumberError+(n||"Argument")+(typeof t=="number"?t a?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function isOdd(t){var e=t.c.length-1;return bitFloor(t.e/LOG_BASE)==e&&t.c[e]%2!=0}function toExponential(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function toFixedPoint(t,e,a){var n,r;if(e<0){for(r=a+".";++e;r+=a);t=r+t}else if(n=t.length,++e>n){for(r=a,e-=n;--e;r+=a);t+=r}else e MAX_SAFE_INTEGER)return a;do e%2&&(a+=t),e=nativeFloor(e/2),e&&(t+=t);while(e);return a}var _baseRepeat=baseRepeat$1,isFunction=isFunction_1,isLength$1=isLength_1;function isArrayLike$4(t){return t!=null&&isLength$1(t.length)&&!isFunction(t)}var isArrayLike_1=isArrayLike$4,eq$1=eq_1,isArrayLike$3=isArrayLike_1,isIndex$1=_isIndex,isObject$2=isObject_1;function isIterateeCall$3(t,e,a){if(!isObject$2(a))return!1;var n=typeof e;return(n=="number"?isArrayLike$3(a)&&isIndex$1(e,a.length):n=="string"&&e in a)?eq$1(a[e],t):!1}var _isIterateeCall=isIterateeCall$3,reWhitespace=/\s/;function trimmedEndIndex$1(t){for(var e=t.length;e--&&reWhitespace.test(t.charAt(e)););return e}var _trimmedEndIndex=trimmedEndIndex$1,trimmedEndIndex=_trimmedEndIndex,reTrimStart=/^\s+/;function baseTrim$1(t){return t&&t.slice(0,trimmedEndIndex(t)+1).replace(reTrimStart,"")}var _baseTrim=baseTrim$1,baseTrim=_baseTrim,isObject$1=isObject_1,isSymbol$1=isSymbol_1,NAN=0/0,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber$1(t){if(typeof t=="number")return t;if(isSymbol$1(t))return NAN;if(isObject$1(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=isObject$1(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=baseTrim(t);var a=reIsBinary.test(t);return a||reIsOctal.test(t)?freeParseInt(t.slice(2),a?2:8):reIsBadHex.test(t)?NAN:+t}var toNumber_1=toNumber$1,toNumber=toNumber_1,INFINITY$1=1/0,MAX_INTEGER=17976931348623157e292;function toFinite$2(t){if(!t)return t===0?t:0;if(t=toNumber(t),t===INFINITY$1||t===-INFINITY$1){var e=t<0?-1:1;return e*MAX_INTEGER}return t===t?t:0}var toFinite_1=toFinite$2,toFinite$1=toFinite_1;function toInteger$1(t){var e=toFinite$1(t),a=e%1;return e===e?a?e-a:e:0}var toInteger_1=toInteger$1,baseRepeat=_baseRepeat,isIterateeCall$2=_isIterateeCall,toInteger=toInteger_1,toString=toString_1;function repeat(t,e,a){return(a?isIterateeCall$2(t,e,a):e===void 0)?e=1:e=toInteger(e),baseRepeat(toString(t),e)}var repeat_1=repeat;const repeat$1=getDefaultExportFromCjs(repeat_1);function digitCount(t){return t.isZero()?1:Math.floor(Math.log10(t.abs().toNumber())+1)}function getAbsolutePrecision(t,{precision:e,significant:a}){return a&&e!==null&&e>0?e-digitCount(t):e}function roundNumber(t,e){const a=getAbsolutePrecision(t,e);if(a===null)return t.toString();const n=expandRoundMode(e.roundMode);if(a>=0)return t.toFixed(a,n);const r=Math.pow(10,Math.abs(a));return t=new BigNumber(t.div(r).toFixed(0,n)).times(r),t.toString()}function replaceInFormat(t,{formattedNumber:e,unit:a}){return t.replace("%n",e).replace("%u",a)}function computeSignificand({significand:t,whole:e,precision:a}){if(e==="0"||a===null)return t;const n=Math.max(0,a-e.length);return(t??"").substr(0,n)}function formatNumber(t,e){var a,n,r;const i=new BigNumber(t);if(e.raise&&!i.isFinite())throw new Error(`"${t}" is not a valid numeric value`);const o=roundNumber(i,e),s=new BigNumber(o),l=s.lt(0),u=s.isZero();let[c,d]=o.split(".");const h=[];let m;const p=(a=e.format)!==null&&a!==void 0?a:"%n",v=(n=e.negativeFormat)!==null&&n!==void 0?n:`-${p}`,y=l&&!u?v:p;for(c=c.replace("-","");c.length>0;)h.unshift(c.substr(Math.max(0,c.length-3),3)),c=c.substr(0,c.length-3);return c=h.join(""),m=h.join(e.delimiter),e.significant?d=computeSignificand({whole:c,significand:d,precision:e.precision}):d=d??repeat$1("0",(r=e.precision)!==null&&r!==void 0?r:0),e.stripInsignificantZeros&&d&&(d=d.replace(/0+$/,"")),i.isNaN()&&(m=t.toString()),d&&i.isFinite()&&(m+=(e.separator||".")+d),replaceInFormat(y,{formattedNumber:m,unit:e.unit})}function getFullScope(t,e,a){let n="";return(e instanceof String||typeof e=="string")&&(n=e),e instanceof Array&&(n=e.join(t.defaultSeparator)),a.scope&&(n=[a.scope,n].join(t.defaultSeparator)),n}function inferType(t){var e,a;if(t===null)return"null";const n=typeof t;return n!=="object"?n:((a=(e=t==null?void 0:t.constructor)===null||e===void 0?void 0:e.name)===null||a===void 0?void 0:a.toLowerCase())||"object"}function interpolate(t,e,a){a=Object.keys(a).reduce((r,i)=>(r[t.transformKey(i)]=a[i],r),{});const n=e.match(t.placeholder);if(!n)return e;for(;n.length;){let r;const i=n.shift(),o=i.replace(t.placeholder,"$1");isSet(a[o])?r=a[o].toString().replace(/\$/gm,"_#$#_"):o in a?r=t.nullPlaceholder(t,i,e,a):r=t.missingPlaceholder(t,i,e,a);const s=new RegExp(i.replace(/\{/gm,"\\{").replace(/\}/gm,"\\}"));e=e.replace(s,r)}return e.replace(/_#\$#_/g,"$")}function lookup(t,e,a={}){a=Object.assign({},a);const n="locale"in a?a.locale:t.locale,r=inferType(n),i=t.locales.get(r==="string"?n:typeof n).slice();e=getFullScope(t,e,a).split(t.defaultSeparator).map(s=>t.transformKey(s)).join(".");const o=i.map(s=>get$2(t.translations,[s,e].join(".")));return o.push(a.defaultValue),o.find(s=>isSet(s))}function numberToDelimited(t,e){const a=new BigNumber(t);if(!a.isFinite())return t.toString();if(!e.delimiterPattern.global)throw new Error(`options.delimiterPattern must be a global regular expression; received ${e.delimiterPattern}`);let[n,r]=a.toString().split(".");return n=n.replace(e.delimiterPattern,i=>`${i}${e.delimiter}`),[n,r].filter(Boolean).join(e.separator)}function arrayPush$2(t,e){for(var a=-1,n=e.length,r=t.length;++a 0&&a(s)?e>1?baseFlatten$2(s,e-1,a,n,r):arrayPush$1(r,s):n||(r[r.length]=s)}return r}var _baseFlatten=baseFlatten$2,ListCache$2=_ListCache;function stackClear$1(){this.__data__=new ListCache$2,this.size=0}var _stackClear=stackClear$1;function stackDelete$1(t){var e=this.__data__,a=e.delete(t);return this.size=e.size,a}var _stackDelete=stackDelete$1;function stackGet$1(t){return this.__data__.get(t)}var _stackGet=stackGet$1;function stackHas$1(t){return this.__data__.has(t)}var _stackHas=stackHas$1,ListCache$1=_ListCache,Map$2=_Map,MapCache=_MapCache,LARGE_ARRAY_SIZE=200;function stackSet$1(t,e){var a=this.__data__;if(a instanceof ListCache$1){var n=a.__data__;if(!Map$2||n.length s))return!1;var u=i.get(t),c=i.get(e);if(u&&c)return u==e&&c==t;var d=-1,h=!0,m=a&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(i.set(t,e),i.set(e,t);++d e||i&&o&&l&&!s&&!u||n&&o&&l||!a&&l||!r)return 1;if(!n&&!i&&!u&&t=s)return l;var u=a[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}var _compareMultiple=compareMultiple$1,arrayMap=_arrayMap,baseGet=_baseGet,baseIteratee=_baseIteratee,baseMap=_baseMap,baseSortBy=_baseSortBy,baseUnary=_baseUnary,compareMultiple=_compareMultiple,identity$2=identity_1,isArray=isArray_1;function baseOrderBy$1(t,e,a){e.length?e=arrayMap(e,function(i){return isArray(i)?function(o){return baseGet(o,i.length===1?i[0]:i)}:i}):e=[identity$2];var n=-1;e=arrayMap(e,baseUnary(baseIteratee));var r=baseMap(t,function(i,o,s){var l=arrayMap(e,function(u){return u(i)});return{criteria:l,index:++n,value:i}});return baseSortBy(r,function(i,o){return compareMultiple(i,o,a)})}var _baseOrderBy=baseOrderBy$1;function apply$1(t,e,a){switch(a.length){case 0:return t.call(e);case 1:return t.call(e,a[0]);case 2:return t.call(e,a[0],a[1]);case 3:return t.call(e,a[0],a[1],a[2])}return t.apply(e,a)}var _apply=apply$1,apply=_apply,nativeMax$1=Math.max;function overRest$1(t,e,a){return e=nativeMax$1(e===void 0?t.length-1:e,0),function(){for(var n=arguments,r=-1,i=nativeMax$1(n.length-e,0),o=Array(i);++r0){if(++e>=HOT_COUNT)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var _shortOut=shortOut$1,baseSetToString=_baseSetToString,shortOut=_shortOut,setToString$1=shortOut(baseSetToString),_setToString=setToString$1,identity=identity_1,overRest=_overRest,setToString=_setToString;function baseRest$1(t,e){return setToString(overRest(t,e,identity),t+"")}var _baseRest=baseRest$1,baseFlatten$1=_baseFlatten,baseOrderBy=_baseOrderBy,baseRest=_baseRest,isIterateeCall$1=_isIterateeCall,sortBy=baseRest(function(t,e){if(t==null)return[];var a=e.length;return a>1&&isIterateeCall$1(t,e[0],e[1])?e=[]:a>2&&isIterateeCall$1(e[0],e[1],e[2])&&(e=[e[0]]),baseOrderBy(t,baseFlatten$1(e,1),[])}),sortBy_1=sortBy;const sortBy$1=getDefaultExportFromCjs(sortBy_1);function baseZipObject$1(t,e,a){for(var n=-1,r=t.length,i=e.length,o={};++n parseInt(t,10)));function numberToHuman(t,e,a){const n={roundMode:a.roundMode,precision:a.precision,significant:a.significant};let r;if(inferType(a.units)==="string"){const d=a.units;if(r=lookup(t,d),!r)throw new Error(`The scope "${t.locale}${t.defaultSeparator}${getFullScope(t,d,{})}" couldn't be found`)}else r=a.units;let i=roundNumber(new BigNumber(e),n);const o=d=>sortBy$1(Object.keys(d).map(h=>INVERTED_DECIMAL_UNITS[h]),h=>h*-1),s=(d,h)=>{const m=d.isZero()?0:Math.floor(Math.log10(d.abs().toNumber()));return o(h).find(p=>m>=p)||0},l=(d,h)=>{const m=DECIMAL_UNITS[h.toString()];return d[m]||""},u=s(new BigNumber(i),r),c=l(r,u);if(i=roundNumber(new BigNumber(i).div(Math.pow(10,u)),n),a.stripInsignificantZeros){let[d,h]=i.split(".");h=(h||"").replace(/0+$/,""),i=d,h&&(i+=`${a.separator}${h}`)}return a.format.replace("%n",i||"0").replace("%u",c).trim()}const STORAGE_UNITS=["byte","kb","mb","gb","tb","pb","eb"];function numberToHumanSize(t,e,a){const n=expandRoundMode(a.roundMode),r=1024,i=new BigNumber(e).abs(),o=i.lt(r);let s;const l=(p,v)=>{const y=v.length-1,w=new BigNumber(Math.log(p.toNumber())).div(Math.log(r)).integerValue(BigNumber.ROUND_DOWN).toNumber();return Math.min(y,w)},u=p=>`number.human.storage_units.units.${o?"byte":p[c]}`,c=l(i,STORAGE_UNITS);o?s=i.integerValue():s=new BigNumber(roundNumber(i.div(Math.pow(r,c)),{significant:a.significant,precision:a.precision,roundMode:a.roundMode}));const d=t.translate("number.human.storage_units.format",{defaultValue:"%n %u"}),h=t.translate(u(STORAGE_UNITS),{count:i.integerValue().toNumber()});let m=s.toFixed(a.precision,n);return a.stripInsignificantZeros&&(m=m.replace(/(\..*?)0+$/,"$1").replace(/\.$/,"")),d.replace("%n",m).replace("%u",h)}function parseDate(t){if(t instanceof Date)return t;if(typeof t=="number"){const n=new Date;return n.setTime(t),n}const e=new String(t).match(/(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{2}):(\d{2}):(\d{2})(?:[.,](\d{1,3}))?)?(Z|\+00:?00)?/);if(e){const n=e.slice(1,8).map(h=>parseInt(h,10)||0);n[1]-=1;const[r,i,o,s,l,u,c]=n;return e[8]?new Date(Date.UTC(r,i,o,s,l,u,c)):new Date(r,i,o,s,l,u,c)}t.match(/([A-Z][a-z]{2}) ([A-Z][a-z]{2}) (\d+) (\d+:\d+:\d+) ([+-]\d+) (\d+)/)&&new Date().setTime(Date.parse([RegExp.$1,RegExp.$2,RegExp.$3,RegExp.$6,RegExp.$4,RegExp.$5].join(" ")));const a=new Date;return a.setTime(Date.parse(t)),a}function pluralize({i18n:t,count:e,scope:a,options:n,baseScope:r}){n=Object.assign({},n);let i,o;if(typeof a=="object"&&a?i=a:i=lookup(t,a,n),!i)return t.missingTranslation.get(a,n);const l=t.pluralization.get(n.locale)(t,e),u=[];for(;l.length;){const c=l.shift();if(isSet(i[c])){o=i[c];break}u.push(c)}return isSet(o)?(n.count=e,t.interpolate(t,o,n)):t.missingTranslation.get(r.split(t.defaultSeparator).concat([u[0]]),n)}var baseFlatten=_baseFlatten,INFINITY=1/0;function flattenDeep(t){var e=t==null?0:t.length;return e?baseFlatten(t,INFINITY):[]}var flattenDeep_1=flattenDeep;const flattenDeep$1=getDefaultExportFromCjs(flattenDeep_1);class PropertyFlatList{constructor(e){this.target=e}call(){const e=flattenDeep$1(Object.keys(this.target).map(a=>this.compute(this.target[a],a)));return e.sort(),e}compute(e,a){return!Array.isArray(e)&&isObject$7(e)?Object.keys(e).map(n=>this.compute(e[n],`${a}.${n}`)):a}}function propertyFlatList(t){return new PropertyFlatList(t).call()}const DEFAULT_OPTIONS={meridian:{am:"AM",pm:"PM"},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbrDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:[null,"January","February","March","April","May","June","July","August","September","October","November","December"],abbrMonthNames:[null,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]};function strftime(t,e,a={}){const{abbrDayNames:n,dayNames:r,abbrMonthNames:i,monthNames:o,meridian:s}=Object.assign(Object.assign({},DEFAULT_OPTIONS),a);if(isNaN(t.getTime()))throw new Error("strftime() requires a valid date object, but received an invalid date.");const l=t.getDay(),u=t.getDate(),c=t.getFullYear(),d=t.getMonth()+1,h=t.getHours();let m=h;const p=h>11?"pm":"am",v=t.getSeconds(),y=t.getMinutes(),w=t.getTimezoneOffset(),_=Math.floor(Math.abs(w/60)),C=Math.abs(w)-_*60,O=(w>0?"-":"+")+(_.toString().length<2?"0"+_:_)+(C.toString().length<2?"0"+C:C);return m>12?m=m-12:m===0&&(m=12),e=e.replace("%a",n[l]),e=e.replace("%A",r[l]),e=e.replace("%b",i[d]),e=e.replace("%B",o[d]),e=e.replace("%d",u.toString().padStart(2,"0")),e=e.replace("%e",u.toString()),e=e.replace("%-d",u.toString()),e=e.replace("%H",h.toString().padStart(2,"0")),e=e.replace("%-H",h.toString()),e=e.replace("%k",h.toString()),e=e.replace("%I",m.toString().padStart(2,"0")),e=e.replace("%-I",m.toString()),e=e.replace("%l",m.toString()),e=e.replace("%m",d.toString().padStart(2,"0")),e=e.replace("%-m",d.toString()),e=e.replace("%M",y.toString().padStart(2,"0")),e=e.replace("%-M",y.toString()),e=e.replace("%p",s[p]),e=e.replace("%P",s[p].toLowerCase()),e=e.replace("%S",v.toString().padStart(2,"0")),e=e.replace("%-S",v.toString()),e=e.replace("%w",l.toString()),e=e.replace("%y",c.toString().padStart(2,"0").substr(-2)),e=e.replace("%-y",c.toString().padStart(2,"0").substr(-2).replace(/^0+/,"")),e=e.replace("%Y",c.toString()),e=e.replace(/%z/i,O),e}var nativeCeil=Math.ceil,nativeMax=Math.max;function baseRange$1(t,e,a,n){for(var r=-1,i=nativeMax(nativeCeil((e-t)/(a||1)),0),o=Array(i);i--;)o[n?i:++r]=t,t+=a;return o}var _baseRange=baseRange$1,baseRange=_baseRange,isIterateeCall=_isIterateeCall,toFinite=toFinite_1;function createRange$1(t){return function(e,a,n){return n&&typeof n!="number"&&isIterateeCall(e,a,n)&&(a=n=void 0),e=toFinite(e),a===void 0?(a=e,e=0):a=toFinite(a),n=n===void 0?ea>=t&&a<=e;function timeAgoInWords(t,e,a,n={}){const r=n.scope||"datetime.distance_in_words",i=(F,g=0)=>t.t(F,{count:g,scope:r});e=parseDate(e),a=parseDate(a);let o=e.getTime()/1e3,s=a.getTime()/1e3;o>s&&([e,a,o,s]=[a,e,s,o]);const l=Math.round(s-o),u=Math.round((s-o)/60),d=u/60/24,h=Math.round(u/60),m=Math.round(d),p=Math.round(m/30);if(within(0,1,u))return n.includeSeconds?within(0,4,l)?i("less_than_x_seconds",5):within(5,9,l)?i("less_than_x_seconds",10):within(10,19,l)?i("less_than_x_seconds",20):within(20,39,l)?i("half_a_minute"):within(40,59,l)?i("less_than_x_minutes",1):i("x_minutes",1):u===0?i("less_than_x_minutes",1):i("x_minutes",u);if(within(2,44,u))return i("x_minutes",u);if(within(45,89,u))return i("about_x_hours",1);if(within(90,1439,u))return i("about_x_hours",h);if(within(1440,2519,u))return i("x_days",1);if(within(2520,43199,u))return i("x_days",m);if(within(43200,86399,u))return i("about_x_months",Math.round(u/43200));if(within(86400,525599,u))return i("x_months",p);let v=e.getFullYear();e.getMonth()+1>=3&&(v+=1);let y=a.getFullYear();a.getMonth()+1<3&&(y-=1);const w=v>y?0:range$1(v,y).filter(F=>new Date(F,1,29).getMonth()==1).length,_=525600,C=w*1440,O=u-C,k=Math.trunc(O/_),N=parseFloat((O/_-k).toPrecision(3));return N<.25?i("about_x_years",k):N<.75?i("over_x_years",k):i("almost_x_years",k+1)}const guessStrategy=function(t,e){e instanceof Array&&(e=e.join(t.defaultSeparator));const a=e.split(t.defaultSeparator).slice(-1)[0];return t.missingTranslationPrefix+a.replace("_"," ").replace(/([a-z])([A-Z])/g,(n,r,i)=>`${r} ${i.toLowerCase()}`)},messageStrategy=(t,e,a)=>{const n=getFullScope(t,e,a),r="locale"in a?a.locale:t.locale,i=inferType(r);return`[missing "${[i=="string"?r:i,n].join(t.defaultSeparator)}" translation]`},errorStrategy=(t,e,a)=>{const n=getFullScope(t,e,a),r=[t.locale,n].join(t.defaultSeparator);throw new Error(`Missing translation: ${r}`)};class MissingTranslation{constructor(e){this.i18n=e,this.registry={},this.register("guess",guessStrategy),this.register("message",messageStrategy),this.register("error",errorStrategy)}register(e,a){this.registry[e]=a}get(e,a){var n;return this.registry[(n=a.missingBehavior)!==null&&n!==void 0?n:this.i18n.missingBehavior](this.i18n,e,a)}}var __awaiter=globalThis&&globalThis.__awaiter||function(t,e,a,n){function r(i){return i instanceof a?i:new a(function(o){o(i)})}return new(a||(a=Promise))(function(i,o){function s(c){try{u(n.next(c))}catch(d){o(d)}}function l(c){try{u(n.throw(c))}catch(d){o(d)}}function u(c){c.done?i(c.value):r(c.value).then(s,l)}u((n=n.apply(t,e||[])).next())})};const DEFAULT_I18N_OPTIONS={defaultLocale:"en",availableLocales:["en"],locale:"en",defaultSeparator:".",placeholder:/(?:\{\{|%\{)(.*?)(?:\}\}?)/gm,enableFallback:!1,missingBehavior:"message",missingTranslationPrefix:"",missingPlaceholder:(t,e)=>`[missing "${e}" value]`,nullPlaceholder:(t,e,a,n)=>t.missingPlaceholder(t,e,a,n),transformKey:t=>t};class I18n{constructor(e={},a={}){this._locale=DEFAULT_I18N_OPTIONS.locale,this._defaultLocale=DEFAULT_I18N_OPTIONS.defaultLocale,this._version=0,this.onChangeHandlers=[],this.translations={},this.availableLocales=[],this.t=this.translate,this.p=this.pluralize,this.l=this.localize,this.distanceOfTimeInWords=this.timeAgoInWords;const{locale:n,enableFallback:r,missingBehavior:i,missingTranslationPrefix:o,missingPlaceholder:s,nullPlaceholder:l,defaultLocale:u,defaultSeparator:c,placeholder:d,transformKey:h}=Object.assign(Object.assign({},DEFAULT_I18N_OPTIONS),a);this.locale=n,this.defaultLocale=u,this.defaultSeparator=c,this.enableFallback=r,this.locale=n,this.missingBehavior=i,this.missingTranslationPrefix=o,this.missingPlaceholder=s,this.nullPlaceholder=l,this.placeholder=d,this.pluralization=new Pluralization(this),this.locales=new Locales(this),this.missingTranslation=new MissingTranslation(this),this.transformKey=h,this.interpolate=interpolate,this.store(e)}store(e){propertyFlatList(e).forEach(n=>setWith$1(this.translations,n,get$2(e,n),Object)),this.hasChanged()}get locale(){return this._locale||this.defaultLocale||"en"}set locale(e){if(typeof e!="string")throw new Error(`Expected newLocale to be a string; got ${inferType(e)}`);const a=this._locale!==e;this._locale=e,a&&this.hasChanged()}get defaultLocale(){return this._defaultLocale||"en"}set defaultLocale(e){if(typeof e!="string")throw new Error(`Expected newLocale to be a string; got ${inferType(e)}`);const a=this._defaultLocale!==e;this._defaultLocale=e,a&&this.hasChanged()}translate(e,a){a=Object.assign({},a);const n=createTranslationOptions(this,e,a);let r;return n.some(o=>(isSet(o.scope)?r=lookup(this,o.scope,a):isSet(o.message)&&(r=o.message),r!=null))?(typeof r=="string"?r=this.interpolate(this,r,a):typeof r=="object"&&r&&isSet(a.count)&&(r=pluralize({i18n:this,count:a.count||0,scope:r,options:a,baseScope:getFullScope(this,e,a)})),a&&r instanceof Array&&(r=r.map(o=>typeof o=="string"?interpolate(this,o,a):o)),r):this.missingTranslation.get(e,a)}pluralize(e,a,n){return pluralize({i18n:this,count:e,scope:a,options:Object.assign({},n),baseScope:getFullScope(this,a,n??{})})}localize(e,a,n){if(n=Object.assign({},n),a==null)return"";switch(e){case"currency":return this.numberToCurrency(a);case"number":return formatNumber(a,Object.assign({delimiter:",",precision:3,separator:".",significant:!1,stripInsignificantZeros:!1},lookup(this,"number.format")));case"percentage":return this.numberToPercentage(a);default:{let r;return e.match(/^(date|time)/)?r=this.toTime(e,a):r=a.toString(),interpolate(this,r,n)}}}toTime(e,a){const n=parseDate(a),r=lookup(this,e);return n.toString().match(/invalid/i)||!r?n.toString():this.strftime(n,r)}numberToCurrency(e,a={}){return formatNumber(e,Object.assign(Object.assign(Object.assign({delimiter:",",format:"%u%n",precision:2,separator:".",significant:!1,stripInsignificantZeros:!1,unit:"$"},camelCaseKeys(this.get("number.format"))),camelCaseKeys(this.get("number.currency.format"))),a))}numberToPercentage(e,a={}){return formatNumber(e,Object.assign(Object.assign(Object.assign({delimiter:"",format:"%n%",precision:3,stripInsignificantZeros:!1,separator:".",significant:!1},camelCaseKeys(this.get("number.format"))),camelCaseKeys(this.get("number.percentage.format"))),a))}numberToHumanSize(e,a={}){return numberToHumanSize(this,e,Object.assign(Object.assign(Object.assign({delimiter:"",precision:3,significant:!0,stripInsignificantZeros:!0,units:{billion:"Billion",million:"Million",quadrillion:"Quadrillion",thousand:"Thousand",trillion:"Trillion",unit:""}},camelCaseKeys(this.get("number.human.format"))),camelCaseKeys(this.get("number.human.storage_units"))),a))}numberToHuman(e,a={}){return numberToHuman(this,e,Object.assign(Object.assign(Object.assign({delimiter:"",separator:".",precision:3,significant:!0,stripInsignificantZeros:!0,format:"%n %u",roundMode:"default",units:{billion:"Billion",million:"Million",quadrillion:"Quadrillion",thousand:"Thousand",trillion:"Trillion",unit:""}},camelCaseKeys(this.get("number.human.format"))),camelCaseKeys(this.get("number.human.decimal_units"))),a))}numberToRounded(e,a){return formatNumber(e,Object.assign({unit:"",precision:3,significant:!1,separator:".",delimiter:"",stripInsignificantZeros:!1},a))}numberToDelimited(e,a={}){return numberToDelimited(e,Object.assign({delimiterPattern:/(\d)(?=(\d\d\d)+(?!\d))/g,delimiter:",",separator:"."},a))}withLocale(e,a){return __awaiter(this,void 0,void 0,function*(){const n=this.locale;try{this.locale=e,yield a()}finally{this.locale=n}})}strftime(e,a,n={}){return strftime(e,a,Object.assign(Object.assign(Object.assign({},camelCaseKeys(lookup(this,"date"))),{meridian:{am:lookup(this,"time.am")||"AM",pm:lookup(this,"time.pm")||"PM"}}),n))}update(e,a,n={strict:!1}){if(n.strict&&!has$1(this.translations,e))throw new Error(`The path "${e}" is not currently defined`);const r=get$2(this.translations,e),i=inferType(r),o=inferType(a);if(n.strict&&i!==o)throw new Error(`The current type for "${e}" is "${i}", but you're trying to override it with "${o}"`);let s;o==="object"?s=Object.assign(Object.assign({},r),a):s=a,set$1(this.translations,e,s),this.hasChanged()}toSentence(e,a={}){const{wordsConnector:n,twoWordsConnector:r,lastWordConnector:i}=Object.assign(Object.assign({wordsConnector:", ",twoWordsConnector:" and ",lastWordConnector:", and "},camelCaseKeys(lookup(this,"support.array"))),a),o=e.length;switch(o){case 0:return"";case 1:return`${e[0]}`;case 2:return e.join(r);default:return[e.slice(0,o-1).join(n),i,e[o-1]].join("")}}timeAgoInWords(e,a,n={}){return timeAgoInWords(this,e,a,n)}onChange(e){return this.onChangeHandlers.push(e),()=>{this.onChangeHandlers.splice(this.onChangeHandlers.indexOf(e),1)}}get version(){return this._version}formatNumber(e,a){return formatNumber(e,a)}get(e){return lookup(this,e)}runCallbacks(){this.onChangeHandlers.forEach(e=>e(this))}hasChanged(){this._version+=1,this.runCallbacks()}}async function loadTranslations(t,e){{e=e.replace("-","_");const n=await(await fetch(`./v2/i18n/${e}.json`)).json();t.store(n)}}let currencies$1=[],chart$2=null,chartData$1=null,afterPromises$4=!1,i18n$3;const budgets=()=>({loading:!1,autoConversion:!1,loadChart(){if(this.loading!==!0){if(this.loading=!0,chartData$1!==null){this.drawChart(this.generateOptions(chartData$1)),this.loading=!1;return}this.getFreshData()}},drawChart(t){if(chart$2!==null){chart$2.data.datasets=t.data.datasets,chart$2.update();return}chart$2=new Chart(document.querySelector("#budget-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey("dashboard-budgets-chart",t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){chartData$1=r,this.drawChart(this.generateOptions(chartData$1)),this.loading=!1;return}new Dashboard$1().dashboard(t,e,null).then(o=>{chartData$1=o.data,this.drawChart(this.generateOptions(chartData$1)),window.store.set(a,chartData$1),this.loading=!1})},generateOptions(t){currencies$1=[];let e=getDefaultChartSettings("column");e.options.locale=window.store.get("locale").replace("_","-"),e.options.plugins={tooltip:{callbacks:{title:function(a){return a.label},label:function(a){let n=a.dataset.label||"";return n&&(n+=": "),n+" "+formatMoney(a.parsed.y,currencies$1[a.parsed.x]??"EUR")}}}},e.data={labels:[],datasets:[{label:i18n$3.t("firefly.spent"),data:[],borderWidth:1,stack:1,backgroundColor:getColors("spent","background"),borderColor:getColors("spent","border")},{label:i18n$3.t("firefly.left"),data:[],borderWidth:1,stack:1,backgroundColor:getColors("left","background"),borderColor:getColors("left","border")},{label:i18n$3.t("firefly.overspent"),data:[],borderWidth:1,stack:1,backgroundColor:getColors("overspent","background"),borderColor:getColors("overspent","border")}]};for(const a in t)if(t.hasOwnProperty(a)){let n=t[a],r=n.label+" ("+n.currency_code+")";e.data.labels.push(r),this.autoConversion&&(currencies$1.push(n.native_currency_code),e.data.datasets[0].data.push(parseFloat(n.native_entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(n.native_entries.left)),e.data.datasets[2].data.push(parseFloat(n.native_entries.overspent))),this.autoConversion||(currencies$1.push(n.currency_code),e.data.datasets[0].data.push(parseFloat(n.entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(n.entries.left)),e.data.datasets[2].data.push(parseFloat(n.entries.overspent)))}return e.options.scales={y:{ticks:{callback:function(a){return formatMoney(a,currencies$1[0]??"EUR")}}}},e},init(){Promise.all([getVariable("autoConversion",!1),getVariable("language","en_US")]).then(t=>{i18n$3=new I18n;const e=t[1].replace("-","_");i18n$3.locale=e,loadTranslations(i18n$3,e).then(()=>{this.autoConversion=t[0],afterPromises$4=!0,this.loading===!1&&this.loadChart()})}),window.store.observe("end",()=>{afterPromises$4&&this.loading===!1&&(chartData$1=null,this.loadChart())}),window.store.observe("autoConversion",t=>{afterPromises$4&&(this.autoConversion=t,this.loading===!1&&this.loadChart())})}});class Dashboard{dashboard(e,a){let n=format$1(e,"y-MM-dd"),r=format$1(a,"y-MM-dd");return api.get("/api/v2/chart/category/dashboard",{params:{start:n,end:r}})}}let currencies=[],chart$1=null,chartData=null,afterPromises$3=!1;const categories=()=>({loading:!1,autoConversion:!1,generateOptions(t){currencies=[];let e=getDefaultChartSettings("column"),a={};for(const r in t)if(t.hasOwnProperty(r)){let i=t[r],o=i.currency_code;this.autoConversion&&(o=i.native_currency_code),a.hasOwnProperty(o)||(a[o]={name:o,yAxisID:"",data:{}},currencies.push(o))}for(const r in t)if(t.hasOwnProperty(r)){let i=t[r],o=i.currency_code;this.autoConversion&&(o=i.native_currency_code);for(const s in a)if(a.hasOwnProperty(s)){let l=0;o===s&&(l=parseFloat(i.amount),""+i.currency_code,this.autoConversion&&(l=parseFloat(i.native_amount),""+i.native_currency_code)),a[s].data.hasOwnProperty(i.label)&&(a[s].data[i.label]=a[s].data[i.label]+l),a[s].data.hasOwnProperty(i.label)||(a[s].data[i.label]=l)}e.data.labels.includes(i.label)||e.data.labels.push(i.label)}let n=0;for(const r in a){let i="y"+r,o={label:r,currency_code:r,yAxisID:i,data:[]};for(const s in a[r].data)o.data.push(a[r].data[s]);e.data.datasets.push(o),e.options.scales.hasOwnProperty(i)||(e.options.scales[i]={beginAtZero:!0,type:"linear",position:n===1?"right":"left",ticks:{callback:function(s,l,u){return formatMoney(s,r)}}},n++)}return e},drawChart(t){if(chart$1!==null){chart$1.options=t.options,chart$1.data=t.data,chart$1.update();return}chart$1=new Chart(document.querySelector("#category-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey("dashboard-categories-chart",t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){chartData=r,this.drawChart(this.generateOptions(chartData)),this.loading=!1;return}new Dashboard().dashboard(t,e,null).then(o=>{chartData=o.data,this.drawChart(this.generateOptions(o.data)),window.store.set(a,chartData),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,chartData!==null){this.drawChart(this.generateOptions(chartData)),this.loading=!1;return}this.getFreshData()}},init(){Promise.all([getVariable("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],afterPromises$3=!0,this.loadChart()}),window.store.observe("end",()=>{afterPromises$3&&(this.chartData=null,this.loadChart())}),window.store.observe("autoConversion",t=>{afterPromises$3&&(this.autoConversion=t,this.loadChart())})}});let Get$2=class{get(e){return api.get("/api/v2/transactions",{params:e})}};/*! * chartjs-chart-sankey v0.12.0 * https://github.com/kurkle/chartjs-chart-sankey#readme * (c) 2022 Jukka Kurkela * Released under the MIT license */function toTextLines(t){const e=[],a=isArray$b(t)?t:isNullOrUndef(t)?[]:[t];for(;a.length;){const n=a.pop();typeof n=="string"?e.unshift.apply(e,n.split(` -`)):Array.isArray(n)?a.push.apply(a,n):isNullOrUndef(a)||e.unshift(""+n)}return e}function validateSizeValue(t){return!t||["min","max"].indexOf(t)===-1?"max":t}const defined=t=>t!==void 0;function calculateX(t,e){const a=new Set(e.map(o=>o.to)),n=new Set(e.map(o=>o.from)),r=new Set([...t.keys()]);let i=0;for(;r.size;){const o=nextColumn([...r],a);for(const s of o){const l=t.get(s);defined(l.x)||(l.x=i),r.delete(s)}r.size&&(a.clear(),e.filter(s=>r.has(s.from)).forEach(s=>a.add(s.to)),i++)}return[...t.keys()].filter(o=>!n.has(o)).forEach(o=>{const s=t.get(o);s.column||(s.x=i)}),i}function nextColumn(t,e){const a=t.filter(n=>!e.has(n));return a.length?a:t.slice(0,1)}const nodeByXY=(t,e)=>t.x!==e.x?t.x-e.x:t.y-e.y;let prevCountId=-1;function getCountId(){return prevCountId=prevCountId<100?prevCountId+1:0,prevCountId}function nodeCount(t,e,a=getCountId()){let n=0;for(const r of t)r.node._visited!==a&&(r.node._visited=a,n+=r.node[e].length+nodeCount(r.node[e],e,a));return n}const flowByNodeCount=t=>(e,a)=>nodeCount(e.node[t],t)-nodeCount(a.node[t],t)||e.node[t].length-a.node[t].length;function processFrom(t,e){t.from.sort(flowByNodeCount("from"));for(const a of t.from){const n=a.node;defined(n.y)||(n.y=e,processFrom(n,e)),e=Math.max(n.y+n.out,e)}return e}function processTo(t,e){t.to.sort(flowByNodeCount("to"));for(const a of t.to){const n=a.node;defined(n.y)||(n.y=e,processTo(n,e)),e=Math.max(n.y+n.in,e)}return e}function setOrGetY(t,e){return defined(t.y)?t.y:(t.y=e,e)}function processRest(t,e){const a=t.filter(c=>c.x===0),n=t.filter(c=>c.x===e),r=a.filter(c=>!defined(c.y)),i=n.filter(c=>!defined(c.y)),o=t.filter(c=>c.x>0&&c.x Math.max(c,d.y+d.out||0),0),l=n.reduce((c,d)=>Math.max(c,d.y+d.in||0),0),u=0;return s>=l?(r.forEach(c=>{s=setOrGetY(c,s),s=Math.max(s+c.out,processTo(c,s))}),i.forEach(c=>{l=setOrGetY(c,l),l=Math.max(l+c.in,processTo(c,l))})):(i.forEach(c=>{l=setOrGetY(c,l),l=Math.max(l+c.in,processTo(c,l))}),r.forEach(c=>{s=setOrGetY(c,s),s=Math.max(s+c.out,processTo(c,s))})),o.forEach(c=>{let d=t.filter(h=>h.x===c.x&&defined(h.y)).reduce((h,m)=>Math.max(h,m.y+Math.max(m.in,m.out)),0);d=setOrGetY(c,d),d=Math.max(d+c.in,processFrom(c,d)),d=Math.max(d+c.out,processTo(c,d)),u=Math.max(u,d)}),Math.max(s,l,u)}function calculateY(t,e){t.sort((o,s)=>Math.max(s.in,s.out)-Math.max(o.in,o.out));const a=t[0];a.y=0;const n=processFrom(a,0),r=processTo(a,0),i=processRest(t,e);return Math.max(n,r,i)}function calculateYUsingPriority(t,e){let a=0,n=0;for(let r=0;r<=e;r++){let i=n;const o=t.filter(s=>s.x===r).sort((s,l)=>s.priority-l.priority);n=o[0].to.filter(s=>s.node.x>r+1).reduce((s,l)=>s+l.flow,0)||0;for(const s of o)s.y=i,i+=Math.max(s.out,s.in);a=Math.max(i,a)}return a}function addPadding(t,e){let a=1,n=0,r=0,i=0;const o=[];t.sort(nodeByXY);for(const s of t){if(s.y){if(s.x===0)o.push(s.y);else{for(n!==s.x&&(n=s.x,r=0),a=r+1;a s.y);a++);r=a}s.y+=a*e,a++}i=Math.max(i,s.y+Math.max(s.in,s.out))}return i}function sortFlows(t,e){t.forEach(a=>{const n=Math[e](a.in||a.out,a.out||a.in),r=n l.node.y+l.node.out/2-(u.node.y+u.node.out/2)).forEach((l,u)=>{r?l.addY=u*(n-l.flow)/(s-1):(l.addY=o,o+=l.flow)}),o=0,s=a.to.length,a.to.sort((l,u)=>l.node.y+l.node.in/2-(u.node.y+u.node.in/2)).forEach((l,u)=>{i?l.addY=u*(n-l.flow)/(s-1):(l.addY=o,o+=l.flow)})})}function layout(t,e,a,n){const r=[...t.values()],i=calculateX(t,e),s=(a?calculateYUsingPriority(r,i):calculateY(r,i))*.03,l=addPadding(r,s);return sortFlows(r,n),{maxX:i,maxY:l}}function buildNodesFromRawData(t){const e=new Map;for(let n=0;n r.flow-n.flow;return[...e.values()].forEach(n=>{n.from=n.from.sort(a),n.from.forEach(r=>{r.node=e.get(r.key)}),n.to=n.to.sort(a),n.to.forEach(r=>{r.node=e.get(r.key)})}),e}function getAddY(t,e,a){for(const n of t)if(n.key===e&&n.index===a)return n.addY;return 0}class SankeyController extends DatasetController{parseObjectData(e,a,n,r){const{from:i="from",to:o="to",flow:s="flow"}=this.options.parsing,l=a.map(({[i]:_,[o]:C,[s]:O})=>({from:_,to:C,flow:O})),{xScale:u,yScale:c}=e,d=[],h=this._nodes=buildNodesFromRawData(l),{column:m,priority:p,size:v}=this.getDataset();if(p)for(const _ of h.values())_.key in p&&(_.priority=p[_.key]);if(m)for(const _ of h.values())_.key in m&&(_.column=!0,_.x=m[_.key]);const{maxX:y,maxY:w}=layout(h,l,!!p,validateSizeValue(v));this._maxX=y,this._maxY=w;for(let _=0,C=l.length;_ 1){const h=u-c*l/2+d;for(let m=0;m t.type==="data"?(t.parsed._custom.x-t.parsed.x)*200:void 0,delay:t=>t.type==="data"?t.parsed.x*500+t.dataIndex*20:void 0},colors:{type:"color",properties:["colorFrom","colorTo"]}},transitions:{hide:{animations:{colors:{type:"color",properties:["colorFrom","colorTo"],to:"transparent"}}},show:{animations:{colors:{type:"color",properties:["colorFrom","colorTo"],from:"transparent"}}}}};SankeyController.overrides={interaction:{mode:"nearest",intersect:!0},datasets:{clip:!1,parsing:!0},plugins:{tooltip:{callbacks:{title(){return""},label(t){const e=t.dataset.data[t.dataIndex];return e.from+" -> "+e.to+": "+e.flow}}},legend:{display:!1}},scales:{x:{type:"linear",bounds:"data",display:!1,min:0,offset:!1},y:{type:"linear",bounds:"data",display:!1,min:0,reverse:!0,offset:!1}},layout:{padding:{top:3,left:3,right:13,bottom:3}}};const controlPoints=(t,e,a,n)=>t({x:t.x+a*(e.x-t.x),y:t.y+a*(e.y-t.y)});function setStyle(t,{x:e,x2:a,options:n}){let r;n.colorMode==="from"?r=color(n.colorFrom).alpha(.5).rgbString():n.colorMode==="to"?r=color(n.colorTo).alpha(.5).rgbString():(r=t.createLinearGradient(e,0,a,0),r.addColorStop(0,color(n.colorFrom).alpha(.5).rgbString()),r.addColorStop(1,color(n.colorTo).alpha(.5).rgbString())),t.fillStyle=r,t.strokeStyle=r,t.lineWidth=.5}class Flow extends Element$1{constructor(e){super(),this.options=void 0,this.x=void 0,this.y=void 0,this.x2=void 0,this.y2=void 0,this.height=void 0,e&&Object.assign(this,e)}draw(e){const a=this,{x:n,x2:r,y:i,y2:o,height:s,progress:l}=a,{cp1:u,cp2:c}=controlPoints(n,i,r,o);l!==0&&(e.save(),l<1&&(e.beginPath(),e.rect(n,Math.min(i,o),(r-n)*l+1,Math.abs(o-i)+s+1),e.clip()),setStyle(e,a),e.beginPath(),e.moveTo(n,i),e.bezierCurveTo(u.x,u.y,c.x,c.y,r,o),e.lineTo(r,o+s),e.bezierCurveTo(c.x,c.y+s,u.x,u.y+s,n,i+s),e.lineTo(n,i),e.stroke(),e.closePath(),e.fill(),e.restore())}inRange(e,a,n){const{x:r,y:i,x2:o,y2:s,height:l}=this.getProps(["x","y","x2","y2","height"],n);if(e o)return!1;const{cp1:u,cp2:c}=controlPoints(r,i,o,s),d=(e-r)/(o-r),h={x:r,y:i},m={x:o,y:s},p=pointInLine(h,u,d),v=pointInLine(u,c,d),y=pointInLine(c,m,d),w=pointInLine(p,v,d),_=pointInLine(v,y,d),C=pointInLine(w,_,d).y;return a>=C&&a<=C+l}inXRange(e,a){const{x:n,x2:r}=this.getProps(["x","x2"],a);return e>=n&&e<=r}inYRange(e,a){const{y:n,y2:r,height:i}=this.getProps(["y","y2","height"],a),o=Math.min(n,r),s=Math.max(n,r)+i;return e>=o&&e<=s}getCenterPoint(e){const{x:a,y:n,x2:r,y2:i,height:o}=this.getProps(["x","y","x2","y2","height"],e);return{x:(a+r)/2,y:(n+i+o)/2}}tooltipPosition(e){return this.getCenterPoint(e)}getRange(e){return e==="x"?this.width/2:this.height/2}}Flow.id="flow";Flow.defaults={colorFrom:"red",colorTo:"green",colorMode:"gradient",hoverColorFrom:(t,e)=>getHoverColor(e.colorFrom),hoverColorTo:(t,e)=>getHoverColor(e.colorTo)};Chart.register({SankeyController,Flow});const SANKEY_CACHE_KEY="dashboard-sankey-data";let i18n$2,afterPromises$2=!1,chart=null,transactions=[],autoConversion=!1,translations={category:null,unknown_category:null,in:null,out:null,unknown_source:null,unknown_dest:null,unknown_account:null,expense_account:null,revenue_account:null,budget:null,unknown_budget:null,all_money:null};const getColor=function(t){return t.includes(translations.revenue_account)?"forestgreen":t.includes("("+translations.in+",")?"green":t.includes(translations.budget)||t.includes(translations.unknown_budget)?"Orchid":t.includes("("+translations.out+",")?"MediumOrchid":t.includes(translations.all_money)?"blue":"red"};function getObjectName(t,e,a,n){if(t==="category"&&e!==null&&a==="in")return translations.category+' "'+e+'" ('+translations.in+(autoConversion?", "+n+")":")");if(t==="category"&&e===null&&a==="in")return translations.unknown_category+" ("+translations.in+(autoConversion?", "+n+")":")");if(t==="category"&&e!==null&&a==="out")return translations.category+' "'+e+'" ('+translations.out+(autoConversion?", "+n+")":")");if(t==="category"&&e===null&&a==="out")return translations.unknown_category+" ("+translations.out+(autoConversion?", "+n+")":")");if(t==="account"&&e===null&&a==="in")return translations.unknown_source+(autoConversion?" ("+n+")":"");if(t==="account"&&e!==null&&a==="in")return translations.revenue_account+'"'+e+'"'+(autoConversion?" ("+n+")":"");if(t==="account"&&e===null&&a==="out")return translations.unknown_dest+(autoConversion?" ("+n+")":"");if(t==="account"&&e!==null&&a==="out")return translations.expense_account+' "'+e+'"'+(autoConversion?" ("+n+")":"");if(t==="budget"&&e!==null)return translations.budget+' "'+e+'"'+(autoConversion?" ("+n+")":"");if(t==="budget"&&e===null)return translations.unknown_budget+(autoConversion?" ("+n+")":"");console.error('Cannot handle: type:"'+t+'", dir: "'+a+'"')}function getLabelName(t,e,a){if(t==="category"&&e!==null)return translations.category+' "'+e+'"'+(autoConversion?" ("+a+")":"");if(t==="category"&&e===null)return translations.unknown_category+(autoConversion?" ("+a+")":"");if(t==="account"&&e===null)return translations.unknown_account+(autoConversion?" ("+a+")":"");if(t==="account"&&e!==null)return e+(autoConversion?" ("+a+")":"");if(t==="budget"&&e!==null)return translations.budget+' "'+e+'"'+(autoConversion?" ("+a+")":"");if(t==="budget"&&e===null)return translations.unknown_budget+(autoConversion?" ("+a+")":"");console.error('Cannot handle: type:"'+t+'"')}const sankey=()=>({loading:!1,autoConversion:!1,generateOptions(){let t=getDefaultChartSettings("sankey"),e={},a={};for(let r in transactions)if(transactions.hasOwnProperty(r)){let i=transactions[r];for(let o in i.attributes.transactions)if(i.attributes.transactions.hasOwnProperty(o)){let s=i.attributes.transactions[o],l=this.autoConversion?s.native_currency_code:s.currency_code,u=this.autoConversion?parseFloat(s.native_amount):parseFloat(s.amount),c;if(s.type==="deposit"){let d=getObjectName("category",s.category_name,"in",l),h=getObjectName("account",s.source_name,"in",l);a[d]=getLabelName("category",s.category_name,l),a[h]=getLabelName("account",s.source_name,l),c=h+"-"+d+"-"+l,e.hasOwnProperty(c)||(e[c]={from:h,to:d,amount:0}),e[c].amount+=u,c=d+"-"+translations.all_money+"-"+l,e.hasOwnProperty(c)||(e[c]={from:d,to:translations.all_money+(this.autoConversion?" ("+l+")":""),amount:0}),e[c].amount+=u}if(s.type==="withdrawal"){let d=getObjectName("budget",s.budget_name,"out",l);a[d]=getLabelName("budget",s.budget_name,l),c=translations.all_money+"-"+d+"-"+l,e.hasOwnProperty(c)||(e[c]={from:translations.all_money+(this.autoConversion?" ("+l+")":""),to:d,amount:0}),e[c].amount+=u;let h=getObjectName("category",s.category_name,"out",l);a[h]=getLabelName("category",s.category_name,l),c=d+"-"+h+"-"+l,e.hasOwnProperty(c)||(e[c]={from:d,to:h,amount:0}),e[c].amount+=u;let m=getObjectName("account",s.destination_name,"out",l);a[m]=getLabelName("account",s.destination_name,l),c=h+"-"+m+"-"+l,e.hasOwnProperty(c)||(e[c]={from:h,to:m,amount:0}),e[c].amount+=u}}}let n={label:"Firefly III dashboard sankey chart",data:[],colorFrom:r=>getColor(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].from:""),colorTo:r=>getColor(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].to:""),colorMode:"gradient",labels:a,size:"min"};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];n.data.push({from:i.from,to:i.to,flow:i.amount})}return t.data.datasets.push(n),t},drawChart(t){if(chart!==null){chart.data.datasets=t.data.datasets,chart.update();return}chart=new Chart(document.querySelector("#sankey-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey(SANKEY_CACHE_KEY,t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){transactions=r,this.drawChart(this.generateOptions()),this.loading=!1;return}let i={start:format$1(t,"y-MM-dd"),end:format$1(e,"y-MM-dd"),type:"withdrawal,deposit",page:1};this.downloadTransactions(i)},downloadTransactions(t){const e=new Date(window.store.get("start")),a=new Date(window.store.get("end")),n=getCacheKey(SANKEY_CACHE_KEY,e,a);new Get$2().get(t).then(i=>{if(transactions=[...transactions,...i.data.data],parseInt(i.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadTransactions(t);return}window.store.set(n,transactions),this.drawChart(this.generateOptions()),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,transactions.length!==0){this.drawChart(this.generateOptions()),this.loading=!1;return}this.getFreshData()}},init(){transactions=[],Promise.all([getVariable("autoConversion",!1),getVariable("language","en-US")]).then(t=>{this.autoConversion=t[0],autoConversion=t[0],i18n$2=new I18n,i18n$2.locale=t[1],loadTranslations(i18n$2,t[1]).then(()=>{translations.all_money=i18n$2.t("firefly.all_money"),translations.category=i18n$2.t("firefly.category"),translations.in=i18n$2.t("firefly.money_flowing_in"),translations.out=i18n$2.t("firefly.money_flowing_out"),translations.unknown_category=i18n$2.t("firefly.unknown_category_plain"),translations.unknown_source=i18n$2.t("firefly.unknown_source_plain"),translations.unknown_dest=i18n$2.t("firefly.unknown_dest_plain"),translations.unknown_account=i18n$2.t("firefly.unknown_any_plain"),translations.unknown_budget=i18n$2.t("firefly.unknown_budget_plain"),translations.expense_account=i18n$2.t("firefly.expense_account"),translations.revenue_account=i18n$2.t("firefly.revenue_account"),translations.budget=i18n$2.t("firefly.budget"),afterPromises$2=!0,this.loadChart()})}),window.store.observe("end",()=>{afterPromises$2&&(this.transactions=[],this.loadChart())}),window.store.observe("autoConversion",t=>{afterPromises$2&&(this.autoConversion=t,this.loadChart())})}});let Get$1=class{get(e){return api.get("/api/v2/subscriptions",{params:e})}paid(e){return api.get("/api/v2/subscriptions/sum/paid",{params:e})}unpaid(e){return api.get("/api/v2/subscriptions/sum/unpaid",{params:e})}},afterPromises$1=!1,i18n$1,subscriptionData={};function downloadSubscriptions(t){return new Get$1().get(t).then(a=>{let n=a.data.data;for(let r in n)if(n.hasOwnProperty(r)){let i=n[r];if(i.attributes.active&&i.attributes.pay_dates.length>0){let o=i.attributes.object_group_id===null?0:i.attributes.object_group_id,s=i.attributes.object_group_title===null?i18n$1.t("firefly.default_group_title_name_plain"):i.attributes.object_group_title,l=i.attributes.object_group_order===null?0:i.attributes.object_group_order;subscriptionData.hasOwnProperty(o)||(subscriptionData[o]={id:o,title:s,order:l,payment_info:{},bills:[]});let u={id:i.id,name:i.attributes.name,amount_min:i.attributes.amount_min,amount_max:i.attributes.amount_max,amount:(parseFloat(i.attributes.amount_max)+parseFloat(i.attributes.amount_min))/2,currency_code:i.attributes.currency_code,native_amount_min:i.attributes.native_amount_min,native_amount_max:i.attributes.native_amount_max,native_amount:(parseFloat(i.attributes.native_amount_max)+parseFloat(i.attributes.native_amount_min))/2,native_currency_code:i.attributes.native_currency_code,transactions:[],pay_dates:i.attributes.pay_dates,paid:i.attributes.paid_dates.length>0};u.expected_amount=t.autoConversion?formatMoney(u.native_amount,u.native_currency_code):formatMoney(u.amount,u.currency_code),u.expected_times=i18n$1.t("firefly.subscr_expected_x_times",{times:i.attributes.pay_dates.length,amount:u.expected_amount});for(let c in i.attributes.paid_dates)if(i.attributes.paid_dates.hasOwnProperty(c)){const d=i.attributes.paid_dates[c];let h=100;t.autoConversion&&(h=Math.round(-100+parseFloat(d.native_amount)*-1/parseFloat(u.native_amount)*100)),t.autoConversion||(h=Math.round(-100+parseFloat(d.amount)*-1/parseFloat(u.amount)*100));let m={amount:t.autoConversion?formatMoney(d.native_amount,d.native_currency_code):formatMoney(d.amount,d.currency_code),percentage:h,date:format$1(new Date(d.date),"PP"),foreign_amount:null};d.foreign_currency_code!==null&&(m.foreign_amount=t.autoConversion?d.foreign_native_amount:d.foreign_amount,m.foreign_currency_code=t.autoConversion?d.native_currency_code:d.foreign_currency_code),u.transactions.push(m)}if(subscriptionData[o].bills.push(u),i.attributes.paid_dates.length===0){const c=i.attributes.pay_dates.length*u.amount,d=i.attributes.pay_dates.length*u.native_amount;subscriptionData[o].payment_info.hasOwnProperty(u.currency_code)||(subscriptionData[o].payment_info[u.currency_code]={currency_code:u.currency_code,paid:0,unpaid:0,native_currency_code:u.native_currency_code,native_paid:0,native_unpaid:0}),subscriptionData[o].payment_info[u.currency_code].unpaid+=c,subscriptionData[o].payment_info[u.currency_code].native_unpaid+=d}if(i.attributes.paid_dates.length>0){for(let c in i.attributes.paid_dates)if(i.attributes.paid_dates.hasOwnProperty(c)){let d=i.attributes.paid_dates[c];subscriptionData[o].payment_info.hasOwnProperty(d.currency_code)||(subscriptionData[o].payment_info[d.currency_code]={currency_code:u.currency_code,paid:0,unpaid:0,native_currency_code:u.native_currency_code,native_paid:0,native_unpaid:0});const h=parseFloat(d.amount)*-1,m=parseFloat(d.native_amount)*-1;subscriptionData[o].payment_info[d.currency_code].paid+=h,subscriptionData[o].payment_info[d.currency_code].native_paid+=m}}}}return parseInt(a.data.meta.pagination.total_pages)>t.page?(t.page++,downloadSubscriptions(t)):Promise.resolve()})}const subscriptions=()=>({loading:!1,autoConversion:!1,subscriptions:[],startSubscriptions(){this.loading=!0;let t=new Date(window.store.get("start")),e=new Date(window.store.get("end"));console.log("here we are");const a=window.store.get("cacheValid");let n=window.store.get(getCacheKey("subscriptions-data-dashboard",t,e));a&&typeof n<"u",subscriptionData={},this.subscriptions=[],console.log("cache is invalid, must download");let r={start:format$1(t,"y-MM-dd"),end:format$1(e,"y-MM-dd"),autoConversion:this.autoConversion,page:1};downloadSubscriptions(r).then(()=>{console.log("Done with download!");let i=Object.values(subscriptionData);for(let o in i)if(i.hasOwnProperty(o)){let s=i[o];const l=Object.keys(s.payment_info);s.col_size=l.length===1?"col-6 offset-3":"col-6",s.chart_width=l.length===1?"50%":"100%",s.payment_length=l.length,this.subscriptions.push(s)}this.loading=!1})},drawPieChart(t,e,a){let n="#pie_"+t+"_"+a.currency_code;const r=this.autoConversion?a.native_unpaid:a.unpaid,i=this.autoConversion?a.native_paid:a.paid,o=this.autoConversion?a.native_currency_code:a.currency_code,l={type:"doughnut",data:{labels:[i18n$1.t("firefly.paid"),i18n$1.t("firefly.unpaid")],datasets:[{label:i18n$1.t("firefly.subscriptions_in_group",{title:e}),data:[i,r],backgroundColor:["rgb(54, 162, 235)","rgb(255, 99, 132)"],hoverOffset:4}]},options:{plugins:{tooltip:{callbacks:{label:function(c){return c.dataset.label+": "+formatMoney(c.raw,o)}}}}}};var u=Chart.getChart(document.querySelector(n));typeof u<"u"&&u.destroy(),new Chart(document.querySelector(n),l)},init(){console.log("subscriptions init"),Promise.all([getVariable("autoConversion",!1),getVariable("language","en-US")]).then(t=>{console.log("subscriptions after promises"),this.autoConversion=t[0],afterPromises$1=!0,i18n$1=new I18n,i18n$1.locale=t[1],loadTranslations(i18n$1,t[1]).then(()=>{this.loading===!1&&this.startSubscriptions()})}),window.store.observe("end",()=>{afterPromises$1&&(console.log("subscriptions observe end"),this.loading===!1&&this.startSubscriptions())}),window.store.observe("autoConversion",t=>{afterPromises$1&&(console.log("subscriptions observe autoConversion"),this.autoConversion=t,this.loading===!1&&this.startSubscriptions())})}});class Get{get(e){return api.get("/api/v2/piggy-banks",{params:e})}}let apiData={},afterPromises=!1,i18n;const PIGGY_CACHE_KEY="dashboard-piggies-data",piggies=()=>({loading:!1,autoConversion:!1,sankeyGrouping:"account",piggies:[],getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey(PIGGY_CACHE_KEY,t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){apiData=r,this.parsePiggies(),this.loading=!1;return}let i={start:format$1(t,"y-MM-dd"),end:format$1(e,"y-MM-dd"),page:1};this.downloadPiggyBanks(i)},downloadPiggyBanks(t){const e=new Date(window.store.get("start")),a=new Date(window.store.get("end")),n=getCacheKey(PIGGY_CACHE_KEY,e,a);new Get().get(t).then(i=>{if(apiData=[...apiData,...i.data.data],parseInt(i.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadPiggyBanks(t);return}window.store.set(n,apiData),this.parsePiggies(),this.loading=!1})},parsePiggies(){let t=[];for(let e in apiData)if(apiData.hasOwnProperty(e)){let a=apiData[e];if(a.attributes.percentage>=100||a.attributes.percentage===0)continue;let n=a.object_group_title??i18n.t("firefly.default_group_title_name_plain");t.hasOwnProperty(n)||(t[n]={id:a.object_group_id??0,title:n,order:a.object_group_order??0,piggies:[]});let r={id:a.id,name:a.attributes.name,percentage:parseInt(a.attributes.percentage),amount:this.autoConversion?a.attributes.native_current_amount:a.attributes.current_amount,left_to_save:this.autoConversion?a.attributes.native_left_to_save:a.attributes.left_to_save,target_amount:this.autoConversion?a.attributes.native_target_amount:a.attributes.target_amount,save_per_month:this.autoConversion?a.attributes.native_save_per_month:a.attributes.save_per_month,currency_code:this.autoConversion?a.attributes.native_currency_code:a.attributes.currency_code};t[n].piggies.push(r)}this.piggies=Object.values(t)},loadPiggyBanks(){if(this.loading!==!0){if(this.loading=!0,this.piggies.length!==0){this.parsePiggies(),this.loading=!1;return}this.getFreshData()}},init(){apiData=[],Promise.all([getVariable("autoConversion",!1),getVariable("language","en-US")]).then(t=>{i18n=new I18n,i18n.locale=t[1],loadTranslations(i18n,t[1]).then(()=>{afterPromises=!0,this.autoConversion=t[0],this.loadPiggyBanks()})}),window.store.observe("end",()=>{afterPromises&&(apiData=[],this.loadPiggyBanks())}),window.store.observe("autoConversion",t=>{afterPromises&&(this.autoConversion=t,this.loadPiggyBanks())})}});/*! +`)):Array.isArray(n)?a.push.apply(a,n):isNullOrUndef(a)||e.unshift(""+n)}return e}function validateSizeValue(t){return!t||["min","max"].indexOf(t)===-1?"max":t}const defined=t=>t!==void 0;function calculateX(t,e){const a=new Set(e.map(o=>o.to)),n=new Set(e.map(o=>o.from)),r=new Set([...t.keys()]);let i=0;for(;r.size;){const o=nextColumn([...r],a);for(const s of o){const l=t.get(s);defined(l.x)||(l.x=i),r.delete(s)}r.size&&(a.clear(),e.filter(s=>r.has(s.from)).forEach(s=>a.add(s.to)),i++)}return[...t.keys()].filter(o=>!n.has(o)).forEach(o=>{const s=t.get(o);s.column||(s.x=i)}),i}function nextColumn(t,e){const a=t.filter(n=>!e.has(n));return a.length?a:t.slice(0,1)}const nodeByXY=(t,e)=>t.x!==e.x?t.x-e.x:t.y-e.y;let prevCountId=-1;function getCountId(){return prevCountId=prevCountId<100?prevCountId+1:0,prevCountId}function nodeCount(t,e,a=getCountId()){let n=0;for(const r of t)r.node._visited!==a&&(r.node._visited=a,n+=r.node[e].length+nodeCount(r.node[e],e,a));return n}const flowByNodeCount=t=>(e,a)=>nodeCount(e.node[t],t)-nodeCount(a.node[t],t)||e.node[t].length-a.node[t].length;function processFrom(t,e){t.from.sort(flowByNodeCount("from"));for(const a of t.from){const n=a.node;defined(n.y)||(n.y=e,processFrom(n,e)),e=Math.max(n.y+n.out,e)}return e}function processTo(t,e){t.to.sort(flowByNodeCount("to"));for(const a of t.to){const n=a.node;defined(n.y)||(n.y=e,processTo(n,e)),e=Math.max(n.y+n.in,e)}return e}function setOrGetY(t,e){return defined(t.y)?t.y:(t.y=e,e)}function processRest(t,e){const a=t.filter(c=>c.x===0),n=t.filter(c=>c.x===e),r=a.filter(c=>!defined(c.y)),i=n.filter(c=>!defined(c.y)),o=t.filter(c=>c.x>0&&c.x Math.max(c,d.y+d.out||0),0),l=n.reduce((c,d)=>Math.max(c,d.y+d.in||0),0),u=0;return s>=l?(r.forEach(c=>{s=setOrGetY(c,s),s=Math.max(s+c.out,processTo(c,s))}),i.forEach(c=>{l=setOrGetY(c,l),l=Math.max(l+c.in,processTo(c,l))})):(i.forEach(c=>{l=setOrGetY(c,l),l=Math.max(l+c.in,processTo(c,l))}),r.forEach(c=>{s=setOrGetY(c,s),s=Math.max(s+c.out,processTo(c,s))})),o.forEach(c=>{let d=t.filter(h=>h.x===c.x&&defined(h.y)).reduce((h,m)=>Math.max(h,m.y+Math.max(m.in,m.out)),0);d=setOrGetY(c,d),d=Math.max(d+c.in,processFrom(c,d)),d=Math.max(d+c.out,processTo(c,d)),u=Math.max(u,d)}),Math.max(s,l,u)}function calculateY(t,e){t.sort((o,s)=>Math.max(s.in,s.out)-Math.max(o.in,o.out));const a=t[0];a.y=0;const n=processFrom(a,0),r=processTo(a,0),i=processRest(t,e);return Math.max(n,r,i)}function calculateYUsingPriority(t,e){let a=0,n=0;for(let r=0;r<=e;r++){let i=n;const o=t.filter(s=>s.x===r).sort((s,l)=>s.priority-l.priority);n=o[0].to.filter(s=>s.node.x>r+1).reduce((s,l)=>s+l.flow,0)||0;for(const s of o)s.y=i,i+=Math.max(s.out,s.in);a=Math.max(i,a)}return a}function addPadding(t,e){let a=1,n=0,r=0,i=0;const o=[];t.sort(nodeByXY);for(const s of t){if(s.y){if(s.x===0)o.push(s.y);else{for(n!==s.x&&(n=s.x,r=0),a=r+1;a s.y);a++);r=a}s.y+=a*e,a++}i=Math.max(i,s.y+Math.max(s.in,s.out))}return i}function sortFlows(t,e){t.forEach(a=>{const n=Math[e](a.in||a.out,a.out||a.in),r=n l.node.y+l.node.out/2-(u.node.y+u.node.out/2)).forEach((l,u)=>{r?l.addY=u*(n-l.flow)/(s-1):(l.addY=o,o+=l.flow)}),o=0,s=a.to.length,a.to.sort((l,u)=>l.node.y+l.node.in/2-(u.node.y+u.node.in/2)).forEach((l,u)=>{i?l.addY=u*(n-l.flow)/(s-1):(l.addY=o,o+=l.flow)})})}function layout(t,e,a,n){const r=[...t.values()],i=calculateX(t,e),s=(a?calculateYUsingPriority(r,i):calculateY(r,i))*.03,l=addPadding(r,s);return sortFlows(r,n),{maxX:i,maxY:l}}function buildNodesFromRawData(t){const e=new Map;for(let n=0;n r.flow-n.flow;return[...e.values()].forEach(n=>{n.from=n.from.sort(a),n.from.forEach(r=>{r.node=e.get(r.key)}),n.to=n.to.sort(a),n.to.forEach(r=>{r.node=e.get(r.key)})}),e}function getAddY(t,e,a){for(const n of t)if(n.key===e&&n.index===a)return n.addY;return 0}class SankeyController extends DatasetController{parseObjectData(e,a,n,r){const{from:i="from",to:o="to",flow:s="flow"}=this.options.parsing,l=a.map(({[i]:_,[o]:C,[s]:O})=>({from:_,to:C,flow:O})),{xScale:u,yScale:c}=e,d=[],h=this._nodes=buildNodesFromRawData(l),{column:m,priority:p,size:v}=this.getDataset();if(p)for(const _ of h.values())_.key in p&&(_.priority=p[_.key]);if(m)for(const _ of h.values())_.key in m&&(_.column=!0,_.x=m[_.key]);const{maxX:y,maxY:w}=layout(h,l,!!p,validateSizeValue(v));this._maxX=y,this._maxY=w;for(let _=0,C=l.length;_ 1){const h=u-c*l/2+d;for(let m=0;m t.type==="data"?(t.parsed._custom.x-t.parsed.x)*200:void 0,delay:t=>t.type==="data"?t.parsed.x*500+t.dataIndex*20:void 0},colors:{type:"color",properties:["colorFrom","colorTo"]}},transitions:{hide:{animations:{colors:{type:"color",properties:["colorFrom","colorTo"],to:"transparent"}}},show:{animations:{colors:{type:"color",properties:["colorFrom","colorTo"],from:"transparent"}}}}};SankeyController.overrides={interaction:{mode:"nearest",intersect:!0},datasets:{clip:!1,parsing:!0},plugins:{tooltip:{callbacks:{title(){return""},label(t){const e=t.dataset.data[t.dataIndex];return e.from+" -> "+e.to+": "+e.flow}}},legend:{display:!1}},scales:{x:{type:"linear",bounds:"data",display:!1,min:0,offset:!1},y:{type:"linear",bounds:"data",display:!1,min:0,reverse:!0,offset:!1}},layout:{padding:{top:3,left:3,right:13,bottom:3}}};const controlPoints=(t,e,a,n)=>t({x:t.x+a*(e.x-t.x),y:t.y+a*(e.y-t.y)});function setStyle(t,{x:e,x2:a,options:n}){let r;n.colorMode==="from"?r=color(n.colorFrom).alpha(.5).rgbString():n.colorMode==="to"?r=color(n.colorTo).alpha(.5).rgbString():(r=t.createLinearGradient(e,0,a,0),r.addColorStop(0,color(n.colorFrom).alpha(.5).rgbString()),r.addColorStop(1,color(n.colorTo).alpha(.5).rgbString())),t.fillStyle=r,t.strokeStyle=r,t.lineWidth=.5}class Flow extends Element$1{constructor(e){super(),this.options=void 0,this.x=void 0,this.y=void 0,this.x2=void 0,this.y2=void 0,this.height=void 0,e&&Object.assign(this,e)}draw(e){const a=this,{x:n,x2:r,y:i,y2:o,height:s,progress:l}=a,{cp1:u,cp2:c}=controlPoints(n,i,r,o);l!==0&&(e.save(),l<1&&(e.beginPath(),e.rect(n,Math.min(i,o),(r-n)*l+1,Math.abs(o-i)+s+1),e.clip()),setStyle(e,a),e.beginPath(),e.moveTo(n,i),e.bezierCurveTo(u.x,u.y,c.x,c.y,r,o),e.lineTo(r,o+s),e.bezierCurveTo(c.x,c.y+s,u.x,u.y+s,n,i+s),e.lineTo(n,i),e.stroke(),e.closePath(),e.fill(),e.restore())}inRange(e,a,n){const{x:r,y:i,x2:o,y2:s,height:l}=this.getProps(["x","y","x2","y2","height"],n);if(e o)return!1;const{cp1:u,cp2:c}=controlPoints(r,i,o,s),d=(e-r)/(o-r),h={x:r,y:i},m={x:o,y:s},p=pointInLine(h,u,d),v=pointInLine(u,c,d),y=pointInLine(c,m,d),w=pointInLine(p,v,d),_=pointInLine(v,y,d),C=pointInLine(w,_,d).y;return a>=C&&a<=C+l}inXRange(e,a){const{x:n,x2:r}=this.getProps(["x","x2"],a);return e>=n&&e<=r}inYRange(e,a){const{y:n,y2:r,height:i}=this.getProps(["y","y2","height"],a),o=Math.min(n,r),s=Math.max(n,r)+i;return e>=o&&e<=s}getCenterPoint(e){const{x:a,y:n,x2:r,y2:i,height:o}=this.getProps(["x","y","x2","y2","height"],e);return{x:(a+r)/2,y:(n+i+o)/2}}tooltipPosition(e){return this.getCenterPoint(e)}getRange(e){return e==="x"?this.width/2:this.height/2}}Flow.id="flow";Flow.defaults={colorFrom:"red",colorTo:"green",colorMode:"gradient",hoverColorFrom:(t,e)=>getHoverColor(e.colorFrom),hoverColorTo:(t,e)=>getHoverColor(e.colorTo)};Chart.register({SankeyController,Flow});const SANKEY_CACHE_KEY="dashboard-sankey-data";let i18n$2,afterPromises$2=!1,chart=null,transactions=[],autoConversion=!1,translations={category:null,unknown_category:null,in:null,out:null,unknown_source:null,unknown_dest:null,unknown_account:null,expense_account:null,revenue_account:null,budget:null,unknown_budget:null,all_money:null};const getColor=function(t){return t.includes(translations.revenue_account)?"forestgreen":t.includes("("+translations.in+",")?"green":t.includes(translations.budget)||t.includes(translations.unknown_budget)?"Orchid":t.includes("("+translations.out+",")?"MediumOrchid":t.includes(translations.all_money)?"blue":"red"};function getObjectName(t,e,a,n){if(t==="category"&&e!==null&&a==="in")return translations.category+' "'+e+'" ('+translations.in+(autoConversion?", "+n+")":")");if(t==="category"&&e===null&&a==="in")return translations.unknown_category+" ("+translations.in+(autoConversion?", "+n+")":")");if(t==="category"&&e!==null&&a==="out")return translations.category+' "'+e+'" ('+translations.out+(autoConversion?", "+n+")":")");if(t==="category"&&e===null&&a==="out")return translations.unknown_category+" ("+translations.out+(autoConversion?", "+n+")":")");if(t==="account"&&e===null&&a==="in")return translations.unknown_source+(autoConversion?" ("+n+")":"");if(t==="account"&&e!==null&&a==="in")return translations.revenue_account+'"'+e+'"'+(autoConversion?" ("+n+")":"");if(t==="account"&&e===null&&a==="out")return translations.unknown_dest+(autoConversion?" ("+n+")":"");if(t==="account"&&e!==null&&a==="out")return translations.expense_account+' "'+e+'"'+(autoConversion?" ("+n+")":"");if(t==="budget"&&e!==null)return translations.budget+' "'+e+'"'+(autoConversion?" ("+n+")":"");if(t==="budget"&&e===null)return translations.unknown_budget+(autoConversion?" ("+n+")":"");console.error('Cannot handle: type:"'+t+'", dir: "'+a+'"')}function getLabelName(t,e,a){if(t==="category"&&e!==null)return translations.category+' "'+e+'"'+(autoConversion?" ("+a+")":"");if(t==="category"&&e===null)return translations.unknown_category+(autoConversion?" ("+a+")":"");if(t==="account"&&e===null)return translations.unknown_account+(autoConversion?" ("+a+")":"");if(t==="account"&&e!==null)return e+(autoConversion?" ("+a+")":"");if(t==="budget"&&e!==null)return translations.budget+' "'+e+'"'+(autoConversion?" ("+a+")":"");if(t==="budget"&&e===null)return translations.unknown_budget+(autoConversion?" ("+a+")":"");console.error('Cannot handle: type:"'+t+'"')}const sankey=()=>({loading:!1,autoConversion:!1,generateOptions(){let t=getDefaultChartSettings("sankey"),e={},a={};for(let r in transactions)if(transactions.hasOwnProperty(r)){let i=transactions[r];for(let o in i.attributes.transactions)if(i.attributes.transactions.hasOwnProperty(o)){let s=i.attributes.transactions[o],l=this.autoConversion?s.native_currency_code:s.currency_code,u=this.autoConversion?parseFloat(s.native_amount):parseFloat(s.amount),c;if(s.type==="deposit"){let d=getObjectName("category",s.category_name,"in",l),h=getObjectName("account",s.source_name,"in",l);a[d]=getLabelName("category",s.category_name,l),a[h]=getLabelName("account",s.source_name,l),c=h+"-"+d+"-"+l,e.hasOwnProperty(c)||(e[c]={from:h,to:d,amount:0}),e[c].amount+=u,c=d+"-"+translations.all_money+"-"+l,e.hasOwnProperty(c)||(e[c]={from:d,to:translations.all_money+(this.autoConversion?" ("+l+")":""),amount:0}),e[c].amount+=u}if(s.type==="withdrawal"){let d=getObjectName("budget",s.budget_name,"out",l);a[d]=getLabelName("budget",s.budget_name,l),c=translations.all_money+"-"+d+"-"+l,e.hasOwnProperty(c)||(e[c]={from:translations.all_money+(this.autoConversion?" ("+l+")":""),to:d,amount:0}),e[c].amount+=u;let h=getObjectName("category",s.category_name,"out",l);a[h]=getLabelName("category",s.category_name,l),c=d+"-"+h+"-"+l,e.hasOwnProperty(c)||(e[c]={from:d,to:h,amount:0}),e[c].amount+=u;let m=getObjectName("account",s.destination_name,"out",l);a[m]=getLabelName("account",s.destination_name,l),c=h+"-"+m+"-"+l,e.hasOwnProperty(c)||(e[c]={from:h,to:m,amount:0}),e[c].amount+=u}}}let n={label:"Firefly III dashboard sankey chart",data:[],colorFrom:r=>getColor(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].from:""),colorTo:r=>getColor(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].to:""),colorMode:"gradient",labels:a,size:"min"};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];n.data.push({from:i.from,to:i.to,flow:i.amount})}return t.data.datasets.push(n),t},drawChart(t){if(chart!==null){chart.data.datasets=t.data.datasets,chart.update();return}chart=new Chart(document.querySelector("#sankey-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey(SANKEY_CACHE_KEY,t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){transactions=r,this.drawChart(this.generateOptions()),this.loading=!1;return}let i={start:format$1(t,"y-MM-dd"),end:format$1(e,"y-MM-dd"),type:"withdrawal,deposit",page:1};this.downloadTransactions(i)},downloadTransactions(t){const e=new Date(window.store.get("start")),a=new Date(window.store.get("end")),n=getCacheKey(SANKEY_CACHE_KEY,e,a);new Get$2().get(t).then(i=>{if(transactions=[...transactions,...i.data.data],parseInt(i.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadTransactions(t);return}window.store.set(n,transactions),this.drawChart(this.generateOptions()),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,transactions.length!==0){this.drawChart(this.generateOptions()),this.loading=!1;return}this.getFreshData()}},init(){transactions=[],Promise.all([getVariable("autoConversion",!1),getVariable("language","en_US")]).then(t=>{this.autoConversion=t[0],autoConversion=t[0],i18n$2=new I18n;const e=t[1].replace("-","_");i18n$2.locale=e,loadTranslations(i18n$2,e).then(()=>{translations.all_money=i18n$2.t("firefly.all_money"),translations.category=i18n$2.t("firefly.category"),translations.in=i18n$2.t("firefly.money_flowing_in"),translations.out=i18n$2.t("firefly.money_flowing_out"),translations.unknown_category=i18n$2.t("firefly.unknown_category_plain"),translations.unknown_source=i18n$2.t("firefly.unknown_source_plain"),translations.unknown_dest=i18n$2.t("firefly.unknown_dest_plain"),translations.unknown_account=i18n$2.t("firefly.unknown_any_plain"),translations.unknown_budget=i18n$2.t("firefly.unknown_budget_plain"),translations.expense_account=i18n$2.t("firefly.expense_account"),translations.revenue_account=i18n$2.t("firefly.revenue_account"),translations.budget=i18n$2.t("firefly.budget"),afterPromises$2=!0,this.loadChart()})}),window.store.observe("end",()=>{afterPromises$2&&(this.transactions=[],this.loadChart())}),window.store.observe("autoConversion",t=>{afterPromises$2&&(this.autoConversion=t,this.loadChart())})}});let Get$1=class{get(e){return api.get("/api/v2/subscriptions",{params:e})}paid(e){return api.get("/api/v2/subscriptions/sum/paid",{params:e})}unpaid(e){return api.get("/api/v2/subscriptions/sum/unpaid",{params:e})}},afterPromises$1=!1,i18n$1,subscriptionData={};function downloadSubscriptions(t){return new Get$1().get(t).then(a=>{let n=a.data.data;for(let r in n)if(n.hasOwnProperty(r)){let i=n[r];if(i.attributes.active&&i.attributes.pay_dates.length>0){let o=i.attributes.object_group_id===null?0:i.attributes.object_group_id,s=i.attributes.object_group_title===null?i18n$1.t("firefly.default_group_title_name_plain"):i.attributes.object_group_title,l=i.attributes.object_group_order===null?0:i.attributes.object_group_order;subscriptionData.hasOwnProperty(o)||(subscriptionData[o]={id:o,title:s,order:l,payment_info:{},bills:[]});let u={id:i.id,name:i.attributes.name,amount_min:i.attributes.amount_min,amount_max:i.attributes.amount_max,amount:(parseFloat(i.attributes.amount_max)+parseFloat(i.attributes.amount_min))/2,currency_code:i.attributes.currency_code,native_amount_min:i.attributes.native_amount_min,native_amount_max:i.attributes.native_amount_max,native_amount:(parseFloat(i.attributes.native_amount_max)+parseFloat(i.attributes.native_amount_min))/2,native_currency_code:i.attributes.native_currency_code,transactions:[],pay_dates:i.attributes.pay_dates,paid:i.attributes.paid_dates.length>0};u.expected_amount=t.autoConversion?formatMoney(u.native_amount,u.native_currency_code):formatMoney(u.amount,u.currency_code),u.expected_times=i18n$1.t("firefly.subscr_expected_x_times",{times:i.attributes.pay_dates.length,amount:u.expected_amount});for(let c in i.attributes.paid_dates)if(i.attributes.paid_dates.hasOwnProperty(c)){const d=i.attributes.paid_dates[c];let h=100;t.autoConversion&&(h=Math.round(-100+parseFloat(d.native_amount)*-1/parseFloat(u.native_amount)*100)),t.autoConversion||(h=Math.round(-100+parseFloat(d.amount)*-1/parseFloat(u.amount)*100));let m={amount:t.autoConversion?formatMoney(d.native_amount,d.native_currency_code):formatMoney(d.amount,d.currency_code),percentage:h,date:format$1(new Date(d.date),"PP"),foreign_amount:null};d.foreign_currency_code!==null&&(m.foreign_amount=t.autoConversion?d.foreign_native_amount:d.foreign_amount,m.foreign_currency_code=t.autoConversion?d.native_currency_code:d.foreign_currency_code),u.transactions.push(m)}if(subscriptionData[o].bills.push(u),i.attributes.paid_dates.length===0){const c=i.attributes.pay_dates.length*u.amount,d=i.attributes.pay_dates.length*u.native_amount;subscriptionData[o].payment_info.hasOwnProperty(u.currency_code)||(subscriptionData[o].payment_info[u.currency_code]={currency_code:u.currency_code,paid:0,unpaid:0,native_currency_code:u.native_currency_code,native_paid:0,native_unpaid:0}),subscriptionData[o].payment_info[u.currency_code].unpaid+=c,subscriptionData[o].payment_info[u.currency_code].native_unpaid+=d}if(i.attributes.paid_dates.length>0){for(let c in i.attributes.paid_dates)if(i.attributes.paid_dates.hasOwnProperty(c)){let d=i.attributes.paid_dates[c];subscriptionData[o].payment_info.hasOwnProperty(d.currency_code)||(subscriptionData[o].payment_info[d.currency_code]={currency_code:u.currency_code,paid:0,unpaid:0,native_currency_code:u.native_currency_code,native_paid:0,native_unpaid:0});const h=parseFloat(d.amount)*-1,m=parseFloat(d.native_amount)*-1;subscriptionData[o].payment_info[d.currency_code].paid+=h,subscriptionData[o].payment_info[d.currency_code].native_paid+=m}}}}return parseInt(a.data.meta.pagination.total_pages)>t.page?(t.page++,downloadSubscriptions(t)):Promise.resolve()})}const subscriptions=()=>({loading:!1,autoConversion:!1,subscriptions:[],startSubscriptions(){this.loading=!0;let t=new Date(window.store.get("start")),e=new Date(window.store.get("end"));console.log("here we are");const a=window.store.get("cacheValid");let n=window.store.get(getCacheKey("subscriptions-data-dashboard",t,e));a&&typeof n<"u",subscriptionData={},this.subscriptions=[],console.log("cache is invalid, must download");let r={start:format$1(t,"y-MM-dd"),end:format$1(e,"y-MM-dd"),autoConversion:this.autoConversion,page:1};downloadSubscriptions(r).then(()=>{console.log("Done with download!");let i=Object.values(subscriptionData);for(let o in i)if(i.hasOwnProperty(o)){let s=i[o];const l=Object.keys(s.payment_info);s.col_size=l.length===1?"col-6 offset-3":"col-6",s.chart_width=l.length===1?"50%":"100%",s.payment_length=l.length,this.subscriptions.push(s)}this.loading=!1})},drawPieChart(t,e,a){let n="#pie_"+t+"_"+a.currency_code;const r=this.autoConversion?a.native_unpaid:a.unpaid,i=this.autoConversion?a.native_paid:a.paid,o=this.autoConversion?a.native_currency_code:a.currency_code,l={type:"doughnut",data:{labels:[i18n$1.t("firefly.paid"),i18n$1.t("firefly.unpaid")],datasets:[{label:i18n$1.t("firefly.subscriptions_in_group",{title:e}),data:[i,r],backgroundColor:["rgb(54, 162, 235)","rgb(255, 99, 132)"],hoverOffset:4}]},options:{plugins:{tooltip:{callbacks:{label:function(c){return c.dataset.label+": "+formatMoney(c.raw,o)}}}}}};var u=Chart.getChart(document.querySelector(n));typeof u<"u"&&u.destroy(),new Chart(document.querySelector(n),l)},init(){console.log("subscriptions init"),Promise.all([getVariable("autoConversion",!1),getVariable("language","en_US")]).then(t=>{console.log("subscriptions after promises"),this.autoConversion=t[0],afterPromises$1=!0,i18n$1=new I18n;const e=t[1].replace("-","_");i18n$1.locale=e,loadTranslations(i18n$1,e).then(()=>{this.loading===!1&&this.startSubscriptions()})}),window.store.observe("end",()=>{afterPromises$1&&(console.log("subscriptions observe end"),this.loading===!1&&this.startSubscriptions())}),window.store.observe("autoConversion",t=>{afterPromises$1&&(console.log("subscriptions observe autoConversion"),this.autoConversion=t,this.loading===!1&&this.startSubscriptions())})}});class Get{get(e){return api.get("/api/v2/piggy-banks",{params:e})}}let apiData={},afterPromises=!1,i18n;const PIGGY_CACHE_KEY="dashboard-piggies-data",piggies=()=>({loading:!1,autoConversion:!1,sankeyGrouping:"account",piggies:[],getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),a=getCacheKey(PIGGY_CACHE_KEY,t,e),n=window.store.get("cacheValid");let r=window.store.get(a);if(n&&typeof r<"u"){apiData=r,this.parsePiggies(),this.loading=!1;return}let i={start:format$1(t,"y-MM-dd"),end:format$1(e,"y-MM-dd"),page:1};this.downloadPiggyBanks(i)},downloadPiggyBanks(t){const e=new Date(window.store.get("start")),a=new Date(window.store.get("end")),n=getCacheKey(PIGGY_CACHE_KEY,e,a);new Get().get(t).then(i=>{if(apiData=[...apiData,...i.data.data],parseInt(i.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadPiggyBanks(t);return}window.store.set(n,apiData),this.parsePiggies(),this.loading=!1})},parsePiggies(){let t=[];for(let e in apiData)if(apiData.hasOwnProperty(e)){let a=apiData[e];if(a.attributes.percentage>=100||a.attributes.percentage===0)continue;let n=a.object_group_title??i18n.t("firefly.default_group_title_name_plain");t.hasOwnProperty(n)||(t[n]={id:a.object_group_id??0,title:n,order:a.object_group_order??0,piggies:[]});let r={id:a.id,name:a.attributes.name,percentage:parseInt(a.attributes.percentage),amount:this.autoConversion?a.attributes.native_current_amount:a.attributes.current_amount,left_to_save:this.autoConversion?a.attributes.native_left_to_save:a.attributes.left_to_save,target_amount:this.autoConversion?a.attributes.native_target_amount:a.attributes.target_amount,save_per_month:this.autoConversion?a.attributes.native_save_per_month:a.attributes.save_per_month,currency_code:this.autoConversion?a.attributes.native_currency_code:a.attributes.currency_code};t[n].piggies.push(r)}this.piggies=Object.values(t)},loadPiggyBanks(){if(this.loading!==!0){if(this.loading=!0,this.piggies.length!==0){this.parsePiggies(),this.loading=!1;return}this.getFreshData()}},init(){apiData=[],Promise.all([getVariable("autoConversion",!1),getVariable("language","en_US")]).then(t=>{i18n=new I18n;const e=t[1].replace("-","_");i18n.locale=e,loadTranslations(i18n,e).then(()=>{afterPromises=!0,this.autoConversion=t[0],this.loadPiggyBanks()})}),window.store.observe("end",()=>{afterPromises&&(apiData=[],this.loadPiggyBanks())}),window.store.observe("autoConversion",t=>{afterPromises&&(this.autoConversion=t,this.loadPiggyBanks())})}});/*! * chartjs-adapter-date-fns v3.0.0 * https://www.chartjs.org * (c) 2022 chartjs-adapter-date-fns Contributors diff --git a/public/build/manifest.json b/public/build/manifest.json index a87ce2d882..5b344763d3 100644 --- a/public/build/manifest.json +++ b/public/build/manifest.json @@ -30,10 +30,10 @@ "integrity": "sha384-B73JAwYNSgI4rwb14zwxigHgAkg1Ms+j6+9sJoDpiL11+VW5RjQCLfIh0RVoi0h6" }, "resources/assets/v2/pages/dashboard/dashboard.js": { - "file": "assets/dashboard-2100f404.js", + "file": "assets/dashboard-808f5a4b.js", "isEntry": true, "src": "resources/assets/v2/pages/dashboard/dashboard.js", - "integrity": "sha384-V9FlCSPQuNaRj8izLok2N3wJYIFCKB/T3n+8gr7HB1r90GH086BF99Wrwel2tHnQ" + "integrity": "sha384-U4rVOcapDLBADgB4Ncgli3+XocCBhndwzaHVmlnYUANCL7GRsVwJsF1/Y50wRHxj" }, "resources/assets/v2/sass/app.scss": { "file": "assets/app-28a195fd.css", diff --git a/public/v2/i18n/bg_BG.json b/public/v2/i18n/bg_BG.json index e748505829..d4217c5b92 100644 --- a/public/v2/i18n/bg_BG.json +++ b/public/v2/i18n/bg_BG.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "\u0411\u044e\u0434\u0436\u0435\u0442" + "budget": "\u0411\u044e\u0434\u0436\u0435\u0442", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "\u0414\u044a\u043b\u0433", + "account_type_Loan": "\u0417\u0430\u0435\u043c", + "account_type_Mortgage": "\u0418\u043f\u043e\u0442\u0435\u043a\u0430" } } } \ No newline at end of file diff --git a/public/v2/i18n/ca_ES.json b/public/v2/i18n/ca_ES.json index 0b5be74ffa..7009729bf4 100644 --- a/public/v2/i18n/ca_ES.json +++ b/public/v2/i18n/ca_ES.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "Cap pressupost", "expense_account": "Compte de despeses", "revenue_account": "Compte d'ingressos", - "budget": "Pressupost" + "budget": "Pressupost", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Deute", + "account_type_Loan": "Cr\u00e8dit", + "account_type_Mortgage": "Hipoteca" } } } \ No newline at end of file diff --git a/public/v2/i18n/cs_CZ.json b/public/v2/i18n/cs_CZ.json index 9a031a1c9e..c482df56f9 100644 --- a/public/v2/i18n/cs_CZ.json +++ b/public/v2/i18n/cs_CZ.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Rozpo\u010det" + "budget": "Rozpo\u010det", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Dluh", + "account_type_Loan": "P\u016fj\u010dka", + "account_type_Mortgage": "Hypot\u00e9ka" } } } \ No newline at end of file diff --git a/public/v2/i18n/da_DK.json b/public/v2/i18n/da_DK.json index 63c68b3f67..2e9458c2ac 100644 --- a/public/v2/i18n/da_DK.json +++ b/public/v2/i18n/da_DK.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "G\u00e6ld", + "account_type_Loan": "L\u00e5n", + "account_type_Mortgage": "Pant" } } } \ No newline at end of file diff --git a/public/v2/i18n/de_DE.json b/public/v2/i18n/de_DE.json index 105b86325f..754d5f64b6 100644 --- a/public/v2/i18n/de_DE.json +++ b/public/v2/i18n/de_DE.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "Kein Budget", "expense_account": "Ausgabenkonto", "revenue_account": "Einnahmekonto", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Schuld", + "account_type_Loan": "Darlehen", + "account_type_Mortgage": "Hypothek" } } } \ No newline at end of file diff --git a/public/v2/i18n/el_GR.json b/public/v2/i18n/el_GR.json index 939a38b1d3..c1539f4de3 100644 --- a/public/v2/i18n/el_GR.json +++ b/public/v2/i18n/el_GR.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "\u03a0\u03c1\u03bf\u03cb\u03c0\u03bf\u03bb\u03bf\u03b3\u03b9\u03c3\u03bc\u03cc\u03c2" + "budget": "\u03a0\u03c1\u03bf\u03cb\u03c0\u03bf\u03bb\u03bf\u03b3\u03b9\u03c3\u03bc\u03cc\u03c2", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "\u03a7\u03c1\u03ad\u03bf\u03c2", + "account_type_Loan": "\u0394\u03ac\u03bd\u03b5\u03b9\u03bf", + "account_type_Mortgage": "\u03a5\u03c0\u03bf\u03b8\u03ae\u03ba\u03b7" } } } \ No newline at end of file diff --git a/public/v2/i18n/en_GB.json b/public/v2/i18n/en_GB.json index cec15428de..024912ab1d 100644 --- a/public/v2/i18n/en_GB.json +++ b/public/v2/i18n/en_GB.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Debt", + "account_type_Loan": "Loan", + "account_type_Mortgage": "Mortgage" } } } \ No newline at end of file diff --git a/public/v2/i18n/en_US.json b/public/v2/i18n/en_US.json index 53cb591438..6859b8fb86 100644 --- a/public/v2/i18n/en_US.json +++ b/public/v2/i18n/en_US.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Debt", + "account_type_Loan": "Loan", + "account_type_Mortgage": "Mortgage" } } } \ No newline at end of file diff --git a/public/v2/i18n/es_ES.json b/public/v2/i18n/es_ES.json index 6e077edf9d..b4064d230a 100644 --- a/public/v2/i18n/es_ES.json +++ b/public/v2/i18n/es_ES.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "Sin presupuesto", "expense_account": "Cuenta de gastos", "revenue_account": "Cuenta de ingresos", - "budget": "Presupuesto" + "budget": "Presupuesto", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Deuda", + "account_type_Loan": "Pr\u00e9stamo", + "account_type_Mortgage": "Hipoteca" } } } \ No newline at end of file diff --git a/public/v2/i18n/fi_FI.json b/public/v2/i18n/fi_FI.json index 6f6a7efcab..8f6ed24358 100644 --- a/public/v2/i18n/fi_FI.json +++ b/public/v2/i18n/fi_FI.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Budjetti" + "budget": "Budjetti", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Velka", + "account_type_Loan": "Laina", + "account_type_Mortgage": "Kiinnelaina" } } } \ No newline at end of file diff --git a/public/v2/i18n/fr_FR.json b/public/v2/i18n/fr_FR.json index cd6c139896..cb1e9bc0f0 100644 --- a/public/v2/i18n/fr_FR.json +++ b/public/v2/i18n/fr_FR.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "Pas de budget", "expense_account": "Compte de d\u00e9penses", "revenue_account": "Compte de recettes", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Dette", + "account_type_Loan": "Pr\u00eat", + "account_type_Mortgage": "Pr\u00eat hypoth\u00e9caire" } } } \ No newline at end of file diff --git a/public/v2/i18n/hu_HU.json b/public/v2/i18n/hu_HU.json index ab1f18905c..0ef2c76abf 100644 --- a/public/v2/i18n/hu_HU.json +++ b/public/v2/i18n/hu_HU.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "K\u00f6lts\u00e9gkeret" + "budget": "K\u00f6lts\u00e9gkeret", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Ad\u00f3ss\u00e1g", + "account_type_Loan": "Hitel", + "account_type_Mortgage": "Jelz\u00e1log" } } } \ No newline at end of file diff --git a/public/v2/i18n/id_ID.json b/public/v2/i18n/id_ID.json index c50714093a..12a378b35d 100644 --- a/public/v2/i18n/id_ID.json +++ b/public/v2/i18n/id_ID.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Anggaran" + "budget": "Anggaran", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Debt", + "account_type_Loan": "Loan", + "account_type_Mortgage": "Mortgage" } } } \ No newline at end of file diff --git a/public/v2/i18n/it_IT.json b/public/v2/i18n/it_IT.json index 8d692cb3bd..753645ac5d 100644 --- a/public/v2/i18n/it_IT.json +++ b/public/v2/i18n/it_IT.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Debito", + "account_type_Loan": "Prestito", + "account_type_Mortgage": "Mutuo" } } } \ No newline at end of file diff --git a/public/v2/i18n/ja_JP.json b/public/v2/i18n/ja_JP.json index e6936d0c26..02a3315c61 100644 --- a/public/v2/i18n/ja_JP.json +++ b/public/v2/i18n/ja_JP.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "\u4e88\u7b97\u306a\u3057", "expense_account": "\u652f\u51fa\u53e3\u5ea7", "revenue_account": "\u53ce\u5165\u53e3\u5ea7", - "budget": "\u4e88\u7b97" + "budget": "\u4e88\u7b97", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "\u501f\u91d1", + "account_type_Loan": "\u30ed\u30fc\u30f3", + "account_type_Mortgage": "\u4f4f\u5b85\u30ed\u30fc\u30f3" } } } \ No newline at end of file diff --git a/public/v2/i18n/ko_KR.json b/public/v2/i18n/ko_KR.json index ede5641377..abeadedec2 100644 --- a/public/v2/i18n/ko_KR.json +++ b/public/v2/i18n/ko_KR.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "\uc608\uc0b0 \uc5c6\uc74c", "expense_account": "\uc9c0\ucd9c \uacc4\uc815", "revenue_account": "\uc218\uc775 \uacc4\uc815", - "budget": "\uc608\uc0b0" + "budget": "\uc608\uc0b0", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "\ub300\ucd9c", + "account_type_Loan": "\ube5a", + "account_type_Mortgage": "\ubaa8\uae30\uc9c0" } } } \ No newline at end of file diff --git a/public/v2/i18n/nb_NO.json b/public/v2/i18n/nb_NO.json index f67035a151..61903adb00 100644 --- a/public/v2/i18n/nb_NO.json +++ b/public/v2/i18n/nb_NO.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Busjett" + "budget": "Busjett", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Gjeld", + "account_type_Loan": "L\u00e5n", + "account_type_Mortgage": "Boligl\u00e5n" } } } \ No newline at end of file diff --git a/public/v2/i18n/nl_NL.json b/public/v2/i18n/nl_NL.json index e8119f97f3..9f9ab9ff5d 100644 --- a/public/v2/i18n/nl_NL.json +++ b/public/v2/i18n/nl_NL.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "Geen budget", "expense_account": "Crediteur", "revenue_account": "Debiteur", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Schuld", + "account_type_Loan": "Lening", + "account_type_Mortgage": "Hypotheek" } } } \ No newline at end of file diff --git a/public/v2/i18n/nn_NO.json b/public/v2/i18n/nn_NO.json index 1843a5e06c..433602628c 100644 --- a/public/v2/i18n/nn_NO.json +++ b/public/v2/i18n/nn_NO.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Budsjett" + "budget": "Budsjett", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Gjeld", + "account_type_Loan": "L\u00e5n", + "account_type_Mortgage": "Boligl\u00e5n" } } } \ No newline at end of file diff --git a/public/v2/i18n/pl_PL.json b/public/v2/i18n/pl_PL.json index 372e48839f..80258bd4e5 100644 --- a/public/v2/i18n/pl_PL.json +++ b/public/v2/i18n/pl_PL.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "Brak bud\u017cetu", "expense_account": "Konto wydatk\u00f3w", "revenue_account": "Konto przychod\u00f3w", - "budget": "Bud\u017cet" + "budget": "Bud\u017cet", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "D\u0142ug", + "account_type_Loan": "Po\u017cyczka", + "account_type_Mortgage": "Hipoteka" } } } \ No newline at end of file diff --git a/public/v2/i18n/pt_BR.json b/public/v2/i18n/pt_BR.json index d9aea0aa86..bcd52e09df 100644 --- a/public/v2/i18n/pt_BR.json +++ b/public/v2/i18n/pt_BR.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "Nenhum or\u00e7amento", "expense_account": "Conta de despesas", "revenue_account": "Conta de Receitas", - "budget": "Or\u00e7amento" + "budget": "Or\u00e7amento", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "D\u00edvida", + "account_type_Loan": "Empr\u00e9stimo", + "account_type_Mortgage": "Hipoteca" } } } \ No newline at end of file diff --git a/public/v2/i18n/pt_PT.json b/public/v2/i18n/pt_PT.json index dba1420be0..de2b1b3fad 100644 --- a/public/v2/i18n/pt_PT.json +++ b/public/v2/i18n/pt_PT.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Or\u00e7amento" + "budget": "Or\u00e7amento", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "D\u00edvida", + "account_type_Loan": "Empr\u00e9stimo", + "account_type_Mortgage": "Hipoteca" } } } \ No newline at end of file diff --git a/public/v2/i18n/ro_RO.json b/public/v2/i18n/ro_RO.json index fc2e6fcb9e..cb59146a21 100644 --- a/public/v2/i18n/ro_RO.json +++ b/public/v2/i18n/ro_RO.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Buget" + "budget": "Buget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Datorie", + "account_type_Loan": "\u00cemprumut", + "account_type_Mortgage": "Credit ipotecar" } } } \ No newline at end of file diff --git a/public/v2/i18n/ru_RU.json b/public/v2/i18n/ru_RU.json index 692abcb775..91277d9374 100644 --- a/public/v2/i18n/ru_RU.json +++ b/public/v2/i18n/ru_RU.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "\u0411\u044e\u0434\u0436\u0435\u0442" + "budget": "\u0411\u044e\u0434\u0436\u0435\u0442", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "\u0414\u0435\u0431\u0438\u0442", + "account_type_Loan": "\u0417\u0430\u0451\u043c", + "account_type_Mortgage": "\u0418\u043f\u043e\u0442\u0435\u043a\u0430" } } } \ No newline at end of file diff --git a/public/v2/i18n/sk_SK.json b/public/v2/i18n/sk_SK.json index ca3ecd702b..001ab49907 100644 --- a/public/v2/i18n/sk_SK.json +++ b/public/v2/i18n/sk_SK.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Rozpo\u010det" + "budget": "Rozpo\u010det", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Dlh", + "account_type_Loan": "P\u00f4\u017ei\u010dka", + "account_type_Mortgage": "Hypot\u00e9ka" } } } \ No newline at end of file diff --git a/public/v2/i18n/sl_SI.json b/public/v2/i18n/sl_SI.json index 17c01ac532..77595226fa 100644 --- a/public/v2/i18n/sl_SI.json +++ b/public/v2/i18n/sl_SI.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "Ni prora\u010duna", "expense_account": "Ra\u010dun stro\u0161kov", "revenue_account": "Ra\u010dun prihodkov", - "budget": "Prora\u010dun" + "budget": "Prora\u010dun", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Dolg", + "account_type_Loan": "Posojilo", + "account_type_Mortgage": "Hipoteka" } } } \ No newline at end of file diff --git a/public/v2/i18n/sv_SE.json b/public/v2/i18n/sv_SE.json index 8994873292..d9145c8516 100644 --- a/public/v2/i18n/sv_SE.json +++ b/public/v2/i18n/sv_SE.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Skuld", + "account_type_Loan": "L\u00e5n", + "account_type_Mortgage": "Bol\u00e5n" } } } \ No newline at end of file diff --git a/public/v2/i18n/tr_TR.json b/public/v2/i18n/tr_TR.json index 8687900e77..6d11c04dcb 100644 --- a/public/v2/i18n/tr_TR.json +++ b/public/v2/i18n/tr_TR.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "B\u00fct\u00e7e" + "budget": "B\u00fct\u00e7e", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "Debt", + "account_type_Loan": "Loan", + "account_type_Mortgage": "Mortgage" } } } \ No newline at end of file diff --git a/public/v2/i18n/uk_UA.json b/public/v2/i18n/uk_UA.json index ca2eea5179..d8dbc457ce 100644 --- a/public/v2/i18n/uk_UA.json +++ b/public/v2/i18n/uk_UA.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Budget" + "budget": "Budget", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "\u0414\u0435\u0431\u0456\u0442", + "account_type_Loan": "\u041f\u043e\u0437\u0438\u043a\u0430", + "account_type_Mortgage": "\u0406\u043f\u043e\u0442\u0435\u043a\u0430" } } } \ No newline at end of file diff --git a/public/v2/i18n/vi_VN.json b/public/v2/i18n/vi_VN.json index 825dfb90e9..1aacfd2c8e 100644 --- a/public/v2/i18n/vi_VN.json +++ b/public/v2/i18n/vi_VN.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "Ng\u00e2n s\u00e1ch" + "budget": "Ng\u00e2n s\u00e1ch", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "M\u00f3n n\u1ee3", + "account_type_Loan": "Ti\u1ec1n vay", + "account_type_Mortgage": "Th\u1ebf ch\u1ea5p" } } } \ No newline at end of file diff --git a/public/v2/i18n/zh_CN.json b/public/v2/i18n/zh_CN.json index 2025d60b9e..3ec28d106d 100644 --- a/public/v2/i18n/zh_CN.json +++ b/public/v2/i18n/zh_CN.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "\u9884\u7b97" + "budget": "\u9884\u7b97", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "\u6b20\u6b3e", + "account_type_Loan": "\u8d37\u6b3e", + "account_type_Mortgage": "\u62b5\u62bc" } } } \ No newline at end of file diff --git a/public/v2/i18n/zh_TW.json b/public/v2/i18n/zh_TW.json index 706543e966..31144ae853 100644 --- a/public/v2/i18n/zh_TW.json +++ b/public/v2/i18n/zh_TW.json @@ -23,7 +23,13 @@ "unknown_budget_plain": "No budget", "expense_account": "Expense account", "revenue_account": "Revenue account", - "budget": "\u9810\u7b97" + "budget": "\u9810\u7b97", + "account_type_Asset account": "Asset account", + "account_type_Expense account": "Expense account", + "account_type_Revenue account": "Revenue account", + "account_type_Debt": "\u8ca0\u50b5", + "account_type_Loan": "\u8cb8\u6b3e", + "account_type_Mortgage": "\u62b5\u62bc" } } } \ No newline at end of file diff --git a/resources/assets/v2/pages/dashboard/accounts.js b/resources/assets/v2/pages/dashboard/accounts.js index c7b656cb51..45d24af4d9 100644 --- a/resources/assets/v2/pages/dashboard/accounts.js +++ b/resources/assets/v2/pages/dashboard/accounts.js @@ -259,7 +259,7 @@ export default () => ({ init() { // console.log('accounts init'); - Promise.all([getVariable('viewRange', '1M'), getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => { + Promise.all([getVariable('viewRange', '1M'), getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => { //console.log('accounts after promises'); this.autoConversion = values[1]; afterPromises = true; diff --git a/resources/assets/v2/pages/dashboard/budgets.js b/resources/assets/v2/pages/dashboard/budgets.js index 3475ea01be..9c9acb2a0a 100644 --- a/resources/assets/v2/pages/dashboard/budgets.js +++ b/resources/assets/v2/pages/dashboard/budgets.js @@ -175,11 +175,12 @@ export default () => ({ init() { // console.log('budgets init'); - Promise.all([getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => { + Promise.all([getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => { i18n = new I18n(); - i18n.locale = values[1]; - loadTranslations(i18n, values[1]).then(() => { + const locale = values[1].replace('-', '_'); + i18n.locale = locale; + loadTranslations(i18n, locale).then(() => { this.autoConversion = values[0]; afterPromises = true; if (false === this.loading) { diff --git a/resources/assets/v2/pages/dashboard/piggies.js b/resources/assets/v2/pages/dashboard/piggies.js index a66091757b..c6058e7c2b 100644 --- a/resources/assets/v2/pages/dashboard/piggies.js +++ b/resources/assets/v2/pages/dashboard/piggies.js @@ -130,11 +130,12 @@ export default () => ({ init() { // console.log('piggies init'); apiData = []; - Promise.all([getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => { + Promise.all([getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => { i18n = new I18n(); - i18n.locale = values[1]; - loadTranslations(i18n, values[1]).then(() => { + const locale = values[1].replace('-', '_'); + i18n.locale = locale; + loadTranslations(i18n, locale).then(() => { // console.log('piggies after promises'); afterPromises = true; this.autoConversion = values[0]; diff --git a/resources/assets/v2/pages/dashboard/sankey.js b/resources/assets/v2/pages/dashboard/sankey.js index f9d9ec93ec..370314492e 100644 --- a/resources/assets/v2/pages/dashboard/sankey.js +++ b/resources/assets/v2/pages/dashboard/sankey.js @@ -350,12 +350,13 @@ export default () => ({ init() { // console.log('sankey init'); transactions = []; - Promise.all([getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => { + Promise.all([getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => { this.autoConversion = values[0]; autoConversion = values[0]; i18n = new I18n(); - i18n.locale = values[1]; - loadTranslations(i18n, values[1]).then(() => { + const locale = values[1].replace('-', '_'); + i18n.locale = locale; + loadTranslations(i18n, locale).then(() => { // some translations: translations.all_money = i18n.t('firefly.all_money'); translations.category = i18n.t('firefly.category'); diff --git a/resources/assets/v2/pages/dashboard/subscriptions.js b/resources/assets/v2/pages/dashboard/subscriptions.js index 4b6b7e9adc..b98320e6ef 100644 --- a/resources/assets/v2/pages/dashboard/subscriptions.js +++ b/resources/assets/v2/pages/dashboard/subscriptions.js @@ -274,14 +274,15 @@ export default () => ({ init() { console.log('subscriptions init'); - Promise.all([getVariable('autoConversion', false), getVariable('language', 'en-US')]).then((values) => { + Promise.all([getVariable('autoConversion', false), getVariable('language', 'en_US')]).then((values) => { console.log('subscriptions after promises'); this.autoConversion = values[0]; afterPromises = true; i18n = new I18n(); - i18n.locale = values[1]; - loadTranslations(i18n, values[1]).then(() => { + const locale = values[1].replace('-', '_'); + i18n.locale = locale; + loadTranslations(i18n, locale).then(() => { if (false === this.loading) { this.startSubscriptions(); } diff --git a/resources/assets/v2/pages/shared/dates.js b/resources/assets/v2/pages/shared/dates.js index cf305d1e75..0982e02ce7 100644 --- a/resources/assets/v2/pages/shared/dates.js +++ b/resources/assets/v2/pages/shared/dates.js @@ -41,7 +41,7 @@ export default () => ({ defaultRange: { start: null, end: null }, - language: 'en-US', + language: 'en_US', init() { // console.log('Dates init'); diff --git a/resources/assets/v2/pages/transactions/create.js b/resources/assets/v2/pages/transactions/create.js index c6cc223dc7..7c6b800727 100644 --- a/resources/assets/v2/pages/transactions/create.js +++ b/resources/assets/v2/pages/transactions/create.js @@ -25,14 +25,135 @@ import {parseFromEntries} from "./shared/parse-from-entries.js"; import formatMoney from "../../util/format-money.js"; import Autocomplete from "bootstrap5-autocomplete"; import Post from "../../api/v2/model/transaction/post.js"; +import {getVariable} from "../../store/get-variable.js"; +import {I18n} from "i18n-js"; +import {loadTranslations} from "../../support/load-translations.js"; + +let i18n; + +const urls = { + description: '/api/v2/autocomplete/transaction-descriptions', + account: '/api/v2/autocomplete/accounts', +}; let transactions = function () { return { count: 0, totalAmount: 0, + transactionType: 'unknown', showSuccessMessage: false, showErrorMessage: false, entries: [], + filters: { + source: [], + destination: [], + }, + detectTransactionType() { + const sourceType = this.entries[0].source_account.type ?? 'unknown'; + const destType = this.entries[0].destination_account.type ?? 'unknown'; + if ('unknown' === sourceType && 'unknown' === destType) { + this.transactionType = 'unknown'; + console.warn('Cannot infer transaction type from two unknown accounts.'); + return; + } + // transfer: both are the same and in strict set of account types + if (sourceType === destType && ['Asset account', 'Loan', 'Debt', 'Mortgage'].includes(sourceType)) { + this.transactionType = 'transfer'; + console.log('Transaction type is detected to be "' + this.transactionType + '".'); + return; + } + // withdrawals: + if ('Asset account' === sourceType && ['Expense account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) { + this.transactionType = 'withdrawal'; + console.log('Transaction type is detected to be "' + this.transactionType + '".'); + return; + } + if ('Asset account' === sourceType && 'unknown' === destType) { + this.transactionType = 'withdrawal'; + console.log('Transaction type is detected to be "' + this.transactionType + '".'); + return; + } + if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Expense account' === destType) { + this.transactionType = 'withdrawal'; + console.log('Transaction type is detected to be "' + this.transactionType + '".'); + return; + } + + // deposits: + if ('Revenue account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) { + this.transactionType = 'deposit'; + console.log('Transaction type is detected to be "' + this.transactionType + '".'); + return; + } + if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Asset account' === destType) { + this.transactionType = 'deposit'; + console.log('Transaction type is detected to be "' + this.transactionType + '".'); + return; + } + console.warn('Unknown account combination between "' + sourceType + '" and "' + destType + '".'); + }, + selectSourceAccount(item, ac) { + const index = parseInt(ac._searchInput.attributes['data-index'].value); + document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account = + { + id: item.id, + name: item.name, + type: item.type, + }; + console.log('Changed source account into a known ' + item.type.toLowerCase()); + }, + changedAmount(e) { + const index = parseInt(e.target.dataset.index); + this.entries[index].amount = parseFloat(e.target.value); + this.totalAmount = 0; + for (let i in this.entries) { + if (this.entries.hasOwnProperty(i)) { + this.totalAmount = this.totalAmount + parseFloat(this.entries[i].amount); + } + } + console.log('Changed amount to ' + this.totalAmount); + }, + selectDestAccount(item, ac) { + const index = parseInt(ac._searchInput.attributes['data-index'].value); + document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account = + { + id: item.id, + name: item.name, + type: item.type, + }; + console.log('Changed destination account into a known ' + item.type.toLowerCase()); + }, + changeSourceAccount(item, ac) { + if (typeof item === 'undefined') { + const index = parseInt(ac._searchInput.attributes['data-index'].value); + let source = document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account; + if (source.name === ac._searchInput.value) { + console.warn('Ignore hallucinated source account name change to "' + ac._searchInput.value + '"'); + return; + } + document.querySelector('#form')._x_dataStack[0].$data.entries[index].source_account = + { + name: ac._searchInput.value, + }; + console.log('Changed source account into a unknown account called "' + ac._searchInput.value + '"'); + } + }, + changeDestAccount(item, ac) { + if (typeof item === 'undefined') { + const index = parseInt(ac._searchInput.attributes['data-index'].value); + let destination = document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account; + if (destination.name === ac._searchInput.value) { + console.warn('Ignore hallucinated destination account name change to "' + ac._searchInput.value + '"'); + return; + } + document.querySelector('#form')._x_dataStack[0].$data.entries[index].destination_account = + { + name: ac._searchInput.value, + }; + console.log('Changed destination account into a unknown account called "' + ac._searchInput.value + '"'); + } + }, + // error and success messages: showError: false, @@ -40,62 +161,85 @@ let transactions = function () { addedSplit() { console.log('addedSplit'); - const opts = { - onSelectItem: console.log, - }; - var src = []; - for (let i = 0; i < 50; i++) { - src.push({ - title: "Option " + i, - id: "opt" + i, - data: { - key: i, - }, - }); - } + Autocomplete.init("input.ac-source", { + server: urls.account, + serverParams: { + types: this.filters.source, + }, + fetchOptions: { + headers: { + 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content + } + }, + hiddenInput: true, + preventBrowserAutocomplete: true, + highlightTyped: true, + liveServer: true, + onChange: this.changeSourceAccount, + onSelectItem: this.selectSourceAccount, + onRenderItem: function (item, b, c) { + return item.name_with_balance + '
' + i18n.t('firefly.account_type_' + item.type) + ''; + } + }); - Autocomplete.init("input.autocomplete", { - items: src, + Autocomplete.init("input.ac-dest", { + server: urls.account, + serverParams: { + types: this.filters.destination, + }, + fetchOptions: { + headers: { + 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content + } + }, + hiddenInput: true, + preventBrowserAutocomplete: true, + liveServer: true, + highlightTyped: true, + onSelectItem: this.selectDestAccount, + onChange: this.changeDestAccount, + onRenderItem: function (item, b, c) { + return item.name_with_balance + '
' + i18n.t('firefly.account_type_' + item.type) + ''; + } + }); + this.filters.destination = []; + Autocomplete.init('input.ac-description', { + server: urls.description, + fetchOptions: { + headers: { + 'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content + } + }, valueField: "id", - labelField: "title", + labelField: "description", highlightTyped: true, onSelectItem: console.log, }); - // setTimeout(() => { - // console.log('timed out'); - // console.log(document.querySelector('input.autocomplete')); - - // }, 1500); - }, init() { - console.log('init()'); - this.addSplit(); + Promise.all([getVariable('language', 'en_US')]).then((values) => { + i18n = new I18n(); + const locale = values[0].replace('-', '_'); + i18n.locale = locale; + loadTranslations(i18n, locale).then(() => { + this.addSplit(); + }); - // // We can use regular objects as source and customize label - // new Autocomplete(document.getElementById("autocompleteRegularInput"), { - // items: { - // opt_some: "Some", - // opt_value: "Value", - // opt_here: "Here is a very long element that should be truncated", - // opt_dia: "çaça" - // }, - // onRenderItem: (item, label) => { - // return label + " (" + item.value + ")"; - // }, - // }); - // new Autocomplete(document.getElementById("autocompleteDatalist"), opts); - //new Autocomplete(document.getElementById("autocompleteRemote"), opts); - // new Autocomplete(document.getElementById("autocompleteLiveRemote"), opts); + }); + // source can never be expense account + this.filters.source = ['Asset account', 'Loan', 'Debt', 'Mortgage', 'Revenue account']; + // destination can never be revenue account + this.filters.destination = ['Expense account', 'Loan', 'Debt', 'Mortgage', 'Asset account']; }, submitTransaction() { + this.detectTransactionType(); // todo disable buttons - let transactions = parseFromEntries(this.entries); + let transactions = parseFromEntries(this.entries, this.transactionType); let submission = { // todo process all options group_title: null, diff --git a/resources/assets/v2/pages/transactions/shared/create-empty-split.js b/resources/assets/v2/pages/transactions/shared/create-empty-split.js index 809e35ef7c..b28997f7d2 100644 --- a/resources/assets/v2/pages/transactions/shared/create-empty-split.js +++ b/resources/assets/v2/pages/transactions/shared/create-empty-split.js @@ -32,7 +32,7 @@ export function createEmptySplit() { let now = new Date(); let formatted = format(now, 'yyyy-MM-dd HH:mm'); return { - description: 'OK then', + description: '', amount: '', source_account: getAccount(), destination_account: getAccount(), diff --git a/resources/assets/v2/pages/transactions/shared/parse-from-entries.js b/resources/assets/v2/pages/transactions/shared/parse-from-entries.js index f561023bc4..fb49b9fb25 100644 --- a/resources/assets/v2/pages/transactions/shared/parse-from-entries.js +++ b/resources/assets/v2/pages/transactions/shared/parse-from-entries.js @@ -22,7 +22,7 @@ * * @param entries */ -export function parseFromEntries(entries) { +export function parseFromEntries(entries, transactionType) { let returnArray = []; for (let i in entries) { if (entries.hasOwnProperty(i)) { @@ -36,8 +36,16 @@ export function parseFromEntries(entries) { current.amount = entry.amount; current.date = entry.date; + // if ID is set: + if ('' !== entry.source_account.id.toString()) { + current.source_id = entry.source_account.id; + } + if ('' !== entry.destination_account.id.toString()) { + current.destination_id = entry.destination_account.id; + } + // TODO transaction type is hard coded: - current.type = 'withdrawal'; + current.type = transactionType; returnArray.push(current); diff --git a/resources/assets/v2/support/load-translations.js b/resources/assets/v2/support/load-translations.js index e8abd3adb9..17162a8065 100644 --- a/resources/assets/v2/support/load-translations.js +++ b/resources/assets/v2/support/load-translations.js @@ -22,6 +22,7 @@ let loaded = false; async function loadTranslations(i18n, locale) { if (false === loaded) { + locale = locale.replace('-', '_'); const response = await fetch(`./v2/i18n/${locale}.json`); const translations = await response.json(); i18n.store(translations); diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 465cced993..832a7f369a 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -2047,6 +2047,9 @@ return [ 'Expense account' => 'Expense account', 'Revenue account' => 'Revenue account', 'Initial balance account' => 'Initial balance account', + 'account_type_Asset account' => 'Asset account', + 'account_type_Expense account' => 'Expense account', + 'account_type_Revenue account' => 'Revenue account', 'account_type_Debt' => 'Debt', 'account_type_Loan' => 'Loan', 'account_type_Mortgage' => 'Mortgage', diff --git a/resources/views/v2/transactions/create.blade.php b/resources/views/v2/transactions/create.blade.php new file mode 100644 index 0000000000..c237d7dbb6 --- /dev/null +++ b/resources/views/v2/transactions/create.blade.php @@ -0,0 +1,227 @@ +@extends('layout.v2') +@section('vite') + @vite(['resources/assets/v2/sass/app.scss', 'resources/assets/v2/pages/transactions/create.js']) +@endsection +@section('content') ++ ++++ ++ A simple success alert with