import{dasp,fasl}from"./format-money-db0e5105.js";import{Gasf}from"./get-04515a82.js";import{pasg}from"./parse-downloaded-splits-84d22cdd.js";import{pasm,dasw,easa,fasy,gasb,hasP,iasS,lasv,aasC,basA,cas_,sasE,jasD,kasc,masu}from"./splice-errors-into-transactions-bdbe4899.js";import{iaso,masT}from"./vendor-0a0b4763.js";import{dasx}from"./create-empty-split-0cfec852.js";import{PasB}from"./put-ade65e7d.js";import"./get-d7bb5fb3.js";constn=D();letL=function(){return{entries:[],originals:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"edit",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,editTitle:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(leteinthis.entries)this.entries.hasOwnProperty(e)&&(this.entries[e].errors=x());this.formStates.isSubmitting=!0;lett=m(this.entries,this.originals,this.groupProperties.transactionType),s={group_title:this.groupProperties.editTitle,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:t};this.groupProperties.title===null&&t.length>1&&(s.group_title=t[0].description);letr=newB;console.log(s),r.put(s,{id:this.groupProperties.id}).then(e=>{consti=e.data.data;if(this.groupProperties.id=parseInt(i.id),this.groupProperties.title=i.attributes.group_title??i.attributes.transactions[0].description,w(this.groupProperties.id,i.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=o.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(e=>{this.submitting=!1,console.log(e),typeofe.response<"u"&&this.parseErrors(e.response.data)})},filters:{source:[],destination:[]},addedSplit(){setTimeout(()=>{constt=function(s,r,e){returns.name_with_balance+'<br><small class="text-muted">'+o.t("firefly.account_type_"+s.type)+"</small>"};a({selector:"input.ac-source",serverUrl:n.account,filters:this.filters.source,onRenderItem:t,onChange:y,onSelectItem:b}),a({selector:"input.ac-dest",serverUrl:n.account,filters:this.filters.destination,onRenderItem:t,onChange:P,onSelectItem:S}),a({selector:"input.ac-category",serverUrl:n.category,valueField:"id",labelField:"name",onChange:c,onSelectItem:c}),a({selector:"input.ac-description",serverUrl:n.description,valueField:"id",labelField:"description",onChange:u,onSelectItem:u})},250)},changedDateTime(t){console.warn("changedDateTime, event is not used")},changedDescription(t){console.warn("changedDescription, event is not used")},changedDestinationAccount(t){console.warn("changedDestinationAccount, event is not used")},changedSourceAccount(t){console.warn("changedSourceAccount, event is not used")},formattedTotalAmount(){returnthis.entries.length===0?l(this.groupProperties.totalAmount,"EUR"):l(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},getTags(t){returnconsole.log("at get tags "+t),console.log(this.entries[t].tags),this.entries[t].tags??[]},getTransactionGroup(){this.entries=[];constt=window.location.href.split("/"),s=parseInt(t[t.length-1]);newf().show(s,{}).then(e=>{consti=e.data.data;this.groupProperties.id=parseInt(i.id),this.groupProperties.transactionType=i.attributes.transactions[0].type.toLowerCase(),this.groupProperties.title=i.attributes.title??i.attributes.transactions[0].description,this.entries=g(i.attributes.transactions,parseInt(i.id)),this.notifications.wait.show=!1}).then(()=>{this.groupProperties.totalAmount=0;for(leteinthis.entries)this.entries.hasOwnProperty(e)&&(this.groupProperties.totalAmount=this.groupProperties.