Files
firefly-iii/public/build/assets/create-409a9a86.js
2024-01-05 14:04:44 +01:00

2 lines
22 KiB
JavaScript

import{a as _,d as P,g as x,l as E}from"./load-translations-9dfbf635.js";import{f as T,k as I,l as m,I as L,m as A}from"./vendor-97200597.js";import{a as D,G as O,f as y}from"./get-35a1642f.js";function b(){return{id:"",name:"",alpine_name:""}}function C(){return{description:[],amount:[],currency_code:[],foreign_amount:[],foreign_currency_code:[],source_account:[],destination_account:[],budget_id:[],category_name:[],piggy_bank_id:[],bill_id:[],tags:[],notes:[],internal_reference:[],external_url:[],latitude:[],longitude:[],zoom_level:[],date:[],interest_date:[],book_date:[],process_date:[],due_date:[],payment_date:[],invoice_date:[]}}function B(){let t=T(new Date,"yyyy-MM-dd HH:mm");return{description:"",amount:"",currency_code:"EUR",foreign_amount:"",foreign_currency_code:"",source_account:b(),destination_account:b(),budget_id:null,category_name:"",piggy_bank_id:null,bill_id:null,tags:[],notes:"",internal_reference:"",external_url:"",hasLocation:!1,map:null,latitude:null,longitude:null,zoomLevel:null,marker:null,date:t,interest_date:"",book_date:"",process_date:"",due_date:"",payment_date:"",invoice_date:"",errors:C()}}function F(e,t){let n=[];for(let r in e)if(e.hasOwnProperty(r)){const o=e[r];let a={};a.description=o.description,a.source_name=o.source_account.name,a.destination_name=o.destination_account.name,a.amount=o.amount,a.currency_code=o.currency_code,a.date=o.date,a.interest_date=o.interest_date,a.book_date=o.book_date,a.process_date=o.process_date,a.due_date=o.due_date,a.payment_date=o.payment_date,a.invoice_date=o.invoice_date,a.budget_id=o.budget_id,a.category_name=o.category_name,a.piggy_bank_id=o.piggy_bank_id,a.bill_id=o.bill_id,a.tags=o.tags,a.notes=o.notes,a.internal_reference=o.internal_reference,a.external_url=o.external_url,a.store_location=!1,o.hasLocation&&(a.store_location=!0,a.longitude=o.longitude.toString(),a.latitude=o.latitude.toString(),a.zoom_level=o.zoomLevel),typeof o.foreign_currency_code<"u"&&o.foreign_currency_code.toString()!==""&&(a.foreign_currency_code=o.foreign_currency_code,typeof o.foreign_amount<"u"&&o.foreign_amount.toString()!==""&&(a.foreign_amount=o.foreign_amount),(typeof o.foreign_amount>"u"||o.foreign_amount.toString()==="")&&(delete a.foreign_amount,delete a.foreign_currency_code)),typeof o.source_account.id<"u"&&o.source_account.id.toString()!==""&&(a.source_id=o.source_account.id),typeof o.destination_account.id<"u"&&o.destination_account.id.toString()!==""&&(a.destination_id=o.destination_account.id),a.type=t,n.push(a)}return n}let $=class{post(t){let n="/api/v2/transactions";return _.post(n,t)}},j=class{list(t){return _.get("/api/v2/currencies",{params:t})}};function q(){let e={page:1,limit:1337};return new j().list(e).then(n=>{let r={defaultCurrency:{},nativeCurrencies:[],foreignCurrencies:[],enabledCurrencies:[]};r.foreignCurrencies.push({id:0,name:"(no foreign currency)",code:"",default:!1,symbol:"",decimal_places:2});for(let o in n.data.data)if(n.data.data.hasOwnProperty(o)){let a=n.data.data[o];if(a.attributes.enabled){let i={id:a.id,name:a.attributes.name,code:a.attributes.code,default:a.attributes.default,symbol:a.attributes.symbol,decimal_places:a.attributes.decimal_places};i.default&&(r.defaultCurrency=i),r.enabledCurrencies.push(i),r.nativeCurrencies.push(i),r.foreignCurrencies.push(i)}}return r})}class R{list(t){return _.get("/api/v2/budgets",{params:t})}}function z(){let e={page:1,limit:1337};return new R().list(e).then(n=>{let r=[{id:0,name:"(no budget)"}];for(let o in n.data.data)if(n.data.data.hasOwnProperty(o)){let a=n.data.data[o],i={id:a.id,name:a.attributes.name};r.push(i)}return r})}function M(){let e={page:1,limit:1337};return new D().list(e).then(n=>{let r={0:{id:0,name:"(no group)",order:0,piggyBanks:[{id:0,name:"(no piggy bank)",order:0}]}};for(let o in n.data.data)if(n.data.data.hasOwnProperty(o)){let a=n.data.data[o],i=a.attributes.object_group_id??"0",s=a.attributes.object_group_title??"(no group)",c={id:a.id,name:a.attributes.name,order:a.attributes.order};r.hasOwnProperty(i)||(r[i]={id:i,name:s,order:a.attributes.object_group_order??0,piggyBanks:[]}),r[i].piggyBanks.push(c),r[i].piggyBanks.sort((u,p)=>u.order-p.order)}return Object.keys(r).sort().reduce((o,a)=>(o[a]=r[a],o),{})})}function U(){let e={page:1,limit:1337};return new O().list(e).then(n=>{let r={0:{id:0,name:"(no group)",order:0,subscriptions:[{id:0,name:"(no subscription)",order:0}]}};for(let o in n.data.data)if(n.data.data.hasOwnProperty(o)){let a=n.data.data[o],i=a.attributes.object_group_id??"0",s=a.attributes.object_group_title??"(no group)",c={id:a.id,name:a.attributes.name,order:a.attributes.order};r.hasOwnProperty(i)||(r[i]={id:i,name:s,order:a.attributes.object_group_order??0,subscriptions:[]}),r[i].subscriptions.push(c),r[i].subscriptions.sort((u,p)=>u.order-p.order)}return Object.keys(r).sort().reduce((o,a)=>(o[a]=r[a],o),{})})}function h(e){const t={server:e.serverUrl,serverParams:{},fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}},hiddenInput:!0,preventBrowserAutocomplete:!0,highlightTyped:!0,liveServer:!0};typeof e.filters<"u"&&e.filters.length>0&&(t.serverParams.types=e.filters),typeof e.onRenderItem<"u"&&e.onRenderItem!==null&&(console.log("add on render item"),t.onRenderItem=e.onRenderItem),e.valueField&&(t.valueField=e.valueField),e.labelField&&(t.labelField=e.labelField),e.onSelectItem&&(t.onSelectItem=e.onSelectItem),e.onChange&&(t.onChange=e.onChange),I.init(e.selector,t)}function w(e,t){const n=parseInt(t._searchInput.attributes["data-index"].value);if(typeof e<"u"&&e.name){document.querySelector("#form")._x_dataStack[0].$data.entries[n].category_name=e.name;return}document.querySelector("#form")._x_dataStack[0].$data.entries[n].category_name=t._searchInput.value}function v(e,t){const n=parseInt(t._searchInput.attributes["data-index"].value);if(typeof e<"u"&&e.description){document.querySelector("#form")._x_dataStack[0].$data.entries[n].description=e.description;return}document.querySelector("#form")._x_dataStack[0].$data.entries[n].description=t._searchInput.value}function N(e,t){if(typeof e>"u"){const n=parseInt(t._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[n].destination_account.name===t._searchInput.value){console.warn('Ignore hallucinated destination account name change to "'+t._searchInput.value+'"');return}document.querySelector("#form")._x_dataStack[0].$data.entries[n].destination_account={name:t._searchInput.value,alpine_name:t._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}}function G(e,t){const n=parseInt(t._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[n].destination_account={id:e.id,name:e.name,alpine_name:e.name,type:e.type,currency_code:e.currency_code},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}function H(e,t){if(typeof e>"u"){const n=parseInt(t._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[n].source_account.name===t._searchInput.value)return;document.querySelector("#form")._x_dataStack[0].$data.entries[n].source_account={name:t._searchInput.value,alpine_name:t._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}}function Z(e,t){const n=parseInt(t._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[n].source_account={id:e.id,name:e.name,alpine_name:e.name,type:e.type,currency_code:e.currency_code},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}class K{post(t,n,r){let o="/api/v1/attachments";return _.post(o,{filename:t,attachable_type:n,attachable_id:r})}upload(t,n){let r="./api/v1/attachments/"+t+"/upload";return axios.post(r,n)}}let V=function(e){let t=e.length,n=0,r=!1;for(const o in e)if(e.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294&&r===!1){let a=new K;a.post(e[o].name,"TransactionJournal",e[o].journal).then(i=>{let s=parseInt(i.data.data.id);a.upload(s,e[o].content).then(c=>{if(n++,n===t){const u=new CustomEvent("upload-success",{some:"details"});document.dispatchEvent(u)}}).catch(c=>{console.error("Could not upload"),console.error(c),n++;const u=new CustomEvent("upload-failed",{error:c});document.dispatchEvent(u),r=!0})}).catch(i=>{console.error("Could not create upload."),console.error(i),n++;const s=new CustomEvent("upload-failed",{error:i});document.dispatchEvent(s),r=!0})}};function X(e,t){t=t.reverse();let n=[],r=0,o=[],a=document.querySelectorAll('input[name="attachments[]"]');for(const i in a)if(a.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294)for(const s in a[i].files)a[i].files.hasOwnProperty(s)&&/^0$|^[1-9]\d*$/.test(s)&&s<=4294967294&&(n.push({journal:t[i].transaction_journal_id,file:a[i].files[s]}),r++);for(const i in n)n.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294&&function(s,c){let u=new FileReader;u.onloadend=function(p){p.target.readyState===FileReader.DONE&&(o.push({name:n[c].file.name,journal:n[c].journal,content:new Blob([p.target.result])}),o.length===r&&V(o))},u.readAsArrayBuffer(s.file)}(n[i],i);return r}function J(e,t,n){let r=[];for(let o in n)n.hasOwnProperty(o)&&r.push(n[o].replace(e,t));return r}function Q(e,t,n){let r,o,a;for(const i in t)if(t.hasOwnProperty(i)){if(i==="group_title"){console.error("Cannot handle error in group title.");continue}if(r=parseInt(i.split(".")[1]),o=i.split(".")[2],a=J(i,o,t[i]),!n.hasOwnProperty(r)){console.error("Cannot handle errors in index #"+r);continue}switch(o){case"currency_code":case"foreign_currency_code":case"category_name":case"piggy_bank_id":case"notes":case"internal_reference":case"external_url":case"latitude":case"longitude":case"zoom_level":case"interest_date":case"book_date":case"process_date":case"due_date":case"payment_date":case"invoice_date":case"amount":case"date":case"budget_id":case"bill_id":case"description":case"tags":n[r].errors[o]=a;break;case"source_name":case"source_id":n[r].errors.source_account=n[r].errors.source_account.concat(a);break;case"type":n[r].errors.source_account=n[r].errors.source_account.concat([e.t("validation.bad_type_source")]),n[r].errors.destination_account=n[r].errors.destination_account.concat([e.t("validation.bad_type_destination")]);break;case"destination_name":case"destination_id":n[r].errors.destination_account=n[r].errors.destination_account.concat(a);break;case"foreign_amount":case"foreign_currency_id":n[r].errors.foreign_amount=n[r].errors.foreign_amount.concat(a);break}typeof n[r]<"u"&&(n[r].errors.source_account=Array.from(new Set(n[r].errors.source_account)),n[r].errors.destination_account=Array.from(new Set(n[r].errors.destination_account)))}return console.log(n[0].errors),n}let d=[],g=[];document.addEventListener("location-remove",e=>{g[e.detail.index].remove()});function W(e){let t=0;if(document.querySelector("#form")._x_dataStack[0].$data.entries[t].hasLocation===!1){g[t]=new m.marker(e.latlng,{draggable:!0}),g[t].on("dragend",ee),g[t].addTo(d[t]);const r=new CustomEvent("location-set",{detail:{latitude:e.latlng.lat,longitude:e.latlng.lng,index:t,zoomLevel:d[t].getZoom()}});document.dispatchEvent(r)}}function Y(e){let t=0;const n=new CustomEvent("location-zoom",{detail:{index:t,zoomLevel:d[t].getZoom()}});document.dispatchEvent(n)}function ee(e){let t=e.target,n=t.getLatLng();t.setLatLng(new m.LatLng(n.lat,n.lng),{draggable:"true"});const r=new CustomEvent("location-move",{detail:{latitude:n.lat,longitude:n.lng,index:0}});document.dispatchEvent(r)}function te(e){if(e>0){console.warn("Corwardly refuse to add a map on split #"+(e+1));return}if(typeof d[e]>"u"){let t=document.getElementById("location_map");d[e]=m.map(t).setView([t.dataset.latitude,t.dataset.longitude],t.dataset.zoomLevel),m.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(d[e]),d[e].on("click",W),d[e].on("zoomend",Y)}}let l;const f={description:"/api/v2/autocomplete/transaction-descriptions",account:"/api/v2/autocomplete/accounts",category:"/api/v2/autocomplete/categories",tag:"/api/v2/autocomplete/tags"};let ne=function(){return{entries:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"create",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},filters:{source:[],destination:[]},changedDateTime(e){console.warn("changedDateTime, event is not used")},changedDescription(e){console.warn("changedDescription, event is not used")},changedDestinationAccount(e){this.detectTransactionType()},changedSourceAccount(e){this.detectTransactionType()},detectTransactionType(){const e=this.entries[0].source_account.type??"unknown",t=this.entries[0].destination_account.type??"unknown";if(e==="unknown"&&t==="unknown"){this.groupProperties.transactionType="unknown",console.warn("Cannot infer transaction type from two unknown accounts.");return}if(e===t&&["Asset account","Loan","Debt","Mortgage"].includes(e)){this.groupProperties.transactionType="transfer",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log("filter down currencies for transfer."),this.filterNativeCurrencies(this.entries[0].source_account.currency_code),this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);return}if(e==="Asset account"&&["Expense account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="withdrawal",console.log('[a] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Asset account"&&t==="unknown"){this.groupProperties.transactionType="withdrawal",console.log('[b] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log(this.entries[0].source_account),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(["Debt","Loan","Mortgage"].includes(e)&&t==="Expense account"){this.groupProperties.transactionType="withdrawal",console.log('[c] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Revenue account"&&["Asset account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}if(["Debt","Loan","Mortgage"].includes(e)&&t==="Asset account"){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}console.warn('Unknown account combination between "'+e+'" and "'+t+'".')},formattedTotalAmount(){return this.entries.length===0?y(this.groupProperties.totalAmount,"EUR"):y(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},filterForeignCurrencies(e){let t=[],n;for(let r in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(r)){let o=this.formData.enabledCurrencies[r];o.code===e&&(n=o)}t.push(n),this.formData.foreignCurrencies=t,t.length===1&&t[0].code===this.entries[0].source_account.currency_code&&(console.log("Foreign currency is same as source currency. Disable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!1),t.length===1&&t[0].code!==this.entries[0].source_account.currency_code&&(console.log("Foreign currency is NOT same as source currency. Enable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!0);for(let r in this.entries)this.entries.hasOwnProperty(r)&&(this.entries[r].foreign_currency_code=e)},filterNativeCurrencies(e){let t=[],n;for(let r in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(r)){let o=this.formData.enabledCurrencies[r];o.code===e&&(n=o)}t.push(n),this.formData.nativeCurrencies=t;for(let r in this.entries)this.entries.hasOwnProperty(r)&&(this.entries[r].currency_code=e)},changedAmount(e){const t=parseInt(e.target.dataset.index);this.entries[t].amount=parseFloat(e.target.value),this.groupProperties.totalAmount=0;for(let n in this.entries)this.entries.hasOwnProperty(n)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[n].amount))},addedSplit(){const e=function(t,n,r){return t.name_with_balance+'<br><small class="text-muted">'+l.t("firefly.account_type_"+t.type)+"</small>"};console.log(this.filters),h({selector:"input.ac-source",serverUrl:f.account,filters:this.filters.source,onRenderItem:e,onChange:H,onSelectItem:Z}),h({selector:"input.ac-dest",serverUrl:f.account,filters:this.filters.destination,onRenderItem:e,onChange:N,onSelectItem:G}),h({selector:"input.ac-category",serverUrl:f.category,valueField:"id",labelField:"name",onChange:w,onSelectItem:w}),h({selector:"input.ac-description",serverUrl:f.description,valueField:"id",labelField:"description",onChange:v,onSelectItem:v})},processUpload(e){this.showMessageOrRedirectUser()},processUploadError(e){this.notifications.success.show=!1,this.notifications.wait.show=!1,this.notifications.error.show=!0,this.formStates.isSubmitting=!1,this.notifications.error.text=l.t("firefly.errors_upload"),console.error(e)},init(){Promise.all([x("language","en_US")]).then(e=>{l=new L;const t=e[0].replace("-","_");l.locale=t,E(l,t).then(()=>{this.addSplit()})}),q().then(e=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=e.defaultCurrency,this.formData.enabledCurrencies=e.enabledCurrencies,this.formData.nativeCurrencies=e.nativeCurrencies,this.formData.foreignCurrencies=e.foreignCurrencies}),z().then(e=>{this.formData.budgets=e,this.formStates.loadingBudgets=!1}),M().then(e=>{this.formData.piggyBanks=e,this.formStates.loadingPiggyBanks=!1}),U().then(e=>{this.formData.subscriptions=e,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",e=>{this.processUpload(e),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",e=>{this.processUploadError(e)}),document.addEventListener("location-move",e=>{this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude}),document.addEventListener("location-set",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),document.addEventListener("location-zoom",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),this.filters.source=["Asset account","Loan","Debt","Mortgage","Revenue account"],this.filters.destination=["Expense account","Loan","Debt","Mortgage","Asset account"]},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(let r in this.entries)this.entries.hasOwnProperty(r)&&(this.entries[r].errors=C());this.formStates.isSubmitting=!0,this.detectTransactionType();let e=F(this.entries,this.groupProperties.transactionType),t={group_title:this.groupProperties.title,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:e};this.groupProperties.title===null&&e.length>1&&(t.group_title=e[0].description);let n=new $;console.log(t),n.post(t).then(r=>{const o=r.data.data;if(this.groupProperties.id=parseInt(o.id),this.groupProperties.title=o.attributes.group_title??o.attributes.transactions[0].description,X(this.groupProperties.id,o.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=l.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(r=>{this.submitting=!1,console.log(r),typeof r.response<"u"&&this.parseErrors(r.response.data)})},showMessageOrRedirectUser(){if(this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.returnHereButton){this.notifications.success.show=!0,this.notifications.success.url="transactions/show/"+this.groupProperties.id,this.notifications.success.text=l.t("firefly.stored_journal_js",{description:this.groupProperties.title}),this.formStates.resetButton&&(this.entries=[],this.addSplit(),this.groupProperties.totalAmount=0);return}window.location="transactions/show/"+this.groupProperties.id+"?transaction_group_id="+this.groupProperties.id+"&message=created"},parseErrors(e){this.notifications.error.show=!0,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.isSubmitting=!1,this.notifications.error.text=l.t("firefly.errors_submission",{errorMessage:e.message}),e.hasOwnProperty("errors")&&(this.entries=Q(l,e.errors,this.entries))},addSplit(){this.entries.push(B()),setTimeout(()=>{A.init("select.ac-tags",{allowClear:!0,server:f.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:l.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}});const e=this.entries.length-1;te(e)},150)},removeSplit(e){this.entries.splice(e,1),document.querySelector("#split-0-tab").click()},clearLocation(e){e.preventDefault();const t=e.currentTarget,n=parseInt(t.attributes["data-index"].value);this.entries[n].hasLocation=!1,this.entries[n].latitude=null,this.entries[n].longitude=null,this.entries[n].zoomLevel=null;const r=new CustomEvent("location-remove",{detail:{index:n}});return document.dispatchEvent(r),!1}}},S={transactions:ne,dates:P};function k(){Object.keys(S).forEach(e=>{console.log(`Loading page component "${e}"`);let t=S[e]();Alpine.data(e,()=>t)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),k()});window.bootstrapped&&(console.log("Loaded through window variable."),k());