PageSourceSearch

https://kiku.listen.org/353.d55a92b665ff425a.bundle.js

js listen.org collected 2026-09-24 20:14:52 UTC 100,456 bytes, 1 lines download raw bytes

1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[353],{44385:function(e,t,s){s.d(t,{a7:function(){return o},n0:function(){return p},pL:function(){return l},pO:function(){return n}});s(18111),s(7588);const i=524288e3,a=104857600;function l(e){const t=e&&e.name?e.name.toLowerCase():"";return t.endsWith(".xlsx")||t.endsWith(".ods")?a:i}function o(e){return`${Math.round(l(e)/1048576)} MB`}const n=".csv,.txt,.xlsx,.ods";function r(e){const t=e&&e.name?e.name.toLowerCase():"";return t.endsWith(".xlsx")?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":t.endsWith(".ods")?"application/vnd.oasis.opendocument.spreadsheet":t.endsWith(".txt")?"text/plain":"text/csv"}function p(e,t,s,i){const a=i||window.fetch.bind(window),l=r(t);return e.post("/imports/upload-url",{type:s,fileName:t.name,size:t.size,contentType:l}).then(e=>{const s=new FormData;return Object.keys(e.data.fields||{}).forEach(t=>{s.append(t,e.data.fields[t])}),s.append("file",t),a(e.data.url,{method:"POST",body:s}).then(t=>{if(!t.ok)throw new Error("upload_failed");return{mediaId:e.data.mediaId}})})}},63079:function(e,t,s){s.d(t,{A:function(){return ws}});var i=s(20641),a=s(90033),l=s(53751);const o={class:"modal-card import-mapping-modal"},n={class:"modal-card-head"},r={class:"import-mapping-modal__heading"},p={class:"modal-card-title"},d={class:"import-mapping-modal__subtitle"},u=["aria-label"],c={class:"modal-card-body"},m={key:0,class:"import-sheet-wrap import-sheet-skeleton","aria-hidden":"true"},h={class:"import-sheet-skeleton__toolbar"},g={class:"import-sheet-skeleton__progress"},y={class:"import-sheet is-skeleton"},f={class:"import-sheet__table"},v={class:"import-sheet__head-btn import-sheet-skeleton__head"},_={class:"import-sheet__gutter"},b={key:1,class:"list-empty-state"},k={class:"list-empty-state-message"},w={key:2,class:"import-sheet-wrap"},C={class:"import-sheet__toolbar"},I={class:"import-sheet__progress"},E={class:"import-sheet__eyebrow"},F={class:"import-sheet__bar-bg"},L={class:"import-sheet__facts"},$={key:0},x={key:1,class:"import-sheet__sep"},R={key:0,class:"import-sheet__ragged","data-testid":"import-ragged-warning"},S={class:"import-mapping-modal__previous-body"},X={class:"buttons"},M={class:"import-sheet__eyebrow"},T={class:"import-matches__counts"},P={class:"import-matches__count is-found"},A={class:"import-sheet-body"},D={class:"import-sheet-area"},O={class:"import-sheet nice-scrollbar"},U={class:"import-sheet__table"},W=["title","aria-pressed","data-column","onClick"],K={class:"import-sheet__head-name"},q={class:"import-sheet__head-summary"},Q={class:"import-sheet__head-chips"},V={key:0,class:"tag is-rounded is-small is-info is-passive"},N={class:"import-sheet__gutter"},j={key:0,class:"tag is-rounded is-small is-info is-passive import-sheet__match-tag"},z=["title"],B={key:0,class:"import-sheet__tags"},G=["title"],H={key:1,class:"import-sheet__resolved"},Y=["title"],J={key:0,class:"import-sheet__raw"},Z={key:3,class:"import-sheet__empty"},ee=["title"],te={key:0,class:"import-sheet__more"},se=["aria-label"],ie=["aria-label","aria-valuenow","aria-valuemin"],ae={class:"import-panel__header"},le={class:"import-panel__title"},oe=["aria-label","title"],ne={class:"import-panel__content nice-scrollbar"},re={key:3,class:"import-mapping-modal__ledger","data-testid":"import-preflight-ledger"},pe={class:"import-mapping-modal__ledger-head"},de={class:"import-sheet__eyebrow"},ue={class:"modal-card-foot import-mapping-modal__foot"},ce={class:"import-mapping-modal__readiness"},me={key:0,class:"tag is-rounded is-small is-danger"},he={class:"buttons import-mapping-modal__actions"};function ge(e,t,s,ge,ye,fe){const ve=(0,i.g2)("b-skeleton"),_e=(0,i.g2)("font-awesome-icon"),be=(0,i.g2)("b-button"),ke=(0,i.g2)("b-message"),we=(0,i.g2)("ImportPreflightStrip"),Ce=(0,i.g2)("ImportColumnPanel"),Ie=(0,i.g2)("ImportLedgerTable"),Ee=(0,i.g2)("b-radio-button"),Fe=(0,i.g2)("b-field"),Le=(0,i.g2)("b-modal");return(0,i.uX)(),(0,i.Wv)(Le,{"model-value":s.active,"has-modal-card":"","trap-focus":"","append-to-body":"","full-screen":"","can-cancel":["escape","x"],"custom-class":"import-mapping-modal-wrapper","onUpdate:modelValue":fe.onModalToggle},{default:(0,i.k6)(()=>[(0,i.Lk)("div",o,[(0,i.Lk)("header",n,[(0,i.Lk)("div",r,[(0,i.Lk)("p",p,(0,a.v_)(e.$t("Map columns")),1),(0,i.Lk)("p",d,(0,a.v_)(e.$t(fe.typeLabel)),1)]),ye.preview?((0,i.uX)(),(0,i.CE)("span",{key:0,class:(0,a.C4)(["import-mapping-modal__save-state",{"has-text-danger":!!ye.saveError}])},[ye.isSaving?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.eW)((0,a.v_)(e.$t("Saving…")),1)],64)):ye.saveError?((0,i.uX)(),(0,i.CE)(i.FK,{key:1},[(0,i.eW)((0,a.v_)(ye.saveError),1)],64)):ye.hasSavedOnce?((0,i.uX)(),(0,i.CE)(i.FK,{key:2},[(0,i.eW)((0,a.v_)(e.$t("Draft saved")),1)],64)):(0,i.Q3)("",!0)],2)):(0,i.Q3)("",!0),(0,i.Lk)("button",{type:"button",class:"delete","aria-label":e.$t("Close"),onClick:t[0]||(t[0]=(...e)=>fe.close&&fe.close(...e))},null,8,u)]),(0,i.Lk)("section",c,[ye.isLoading?((0,i.uX)(),(0,i.CE)("div",m,[(0,i.Lk)("div",h,[(0,i.Lk)("div",g,[(0,i.bF)(ve,{width:"180px",height:"11px",animated:""}),(0,i.bF)(ve,{width:"100%",height:"6px",animated:""})]),(0,i.bF)(ve,{width:"140px",height:"11px",animated:""})]),(0,i.Lk)("div",y,[(0,i.Lk)("table",f,[(0,i.Lk)("thead",null,[(0,i.Lk)("tr",null,[t[10]||(t[10]=(0,i.Lk)("th",{class:"import-sheet__gutter import-sheet__gutter--head"},null,-1)),((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(6,e=>(0,i.Lk)("th",{key:`import-sheet-skeleton-head-${e}`,class:"import-sheet__head"},[(0,i.Lk)("div",v,[(0,i.bF)(ve,{width:e%2?"58%":"44%",height:"14px",animated:""},null,8,["width"]),(0,i.bF)(ve,{width:e%3?"40%":"52%",height:"12px",animated:""},null,8,["width"]),(0,i.bF)(ve,{width:"88px",height:"22px",rounded:"",animated:""})])])),64))])]),(0,i.Lk)("tbody",null,[((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(10,e=>(0,i.Lk)("tr",{key:`import-sheet-skeleton-row-${e}`},[(0,i.Lk)("th",_,[(0,i.bF)(ve,{width:"14px",height:"12px",animated:""})]),((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(6,t=>(0,i.Lk)("td",{key:`import-sheet-skeleton-${e}-${t}`,class:"import-sheet__cell"},[(0,i.bF)(ve,{width:(7*e+13*t)%40+35+"%",height:"13px",animated:""},null,8,["width"])])),64))])),64))])])])])):ye.loadError?((0,i.uX)(),(0,i.CE)("div",b,[(0,i.bF)(_e,{icon:"fa-light fa-triangle-exclamation",class:"list-empty-state-icon"}),(0,i.Lk)("p",k,(0,a.v_)(ye.loadError),1),(0,i.bF)(be,{class:"is-rounded",type:"is-light",onClick:fe.loadPreview},{default:(0,i.k6)(()=>
1[(0,i.eW)((0,a.v_)(e.$t("Try again")),1)]),_:1},8,["onClick"])])):ye.preview?((0,i.uX)(),(0,i.CE)("div",w,[(0,i.Lk)("div",C,[(0,i.Lk)("div",I,[(0,i.Lk)("p",E,(0,a.v_)(e.$t("{mapped} of {total} columns mapped",{mapped:fe.mappedCount,total:ye.preview.headers.length})),1),(0,i.Lk)("div",F,[(0,i.Lk)("div",{class:"import-sheet__bar-fill",style:(0,a.Tr)({width:fe.mappedWidth})},null,4)])]),(0,i.Lk)("p",L,[s.fileName?((0,i.uX)(),(0,i.CE)("span",$,(0,a.v_)(s.fileName),1)):(0,i.Q3)("",!0),s.fileName?((0,i.uX)(),(0,i.CE)("span",x," · ")):(0,i.Q3)("",!0),(0,i.Lk)("span",null,(0,a.v_)(e.$t("{rows} rows sampled",{rows:ye.preview.sampledRowCount})),1)])]),ye.preview.raggedRowCount?((0,i.uX)(),(0,i.CE)("p",R,(0,a.v_)(e.$t("{count} sampled rows have more columns than the header row. A value containing the column separator is not quoted, so everything after it shifts one column across. Re-save the file as CSV UTF-8, or separate values inside a cell with a semicolon.",{count:ye.preview.raggedRowCount})),1)):(0,i.Q3)("",!0),ye.previousMapping?((0,i.uX)(),(0,i.Wv)(ke,{key:1,class:"import-mapping-modal__previous",type:"is-info",closable:!1,"data-testid":"import-previous-mapping"},{default:(0,i.k6)(()=>[(0,i.Lk)("div",S,[(0,i.Lk)("span",null,(0,a.v_)(e.$t("Apply your previous mapping from {date}?",{date:fe.previousMappingDate})),1),(0,i.Lk)("div",X,[(0,i.bF)(be,{class:"is-rounded",type:"is-info",size:"is-small","data-testid":"import-apply-previous-mapping",onClick:fe.applyPreviousMapping},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Apply")),1)]),_:1},8,["onClick"]),(0,i.bF)(be,{class:"is-rounded is-nobg",size:"is-small","data-testid":"import-dismiss-previous-mapping",onClick:t[1]||(t[1]=e=>ye.previousMapping=null)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Dismiss")),1)]),_:1})])])]),_:1})):(0,i.Q3)("",!0),(0,i.bF)(we,{preflight:ye.preflight,"is-queued":fe.isQueued,"mapping-revision":ye.mappingRevision,"validation-errors":ye.validationErrors,total:ye.totalRows,progress:ye.processedRows,"active-filter":ye.ledgerFilter,"import-type":s.importType,onFilter:fe.setLedgerFilter},null,8,["preflight","is-queued","mapping-revision","validation-errors","total","progress","active-filter","import-type","onFilter"]),ye.preview.matchable&&fe.matchTiles.length?((0,i.uX)(),(0,i.CE)("div",{key:2,class:(0,a.C4)(["import-matches",{"is-stale":ye.isMatching}]),"data-testid":"import-matches"},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(fe.matchTiles,s=>((0,i.uX)(),(0,i.CE)("div",{key:s.key,class:"import-matches__tile"}
1,[(0,i.Lk)("p",M,(0,a.v_)(e.$t(s.label)),1),(0,i.Lk)("p",T,[(0,i.Lk)("span",P,(0,a.v_)(e.$t("{count} found",{count:s.found})),1),t[11]||(t[11]=(0,i.Lk)("span",{class:"import-sheet__sep"},"·",-1)),(0,i.Lk)("span",{class:(0,a.C4)(["import-matches__count",{"is-new":s.create>0}])},(0,a.v_)(e.$t(s.createsLabel,{count:s.create})),3),t[12]||(t[12]=(0,i.Lk)("span",{class:"import-sheet__sep"},"·",-1)),(0,i.Lk)("span",{class:(0,a.C4)(["import-matches__count",{"is-unmatched":s.unmatched>0}])},(0,a.v_)(e.$t("{count} unmatched",{count:s.unmatched})),3)])]))),128))],2)):(0,i.Q3)("",!0),(0,i.Lk)("div",A,[(0,i.Lk)("div",D,[(0,i.Lk)("div",O,[(0,i.Lk)("table",U,[(0,i.Lk)("thead",null,[(0,i.Lk)("tr",null,[t[13]||(t[13]=(0,i.Lk)("th",{class:"import-sheet__gutter import-sheet__gutter--head"},null,-1)),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ye.preview.headers,t=>((0,i.uX)(),(0,i.CE)("th",{key:t.key,class:(0,a.C4)(["import-sheet__head",{"is-selected":t.key===ye.selectedKey}])},[(0,i.Lk)("button",{type:"button",class:"import-sheet__head-btn",title:t.raw,"aria-pressed":t.key===ye.selectedKey,"data-column":t.key,onClick:e=>fe.selectColumn(t.key)},[(0,i.Lk)("span",K,(0,a.v_)(t.raw),1),(0,i.Lk)("span",q,(0,a.v_)(fe.destinationSummary(t.key)),1),(0,i.Lk)("span",Q,[(0,i.Lk)("span",{class:(0,a.C4)(["tag is-rounded is-small",fe.statusTag(t.key).type])},(0,a.v_)(e.$t(fe.statusTag(t.key).label)),3),ye.suggested[t.key]?((0,i.uX)(),(0,i.CE)("span",V,(0,a.v_)(e.$t("Suggested")),1)):(0,i.Q3)("",!0)])],8,W)],2))),128))])]),(0,i.Lk)("tbody",null,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(fe.visibleRows,(t,s)=>((0,i.uX)(),(0,i.CE)("tr",{key:s},[(0,i.Lk)("th",N,(0,a.v_)(s+1),1),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ye.preview.headers,l=>((0,i.uX)(),(0,i.CE)("td",{key:l.key,class:(0,a.C4)(["import-sheet__cell",{"is-selected":l.key===ye.selectedKey,"is-skipped":fe.isSkipped(l.key),"is-unmatched":"unmatched"===fe.matchClass(l.key,s),"is-new-match":"new"===fe.matchClass(l.key,s)}])},["new"===fe.matchClass(l.key,s)?((0,i.uX)(),(0,i.CE)("span",j,(0,a.v_)(e.$t("New")),1)):"unmatched"===fe.matchClass(l.key,s)?((0,i.uX)(),(0,i.CE)("span",{key:1,class:"tag is-rounded is-small is-warning is-passive import-sheet__match-tag",title:e.$t("No match in the sample: this row will fail unless the reference is completed")},(0,a.v_)(e.$t("Unmatched")),9,z)):(0,i.Q3)("",!0),fe.cellParts(l.key,t[l.key])?((0,i.uX)(),(0,i.CE)(i.FK,{key:2},["checkboxes"===ye.columns[l.key].fieldType?((0,i.uX)(),(0,i.CE)("span",B,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(fe.cellParts(l.key,t[l.key]),(e,t)=>((0,i.uX)(),(0,i.CE)("span",{key:t,class:"tag is-default is-rounded is-small",title:e.raw},(0,a.v_)(e.label),9,G))),128))])):((0,i.uX)(),(0,i.CE)("span",H,[(0,i.Lk)("span",{class:"import-sheet__value",title:fe.cellParts(l.key,t[l.key])[0].label},(0,a.v_)(fe.cellParts(l.key,t[l.key])[0].label),9,Y),fe.cellParts(l.key,t[l.key])[0].label!==fe.cellParts(l.key,t[l.key])[0].raw?((0,i.uX)(),(0,i.CE)("span",J,(0,a.v_)(fe.cellParts(l.key,t[l.key])[0].raw),1)):(0,i.Q3)("",!0)]))],64)):fe.isEmptyCell(t[l.key])?((0,i.uX)(),(0,i.CE)("span",Z," — ")):((0,i.uX)(),(0,i.CE)("span",{key:4,class:"import-sheet__value",title:String(t[l.key])},(0,a.v_)(t[l.key]),9,ee))],2))),128))]))),128))])])])]),fe.hiddenRowCount>0?((0,i.uX)(),(0,i.CE)("div",te,[(0,i.bF)(be,{size:"is-small",class:"is-rounded is-nobg",onClick:t[2]||(t[2]=e=>ye.showAllRows=!0)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Show {count} more",{count:fe.hiddenRowCount})),1)]),_:1})])):(0,i.Q3)("",!0),(0,i.bF)(l.eB,{name:"import-panel-slide"},{default:(0,i.k6)(()=>[fe.selectedHeader&&ye.columns[ye.selectedKey]?((0,i.uX)(),(0,i.CE)("div",{key:0,class:"import-panel",role:"dialog","aria-modal":"false","aria-label":fe.selectedHeader.raw,style:(0,a.Tr)({"--import-panel-width":ye.panelWidth+"px"})},[(0,i.Lk)("div",{class:"import-panel__resizer",role:"separator","aria-orientation":"vertical","aria-label":e.$t("Resize panel"),"aria-valuenow":ye.panelWidth,"aria-valuemin":ye.PANEL_MIN_WIDTH,tabindex:"0",onPointerdown:t[3]||(t[3]=(...e)=>fe.startPanelResize&&fe.startPanelResize(...e)),onKeydown:[t[4]||(t[4]=(0,l.jR)((0,l.D$)(e=>fe.nudgePanel(-24),["prevent"]),["left"])),t[5]||(t[5]=(0,l.jR)((0,l.D$)(e=>fe.nudgePanel(24),["prevent"]),["right"]))]},null,40,ie),(0,i.Lk)("div",ae,[(0,i.Lk)("p",le,(0,a.v_)(fe.selectedHeader.raw),1),(0,i.Lk)("button",{type:"button",class:"import-panel__close","aria-label":e.$t("Close"),title:e.$t("Close"),onClick:t[6]||(t[6]=e=>ye.selectedKey=null)},[(0,i.bF)(_e,{icon:"fa-light fa-xmark"})],8,oe)]),(0,i.Lk)("div",ne,[((0,i.uX)(),(0,i.Wv)(Ce,{key:ye.selectedKey,header:fe.selectedHeader,entry:ye.columns[ye.selectedKey],stats:ye.preview.columns[ye.selectedKey]||{},"sample-values":fe.sampleValues(ye.selectedKey),"sampled-row-count":ye.preview.sampledRowCount,"system-fields":ye.preview.systemFields,"import-type":s.importType,"field-groups":ye.preview.fieldGroups||[],"used-system-fields":fe.usedSystemFieldsExcept(ye.selectedKey),"custom-fields":ye.preview.customFields,suggested:!!ye.suggested[ye.selectedKey],"field-descriptions":ye.preview.fieldDescriptions||{},"date-format":ye.options.dateFormats[ye.selectedKey]||null,onUpdate:t[7]||(t[7]=e=>fe.updateColumn(ye.selectedKey,e)),onDateFormat:t[8]||(t[8]=e=>fe.setDateFormat(ye.selectedKey,e))},null,8,["header","entry","stats","sample-values","sampled-row-count","system-fields","import-type","field-groups","used-system-fields","custom-fields","suggested","field-descriptions","date-format"]))])],12,se)):(0,i.Q3)("",!0)]),_:1})]),ye.ledgerFilter?((0,i.uX)(),(0,i.CE)("div",re,[(0,i.Lk)("div",pe,[(0,i.Lk)("p",de,(0,a.v_)(e.$t(fe.ledgerTitle)),1),(0,i.bF)(be,{class:"is-rounded",type:"is-text",size:"is-small",onClick:t[9]||(t[9]=e=>fe.setLedgerFilter(null))},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Close")),1)]),_:1})]),(0,i.bF)(Ie,{"import-id":s.importId,phase:"preflight",filter:ye.ledgerFilter,headers:ye.preview.headers},null,8,["import-id","filter","headers"])])):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0)]),(0,i.Lk)("footer",ue,[(0,i.Lk)("div",ce,[ye.preview?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(fe.requirementChips,t=>((0,i.uX)(),(0,i.CE)("span",{key:t.key,class:(0,a.C4)(["tag is-rounded is-small",t.satisfied?"is-success":"is-default"])},[(0,i.bF)(_e,{icon:t.satisfied?"fa-light fa-check":"fa-light fa-circle-exclamation",class:"import-mapping-modal__chip-icon"},null,8,["icon"]),(0,i.eW)(" "+(0,a.v_)(t.satisfied?t.label:e.$t("{field} needed",{field:t.label})),1)],2))),128)),fe.duplicateList.length?((0,i.uX)(),(0,i.CE)("span",me,[(0,i.bF)(_e,{icon:"fa-light fa-triangle-exclamation",class:"import-mapping-modal__chip-icon"}),(0,i.eW)(" "+(0,a.v_)(e.$t("Each system field can be filled by one column only"))+": "+(0,a.v_)(fe.duplicateList.join(", ")),1)])):(0,i.Q3)("",!0)],64)):(0,i.Q3)("",!0)]),fe.isPersonType?((0,i.uX)(),(0,i.Wv)(Fe,{key:0,class:"import-mapping-modal__existing",label:e.$t("Members that already exist"),"data-testid":"import-existing-option"},{default:(0,i.k6)(()=>[(0,i.bF)(Ee,{"model-value":ye.options.existing,"native-value":"skip",size:"is-small","onUpdate:modelValue":fe.setExistingOption},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Skip them")),1)]),_:1},8,["model-value","onUpdate:modelValue"]),(0,i.bF)(Ee,{"model-value":ye.options.existing,"native-value":"update",size:"is-small","onUpdate:modelValue":fe.setExistingOption},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Update the mapped fields")),1)]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["label"])):(0,i.Q3)("",!0),(0,i.Lk)("div",he,[(0,i.bF)(be,{class:"is-rounded",type:"is-danger",outlined:"",disabled:ye.isStarting||!ye.preview,onClick:fe.confirmDiscard},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Discard")),1)]),_:1},8,["disabled","onClick"]),(0,i.bF)(be,{class:"is-rounded",type:"is-primary",disabled:!fe.canStart,loading:ye.isStarting,onClick:fe.start},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Start import")),1)]),_:1},8,["disabled","loading","onClick"])])])])]),_:1},8,["model-value","onUpdate:modelValue"])}s(44114),s(18111),s(81148),s(22489),s(20116),s(7588),s(61701);var ye=s(38221),fe=s.n(ye);
1const ve={class:"import-column-panel"},_e={class:"import-column-panel__head"},be={class:"import-column-panel__help"},ke={key:0,class:"tag is-rounded is-small is-info is-passive"},we={key:0,class:"tags import-column-panel__samples"},Ce={key:0,class:"tag is-rounded is-small is-default"},Ie=["aria-label"],Ee=["aria-pressed","onClick"],Fe={value:null,disabled:""},Le=["label"],$e=["value","disabled"],xe=["value","disabled"],Re={key:2,class:"is-size-7 has-text-grey import-column-panel__field-help","data-testid":"import-field-help"},Se={key:0,class:"import-column-panel__example"},Xe=["value"],Me={class:"import-column-panel__field-name"},Te={class:"import-column-panel__field-type"},Pe=["value"],Ae={key:6,class:"import-column-panel__help"},De=["aria-label"],Oe=["aria-pressed","onClick"],Ue={class:"import-column-panel__delimiter"},We={key:1,class:"import-column-panel__split"},Ke={class:"import-column-panel__eyebrow"},qe={key:2,class:"import-column-panel__help"};function Qe(e,t,s,l,o,n){const r=(0,i.g2)("font-awesome-icon"),p=(0,i.g2)("b-field"),d=(0,i.g2)("b-select"),u=(0,i.g2)("b-tooltip"),c=(0,i.g2)("b-autocomplete"),m=(0,i.g2)("b-input"),h=(0,i.g2)("ImportValueMapTable");return(0,i.uX)(),(0,i.CE)("div",ve,[(0,i.Lk)("div",_e,[(0,i.Lk)("p",be,(0,a.v_)(e.$t("{count} of {total} sample rows have a value",{count:s.stats.nonEmpty||0,total:s.sampledRowCount})),1),s.suggested?((0,i.uX)(),(0,i.CE)("span",ke,[(0,i.bF)(r,{icon:"fa-light fa-lightbulb",class:"import-column-panel__chip-icon"}),(0,i.eW)(" "+(0,a.v_)(e.$t("Suggested")),1)])):(0,i.Q3)("",!0)]),s.sampleValues.length?((0,i.uX)(),(0,i.CE)("div",we,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(s.sampleValues.slice(0,5),e=>((0,i.uX)(),(0,i.CE)("span",{key:e,class:"tag is-rounded is-small is-default"},(0,a.v_)(e),1))),128)),n.extraSampleCount>0?((0,i.uX)(),(0,i.CE)("span",Ce," +"+(0,a.v_)(n.extraSampleCount),1)):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0),(0,i.bF)(p,{label:e.$t("Destination")},{default:(0,i.k6)(()=>[(0,i.Lk)("div",{class:"orgo-segmented-toggle has-label import-column-panel__destinations",role:"group","aria-label":e.$t("Destination")},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.destinations,t=>((0,i.uX)(),(0,i.CE)("button",{key:t.value,type:"button",class:(0,a.C4)(["orgo-segmented-option",{"is-active":n.destination===t.value}]),"aria-pressed":n.destination===t.value,onClick:e=>n.setDestination(t.value)},[(0,i.bF)(r,{icon:t.icon},null,8,["icon"]),(0,i.Lk)("span",null,(0,a.v_)(e.$t(t.label)),1)],10,Ee))),128))],8,Ie)]),_:1},8,["label"]),"system"===n.destination?((0,i.uX)(),(0,i.Wv)(p,{key:1,label:e.$t("System field"),type:n.isDuplicateSystem?"is-danger":"",message:n.isDuplicateSystem?e.$t("Another column already fills this field"):""},{default:(0,i.k6)(()=>[(0,i.bF)(d,{"model-value":s.entry.field,expanded:"","onUpdate:modelValue":n.setSystemField},{default:(0,i.k6)(()=>[(0,i.Lk)("option",Fe,(0,a.v_)(e.$t("Choose a field")),1),s.fieldGroups.length?((0,i.uX)(!0),(0,i.CE)(i.FK,{key:0},(0,i.pI)(s.fieldGroups,t=>((0,i.uX)(),(0,i.CE)("optgroup",{key:t.key,label:e.$t(t.label)},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(t.fields,t=>((0,i.uX)(),(0,i.CE)("option",{key:t,value:t,disabled:s.usedSystemFields.includes(t)&&t!==s.entry.field},[(0,i.eW)((0,a.v_)(e.$t(n.systemFieldLabel(t,s.importType)))+" ",1),s.usedSystemFields.includes(t)&&t!==s.entry.field?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.eW)("("+(0,a.v_)(e.$t("already used"))+")",1)],64)):(0,i.Q3)("",!0)],8,$e))),128))],8,Le))),128)):((0,i.uX)(!0),(0,i.CE)(i.FK,{key:1},(0,i.pI)(s.systemFields,t=>((0,i.uX)(),(0,i.CE)("option",{key:t,value:t,disabled:s.usedSystemFields.includes(t)&&t!==s.entry.field},[(0,i.eW)((0,a.v_)(e.$t(n.systemFieldLabel(t,s.importType)))+" ",1),s.usedSystemFields.includes(t)&&t!==s.entry.field?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.eW)("("+(0,a.v_)(e.$t("already used"))+")",1)],64)):(0,i.Q3)("",!0)],8,xe))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["label","type","message"])):(0,i.Q3)("",!0),"system"===n.destination&&n.fieldHelp?((0,i.uX)(),(0,i.CE)("p",Re,[(0,i.eW)((0,a.v_)(n.fieldHelp.description)+" ",1),n.fieldHelp.example?((0,i.uX)(),(0,i.CE)("span",Se,(0,a.v_)(e.$t("Example: {example}",{example:n.fieldHelp.example})),1)):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0),n.isDateField?((0,i.uX)(),(0,i.Wv)(p,{key:3,label:e.$t("Date format"),type:n.isAmbiguousDate?"is-warning":"",message:n.isAmbiguousDate?e.$t("Ambiguous, please choose"):"","data-testid":"import-date-format"},{default:(0,i.k6)(()=>[(0,i.bF)(d,{"model-value":n.selectedDateFormat,expanded:"","onUpdate:modelValue":n.setDateFormat},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.dateFormats,t=>((0,i.uX)(),(0,i.CE)("option",{key:t.value,value:t.value},(0,a.v_)(t.sample)+" ("+(0,a.v_)(e.$t(t.order))+") ",9,Xe))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["label","type","message"])):(0,i.Q3)("",!0),"existing"===n.destination?((0,i.uX)(),(0,i.Wv)(p,{key:4,label:e.$t("Existing custom field"),message:n.selectedCustomField?e.$t("Type")+": "+e.$t(o.fieldTypeLabels[n.selectedCustomField.fieldType]||n.selectedCustomField.fieldType):""},{default:(0,i.k6)(()=>[(0,i.bF)(c,{modelValue:o.existingSearch,"onUpdate:modelValue":t[0]||(t[0]=e=>o.existingSearch=e),data:n.filteredCustomFields,field:"name","open-on-focus":"","keep-first":"",clearable:"",placeholder:e.$t("Search your profile fields"),onSelect:n.setExistingField},{default:(0,i.k6)(t=>
1[(0,i.Lk)("div",{class:(0,a.C4)(["import-column-panel__field-option",{"is-disabled":t.option.isEncrypted}])},[(0,i.Lk)("span",Me,(0,a.v_)(t.option.name),1),(0,i.Lk)("span",Te,(0,a.v_)(e.$t(o.fieldTypeLabels[t.option.fieldType]||t.option.fieldType)),1),t.option.isEncrypted?((0,i.uX)(),(0,i.Wv)(u,{key:0,label:e.$t("Encrypted fields cannot be filled by an import"),position:"is-left"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"fa-light fa-lock"})]),_:1},8,["label"])):(0,i.Q3)("",!0)],2)]),empty:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("No matching field")),1)]),_:1},8,["modelValue","data","placeholder","onSelect"])]),_:1},8,["label","message"])):(0,i.Q3)("",!0),"new"===n.destination?((0,i.uX)(),(0,i.CE)(i.FK,{key:5},[(0,i.bF)(p,{label:e.$t("Field name")},{default:(0,i.k6)(()=>[(0,i.bF)(m,{"model-value":s.entry.name,"onUpdate:modelValue":n.setName},null,8,["model-value","onUpdate:modelValue"])]),_:1},8,["label"]),(0,i.bF)(p,{label:e.$t("Field type")},{default:(0,i.k6)(()=>[(0,i.bF)(d,{"model-value":s.entry.fieldType,expanded:"","onUpdate:modelValue":n.setFieldType},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.fieldTypes,t=>((0,i.uX)(),(0,i.CE)("option",{key:t,value:t},(0,a.v_)(e.$t(o.fieldTypeLabels[t])),9,Pe))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["label"])],64)):(0,i.Q3)("",!0),"skip"===n.destination?((0,i.uX)(),(0,i.CE)("p",Ae,(0,a.v_)(e.$t("This column is left out of the import.")),1)):(0,i.Q3)("",!0),n.isChoice?((0,i.uX)(),(0,i.CE)(i.FK,{key:7},["checkboxes"===s.entry.fieldType?((0,i.uX)(),(0,i.Wv)(p,{key:0,label:e.$t("Values in a cell are separated by")},{default:(0,i.k6)(()=>[(0,i.Lk)("div",{class:"orgo-segmented-toggle has-label",role:"group","aria-label":e.$t("Values in a cell are separated by")},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.delimiters,t=>((0,i.uX)(),(0,i.CE)("button",{key:t.value,type:"button",class:(0,a.C4)(["orgo-segmented-option",{"is-active":(s.entry.delimiter||",")===t.value}]),"aria-pressed":(s.entry.delimiter||",")===t.value,onClick:e=>n.setDelimiter(t.value)},[(0,i.Lk)("span",Ue,(0,a.v_)(t.value),1),(0,i.Lk)("span",null,(0,a.v_)(e.$t(t.label)),1)],10,Oe))),128))],8,De)]),_:1},8,["label"])):(0,i.Q3)("",!0),"checkboxes"===s.entry.fieldType&&n.splitPreview.length?((0,i.uX)(),(0,i.CE)("div",We,[(0,i.Lk)("p",Ke,(0,a.v_)(e.$t("Split preview")),1),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.splitPreview,(e,t)=>((0,i.uX)(),(0,i.CE)("div",{key:t,class:"tags import-column-panel__split-row"},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(e,e=>((0,i.uX)(),(0,i.CE)("span",{key:e,class:"tag is-rounded is-small is-default"},(0,a.v_)(e),1))),128))]))),128))])):(0,i.Q3)("",!0),(0,i.bF)(p,{label:e.$t("Match values to options")},{default:(0,i.k6)(()=>[((0,i.uX)(),(0,i.Wv)(h,{key:n.tableKey,mode:s.entry.fieldId?"existing":"new",values:n.choiceValues,options:n.choiceOptions,"value-map":s.entry.valueMap||{},onUpdate:n.setValueMap},null,8,["mode","values","options","value-map","onUpdate"]))]),_:1},8,["label"]),s.stats.distinctTruncated?((0,i.uX)(),(0,i.CE)("p",qe,(0,a.v_)(e.$t("Only the first 100 distinct values are shown. Values the sample missed are added as new options during the import.")),1)):(0,i.Q3)("",!0)],64)):(0,i.Q3)("",!0)])}const Ve={class:"import-value-map"},Ne={key:0,class:"list-empty-state import-value-map__empty"},je={class:"list-empty-state-message"},ze={key:1,class:"orgo-table-wrap"},Be={class:"import-value-map__cell"},Ge=["title"],He={class:"tag is-rounded is-small is-default"},Ye=["value"],Je=["value"],Ze={key:1,class:"import-value-map__cell"},et=["value"],tt=["value"];function st(e,t,s,l,o,n){const r=(0,i.g2)("font-awesome-icon"),p=(0,i.g2)("b-table-column"),d=(0,i.g2)("b-select"),u=(0,i.g2)("b-input"),c=(0,i.g2)("b-table");return(0,i.uX)(),(0,i.CE)("div",Ve,[n.rows.length?((0,i.uX)(),(0,i.CE)("div",ze,[(0,i.bF)(c,{data:n.rows,"mobile-cards":!1,narrowed:"",hoverable:""},{default:(0,i.k6)(()=>[(0,i.bF)(p,{label:e.$t("Value in file"),field:"value"},{default:(0,i.k6)(e=>[(0,i.Lk)("span",Be,[(0,i.Lk)("span",{class:"import-value-map__value",title:e.row.value},(0,a.v_)(e.row.value),9,Ge),(0,i.Lk)("span",He,(0,a.v_)(e.row.count),1)])]),_:1},8,["label"]),(0,i.bF)(p,{label:"new"===s.mode?e.$t("Option label"):e.$t("Option"),field:"target"},{default:(0,i.k6)(t=>["new"===s.mode?((0,i.uX)(),(0,i.CE)("div",{key:0,class:(0,a.C4)(["import-value-map__cell is-stacked",{"is-merged":!n.ownsOption(t.row)}])},[(0,i.bF)(d,{"model-value":n.targetFor(t.row),size:"is-small",expanded:"","onUpdate:modelValue":e=>n.setTarget(t.row,e)},{default:(0,i.k6)(()=>[(0,i.Lk)("option",{value:n.ownKey(t.row)||o.OWN},(0,a.v_)(e.$t("Own option")),9,Ye),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.mergeCandidates(t.row),t=>((0,i.uX)(),(0,i.CE)("option",{key:t.key,value:t.key},(0,a.v_)(e.$t("Merge into"))+": "+(0,a.v_)(t.label),9,Je))),128))]),_:2},1032,["model-value","onUpdate:modelValue"]),n.ownsOption(t.row)?((0,i.uX)(),(0,i.Wv)(u,{key:0,"model-value":o.localOptions[n.ownKey(t.row)],size:"is-small",expanded:"","onUpdate:modelValue":e=>n.setLabel(t.row,e)},null,8,["model-value","onUpdate:modelValue"])):(0,i.Q3)("",!0)],2)):((0,i.uX)(),(0,i.CE)("div",Ze,[(0,i.bF)(d,{"model-value":n.targetFor(t.row),size:"is-small",expanded:"","onUpdate:modelValue":e=>n.setTarget(t.row,e)},{default:(0,i.k6)(()=>[(0,i.Lk)("option",{value:o.CREATE_NEW},(0,a.v_)(e.$t("Create new option")),9,et),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.existingOptionList,e=>((0,i.uX)(),(0,i.CE)("option",{key:e.key,value:e.key},(0,a.v_)(e.label),9,tt))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]))]),_:1},8,["label"])]),_:1},8,["data"])])):((0,i.uX)(),(0,i.CE)("div",Ne,[(0,i.bF)(r,{icon:"fa-light fa-list-check",class:"list-empty-state-icon"}),(0,i.Lk)("p",je,(0,a.v_)(e.$t("No values found in the sample rows")),1
1)]))])}s(18237),s(13579),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);const it=["radio","dropdown","checkboxes"],at=["input","textarea","number","date","boolean","dropdown","radio","checkboxes"],lt=[",",";","|"],ot=[{value:"Y-m-d",sample:"2026-03-09",order:"year, month, day"},{value:"d/m/Y",sample:"09/03/2026",order:"day, month, year"},{value:"m/d/Y",sample:"03/09/2026",order:"month, day, year"},{value:"d.m.Y",sample:"09.03.2026",order:"day, month, year"},{value:"d-m-Y",sample:"09-03-2026",order:"day, month, year"}],nt=["date","datetime"];function rt(e){return String(e??"").trim().replace(/\s+/g," ").toLowerCase()}function pt(e){return it.includes(e)}function dt(e,t,s){const i=[];let a="",l=!1,o=-1;for(let n=0;n<e.length;n++){const r=e[n];l?'"'===r?'"'===e[n+1]?(a+='"',n++):l=!1:a+=r:'"'!==r||""!==a.trim()||n===s?r!==t?a+=r:(i.push(a),a=""):(l=!0,o=n,a="")}return l?dt(e,t,o):(i.push(a),i)}function ut(e,t){if(null===e||void 0===e)return[];const s=String(e);if(!t){const e=s.trim();return""===e?[]:[e]}return dt(s,t,-1).map(e=>e.trim()).filter(e=>""!==e)}function ct(e,t,s){const i=e||[];if("checkboxes"!==t)return i.map(e=>({value:String(e.value),count:e.count}));const a=new Map;return i.forEach(e=>{ut(e.value,s).forEach(t=>{const s=rt(t),i=a.get(s);i?i.count+=e.count:a.set(s,{value:t,count:e.count})})}),Array.from(a.values()).sort((e,t)=>t.count-e.count)}function mt(e){const t={},s={};return e.forEach((e,i)=>{const a=String(i+1);t[a]=e.value,s[rt(e.value)]=a}),{options:t,valueMap:s}}function ht(e,t){const s={};Object.entries(t||{}).forEach(([e,t])=>{s[rt(t)]=String(e)});const i={};return e.forEach(e=>{const t=rt(e.value);void 0!==s[t]&&(i[t]=s[t])}),i}function gt(e){let t=",",s=0;return lt.forEach(i=>{const a=(e||[]).reduce((e,t)=>e+(String(t.value).includes(i)?t.count:0),0);a>s&&(t=i,s=a)}),t}function yt(e,t,s){const i=t?.suggestion||{target:"custom_field",fieldId:null,fieldType:"input",delimiter:null};if("system"===i.target)return{target:"system",field:i.field};if("skip"===i.target)return{target:"skip"};const a=i.fieldType||"input";if(i.fieldId){const e=s[i.fieldId],l=e?e.fieldType:a,o={target:"custom_field",fieldId:i.fieldId,fieldType:l,valueMap:{},delimiter:"checkboxes"===l?i.delimiter||gt(t?.distinct):null};if(pt(o.fieldType)){const s=ct(t?.distinct,o.fieldType,o.delimiter);o.valueMap=ht(s,e?.fieldOptions?.options)}return o}const l="checkboxes"===a?i.delimiter||gt(t?.distinct):null,o={target:"custom_field",fieldId:null,name:e.raw,fieldType:a,options:{},valueMap:{},delimiter:l};if(pt(a)){const e=ct(t?.distinct,a,l);Object.assign(o,mt(e))}return o}function ft(e){if(e.mapping&&"object"===typeof e.mapping&&Object.keys(e.mapping).length>0)return{columns:JSON.parse(JSON.stringify(e.mapping)),suggested:{}};const t={};(e.customFields||[]).forEach(e=>{t[e.id]=e});const s={},i={};return(e.headers||[]).forEach(a=>{s[a.key]=yt(a,e.columns?.[a.key],t),i[a.key]=!0}),{columns:s,suggested:i}}function vt(e){const t={};return Object.entries(e||{}).forEach(([e,s])=>{"system"===s?.target&&s.field&&(t[s.field]=t[s.field]||[],t[s.field].push(e))}),Object.fromEntries(Object.entries(t).filter(([,e])=>e.length>1))}function _t(e){const t=new Set;return Object.values(e||{}).forEach(e=>{"system"===e?.target&&e.field&&t.add(e.field)}),t}function bt(e,t){const s=[];let i=!1;return(t||[]).forEach(t=>{const a=t.filter(t=>!e.has(t));0===a.length?i=!0:s.push(a)}),{ready:i,missingGroups:i?[]:s}}function kt(e,t,s){const i=_t(e),a=s&&"object"===typeof s&&!Array.isArray(s)?s:{},l=Object.keys(a);if(l.length>0){const e={};let t=!0;return l.forEach(s=>{const l=bt(i,a[s]);l.ready||(t=!1,e[s]=l.missingGroups)}),{ready:t,missingGroups:Object.values(e).flat(),missingByGroup:e}}const o=t||[];if(0===o.length)return{ready:!0,missingGroups:[],missingByGroup:{}};const n=bt(i,o);return{ready:n.ready,missingGroups:n.missingGroups,missingByGroup:n.ready?{}:{default:n.missingGroups}}}function wt(e,t){return t&&Array.isArray(e)&&e.find(e=>Array.isArray(e.fields)&&e.fields.includes(t))||null}function Ct(e,t,s,i,a){const l=s?.[i];if(!e||!l||"system"!==l.target||!l.field)return null;const o=wt(t,l.field),n=o?e[o.key]:null;if(!n||!Array.isArray(n.rows))return null;const r=n.rows.find(e=>e.index===a);return r?r.status:null}const It={email:"Email",first_name:"First name",last_name:"Last name",name:"Name",phone:"Phone",phone_number:"Phone number",address:"Address",postal_code:"Postal code",town:"Town",town_residence:"Town of residence",country:"Country",website:"Website",gender:"Gender",birth_date:"Birth date",status:"Status",tags:"Tags",member_id:"Member ID",company_name:"Company name",company_identifier:"C
1ompany identifier",company_address:"Company address",company_reg_no:"Company registration number",company_position:"Company position",organisation:"Organisation",role:"Role",badge_type:"Badge type",badge_type_legacy_id:"Badge type legacy ID",badge_type_id:"Badge type legacy ID",badge_name:"Badge",badge_legacy_id:"Badge legacy ID",concluded_at:"Awarded on",points_at_award:"Points",comment_user:"Member comment",comment_master:"Reviewer comment",badge_user_legacy_id:"Award legacy ID",profession_headline:"Profession headline",profession_organisation:"Current organisation",profession_organisation_role:"Role at organisation",profession_organisation_website:"Organisation website",linkedin:"LinkedIn",twitter:"Twitter",instagram:"Instagram",is_full_member:"Full member",is_newsletter_subscribed:"Newsletter subscribed",date_created:"Date created",date_joined:"Date joined",date_joined_full_member:"Date joined as full member",local_center:"Chapter",local_center_legacy_id:"Chapter legacy ID",user_legacy_id:"Legacy ID",event_name:"Event name",event_datetime:"Event date",chapter:"Chapter",event_legacy_id:"Event legacy ID",attendee_email:"Attendee email",attendee_name:"Attendee name",attendee_organisation:"Attendee organisation",role_name:"Role name",role_legacy_id:"Role legacy ID",unit_name:"Unit name",unit_legacy_id:"Unit legacy ID",start_date:"Start date",end_date:"End date",is_admin:"Unit admin",short_name:"Short name",is_parent:"Is parent",parent:"Parent chapter",google_place_name:"Place name",google_latitude:"Latitude",google_longitude:"Longitude",contact_full_name:"Contact name",contact_email:"Contact email",contact_phone:"Contact phone",facebook_url:"Facebook URL",iban_eur:"IBAN",datetime_begin:"Begins",datetime_end:"Ends",event_type:"Event type",location_name:"Location",google_place_latitude:"Latitude",google_place_longitude:"Longitude",is_training:"Training",is_public:"Public",owner_user_legacy_id:"Owner legacy ID",description:"Description",timezone:"Timezone",type:"Type",month_period:"Months per period",has_subscription:"Subscription",has_one_time_payment:"One-time payment",is_archived:"Archived",product_legacy_id:"Product legacy ID",product_price_legacy_id:"Price tier legacy ID",previous_version_old_id:"Previous version legacy ID",price:"Price",is_default:"Default tier",is_subscription:"Subscription tier",is_lifetime:"Lifetime",is_restricted:"Restricted",valid_from:"Valid from",valid_to:"Valid to",is_user_type:"Member type",is_organizational:"Organisational role",is_local_center:"Chapter role",is_local_center_parent:"Parent chapter role",parent_unit:"Parent unit",parent_unit_legacy_id:"Parent unit legacy ID",legal_name:"Legal name",registration_number:"Registration number",vat_number:"VAT number",valid_fee_date:"Membership valid until",fee_tenant_product_price_id:"Fee price tier",company_legacy_id:"Company legacy ID",company_user_legacy_id:"Membership legacy ID",user_type_legacy_id:"Member type (name or legacy ID)",fee_tenant_product_price_legacy_id:"Fee price legacy ID",payer_email:"Payer email",payer_name:"Payer name",payer_organisation:"Payer organisation",payer_personal_number:"Payer personal number",product_name:"Product name",product_type:"Product type",price_name:"Price tier name",amount:"Amount",currency:"Currency",period_start:"Period start",period_end:"Period end",comment_by_user:"Comment",payment_legacy_id:"Payment legacy ID"},Et={user:{role:"Roles to assign"},"user-modify":{role:"Roles to assign"}};function Ft(e,t){if(!e)return"";const s=t&&Et[t];if(s&&s[e])return s[e];if(It[e])return It[e];const i=String(e).replace(/_/g," ").trim();return i.charAt(0).toUpperCase()+i.slice(1)}function Lt(e,t){return e&&"skip"!==e.target?"system"===e.target?!e.field||t[e.field]?"attention":"system":e.pendingExisting?"attention":e.fieldId?"existing":"new":"skipped"}function $t(e){const t={};return Object.entries(e||{}).forEach(([e,s])=>{if(s)if("system"===s.target)t[e]={target:"system",field:s.field};else if("skip"===s.target||s.pendingExisting)t[e]={target:"skip"};else{const i={target:"custom_field",fieldId:s.fieldId||null,fieldType:s.fieldType,valueMap:s.valueMap||{},delimiter:"checkboxes"===s.fieldType?s.delimiter||",":null};s.fieldId||(i.name=s.name,i.options=pt(s.fieldType)&&s.options||{}),t[e]=i}}),t}
1function xt(e,t,s){if(!e||"custom_field"!==e.target||!pt(e.fieldType))return null;const i="checkboxes"===e.fieldType?e.delimiter||",":null,a=ut(s,i||null);if(0===a.length)return null;const l={};Object.entries(t||{}).forEach(([e,t])=>{l[rt(t)]=String(e)});const o=e.valueMap||{};return a.map(e=>{const s=rt(e);let i=void 0!==o[s]&&null!==o[s]?String(o[s]):null;null!==i&&void 0!==t?.[i]||(i=void 0!==l[s]?l[s]:null);const a=null!==i&&void 0!==t?.[i]?String(t[i]):e;return{raw:e,label:a,resolved:null!==i}})}const Rt="__create__",St="__own__";var Xt={name:"ImportValueMapTable",props:{mode:{type:String,required:!0,validator:e=>["new","existing"].includes(e)},values:{type:Array,default:()=>[]},options:{type:Object,default:()=>({})},valueMap:{type:Object,default:()=>({})}},emits:["update"],data(){return{CREATE_NEW:Rt,OWN:St,localOptions:{...this.options||{}},localValueMap:{...this.valueMap||{}},owners:{}}},computed:{rows(){return(this.values||[]).map(e=>({...e,norm:rt(e.value)}))},existingOptionList(){return Object.entries(this.options||{}).map(([e,t])=>({key:String(e),label:t}))}},created(){this.reload()},methods:{reload(){this.localOptions={...this.options||{}},this.localValueMap={...this.valueMap||{}},this.owners="new"===this.mode?this.computeOwners():{}},computeOwners(){const e={},t={};return this.rows.forEach(s=>{e[s.norm]=null;const i=this.localValueMap[s.norm];void 0!==i&&null!==i&&void 0!==this.localOptions[i]&&(t[i]=t[i]||[],t[i].push(s))}),Object.entries(t).forEach(([t,s])=>{const i=rt(this.localOptions[t]),a=s.find(e=>e.norm===i)||s[0];e[a.norm]=String(t)}),e},ownKey(e){const t=this.owners[e.norm];return void 0===t?null:t},ownsOption(e){return"new"===this.mode&&this.targetFor(e)===this.ownKey(e)&&null!==this.ownKey(e)},targetFor(e){const t=this.localValueMap[e.norm];return void 0!==t&&null!==t?String(t):"new"===this.mode?this.ownKey(e):Rt},mergeCandidates(e){const t=this.ownKey(e);return Object.entries(this.localOptions).filter(([s])=>s!==t&&this.isOptionInUse(s,e)).map(([e,t])=>({key:e,label:t}))},isOptionInUse(e,t){return this.rows.some(s=>s.norm!==t.norm&&this.targetFor(s)===e)},setTarget(e,t){if("existing"===this.mode&&t===Rt)return delete this.localValueMap[e.norm],this.localValueMap={...this.localValueMap},void this.emitUpdate();if("new"===this.mode&&(t===this.ownKey(e)||t===St)){let t=this.ownKey(e);return null!==t&&void 0!==this.localOptions[t]||(t=this.nextKey(),this.localOptions={...this.localOptions,[t]:e.value},this.owners={...this.owners,[e.norm]:t}),this.localValueMap={...this.localValueMap,[e.norm]:t},void this.emitUpdate()}this.localValueMap={...this.localValueMap,[e.norm]:String(t)},this.emitUpdate()},setLabel(e,t){const s=this.ownKey(e);null!==s&&(this.localOptions={...this.localOptions,[s]:t},this.emitUpdate())},nextKey(){const e=Object.keys(this.localOptions).map(e=>Number(e)).filter(Number.isFinite).reduce((e,t)=>Math.max(e,t),0);return String(e+1)},emitUpdate(){if("existing"===this.mode)return void this.$emit("update",{options:null,valueMap:{...this.localValueMap}});const e=new Set(Object.values(this.localValueMap)),t={};Object.entries(this.localOptions).forEach(([s,i])=>{e.has(s)&&(t[s]=i)}),this.$emit("update",{options:t,valueMap:{...this.localValueMap}})}}},Mt=s(66262);const Tt=(0,Mt.A)(Xt,[["render",st],["__scopeId","data-v-554e08c3"]]);var Pt=Tt,At={name:"ImportColumnPanel",components:{ImportValueMapTable:Pt},props:{header:{type:Object,required:!0},entry:{type:Object,required:!0},stats:{type:Object,default:()=>({})},sampleValues:{type:Array,default:()=>[]},sampledRowCount:{type:Number,default:0},systemFields:{type:Array,default:()=>[]},importType:{type:String,default:""},fieldGroups:{type:Array,default:()=>[]},usedSystemFields:{type:Array,default:()=>[]},customFields:{type:Array,default:null},suggested:{type:Boolean,default:!1},fieldDescriptions:{type:Object,default:()=>({})},dateFormat:{type:String,default:null}},emits:["update","date-format"],data(){return{existingSearch:this.entry.fieldId?this.customFieldName(this.entry.fieldId):"",fieldTypes:at,fieldTypeLabels:{input:"Text",textarea:"Long text",number:"Number",date:"Date",boolean:"Yes / No",dropdown:"Dropdown",radio:"Single choice",checkboxes:"Multiple choice"},dateFormats:ot,delimiters:[{value:",",label:"Comma"},{value:";",label:"Semicolon"},{value:"|",label:"Pipe"}]}},computed:{destinations(){const e=[{value:"system",label:"System field",icon:"fa-light fa-table-columns"},{value:"existing",label:"Existing field",icon:"fa-light fa-list-check"},{value:"new",label:"New field",icon:"fa-light fa-plus"},{value:"skip",label:"Skip",icon:"fa-light fa-ban"}];return this.hasCustomFields?e:e.filter(e=>
1"system"===e.value||"skip"===e.value)},hasCustomFields(){return Array.isArray(this.customFields)},destination(){return"system"===this.entry.target?"system":"skip"===this.entry.target?"skip":this.entry.fieldId||this.entry.pendingExisting?"existing":"new"},fieldHelp(){return"system"===this.entry.target&&this.entry.field&&this.fieldDescriptions[this.entry.field]||null},isDateField(){return!!this.fieldHelp&&nt.includes(this.fieldHelp.kind)},isAmbiguousDate(){return!!this.stats.dateFormat?.ambiguous},selectedDateFormat(){return this.dateFormat||this.stats.dateFormat?.detected||ot[0].value},extraSampleCount(){const e=Number(this.stats.distinct?.length)||0;return Math.max(0,e-Math.min(5,this.sampleValues.length))},isDuplicateSystem(){return"system"===this.entry.target&&this.usedSystemFields.includes(this.entry.field)},isChoice(){return"custom_field"===this.entry.target&&pt(this.entry.fieldType)},selectedCustomField(){return(this.customFields||[]).find(e=>e.id===this.entry.fieldId)||null},filteredCustomFields(){const e=(this.existingSearch||"").toLowerCase();return(this.customFields||[]).filter(t=>!e||t.name.toLowerCase().includes(e))},choiceValues(){return ct(this.stats.distinct,this.entry.fieldType,this.entry.delimiter)},choiceOptions(){return this.entry.fieldId?this.selectedCustomField?.fieldOptions?.options||{}:this.entry.options||{}},tableKey(){return[this.header.key,this.entry.fieldId||"new",this.entry.fieldType,this.entry.delimiter||""].join(":")},splitPreview(){return this.sampleValues.slice(0,3).map(e=>ut(e,this.entry.delimiter||",")).filter(e=>e.length>0)}},methods:{systemFieldLabel:Ft,customFieldName(e){const t=(this.customFields||[]).find(t=>t.id===e);return t?t.name:""},emitEntry(e){this.$emit("update",e)},setDestination(e){e!==this.destination&&("existing"!==e&&"new"!==e||this.hasCustomFields)&&("system"===e?this.emitEntry({target:"system",field:null}):"skip"===e?this.emitEntry({target:"skip"}):"existing"===e?(this.existingSearch="",this.emitEntry({target:"custom_field",fieldId:null,fieldType:"input",valueMap:{},delimiter:null,pendingExisting:!0})):this.emitEntry(this.freshNewEntry("input")))},setSystemField(e){this.emitEntry({target:"system",field:e})},setExistingField(e){if(!e||e.isEncrypted)return;const t={target:"custom_field",fieldId:e.id,fieldType:e.fieldType,valueMap:{},delimiter:"checkboxes"===e.fieldType?this.entry.delimiter||",":null};if(pt(e.fieldType)){const s=ct(this.stats.distinct,e.fieldType,t.delimiter);t.valueMap=ht(s,e.fieldOptions?.options||{})}this.emitEntry(t)},setName(e){this.emitEntry({...this.entry,name:e})},setFieldType(e){this.emitEntry(this.freshNewEntry(e))},freshNewEntry(e){const t="checkboxes"===e?this.entry.delimiter||",":null,s={target:"custom_field",fieldId:null,name:this.entry.name||this.header.raw,fieldType:e,options:{},valueMap:{},delimiter:t};return pt(e)&&Object.assign(s,mt(ct(this.stats.distinct,e,t))),s},setDelimiter(e){if(!lt.includes(e))return;const t=ct(this.stats.distinct,"checkboxes",e);if(this.entry.fieldId){const s=this.selectedCustomField?.fieldOptions?.options||{};return void this.emitEntry({...this.entry,delimiter:e,valueMap:ht(t,s)})}this.emitEntry({...this.entry,delimiter:e,...mt(t)})},setDateFormat(e){this.$emit("date-format",e)},setValueMap({options:e,valueMap:t}){const s={...this.entry,valueMap:t};null===e||this.entry.fieldId||(s.options=e),this.emitEntry(s)}}};const Dt=(0,Mt.A)(At,[["render",Qe],["__scopeId","data-v-1161fa38"]]);var Ot=Dt,Ut=s(95875);const Wt={key:0,class:"import-preflight","data-testid":"import-preflight"},Kt={key:0,class:"import-preflight__progress"},qt={class:"import-preflight__eyebrow"},Qt={class:"import-preflight__bar-bg"},Vt={key:1,class:"import-preflight__eyebrow"},Nt={key:2,class:"import-preflight__eyebrow"},jt={key:3,class:"notification is-danger is-light import-preflight__errors"},zt={class:"import-preflight__errors-title"},Bt={key:0},Gt={class:"import-preflight__tiles"},Ht=["aria-pressed","data-outcome","onClick"],Yt={class:"import-preflight__count"},Jt={class:"import-preflight__label"},Zt={key:0,class:"import-preflight__note"};function es(e,t,s,l,o,n){return"none"!==n.state?((0,i.uX)(),(0,i.CE)("div",Wt,["running"===n.state?((0,i.uX)(),(0,i.CE)("div",Kt,[(0,i.Lk)("p",qt,(0,a.v_)(e.$t("Checking {count} rows...",{count:s.total})),1),(0,i.Lk)("div",Qt,[(0,i.Lk)("div",{class:"import-preflight__bar-fill",style:(0,a.Tr)({width:n.progressWidth})},null,4)])])):"queued"===n.state?((0,i.uX)(),(0,i.CE)("p",Vt,(0,a.v_)(e.$t("Waiting behind another import")),1)):"stale"===n.state?((0,i.uX)(),(0,i.CE)("p",Nt,(0,a.v_)(e.$t("Mapping changed, checking again...")),1)):"failed"===n.state?((0,i.uX)(),(0,i.CE)("div",jt,[(0,i.Lk)("p",zt,(0,a.v_)(e.$t("The check could not finish")),1),s.val
1idationErrors.length?((0,i.uX)(),(0,i.CE)("ul",Bt,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(s.validationErrors,(e,t)=>((0,i.uX)(),(0,i.CE)("li",{key:t},(0,a.v_)(e),1))),128))])):(0,i.Q3)("",!0)])):((0,i.uX)(),(0,i.CE)(i.FK,{key:4},[(0,i.Lk)("div",Gt,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.tiles,t=>((0,i.uX)(),(0,i.CE)("button",{key:t.key,type:"button",class:(0,a.C4)(["import-preflight__tile",[t.tone,{"is-active":n.isActive(t)}]]),"aria-pressed":n.isActive(t),"data-outcome":t.key,onClick:e=>n.toggle(t)},[(0,i.Lk)("span",Yt,(0,a.v_)(t.count),1),(0,i.Lk)("span",Jt,(0,a.v_)(e.$t(t.label)),1)],10,Ht))),128))]),n.isRowByRowType?((0,i.uX)(),(0,i.CE)("p",Zt,(0,a.v_)(e.$t("Create counts are an upper bound for this type")),1)):(0,i.Q3)("",!0)],64))])):(0,i.Q3)("",!0)}const ts=[{key:"create",label:"Will be created",count:"create",filter:{outcome:"create"},tone:"is-create"},{key:"update",label:"Will be updated",count:"update",filter:{outcome:"update"},tone:"is-update"},{key:"skip",label:"Will be skipped",count:"skip",filter:{status:"skipped"},tone:"is-skip"},{key:"fail",label:"Will fail",count:"fail",filter:{status:"error"},tone:"is-fail"},{key:"warning",label:"With warnings",count:"warning",filter:{status:"warning"},tone:"is-warning"}],ss=["local-center","unit","role","badge-type","badge"];var is={name:"ImportPreflightStrip",props:{preflight:{type:Object,default:null},mappingRevision:{type:Number,default:null},validationErrors:{type:Array,default:()=>[]},total:{type:Number,default:0},progress:{type:Number,default:0},activeFilter:{type:Object,default:null},isQueued:{type:Boolean,default:!1},importType:{type:String,default:""}},emits:["filter"],computed:{state(){const e=this.preflight?.status||"none";return this.isQueued&&"failed"!==e?"queued":"running"===e||"failed"===e?e:"ready"===e?null!==this.mappingRevision&&this.preflight.revision!==this.mappingRevision?"stale":"ready":"stale"===e?"stale":"none"},tiles(){const e=this.preflight?.counts||{};return ts.map(t=>({...t,count:e[t.count]||0}))},progressWidth(){return this.total?Math.min(100,Math.round(this.progress/this.total*100))+"%":"0%"},isRowByRowType(){return ss.includes(this.importType)}},methods:{isActive(e){const t=this.activeFilter;return!!t&&Object.keys(e.filter).every(s=>t[s]===e.filter[s])},toggle(e){this.$emit("filter",this.isActive(e)?null:{...e.filter})}}};const as=(0,Mt.A)(is,[["render",es],["__scopeId","data-v-3231f710"]]);var ls=as;const os={user:"Users",contact:"Contacts","user-modify":"Modify Users","contact-modify":"Modify Contacts","product-payment":"Product Payments","event-attend":"Event Attendance","user-role":"User Roles","local-center":"Local Centers",event:"Events",product:"Products","product-price":"Product Prices",role:"Roles",unit:"Units",company:"Companies","company-user":"Company Members","user-list-members":"List members","badge-type":"Badge Types",badge:"Badges","badge-user":"Badge Assignments"},ns={fields:"Required fields",default:"Required"},rs={contact:"{count} new contacts",product:"{count} new products",product_price:"{count} new price tiers",event:"{count} new events",company:"{count} new companies"},ps={system:{label:"System field",type:"is-success is-passive"},existing:{label:"Existing field",type:"is-primary is-passive"},new:{label:"New field",type:"is-info is-passive"},skipped:{label:"Skipped",type:"is-default"},attention:{label:"Needs attention",type:"is-warning is-passive"}},ds={input:"Text",textarea:"Long text",number:"Number",date:"Date",boolean:"Yes / No",dropdown:"Dropdown",radio:"Single choice",checkboxes:"Multiple choice"},us=20,cs=["user","contact","user-modify","contact-modify"],ms=2e3,hs=2e3,gs=["preflight","queued"],ys={create:"Rows that will be created",update:"Rows that will be updated",skipped:"Rows that will be skipped",error:"Rows that will fail",warning:"Rows with warnings"},fs=460,vs=360,_s=960;var bs={name:"ImportMappingModal",components:{ImportColumnPanel:Ot,ImportLedgerTable:Ut.A,ImportPreflightStrip:ls},props:{active:{type:Boolean,default:!1},importId:{type:Number,default:null},importType:{type:String,default:""},fileName:{type:String,default:""}},emits:["started","discarded","close"],data(){return{PANEL_MIN_WIDTH:vs,panelWidth:fs,panelDrag:null,preview:null,columns:{},suggested:{}
1,selectedKey:null,showAllRows:!1,isLoading:!1,loadError:null,isSaving:!1,pendingEdit:!1,saveError:null,hasSavedOnce:!1,isStarting:!1,pendingSave:null,saveDebounced:null,matches:null,isMatching:!1,matchRequestId:0,preflight:null,preflightTimer:null,pollTimer:null,preflightEnabled:!0,mappingRevision:null,validationErrors:[],totalRows:0,processedRows:0,ledgerFilter:null,options:{existing:"skip",dateFormats:{}},importStatus:null,stateRequestId:0,lastMappingRequestId:0,lastSavedPayload:null,previousMapping:null}},computed:{typeLabel(){return os[this.importType]||this.importType},selectedHeader(){return this.preview?.headers.find(e=>e.key===this.selectedKey)||null},duplicates(){return vt(this.columns)},duplicateList(){return Object.keys(this.duplicates)},state(){return kt(this.columns,this.preview?.requiredColumnGroups||[],this.preview?.requiredGroups||{})},requiredGroupNames(){const e=this.preview?.requiredGroups;return e&&"object"===typeof e&&!Array.isArray(e)?Object.keys(e):[]},requirementChips(){const e=_t(this.columns);return this.requiredGroupNames.length?this.requiredGroupNames.map(e=>{const t=this.preview.requiredGroups[e]||[],s=(this.preview.fieldGroups||[]).find(t=>t.key===e),i=s?this.$t(s.label):this.$t(ns[e]||e),a=t.map(e=>e.map(e=>this.$t(Ft(e,this.importType))).join(" + ")).join(" "+this.$t("or")+" ");return{key:e,label:a?i+": "+a:i,satisfied:!this.state.missingByGroup?.[e]}}):(this.preview?.requiredColumnGroups||[]).map(t=>({key:t.join("+"),label:t.map(e=>this.$t(Ft(e,this.importType))).join(" + "),satisfied:t.every(t=>e.has(t))}))},matchTiles(){return this.matches?Object.entries(this.matches).map(([e,t])=>{const s=(this.preview?.fieldGroups||[]).find(t=>t.key===e);return{key:e,label:s?s.label:e,found:t.found||0,create:t.create||0,unmatched:(t.unresolved||0)+(t.ambiguous||0),createsLabel:rs[t.createsAs]||"{count} new"}}):[]},mappedCount(){return Object.keys(this.columns).filter(e=>{const t=Lt(this.columns[e],this.duplicates);return"system"===t||"existing"===t||"new"===t}).length},mappedWidth(){const e=this.preview?.headers.length||0;return 0===e?"0%":Math.round(this.mappedCount/e*100)+"%"},sampleRows(){return this.preview?.sampleRows||[]},visibleRows(){return this.showAllRows?this.sampleRows:this.sampleRows.slice(0,us)},hiddenRowCount(){return Math.max(0,this.sampleRows.length-this.visibleRows.length)},isQueued(){return"queued"===this.importStatus},isPersonType(){return cs.includes(this.importType)},isPreflightReady(){return"ready"===this.preflight?.status&&this.preflight.revision===this.mappingRevision},hasPendingSave(){return this.isSaving||this.pendingEdit},canStart(){return!!this.preview&&this.state.ready&&0===this.duplicateList.length&&!this.isStarting&&!this.saveError&&!this.hasPendingSave&&this.isPreflightReady},ledgerTitle(){const e=this.ledgerFilter?.status||this.ledgerFilter?.outcome;return ys[e]||"Rows"},previousMappingDate(){return this.previousMapping?.dateCompleted?this.$filters.formatDateCool(this.previousMapping.dateCompleted):""}},watch:{importId(){this.reset(),this.active&&this.importId&&this.loadPreview()},active(e){e&&this.importId&&(this.preflightEnabled=!0,this.preview?this.fetchImportState():this.loadPreview())}},created(){this.saveDebounced=fe()(this.save,400),this.active&&this.importId&&this.loadPreview()},beforeUnmount(){this.stopPanelResize(),this.stopPreflight(),this.saveDebounced&&this.saveDebounced.cancel()},methods:{startPanelResize(e){void 0!==e.button&&0!==e.button||(e.preventDefault(),this.panelDrag={startX:e.clientX,startWidth:this.panelWidth},document.addEventListener("pointermove",this.onPanelResize),document.addEventListener("pointerup",this.stopPanelResize),document.addEventListener("pointercancel",this.stopPanelResize),document.body.classList.add("import-panel-resizing"))},onPanelResize(e){this.panelDrag&&this.setPanelWidth(this.panelDrag.startWidth+(this.panelDrag.startX-e.clientX))},stopPanelResize(){this.panelDrag&&(this.panelDrag=null,document.removeEventListener("pointermove",this.onPanelResize),document.removeEventListener("pointerup",this.stopPanelResize),document.removeEventListener("pointercancel",this.stopPanelResize),document.body.classList.remove("import-panel-resizing"))},nudgePanel(e){this.setPanelWidth(this.panelWidth+e)},setPanelWidth(e){const t=this.$el?.querySelector?.(".import-sheet-body")?.clientWidth||0,s=t>0?Math.min(_s,Math.floor(.66*t)):_s;this.panelWidth=Math.round(Math.min(s,Math.max(vs,e)))},reset(){this.saveDebounced?.cancel?.(),this.pendingEdit=!1,this.stopPreflight(),this.preflightEnabled=!0,this.preflight=null,this.mappingRevision=null,this.validationErrors=[],this.totalRows=0,this.processedRows=0,this.ledgerFilter=null,this.options={existing:"skip",dateFormats:{}},this.importStatus=null,this.stateRequestId+=1,this.lastMappingRequestId+=1,this.lastSavedPayload=null,this.previousMapping=null,this.preview=null,this.matches=null,this.isMatching=!1,this.matchRequestId+=1,this.columns={},this.suggested={},this.selectedKey=null,this.showAllRows=!1,this.loadError=null,this.saveError=null,this.hasSavedOnce=!1},loadPreview(){this.isLoading=!0,this.loadError=null,this.$http.plain.get(`/imports/${this.importId}/preview`).then(e=>{this.preview=e.data;const t=ft(this.preview);this.columns=t.columns,this.suggested=t.suggested,this.selectedKey=null,this.hasSavedOnce=!!this.preview.mapping;const s=this.preview.options||{};
1this.options={existing:s.existing||"skip",dateFormats:{...s.dateFormats||{}}},this.preview.mapping?(this.fetchMatches(),this.fetchImportState()):(this.scheduleSave(),this.fetchLastMapping())}).catch(e=>{console.log(e),this.loadError=e.response?.data?.error||this.$t("Could not read the file")}).finally(()=>{this.isLoading=!1})},selectColumn(e){this.selectedKey=this.selectedKey===e?null:e},isSkipped(e){const t=this.columns[e];return!t||"skip"===t.target},isEmptyCell(e){return null===e||void 0===e||""===String(e).trim()},optionsFor(e){const t=this.columns[e];if(!t||"custom_field"!==t.target)return{};if(t.fieldId){const e=(this.preview?.customFields||[]).find(e=>e.id===t.fieldId);return e?.fieldOptions?.options||{}}return t.options||{}},cellParts(e,t){return this.isEmptyCell(t)?null:xt(this.columns[e],this.optionsFor(e),t)},sampleValues(e){const t=[];return this.sampleRows.forEach(s=>{const i=s[e];null===i||void 0===i||""===String(i).trim()||t.includes(i)||t.push(String(i))}),t.slice(0,5)},matchClass(e,t){const s=Ct(this.matches,this.preview?.fieldGroups,this.columns,e,t);return"unresolved"===s||"ambiguous"===s?"unmatched":"create"===s?"new":null},fetchMatches(){if(!this.importId||!this.preview?.matchable)return;const e=++this.matchRequestId;this.isMatching=!0,this.$http.plain.get(`/imports/${this.importId}/matches`).then(t=>{e===this.matchRequestId&&(this.matches=t.data?.matches||{})}).catch(e=>{console.log(e)}).finally(()=>{e===this.matchRequestId&&(this.isMatching=!1)})},destinationSummary(e){const t=this.columns[e];if(!t)return"";if("attention"===Lt(t,this.duplicates))return this.$t("Needs attention");if("system"===t.target){const e=wt(this.preview?.fieldGroups,t.field);return"→ "+(e?this.$t(e.label)+" · ":"")+this.$t(Ft(t.field,this.importType))}if("skip"===t.target)return this.$t("Skipped");const s=this.$t(ds[t.fieldType]||t.fieldType);if(t.fieldId){const e=(this.preview?.customFields||[]).find(e=>e.id===t.fieldId);return this.$t("Existing field")+" · "+s+(e?" · "+e.name:"")}const i=Object.keys(t.options||{}).length,a=this.$t("New field")+" · "+s;return i>0?a+" · "+this.$t("{count} options",{count:i}):a},statusTag(e){return ps[Lt(this.columns[e],this.duplicates)]},usedSystemFieldsExcept(e){const t={...this.columns};return delete t[e],Array.from(_t(t))},updateColumn(e,t){this.columns={...this.columns,[e]:t},this.suggested[e]&&(this.suggested={...this.suggested,[e]:!1}),this.scheduleSave()},scheduleSave(){this.pendingEdit=!0,this.saveDebounced()},buildSavePayload(){return{columns:$t(this.columns),options:{existing:this.options.existing,dateFormats:{...this.options.dateFormats}}}},save(){if(!this.importId)return this.pendingEdit=!1,Promise.resolve();const e=this.buildSavePayload(),t=JSON.stringify(e);if(this.pendingEdit=!1,t===this.lastSavedPayload)return Promise.resolve();this.isSaving=!0,this.saveError=null;const s=this.$http.plain.patch(`/imports/${this.importId}/mapping`,e).then(e=>{this.lastSavedPayload=t,this.hasSavedOnce=!0,this.onMappingSaved(e.data),this.fetchMatches()}).catch(e=>{throw console.log(e),this.saveError=e.response?.data?.error||this.$t("Could not save the mapping"),e}).finally(()=>{this.isSaving=!1});return this.pendingSave=s.catch(()=>{}),s},flushSave(){return this.saveDebounced.cancel(),this.save()},start(){if(!this.canStart)return;const e=this.preflight?.counts?.fail||0;e>0?this.$buefy.dialog.confirm({title:this.$t("Some rows will fail"),message:this.$t("{count} rows will fail and be left out. Import the rest?",{count:e}),confirmText:this.$t("Import the rest"),cancelText:this.$t("Cancel"),type:"is-warning",hasIcon:!0,onConfirm:()=>this.runStart()}):this.runStart()},runStart(){this.isStarting=!0,this.stopPreflight(),this.flushSave().then(()=>this.$http.plain.post(`/imports/${this.importId}/start`)).then(e=>{const t="queued"===e.data?.status;this.$buefy.toast.open({message:t?this.$t("Waiting for another import to finish"):this.$t("Import started successfully"),type:t?"is-info":"is-success"}),this.$emit("started",e.data)}).catch(e=>{console.log(e);const t=e.response?.data||{},s=Array.isArray(t.errors)&&t.errors.length?t.errors.join(" "):t.error;
1this.$buefy.toast.open({message:s||this.$t("Import could not be started"),type:"is-danger",duration:6e3})}).finally(()=>{this.isStarting=!1})},onMappingSaved(e){this.stateRequestId+=1,e&&void 0!==e.mappingRevision&&(this.mappingRevision=e.mappingRevision),e&&e.preflight&&(this.preflight=e.preflight),this.validationErrors=[],this.ledgerFilter=null,this.schedulePreflight()},schedulePreflight(){clearTimeout(this.preflightTimer),this.preflightTimer=null,this.preflightEnabled&&this.importId&&(!this.state.ready||this.duplicateList.length>0||(this.preflightTimer=setTimeout(this.runPreflight,ms)))},runPreflight(){this.preflightEnabled&&this.importId&&(this.validationErrors=[],this.$http.plain.post(`/imports/${this.importId}/preflight`).then(e=>{this.importStatus=e.data?.status||null,this.preflight=e.data?.preflight||{status:"running",revision:this.mappingRevision,counts:null},this.pollPreflight()}).catch(e=>{console.log(e);const t=e.response?.data||{};409!==e.response?.status?(this.validationErrors=Array.isArray(t.errors)&&t.errors.length?t.errors:[t.error||this.$t("The check could not finish")],this.importStatus=null,this.preflight={status:"failed",revision:this.mappingRevision,counts:null}):String(t.error||"").includes("already running")?this.pollPreflight():this.schedulePreflight()}))},pollPreflight(){if(clearTimeout(this.pollTimer),this.pollTimer=null,!this.preflightEnabled||!this.importId)return;const e=++this.stateRequestId;this.pollTimer=setTimeout(()=>{this.$http.plain.get(`/imports/${this.importId}`).then(t=>{e===this.stateRequestId&&this.onImportState(t.data||{})}).catch(e=>{console.log(e)})},hs)},fetchImportState(){const e=++this.stateRequestId;this.$http.plain.get(`/imports/${this.importId}`).then(t=>{e===this.stateRequestId&&this.onImportState(t.data||{})}).catch(e=>{console.log(e)})},onImportState(e){this.applyImportState(e);const t=e.preflight||{};gs.includes(e.status)||"running"===t.status?this.pollPreflight():"failed"===t.status&&t.revision===e.mappingRevision||"ready"===t.status&&t.revision===e.mappingRevision||this.schedulePreflight()},applyImportState(e){if(this.importStatus=e.status||null,void 0!==e.mappingRevision&&null!==e.mappingRevision&&(this.mappingRevision=e.mappingRevision),this.preflight=e.preflight||null,this.totalRows=e.totalRows||0,this.processedRows=e.processedRows||0,"failed"===e.preflight?.status){const t=e.errorSummary||{},s=Array.isArray(t.validationErrors)?t.validationErrors:[];this.validationErrors=s.length?s:[t.message||this.$t("The check could not finish")]}},stopPreflight(){clearTimeout(this.preflightTimer),clearTimeout(this.pollTimer),this.preflightTimer=null,this.pollTimer=null},setLedgerFilter(e){this.ledgerFilter=e},setExistingOption(e){e!==this.options.existing&&(this.options={...this.options,existing:e},this.scheduleSave())},setDateFormat(e,t){e&&this.options.dateFormats[e]!==t&&(this.options={...this.options,dateFormats:{...this.options.dateFormats,[e]:t}},this.scheduleSave())},fetchLastMapping(){const e=++this.lastMappingRequestId;this.$http.plain.get("/imports/last-mapping",{params:{type:this.importType}}).then(t=>{if(e!==this.lastMappingRequestId)return;const s=t.data||{},i=s.columns;if(!i||0===Object.keys(i).length)return;const a=(this.preview?.headers||[]).map(e=>e.key);Object.keys(i).every(e=>a.includes(e))&&(this.previousMapping=s)}).catch(e=>{console.log(e)})},applyPreviousMapping(){const e=this.previousMapping;e&&(this.columns={...this.columns,...JSON.parse(JSON.stringify(e.columns))},this.suggested={},e.options&&(this.options={existing:e.options.existing||"skip",dateFormats:{...e.options.dateFormats||{}}}),this.previousMapping=null,this.scheduleSave())},confirmDiscard(){this.$buefy.dialog.confirm({title:this.$t("Discard import"),message:this.$t("The uploaded file and this mapping will be deleted. Nothing has been imported yet."),confirmText:this.$t("Discard"),cancelText:this.$t("Cancel"),type:"is-danger",hasIcon:!0,onConfirm:()=>this.discard()})},discard(){this.saveDebounced.cancel(),this.isStarting=!0,this.$http.plain.delete(`/imports/${this.importId}`).then(()=>{this.$emit("discarded")}).catch(e=>
1{console.log(e),this.$buefy.toast.open({message:e.response?.data?.error||this.$t("Could not discard the import"),type:"is-danger"})}).finally(()=>{this.isStarting=!1})},onModalToggle(e){e||this.close()},close(){this.stopPreflight(),this.preflightEnabled=!1,this.saveDebounced.flush(),this.$emit("close")}}};const ks=(0,Mt.A)(bs,[["render",ge],["__scopeId","data-v-0b0b071a"]]);var ws=ks},90353:function(e,t,s){s.r(t),s.d(t,{default:function(){return je}});var i=s(20641),a=s(90033);const l={class:"o-mediumwidth import-page"},o={class:"level import-page__header"},n={class:"level-left"},r={class:"level-item"},p={class:"title"},d={key:0,class:"title-count-badge"},u={class:"import-page__lead"},c={class:"import-steps"},m={key:0,class:"import-section-heading"},h={class:"title is-5"},g={class:"import-page__lead"},y={class:"import-step__grid"},f={class:"o-step-dot"},v={key:1},_={class:"import-step__body"},b={class:"import-step__title-row"},k={class:"import-step__title"},w={key:0,class:"tag is-rounded is-small is-info is-passive"},C={key:1,class:"tag is-rounded is-small is-warning is-passive"},I={key:2,class:"tag is-rounded is-small is-default"},E={class:"import-step__description"},F={key:0,class:"import-step__description"},L={key:1,class:"import-step__run"},$={key:0,class:"import-step__meta"},x={key:1,class:"import-step__meta"},R={key:0,class:"import-step__meta is-lead"},S={class:"import-bar-bg"},X={class:"count-tile-row import-step__tiles"},M={class:"count-tile"},T={class:"count-tile-label"},P={class:"count-tile-value"},A={class:"count-tile"},D={class:"count-tile-label"},O={class:"count-tile-value has-text-success"},U={class:"count-tile"},W={class:"count-tile-label"},K={key:0,class:"count-tile"},q={class:"count-tile-label"},Q={class:"count-tile-value has-text-info"},V={key:1,class:"count-tile"},N={class:"count-tile-label"},j={class:"count-tile-value has-text-warning"},z={key:2,class:"count-tile"},B={class:"count-tile-label"},G={class:"count-tile-value has-text-warning"},H={key:2,class:"import-step__meta"},Y={class:"has-text-success"},J={class:"has-text-danger"},Z={class:"has-text-warning"},ee={key:3,class:"import-step__meta has-text-danger"},te={key:4,class:"import-file-chip"},se={class:"import-file-chip__name"},ie={class:"import-file-chip__size"},ae={class:"import-step__side"},le={key:1,class:"import-step__actions"},oe={key:2,class:"import-step__actions"},ne=["href"],re={class:"button is-small is-light is-rounded"},pe={key:3,class:"import-step__actions"},de={class:"import-section-heading"},ue={class:"title is-5"},ce={key:0,class:"card p-5","aria-hidden":"true"},me={key:1,class:"list-empty-state"},he={class:"list-empty-state-message"},ge={key:2,class:"orgo-table-wrap import-history__table"},ye={class:"import-history__type"},fe={key:0,class:"ml-1"},ve={key:0,class:"import-history__results"},_e=["data-testid"],be={class:"import-history__muted"},ke={key:1,class:"import-history__muted"},we={class:"import-history__date"},Ce={key:1,class:"tag is-rounded is-small is-warning is-passive"},Ie={key:0,class:"import-errors"},Ee={class:"import-error"},Fe={class:"import-error__content"},Le={class:"import-error__message"},$e={key:0,class:"import-error__data"},xe={key:1,class:"import-ledger"},Re={class:"import-ledger__toolbar"},Se={class:"import-ledger__filters",role:"group"},Xe={key:0,class:"import-ledger__count"},Me={class:"import-ledger__downloads"},Te={key:2,class:"import-errors__note"};function Pe(e,t,s,Pe,Ae,De){const Oe=(0,i.g2)("b-loading"),Ue=(0,i.g2)("font-awesome-icon"),We=(0,i.g2)("b-button"),Ke=(0,i.g2)("b-upload"),qe=(0,i.g2)("b-skeleton"),Qe=(0,i.g2)("b-table-column"),Ve=(0,i.g2)("b-tooltip"),Ne=(0,i.g2)("b-radio-button"),je=(0,i.g2)("ImportLedgerTable"),ze=(0,i.g2)("b-table"),Be=(0,i.g2)("ImportMappingModal");return(0,i.uX)(),(0,i.CE)("section",l,[(0,i.bF)(Oe,{active:Ae.isLoading,"is-full-page":!1},null,8,["active"]),(0,i.Lk)("div",o,[(0,i.Lk)("div",n,[(0,i.Lk)("div",r,[(0,i.Lk)("h2",p,[(0,i.eW)((0,a.v_)(e.$t("Data import"))+" ",1),De.completedCount>0?((0,i.uX)(),(0,i.CE)("span",d,(0,a.v_)(De.completedCount),1)):(0,i.Q3)("",!0)])])])]),(0,i.Lk)("p",u,(0,a.v_)(e.$t("Import data in the correct order to maintain referential integrity"))+" "+(0,a.v_)(e.$t("For best results, import data in the order shown below to ensure relationships between entities are properly established.")),1),(0,i.Lk)("div",c,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(De.filteredImportSteps,(s,l)=>((0,i.uX)(),(0,i.CE)(i.FK,{key:s.type},[s.isModify&&!De.filteredImportSteps[l-1]?.isModify?((0,i.uX)(),(0,i.CE)("div",m,[(0,i.Lk)("h3",h,(0,a.v_)(e.$t("Modify existing records")),1),(0,i.Lk)("p",g,(0,a.v_)(e.$t("The
1se imports update existing users/contacts in place. Partial-update semantics: empty cells leave the field unchanged. Rollback restores prior values.")),1)])):(0,i.Q3)("",!0),(0,i.Lk)("div",{class:(0,a.C4)(["card p-5 import-step",{"is-running":De.isRunning(s)}])},[(0,i.Lk)("div",y,[(0,i.Lk)("div",{class:(0,a.C4)(["o-step import-step__dot",De.stepState(s)])},[(0,i.Lk)("div",f,["completed"===De.stepState(s)?((0,i.uX)(),(0,i.Wv)(Ue,{key:0,icon:"fa-light fa-check"})):((0,i.uX)(),(0,i.CE)("span",v,(0,a.v_)(l+1),1))])],2),(0,i.Lk)("div",_,[(0,i.Lk)("div",b,[(0,i.Lk)("span",k,(0,a.v_)(e.$t(s.label)),1),s.isOptional?((0,i.uX)(),(0,i.CE)("span",w,(0,a.v_)(e.$t("Optional")),1)):(0,i.Q3)("",!0),s.isModify?((0,i.uX)(),(0,i.CE)("span",C,(0,a.v_)(e.$t("Modify")),1)):(0,i.Q3)("",!0),De.usesWizard(s.type)?((0,i.uX)(),(0,i.CE)("span",I,(0,a.v_)(e.$t("Column mapping")),1)):(0,i.Q3)("",!0)]),(0,i.Lk)("p",E,(0,a.v_)(e.$t(s.description)),1),s.isOptional&&s.optionalMessage?((0,i.uX)(),(0,i.CE)("p",F,(0,a.v_)(e.$t(s.optionalMessage)),1)):(0,i.Q3)("",!0),De.isRunning(s)?((0,i.uX)(),(0,i.CE)("div",L,["converting"===s.lastImport.status?((0,i.uX)(),(0,i.CE)("p",$,[(0,i.bF)(Ue,{icon:"fa-light fa-file-import"}),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Reading your spreadsheet...")),1)])):"queued"===s.lastImport.status?((0,i.uX)(),(0,i.CE)("p",x,[(0,i.bF)(Ue,{icon:"fa-light fa-hourglass-half"}),(0,i.Lk)("span",null,(0,a.v_)(De.queueMessage(s.lastImport)),1)])):((0,i.uX)(),(0,i.CE)(i.FK,{key:2},["preflight"===s.lastImport.status?((0,i.uX)(),(0,i.CE)("p",R,[(0,i.bF)(Ue,{icon:"fa-light fa-magnifying-glass"}),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Checking the file...")),1)])):(0,i.Q3)("",!0),(0,i.Lk)("div",S,[(0,i.Lk)("div",{class:"import-bar-fill",style:(0,a.Tr)({width:De.progressWidth(s.lastImport)})},null,4)]),(0,i.Lk)("div",X,[(0,i.Lk)("div",M,[(0,i.Lk)("span",T,(0,a.v_)(e.$t("Processed")),1),(0,i.Lk)("span",P,(0,a.v_)(s.lastImport.processedRows)+" / "+(0,a.v_)(s.lastImport.totalRows),1)]),(0,i.Lk)("div",A,[(0,i.Lk)("span",D,(0,a.v_)(e.$t("Successful")),1),(0,i.Lk)("span",O,(0,a.v_)(s.lastImport.successfulRows),1)]),(0,i.Lk)("div",U,[(0,i.Lk)("span",W,(0,a.v_)(e.$t("Failed")),1),(0,i.Lk)("span",{class:(0,a.C4)(["count-tile-value",{"has-text-danger":s.lastImport.failedRows>0}])},(0,a.v_)(s.lastImport.failedRows),3)]),s.lastImport.updatedRows>0?((0,i.uX)(),(0,i.CE)("div",K,[(0,i.Lk)("span",q,(0,a.v_)(e.$t("Updated")),1),(0,i.Lk)("span",Q,(0,a.v_)(s.lastImport.updatedRows),1)])):(0,i.Q3)("",!0),s.lastImport.skippedRows>0?((0,i.uX)(),(0,i.CE)("div",V,[(0,i.Lk)("span",N,(0,a.v_)(e.$t("Skipped")),1),(0,i.Lk)("span",j,(0,a.v_)(s.lastImport.skippedRows),1)])):(0,i.Q3)("",!0),s.lastImport.warningRows>0?((0,i.uX)(),(0,i.CE)("div",z,[(0,i.Lk)("span",B,(0,a.v_)(e.$t("Warnings")),1),(0,i.Lk)("span",G,(0,a.v_)(s.lastImport.warningRows),1)])):(0,i.Q3)("",!0)])],64))])):s.lastImport&&"completed"===s.lastImport.status?((0,i.uX)(),(0,i.CE)("p",H,[(0,i.bF)(Ue,{icon:"fa-light fa-calendar"}),(0,i.Lk)("span",null,(0,a.v_)(e.$filters.formatDateCool(s.lastImport.dateCompleted)),1),t[2]||(t[2]=(0,i.Lk)("span",{class:"import-step__meta-sep"},"·",-1)),(0,i.Lk)("span",Y,(0,a.v_)(s.lastImport.successfulRows)+" "+(0,a.v_)(e.$t("successful")),1),s.lastImport.failedRows>0?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[t[0]||(t[0]=(0,i.Lk)("span",{class:"import-step__meta-sep"},"·",-1)),(0,i.Lk)("span",J,(0,a.v_)(s.lastImport.failedRows)+" "+(0,a.v_)(e.$t("failed")),1)],64)):(0,i.Q3)("",!0),s.lastImport.skippedRows>0?((0,i.uX)(),(0,i.CE)(i.FK,{key:1},[t[1]||(t[1]=(0,i.Lk)("span",{class:"import-step__meta-sep"},"·",-1)),(0,i.Lk)("span",Z,(0,a.v_)(s.lastImport.skippedRows)+" "+(0,a.v_)(e.$t("skipped")),1)],64)):(0,i.Q3)("",!0)])):s.lastImport&&"failed"===s.lastImport.status?((0,i.uX)(),(0,i.CE)("p",ee,[(0,i.bF)(Ue,{icon:"fa-light fa-triangle-exclamation"}),(0,i.Lk)("span",null,(0,a.v_)(s.lastImport.errorSummary?.message||e.$t("Import failed")),1)])):(0,i.Q3)("",!0),s.file&&!s.isUploading?((0,i.uX)(),(0,i.CE)("div",te,[(0,i.bF)(Ue,{icon:"fa-light fa-file-csv",class:"import-file-chip__icon"}),(0,i.Lk)("span",se,(0,a.v_)(s.file.name),1),(0,i.Lk)("span",ie,(0,a.v_)(De.formatFileSize(s.file.size)),1),(0,i.bF)(We,{size:"is-small",class:"is-rounded is-nobg import-file-chip__remove","aria-label":e.$t("Remove"),onClick:e=>s.file=null},{default:(0,i.k6)(()=>[(0,i.bF)(Ue,{icon:"fa-light fa-xmark"})]),_:1},8,["aria-label","onClick"])])):(0,i.Q3)("",!0)]),(0,i.Lk)("div",ae,[s.lastImport?((0,i.uX)(),(0,i.CE)("span",{key:0,class:(0,a.C4)(["tag is-rounded is-small",De.statusTagClass(s.lastImport.status)])},(0,a.v_)(e.$t(De.getStatusLabel(s.lastImport.status))),3)):(0,i.Q3)("",!0),De.isMappingDraft(s)?((0,i.uX)(),(0,i.CE)("div",le,[(0,i.bF)(We,{type:"is-danger",size:"is-small",class:"is-rounded",outlined:"",onClick:e=>De.confirmDiscardDraft(s)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Discard")),1)]),_:1},8,["onClick"]),(0,i.bF)(We,{type:"is-primary",size:"is-small",class:"is-rounded",onClick:e=>De.openMapping(s.lastImport)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Continue mapping")),1)]),_:1},8,["onClick"])])):s.file?((0,i.uX)(),(0,i.CE)("div",pe,[(0,i.bF)(We,{type:"is-primary",size:"is-small",class:"is-rounded",loading:s.isUploading,disabled:s.isUploading,onClick:e=>De.startImport(s)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(De.usesWizard(s.type)?e.$t("Map columns"):e.$t("Start Import")),1)]),_:2},1032,["loading","disabled","onClick"])])):((0,i.uX)(),(0,i.CE)("div",oe,[s.exampleFile?((0,i.uX)(),(0,i.CE)("a",{key:0,href:s.exampleFile,target:"_blank",class:"button is-small is-rounded is-nobg import-step__example"},[(0,i.bF)(Ue,{icon:"fa-light fa-download"}),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Example CSV")),1)],8,ne)):(0,i.Q3)("",!0),(0,i.bF)(We,{type:"is-text",size:"is-small",loading:s.isDownloadingTemplate,"data-testid":"import-download-template-"+s.type,onClick:e=>De.downloadTemplate(s)},{default:(0,i.k6)(()=>[(0,i.bF)(Ue,{icon:"fa-light fa-download"}),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Download a template")),1)]),_:1},8,["loading","data-testid","onClick"]),(0,i.bF)(Ke,{modelValue:s.file,"onUpdate:modelValue":e=>s.file=e,accept:Ae.IMPORT_ACCEPT},{default:(0,i.k6)(()=>[(0,i.Lk)("a",re,[(0,i.bF)(Ue,{icon:"fa-light fa-upload"}),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Choose file")),1)])]),_:1},8,["modelValue","onUpdate:modelValue","accept"])]))])])],2)],64))),128))]),(0,i.Lk)("div",de,[(0,i.Lk)("h3",ue,(0,a.v_)(e.$t("Import History")),1)]),Ae.isLoadingHistory&&!De.hasAnyImports?((0,i.uX)(),(0,i.CE)("div",ce,[((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(4,e=>(0,i.Lk)("div",{key:`import-history-skeleton-${e}`,class:"import-history-skeleton-row"},[(0,i.bF)(qe,{width:"18%",height:"14px",animated:""}),(0,i.bF)(qe,{width:"14%",height:"14px",animated:""}),(0,i.bF)(qe,{width:"22%",height:"14px",animated:""}),(0,i.bF)(qe,{width:"20%",height:"14px",animated:""})])),64))])):De.hasAnyImports?((0,i.uX)(),(0,i.CE)("div",ge,[(0,i.bF)(ze,{data:Ae.allImports,loading:Ae.isLoadingHistory,"mobile-cards":!1,paginated:Ae.allImports.length>20,"per-page":20,"pagination-rounded":"",hoverable:"",detailed:"","detail-key":"id"},{detail:(0,i.k6)(s=>[s.row.errorSummary?((0,i.uX)(),(0,i.CE)("div",Ie,[(0,i.Lk)("div",Ee,[t[3]||(t[3]=(0,i.Lk)("div",{class:"import-error__row"},"!",-1)),(0,i.Lk)("div",Fe,[(0,i.Lk)("div",Le,(0,a.v_)(s.row.errorSummary.message||s.row.errorSummary),1),s.row.errorSummary.validationErrors?((0,i.uX)(),(0,i.CE)("div",$e,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(s.row.errorSummary.validationErrors,(e,t)=>((0,i.uX)(),(0,i.CE)("code",{key:t},(0,a.v_)(e),1))),128))])):(0,i.Q3)("",!0)])])])):(0,i.Q3)("",!0),De.hasLedgerRows(s.row)?((0,i.uX)(),(0,i.CE)("div",xe,[(0,i.Lk)("div",Re,[(0,i.Lk)("div",Se,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(De.ledgerGroups,t=>((0,i.uX)(),(0,i.Wv)(Ne,{key:t.key,"model-value":De.ledgerFilterKey(s.row.id),"native-value":t.key,size:"is-small","onUpdate:modelValue":e=>De.setLedgerFilter(s.row.id,e)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t(t.label))+" ",1),De.ledgerGroupCount(s.row,t.key)?((0,i.uX)(),(0,i.CE)("span",Xe,(0,a.v_)(De.ledgerGroupCount(s.row,t.key)),1)):(0,i.Q3)("",!0)]),_:2},1032,["model-value","native-value","onUpdate:modelValue"]))),128))]),(0,i.Lk)("div",Me,[(0,i.bF)(We,{type:"is-text",size:"is-small",loading:De.isDownloadingExport(s.row.id,"ledger"),"data-testid":"import-download-ledger-"+s.row.id,onClick:e=>De.downloadExport(s.row,"ledger")},{default:(0,i.k6)(()=>[(0,i.bF)(Ue,{icon:"fa-light fa-download"}),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Download ledger")),1)]),_:1},8,["loading","data-testid","onClick"]),De.hasRowsToFix(s.row)?((0,i.uX)(),(0,i.Wv)(We,{key:0,t
1ype:"is-text",size:"is-small",loading:De.isDownloadingExport(s.row.id,"fix"),"data-testid":"import-download-fix-"+s.row.id,onClick:e=>De.downloadExport(s.row,"fix")},{default:(0,i.k6)(()=>[(0,i.bF)(Ue,{icon:"fa-light fa-file-pen"}),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Download rows to fix")),1)]),_:1},8,["loading","data-testid","onClick"])):(0,i.Q3)("",!0)])]),(0,i.bF)(je,{"import-id":s.row.id,phase:"run",filter:De.ledgerFilter(s.row.id)},null,8,["import-id","filter"])])):s.row.errorSummary?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("p",Te,(0,a.v_)(e.$t("No rows to report")),1))]),default:(0,i.k6)(()=>[(0,i.bF)(Qe,{field:"type",label:e.$t("Type")},{default:(0,i.k6)(t=>[(0,i.Lk)("span",ye,(0,a.v_)(e.$t(De.getTypeLabel(t.row.type))),1)]),_:1},8,["label"]),(0,i.bF)(Qe,{field:"status",label:e.$t("Status")},{default:(0,i.k6)(t=>[(0,i.Lk)("span",{class:(0,a.C4)(["tag is-rounded is-small",De.statusTagClass(t.row.status)])},[(0,i.eW)((0,a.v_)(e.$t(De.getStatusLabel(t.row.status)))+" ",1),"processing"===t.row.status?((0,i.uX)(),(0,i.CE)("span",fe,(0,a.v_)(t.row.progressPercentage)+"% ",1)):(0,i.Q3)("",!0)],2)]),_:1},8,["label"]),(0,i.bF)(Qe,{field:"results",label:e.$t("Results")},{default:(0,i.k6)(t=>[t.row.totalRows?((0,i.uX)(),(0,i.CE)("span",ve,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(De.outcomeCounts(t.row),s=>((0,i.uX)(),(0,i.Wv)(Ve,{key:s.key,label:e.$t(s.label),position:"is-top","append-to-body":""},{default:(0,i.k6)(()=>[(0,i.Lk)("span",{class:(0,a.C4)(["import-history__count",s.value>0?s.tone:"import-history__muted"])},[(0,i.bF)(Ue,{icon:s.icon},null,8,["icon"]),(0,i.Lk)("span",{"data-testid":"import-count-"+s.key+"-"+t.row.id},(0,a.v_)(s.value),9,_e)],2)]),_:2},1032,["label"]))),128)),(0,i.Lk)("span",be,"/ "+(0,a.v_)(t.row.totalRows),1)])):((0,i.uX)(),(0,i.CE)("span",ke," — "))]),_:1},8,["label"]),(0,i.bF)(Qe,{field:"dateCreated",label:e.$t("Date")},{default:(0,i.k6)(t=>[(0,i.Lk)("span",we,(0,a.v_)(e.$filters.formatDateCool(t.row.dateCreated)),1)]),_:1},8,["label"]),(0,i.bF)(Qe,{field:"actions",label:e.$t("Actions"),width:"140"},{default:(0,i.k6)(t=>["completed"!==t.row.status||t.row.rollbackDateTime?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.Wv)(We,{key:0,type:"is-danger",size:"is-small",class:"is-rounded",outlined:"",onClick:e=>De.confirmRollback(t.row)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Rollback")),1)]),_:1},8,["onClick"])),t.row.rollbackDateTime?((0,i.uX)(),(0,i.CE)("span",Ce,(0,a.v_)(e.$t("Rolled back")),1)):(0,i.Q3)("",!0)]),_:1},8,["label"])]),_:1},8,["data","loading","paginated"])])):((0,i.uX)(),(0,i.CE)("div",me,[(0,i.bF)(Ue,{icon:"fa-light fa-file-import",class:"list-empty-state-icon"}),(0,i.Lk)("p",he,(0,a.v_)(e.$t("No imports yet. Choose a file above to run the first one.")),1)])),(0,i.bF)(Be,{active:Ae.isMappingModalActive,"import-id":Ae.mappingImport?Ae.mappingImport.id:null,"import-type":Ae.mappingImport?Ae.mappingImport.type:"","file-name":Ae.mappingImport?Ae.mappingImport.fileName:"",onStarted:De.onMappingStarted,onDiscarded:De.onMappingDiscarded,onClose:De.closeMapping},null,8,["active","import-id","import-type","file-name","onStarted","onDiscarded","onClose"])])}s(18111),s(22489),s(20116),s(7588),s(13579),s(14603),s(47566),s(98721);var Ae=s(40834),De=s(63079),Oe=s(95875),Ue=s(44385);const We=["user","contact","user-modify","contact-modify","product-payment","event-attend","user-role","local-center","event","product","product-price","role","unit","company","company-user","badge-type","badge","badge-user"],Ke=["processing","pending","validating","converting","preflight","queued"],qe=[{key:"all",label:"All",filter:null},{key:"skipped",label:"Skipped",filter:{status:"skipped"}},{key:"failed",label:"Failed",filter:{status:"error"}},{key:"warnings",label:"Warnings",filter:{status:"warning"}}];var Qe={name:"Import",components:{ImportMappingModal:De.A,ImportLedgerTable:Oe.A},data(){return{IMPORT_ACCEPT:Ue.pO,isLoading:!1,isMappingModalActive:!1,mappingImport:null,isLoadingHistory:!1,pollingInterval:null,ledgerFilters:{},downloadingExport:null,importSteps:[{type:"local-center",label:"Local Centers",description:"Import local centers (branches/chapter
1s)",exampleFile:"/examples/import_local_centers.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"localCenter.isActive"},{type:"unit",label:"Units",description:"Import organizational units and groups",exampleFile:"/examples/import_units.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"group.hasUnits"},{type:"role",label:"Roles",description:"Import user roles and positions",exampleFile:"/examples/import_roles.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:null},{type:"badge-type",label:"Badge Types",description:"Import badge type categories",exampleFile:"/examples/import_badge_types.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"gamification.isActive"},{type:"badge",label:"Badges",description:"Import individual badges and achievements",exampleFile:"/examples/import_badges.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"gamification.isActive"},{type:"user",label:"Users",description:"Import user accounts and profiles",exampleFile:"/examples/import_users.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:null},{type:"contact",label:"Contacts",description:"Import contacts (external people, newsletter subscribers). Emails matching existing users are skipped.",exampleFile:"/examples/import_contacts.csv",file:null,isUploading:!1,status:null,lastImport:null,isOptional:!0,optionalMessage:"This step is optional. Contacts with emails matching existing users will be skipped."},{type:"user-role",label:"User Roles",description:"Assign roles to users in units",exampleFile:"/examples/import_user_roles.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:null},{type:"product",label:"Products",description:"Import products and services",exampleFile:"/examples/import_products.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"fees.isActive"},{type:"product-price",label:"Product Prices",description:"Import product pricing tiers",exampleFile:"/examples/import_product_prices.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"fees.isActive"},{type:"product-payment",label:"Product Payments",description:"Import payment history — products and price tiers are created or linked automatically by name",exampleFile:"/examples/import_product_payments.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"fees.isActive"},{type:"event",label:"Events",description:"Import events and activities",exampleFile:"/examples/import_events.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"events.isActive"},{type:"event-attend",label:"Event Attendance",description:"Import event attendance records",exampleFile:"/examples/import_event_attendance.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"events.isActive"},{type:"badge-user",label:"Badge Assignments",description:"Import user badge achievements",exampleFile:"/examples/import_badge_users.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"gamification.isActive"},{type:"company",label:"Companies",description:"Import companies/organizations with membership details",exampleFile:"/examples/import_companies.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"company.isActive"},{type:"company-user",label:"Company Members",description:"Assign users to companies with roles",exampleFile:"/examples/import_company_users.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:"company.isActive"},{type:"user-modify",label:"Modify Users",description:"Bulk-update existing users. Match by email, user_legacy_id, or phone_number. Empty cells leave the field unchanged. Unmatched rows fall back to creating a Contact when enough data is present.",exampleFile:"/examples/import_user_modify.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:null,isModify:!0},{type:"contact-modify",label:"Modify Contacts",description:"Bulk-update existing contacts. Match by email or phone. Empty cells leave the field unchanged. Unmatched rows fall back to creating a Contact when enough data is present.",exampleFile:"/examples/import_contact_modify.csv",file:null,isUploading:!1,status:null,lastImport:null,requiredFeature:null,isModify:!0}],allImports:[]}},computed:{...(0,Ae.L8)(["tenant"]),hasAnyImports(){return this.allImports&&this.allImports.length>0},completedCount(){return(this.allImports||[]).filter(e=>"completed"===e.status).length},ledgerGroups(){return qe},filteredImportSteps(){return this.importSteps.filter(e=>!e.requiredFeature||this.isFeatureActive(e.requiredFeature))}},created(){this.loadAllImports()},beforeUnmount(){this.stopPolling()},methods:{isFeatureActive(e){if(!this.tenant?.settingFeatures)return!1;const t=e.split(".");let s=this.tenant.settingFeatures;for(const i of t){if(void 0===s||null===s)return!1;s=s[i]}return!0===s},isRunning(e){return!!e.lastImport&&Ke.includes(e.lastImport.status)},stepState(e){const t=e.lastImport?.status;return"completed"===t?"completed":"failed"===t?"failed":"mapping"===t||Ke.includes(t)?"active":""},progressWidth(e){const t=Number(e?.progressPercentage)||0;return Math.min(100,Math.max(0,t))+"%"},startImport(e){e.file&&e.file.size>
1(0,Ue.pL)(e.file)?this.$buefy.toast.open({message:this.$t("File is larger than the {size} import limit",{size:(0,Ue.a7)(e.file)}),type:"is-danger",duration:5e3}):(e.isUploading=!0,(0,Ue.n0)(this.$http.plain,e.file,e.type).then(({mediaId:t})=>{const s={type:e.type,media_id:t};return this.usesWizard(e.type)&&(s.wizard=!0),this.$http.plain.post("/imports",s)}).then(t=>{const s=e.file?e.file.name:"";return e.file=null,e.lastImport=t.data,"mapping"===t.data.status?(e.status="mapping",void this.openMapping(t.data,s)):"converting"===t.data.status?(e.status="converting",e.convertingFileName=s,this.loadAllImports(),void this.startPolling()):(this.$buefy.toast.open({message:this.$t("Import started successfully"),type:"is-success"}),e.status="processing",this.loadAllImports(),void this.startPolling())}).catch(e=>{console.log(e);const t="upload_failed"===e?.message?this.$t("Upload failed"):e.response?.data?.error||this.$t("Import failed");this.$buefy.toast.open({message:t,type:"is-danger"})}).finally(()=>{e.isUploading=!1}))},usesWizard(e){return We.includes(e)},downloadTemplate(e){e.isDownloadingTemplate=!0,this.$http.plain.get("/imports/template/"+e.type,{responseType:"blob"}).then(t=>{const s=window.URL.createObjectURL(new Blob([t.data])),i=document.createElement("a");i.href=s,i.setAttribute("download",`import_${e.type}.csv`),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(s)}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Could not download the template"),type:"is-danger"})}).finally(()=>{e.isDownloadingTemplate=!1})},isMappingDraft(e){return!!e.lastImport&&"mapping"===e.lastImport.status},openMapping(e,t=""){this.mappingImport={id:e.id,type:e.type,fileName:t},this.isMappingModalActive=!0},closeMapping(){this.isMappingModalActive=!1,this.loadAllImports(!0)},onMappingStarted(){this.isMappingModalActive=!1,this.mappingImport=null,this.loadAllImports(),this.startPolling()},onMappingDiscarded(){this.isMappingModalActive=!1,this.mappingImport=null,this.loadAllImports()},confirmDiscardDraft(e){this.$buefy.dialog.confirm({title:this.$t("Discard import"),message:this.$t("The uploaded file and this mapping will be deleted. Nothing has been imported yet."),confirmText:this.$t("Discard"),cancelText:this.$t("Cancel"),type:"is-danger",hasIcon:!0,onConfirm:()=>this.discardDraft(e)})},discardDraft(e){this.isLoading=!0,this.$http.plain.delete(`/imports/${e.lastImport.id}`).then(()=>{e.lastImport=null,e.status=null,this.loadAllImports()}).catch(e=>{console.log(e),this.$buefy.toast.open({message:e.response?.data?.error||this.$t("Could not discard the import"),type:"is-danger"})}).finally(()=>{this.isLoading=!1})},loadAllImports(e=!1){e||(this.isLoadingHistory=!0),this.$http.plain.get("/imports").then(e=>{this.allImports=e.data["hydra:member"]||[],this.importSteps.forEach(e=>{const t=e.lastImport?.status,s=this.allImports.find(t=>t.type===e.type&&("completed"===t.status||Ke.includes(t.status)||"mapping"===t.status));s&&("converting"!==t||"mapping"!==s.status||this.isMappingModalActive||this.openMapping(s,e.convertingFileName||""),e.lastImport=s,e.status=s.status)});const t=this.hasActiveImports();t&&!this.pollingInterval?this.startPolling():!t&&this.pollingInterval&&this.stopPolling()}).catch(e=>{console.log(e)}).finally(()=>{e||(this.isLoadingHistory=!1)})},hasActiveImports(){return this.filteredImportSteps.some(e=>Ke.includes(e.status))},startPolling(){this.pollingInterval||(this.pollingInterval=setInterval(()=>{this.loadAllImports(!0)},3e3))},stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)},confirmRollback(e){const t=["user-modify","contact-modify"].includes(e.type),s=t?this.$t("Are you sure you want to rollback this import? Modified records will be restored to their values at the time of import, and any contacts created as fallbacks will be deleted. Note: if other imports or admins have changed these records since then, those changes will also be reverted to the snapshot."):this.$t("Are you sure you want to rollback this import? This will delete all imported data and cannot be undone.");this.$buefy.dialog.confirm({title:this.$t("Rollback Import"),message:s,confirmText:this.$t("Rollback"),
1cancelText:this.$t("Cancel"),type:"is-danger",hasIcon:!0,onConfirm:()=>this.rollbackImport(e.id)})},rollbackImport(e){this.isLoading=!0,this.$http.plain.post(`/imports/${e}/rollback`).then(()=>{this.$buefy.toast.open({message:this.$t("Import rolled back successfully"),type:"is-success"}),this.loadAllImports()}).catch(e=>{console.log(e),this.$buefy.toast.open({message:e.response?.data?.error||this.$t("Rollback failed"),type:"is-danger"})}).finally(()=>{this.isLoading=!1})},getStatusLabel(e){const t={converting:"Converting",mapping:"Mapping columns",preflight:"Checking",queued:"Queued",pending:"Pending",validating:"Validating",processing:"Processing",completed:"Completed",failed:"Failed",rolled_back:"Rolled Back"};return t[e]||e},statusTagClass(e){const t={converting:"is-info is-passive",mapping:"is-info is-passive",preflight:"is-info",queued:"is-info is-passive",pending:"is-default",validating:"is-info is-passive",processing:"is-warning is-passive",completed:"is-success",failed:"is-danger",rolled_back:"is-warning is-passive"};return t[e]||"is-default"},getTypeLabel(e){const t={"local-center":"Local Centers",unit:"Units",contact:"Contacts",role:"Roles","badge-type":"Badge Types",badge:"Badges",user:"Users","user-role":"User Roles",event:"Events","event-attend":"Event Attendance","badge-user":"Badge Assignments",company:"Companies","company-user":"Company Members","user-modify":"Modify Users","contact-modify":"Modify Contacts"};return t[e]||e},formatFileSize(e){if(0===e)return"0 Bytes";const t=1024,s=["Bytes","KB","MB","GB"],i=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,i)*100)/100+" "+s[i]},outcomeCounts(e){const t=e.successfulRows||0,s=e.updatedRows||0;return[{key:"created",label:"Created",icon:"fa-light fa-plus",tone:"has-text-success",value:Math.max(0,t-s)},{key:"updated",label:"Updated",icon:"fa-light fa-pen",tone:"has-text-info",value:s},{key:"skipped",label:"Skipped",icon:"fa-light fa-arrow-right",tone:"has-text-warning",value:e.skippedRows||0},{key:"failed",label:"Failed",icon:"fa-light fa-xmark",tone:"has-text-danger",value:e.failedRows||0},{key:"warnings",label:"Warnings",icon:"fa-light fa-triangle-exclamation",tone:"is-warning-soft",value:e.warningRows||0}]},hasLedgerRows(e){return(e.skippedRows||0)+(e.failedRows||0)+(e.warningRows||0)>0},hasRowsToFix(e){return(e.skippedRows||0)+(e.failedRows||0)>0},ledgerFilterKey(e){return this.ledgerFilters[e]||"all"},ledgerFilter(e){const t=qe.find(t=>t.key===this.ledgerFilterKey(e));return t?t.filter:null},ledgerGroupCount(e,t){const s={skipped:e.skippedRows||0,failed:e.failedRows||0,warnings:e.warningRows||0};return"all"===t?s.skipped+s.failed+s.warnings:s[t]||0},setLedgerFilter(e,t){this.ledgerFilters={...this.ledgerFilters,[e]:t}},isDownloadingExport(e,t){return this.downloadingExport===e+":"+t},downloadExport(e,t){this.downloadingExport=e.id+":"+t,this.$http.plain.get("/imports/"+e.id+"/logs/export",{params:{scope:t},responseType:"blob"}).then(s=>{const i=window.URL.createObjectURL(new Blob([s.data])),a=document.createElement("a");a.href=i,a.setAttribute("download",`import-${e.id}-${"fix"===t?"rows-to-fix":"ledger"}.csv`),document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(i)}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Could not download the file"),type:"is-danger"})}).finally(()=>{this.downloadingExport=null})},queueMessage(e){const t=e?.queuePosition;return Number.isInteger(t)?this.$t("Waiting: {n} ahead",{n:t}):this.$t("Waiting for another import to finish")}}},Ve=s(66262);const Ne=(0,Ve.A)(Qe,[["render",Pe],["__scopeId","data-v-d05fc0e2"]]);var je=Ne},95875:function(e,t,s){s.d(t,{A:function(){return I}});var i=s(20641),a=s(90033);const l={class:"import-ledger-table"},o={key:0,class:"import-ledger-table__loading","aria-hidden":"true"},n={key:1,class:"notification is-danger is-light import-ledger-table__error"},r={class:"import-ledger-table__error-message"},p={key:2,class:"list-empty-state import-ledger-table__empty"},d={class:"list-empty-state-message"},u={class:"import-ledger-list"},c={class:"import-ledger-list__head"},m={class:"import-ledger-list__row"},h={class:"import-ledger-list__reason"},g={key:0,class:"import-ledger-list__source orgo-table-wrap"},y={class:"table is-narrow import-ledger-list__table"},f=["title"];function v(e,t,s,v,_,b){const k=(0,i.g2)("b-skeleton"),w=(0,i.g2)("font-awesome-icon"),C=(0,i.g2)("b-button"),I=(0,i.g2)("b-tag"),E=(0,i.g2)("b-pagination");return(0,i.uX)(),(0,i.CE)("div",l,[_.isLoading?((0,i.uX)(),(0,i.CE)("div",o,[((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(3,e=>(0,i.bF)(k,{key:`import-ledger-skeleton-${e}`,height:"36px",animated:""})),64))])):_.loadError?((0,i.uX)(),(0,i.CE)("div",n,[(0,i.bF)(w,{icon:"fa-light fa-triangle-exclamation"}),(0,i.Lk)("span",r,(0,a.v_)(_.loadError),1),(0,i.bF)(C,{class:"is-rounded import-ledger-table__retry",size:"is-small",onClick:b.load},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Retry")),1)]),_:1},8,["onClick"])])):_.rows.length?((0,i.uX)(),(0,i.CE)(i.FK,{key:3},[(0,i.Lk)("ul",u,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(_.rows,t=>((0,i.uX)(),(0,i.CE)("li",{key:t.id,class:"import-ledger-list__item"},[(0,i.Lk)("div",c,[(0,i.Lk)("span",m,(0,a.v_)(b.rowLabel(t)),1),(0,i.bF)(I,{class:(0,a.C4)(["is-rounded is-small",b.outcomeTag
1Class(t.outcome)])},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t(b.outcomeLabel(t.outcome))),1)]),_:2},1032,["class"]),(0,i.Lk)("span",h,(0,a.v_)(t.errorMessage||"-"),1)]),b.sourceCells(t).length?((0,i.uX)(),(0,i.CE)("div",g,[(0,i.Lk)("table",y,[(0,i.Lk)("thead",null,[(0,i.Lk)("tr",null,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(b.sourceCells(t),e=>((0,i.uX)(),(0,i.CE)("th",{key:e.key},(0,a.v_)(e.label),1))),128))])]),(0,i.Lk)("tbody",null,[(0,i.Lk)("tr",null,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(b.sourceCells(t),e=>((0,i.uX)(),(0,i.CE)("td",{key:e.key,title:e.value},(0,a.v_)(e.value),9,f))),128))])])])])):(0,i.Q3)("",!0)]))),128))]),_.total>_.perPage?((0,i.uX)(),(0,i.Wv)(E,{key:0,class:"import-ledger-table__pagination",total:_.total,"per-page":_.perPage,current:_.page,"backend-pagination":"","pagination-rounded":"",size:"is-small",onChange:b.changePage},null,8,["total","per-page","current","onChange"])):(0,i.Q3)("",!0)],64)):((0,i.uX)(),(0,i.CE)("div",p,[(0,i.bF)(w,{icon:"fa-light fa-list-check",class:"list-empty-state-icon"}),(0,i.Lk)("p",d,(0,a.v_)(e.$t("No rows in this group")),1)]))])}s(44114),s(18111),s(22489),s(7588),s(61701);const _=20,b=["create","update"];var k={name:"ImportLedgerTable",props:{importId:{type:Number,required:!0},phase:{type:String,default:"run",validator:e=>["preflight","run"].includes(e)},filter:{type:Object,default:null},headers:{type:Array,default:null}},data(){return{perPage:_,rows:[],total:0,page:1,isLoading:!1,loadError:null,loadRequestId:0}},computed:{rawHeaders(){if(!this.showRawColumns)return[];if(this.headers&&this.headers.length)return this.headers;const e=[];return this.rows.forEach(t=>{Object.keys(t.rowData||{}).forEach(t=>{e.includes(t)||e.push(t)})}),e.map(e=>({key:e,raw:e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," ")}))},showRawColumns(){return!b.includes(this.filter?.outcome)}},watch:{importId(){this.reload()},phase(){this.reload()},filter:{deep:!0,handler(){this.reload()}}},created(){this.load()},methods:{reload(){this.page=1,this.load()},changePage(e){this.page=e,this.load()},load(){const e=++this.loadRequestId;this.isLoading=!0,this.loadError=null,this.$http.plain.get("/imports/"+this.importId+"/logs",{params:{page:this.page,phase:this.phase,...this.filter||{}}}).then(t=>{e===this.loadRequestId&&(this.rows=t.data["hydra:member"]||[],this.total=t.data["hydra:totalItems"]||0)}).catch(t=>{console.error(t),e===this.loadRequestId&&(this.rows=[],this.total=0,this.loadError=t.response?.data?.error||this.$t("Could not load these rows"))}).finally(()=>{e===this.loadRequestId&&(this.isLoading=!1)})},rowLabel(e){return e.rowNumber?this.$t("Row")+" "+e.rowNumber:this.$t("File")},sourceCells(e){return this.showRawColumns&&e.rowData?this.rawHeaders.map(t=>({key:t.key,label:t.raw,value:this.cellValue(e,t.key)})).filter(e=>"-"!==e.value):[]},cellValue(e,t){const s=e.rowData?e.rowData[t]:null;return null===s||void 0===s||""===s?"-":String(s)},outcomeLabel(e){const t={create:"Created",update:"Updated",skip:"Skipped",fail:"Failed",warning:"Warning"};return t[e]||e||"-"},outcomeTagClass(e){const t={create:"is-success",update:"is-success",skip:"is-warning",fail:"is-danger",warning:"is-warning is-passive"};return t[e]||"is-default"}}},w=s(66262);const C=(0,w.A)(k,[["render",v],["__scopeId","data-v-6f87ce32"]]);var I=C}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.