@ingestro/importer-react 4.9.5 → 4.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingestro/importer-react",
3
- "version": "4.9.5",
3
+ "version": "4.9.8",
4
4
  "homepage": "https://docs.ingestro.com",
5
5
  "peerDependencies": {
6
6
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -1 +1 @@
1
- import{A as i,B as r,w as o,x as t,y as m,z as n}from"../../chunk-YNRGLIVA.js";import"../../chunk-FJK35UW2.js";import"../../chunk-LROANN4K.js";import"../../chunk-REPANPD5.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import{expose as e}from"comlink";var p=()=>!0;e({check:p,getValues:r,addToAllRows:o,joinWithoutColumns:t,joinOnColumns:m,appendToColumns:n,countMatching:i});
1
+ import{A as m,B as n,C as i,D as r,y as o,z as t}from"../../chunk-OJ6BFZRM.js";import"../../chunk-POKDA5JR.js";import"../../chunk-OVVPTSKA.js";import"../../chunk-REPANPD5.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import{expose as e}from"comlink";var p=()=>!0;e({check:p,getValues:r,addToAllRows:o,joinWithoutColumns:t,joinOnColumns:m,appendToColumns:n,countMatching:i});
@@ -1 +1 @@
1
- import{A as n,C as m,D as s,F as h,M as v,r as e,s as t,t as r,y as o,z as c}from"../../chunk-LROANN4K.js";import"../../chunk-3IKZH76S.js";import{expose as S}from"comlink";var p=()=>!0;S({convertCsv2Sheet:e,convertExcel2Sheet:m,convertJson2Sheet:r,convertXLS2Sheet:o,convertXML2Sheet:c,jsonParser:t,parseDateFormat:v,convertPdf2Sheets:n,convertNumbers2Sheet:s,buildXmlTree:h,check:p});
1
+ import{A as n,B as m,C as s,E as h,L as v,r as e,s as t,t as r,y as o,z as c}from"../../chunk-OVVPTSKA.js";import"../../chunk-3IKZH76S.js";import{expose as S}from"comlink";var p=()=>!0;S({convertCsv2Sheet:e,convertExcel2Sheet:m,convertJson2Sheet:r,convertXLS2Sheet:o,convertXML2Sheet:c,jsonParser:t,parseDateFormat:v,convertPdf2Sheets:n,convertNumbers2Sheet:s,buildXmlTree:h,check:p});
@@ -1 +1 @@
1
- import{e as o,h as e}from"../../chunk-ET4YM2J3.js";import"../../chunk-FJK35UW2.js";import"../../chunk-LROANN4K.js";import"../../chunk-REPANPD5.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import*as m from"comlink";var r=()=>!0;m.expose({check:r,getCountBySearchValue:o,getRowsToRemove:e});
1
+ import{e as o,h as e}from"../../chunk-JR3GQV5Y.js";import"../../chunk-POKDA5JR.js";import"../../chunk-OVVPTSKA.js";import"../../chunk-REPANPD5.js";import"../../chunk-J5WOZVPO.js";import"../../chunk-3IKZH76S.js";import*as m from"comlink";var r=()=>!0;m.expose({check:r,getCountBySearchValue:o,getRowsToRemove:e});
package/chunk-FJK35UW2.js DELETED
@@ -1 +0,0 @@
1
- import{K as T,M as _,a as Z,b as J,c as j,d as ee,e as te,f as re,h as ie,l as oe,m as f}from"./chunk-LROANN4K.js";import{a as d,c as l,f as F,h as A}from"./chunk-REPANPD5.js";import{a as g}from"./chunk-J5WOZVPO.js";var N=class{constructor({validation:e,regex:t,fields:i,errorMessage:o,operator:n,value:s}){this.getValidation=()=>this.validation;this.getRegex=()=>this.regex;this.getFields=()=>this.fields;this.getErrorMessage=()=>this.errorMessage;this.getOperator=()=>this.operator;this.getValue=()=>this.value;this.serialize=()=>({validation:this.getValidation(),fields:this.getFields(),regex:this.getRegex(),errorMessage:this.getErrorMessage(),operator:this.getOperator(),value:this.getValue()});this.validation=e,this.regex=t,this.fields=i??[],this.errorMessage=o,this.operator=n,this.value=s}},Pt=N;var h=class r{constructor({description:e,key:t,example:i,label:o,type:n,validators:s,mappingValidation:a,alternativeMatches:p,columnSize:u,creator:m,baseKey:y,baseKeyCounter:E,outputFormat:M,inputFormat:b,numberFormat:x,hidden:S,disabled:O,optionMappingConfiguration:P,columnWidth:R,excludeFromAutoMatching:I}){this.getDescription=()=>this.description;this.getKey=()=>this.key;this.getExample=()=>this.example;this.getLabel=()=>this.label;this.setLabel=e=>{this.label=e};this.getType=()=>this.type;this.getOutputFormat=()=>r.getOutputFormat(this.outputFormat);this.getInputFormat=()=>this.inputFormat;this.getDeclaredInputFormat=()=>this.declaredInputFormat;this.setInputFormat=e=>{this.inputFormat=e};this.dateFormatPromptResolved=null;this.setDateFormatPromptResolved=e=>{this.dateFormatPromptResolved=e};this.getDateFormatPromptResolved=()=>this.dateFormatPromptResolved;this.resetSessionInputFormat=()=>{this.inputFormat=this.declaredInputFormat,this.dateFormatPromptResolved=null};this.getValidators=()=>this.validators;this.getColumnSize=()=>this.columnSize;this.getColumnWidth=()=>this.columnWidth;this.getIsRequired=()=>!!this.validators.find(t=>t.getValidation()==="REQUIRED");this.getIsUnique=()=>!!this.validators.find(t=>t.getValidation()==="UNIQUE");this.getIsUniqueAndRequired=()=>this.getIsRequired()===!0&&this.getIsUnique()===!0;this.hasMappingValidation=()=>!!(this.mappingValidation&&this.mappingValidation.logic&&this.mappingValidation.logic.trim().length>0);this.getMappingValidation=()=>this.mappingValidation||void 0;this.getAlternativeMatches=()=>this.alternativeMatches.filter(e=>!!e);this.getCreator=()=>this.creator;this.getBaseKey=()=>this.baseKey;this.getBaseKeyCounter=()=>this.baseKeyCounter;this.setCustomKey=({key:e,baseKey:t,baseKeyCounter:i,creator:o})=>{this.baseKey=t,this.key=e,this.baseKeyCounter=i,this.creator=o};this.isDropdown=()=>r.isTypeDropdown(this.getType());this.isCategoryType=()=>r.isTypeCategory(this.getType());this.isBooleanType=()=>this.type==="boolean";this.serialize=()=>({description:this.getDescription(),example:this.getExample(),key:this.getKey(),label:this.getLabel(),type:this.getType(),validators:[],alternativeMatches:this.getAlternativeMatches(),columnSize:this.getColumnSize(),columnWidth:this.getColumnWidth(),outputFormat:this.getOutputFormat(),inputFormat:this.getInputFormat(),isMultiSelection:this.getIsMultiSelection(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration(),excludeFromAutoMatching:this.isExcludedFromAutoMatching()});this.getIsMultiSelection=()=>!1;this.getNumberFormat=()=>this.numberFormat;this.isDisabled=()=>this.disabled;this.isNumeric=()=>this.type==="int"||this.type==="float"||this.type==="currency_eur"||this.type==="currency_usd"||this.type==="percentage";this.isCurrency=()=>this.type==="currency_eur"||this.type==="currency_usd";this.baseClone=()=>{let e=this.serialize(),t=new r({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,validators:this.getValidators(),alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,columnWidth:e.columnWidth,baseKey:e.baseKey,baseKeyCounter:e.baseKeyCounter,creator:e.creator,numberFormat:e.numberFormat,outputFormat:e.outputFormat,inputFormat:this.declaredInputFormat,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration,excludeFromAutoMatching:e.excludeFromAutoMatching});return t.setInputFormat(this.inputFormat),t.setDateFormatPromptResolved(this.dateFormatPromptResolved),t};this.isHidden=()=>this.hidden;this.isExcludedFromAutoMatching=()=>this.excludeFromAutoMatching;this.getOptionMappingConfiguration=()=>this.optionMappingConfiguration;this.description=e,this.key=t,this.example=i,this.label=o,this.type=n,this.validators=s??[],this.mappingValidation=a,this.alternativeMatches=p?[...p.filter(c=>c!==o&&c!==t)?.map(c=>c?.toString())]:[],this.columnSize=u,this.creator=m,this.baseKey=y||t,this.baseKeyCounter=E||0,this.outputFormat=M||"",this.declaredInputFormat=b??null,this.inputFormat=b??null,this.numberFormat=x||"eu",this.hidden=S??!1,this.disabled=O??!1,this.optionMappingConfiguration=P,this.columnWidth=R,this.excludeFromAutoMatching=I??!1}static{this.getOutputFormat=e=>(e||"DD.MM.YYYY").replace(/d/g,"D").replace(/e|E/g,"")}static{this.isTypeDropdown=e=>r.isTypeCategory(e)||e==="boolean"}static{this.isTypeCategory=e=>e==="single-select"||e==="currency_code"||e==="country_code_alpha_2"||e==="country_code_alpha_3"}};import{isNil as G,escapeRegExp as xt,isArray as St}from"lodash";var V=()=>g.getInstance().getTruthyWords(),H=()=>g.getInstance().getFalsyWords(),Yt=()=>g.getInstance().getBooleanOptionToRender(),wt=[...V(),...H()];import{isArray as Se,isNil as Oe,isObject as Pe}from"lodash";var L=class{constructor(){this.parse=(e,t)=>Oe(e)||Se(e)||Pe(e)?null:V().includes(`${e}`.toLowerCase())?!0:H().includes(`${e}`.toLowerCase())?!1:e===""?null:`${e}`}},se=L;import{isArray as ae,isBoolean as le,isNil as pe,isObject as ue}from"lodash";var Y=class{constructor(){this.parseSingle=(e,t)=>pe(e)||ue(e)||ae(e)?null:le(e)?JSON.stringify(e):A({value:e,dataModel:t.dataModel,isTrim:!0});this.parseMultiple=(e,t)=>ae(e)?e.map(i=>A({value:i,dataModel:t.dataModel,isTrim:!0})):pe(e)||ue(e)||e===""?null:le(e)?[JSON.stringify(e)]:[A({value:e,dataModel:t.dataModel,isTrim:!0})];this.parse=(e,t)=>t.dataModel.getIsMultiSelection()&&!t.forceSingle?this.parseMultiple(e,t):this.parseSingle(e,t)}},me=Y;import{isArray as Re,isBoolean as Ie,isNil as Fe,isObject as _e}from"lodash";var w=class{constructor(){this.parse=(e,t)=>{if(Fe(e)||Re(e)||_e(e))return null;if(Ie(e))return JSON.stringify(e);if(e==="")return null;if(typeof e=="number"){let i=`${e}`;return l(d.isScientificNotation(i)?d.expandScientificNotation(i):i)}return l(`${e}`)}}},de=w;import{isArray as Ne,isBoolean as Ue,isNil as Ve,isObject as He}from"lodash";var X=class{constructor(){this.parse=(e,t)=>Ve(e)?null:Ue(e)?e?"1":"0":He(e)||Ne(e)||e===""||l(e)===null?null:this.valueParser(e,t)}},D=X;var k=class extends D{constructor(){super(...arguments);this.valueParser=(t,i)=>{let o=d.convertStringToNumber(t,{format:i?.numberFormat});return o===null?l(`${t}`):Number(o)}}},ye=k;var v=class extends D{constructor(){super(...arguments);this.valueParser=(t,i)=>{let o=d.convertStringToNumber(t,{format:i?.numberFormat});return o===null?l(`${t}`):Number(o)}}},ce=v;import{isArray as Le,isBoolean as Ye,isNil as we,isNumber as Xe,isObject as ke}from"lodash";var $=class{constructor(){this.parse=(e,t)=>{if(we(e)||ke(e)||Le(e))return null;if(Ye(e))return JSON.stringify(e);if(Xe(e))return e;if(e===""||l(e)===null)return null;let i=d.convertStringToNumber(e,{adornment:"percentage"});return i===null?l(`${e}`):Number(i)}}},Me=$;import{isArray as ve,isBoolean as $e,isNil as We,isObject as Ke}from"lodash";var W=class{constructor(){this.parse=(e,t)=>{if(We(e)||ve(e)||Ke(e))return null;if($e(e))return JSON.stringify(e);if(e===""||l(e)===null)return null;let i=d.convertStringToNumber(e,{format:t?.numberFormat});return i===null?l(`${e}`):Number(i)}}},ge=W;var fe=["dd.MM.yyyy HH:mm","dd.MM.yyyy","dd/MM/yyyy HH:mm:ss","dd/MM/yyyy HH:mm","dd/MM/yyyy","dd-MM-yyyy HH:mm:ss","dd-MM-yyyy HH:mm","yyyy-MM-dd'T'HH:mm:ss","yyyy-MM-dd","yyyy-dd-MM","yyyy-MM-dd HH:mm:ss","dd-MM-yyyy","MM-dd-yyyy","MM/dd/yyyy","MM.dd.yyyy","yyyy/MM/dd","yyyyMMdd","dd MMM yyyy","dd MMMM yyyy","MM-dd-yyyy HH:mm:ss","MM/dd/yyyy HH:mm:ss","yyyy-MM-dd HH:mm","MM-dd-yyyy HH:mm","MM/dd/yyyy HH:mm","dd-MMM-yyyy","MMM yyyy","MMMM yyyy","MM/yyyy","M/yyyy","yyyy/MM","MM.yyyy","MM.yy","yyyy.MM","MM-yyyy","yyyy-MM","MMMM d, yyyy","MMM d, yyyy","MM dd yyyy","yyyy-MM-dd'T'HH:mm:ss.SSS","yyyy-MM-dd'T'HH:mm:ss.SSSxxx","yyyy.MM.dd","yyyy MM dd","yyyy/dd/MM","yyyy.dd.MM","dd yyyy MM","dd.yyyy.MM","dd-yyyy-MM","yyyy dd MM","MM yyyy dd","dd/yyyy/MM","MM/yyyy/dd"],Be=["dd.MM.yyyy","dd/MM/yyyy","dd-MM-yyyy","MM.dd.yyyy","MM/dd/yyyy","MM-dd-yyyy","yyyy.MM.dd","yyyy/MM/dd","yyyy-MM-dd","yyyy.dd.MM","yyyy/dd/MM","yyyy-dd-MM","dd MMM yyyy","dd MMMM yyyy","MMM dd, yyyy","MMMM dd, yyyy","MMM dd yyyy","yyyy MMM dd"],ze=["ddMMyyyy","MMddyyyy","yyyyMMdd"],Qe=[""," HH:mm"," HH:mm:ss"],Ge=["yyyy-MM-dd","yyyy-dd-MM"],qe=["'T'HH:mm:ss","'T'HH:mm:ss.SSS","'T'HH:mm:ss.SSSxxx"],Ze=[...Be.flatMap(r=>Qe.map(e=>`${r}${e}`)),...ze,...Ge.flatMap(r=>qe.map(e=>`${r}${e}`))],Je=new Set(fe),K=new Set([...fe,...Ze.filter(r=>!Je.has(r))]);var je={YYYY:"yyyy",YY:"yy",MMMM:"MMMM",MMM:"MMM",MM:"MM",M:"M",DD:"dd",D:"d",HH:"HH",H:"H",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"SSS",SS:"SS",S:"S",A:"a",a:"a",XXXXX:"XXXXX",XXXX:"XXXX",XXX:"XXX",XX:"XX",X:"X",xxxxx:"xxxxx",xxxx:"xxxx",xxx:"xxx",xx:"xx",x:"x",ZZ:"xxx",Z:"X"},he=r=>r.replace(/'/g,"''"),et=r=>{let e="",t=0;for(;t<r.length;){let i=r[t];if(i==="'"){t+=1;let o="";for(;t<r.length;)if(r[t]==="'")if(r[t+1]==="'")o+="'",t+=2;else{t+=1;break}else o+=r[t],t+=1;e+=`'${he(o)}'`;continue}if(i==="["){t+=1;let o="";for(;t<r.length;)if(r[t]==="]")if(r[t+1]==="]")o+="]",t+=2;else{t+=1;break}else o+=r[t],t+=1;e+=`'${he(o)}'`;continue}if(i==="T"){e+="'T'",t+=1;continue}if(/[A-Za-z]/.test(i)){let o=1;for(;r[t+o]===i;)o++;let n=r.slice(t,t+o);e+=je[n]??n,t+=o}else e+=i,t+=1}return e},Te=/^(yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|H|hh|h|mm|m|ss|s|SSS|SS|S|XXXXX|XXXX|XXX|XX|X|xxxxx|xxxx|xxx|xx|x|a)/,tt=new Set(["HH","H","hh","h","mm","m","ss","s","SSS","SS","S","a","XXXXX","XXXX","XXX","XX","X","xxxxx","xxxx","xxx","xx","x"]),rt=new Set(["MMM","MMMM"]),it=[".","/","-"," "],ot="",nt=r=>{let e=[],t=0;for(;t<r.length;){if(r[t]==="'"){t+=1;let n="'";for(;t<r.length;)if(r[t]==="'")if(r[t+1]==="'")n+="''",t+=2;else{n+="'",t+=1;break}else n+=r[t],t+=1;e.push({kind:"text",text:n});continue}let i=r.slice(t).match(Te);if(i){e.push({kind:"token",token:i[1]}),t+=i[1].length;continue}let o=r[t];for(t+=1;t<r.length&&!(r[t]==="'"||Te.test(r.slice(t)));)o+=r[t],t+=1;e.push({kind:"text",text:o})}return e},st=r=>{for(let e=0;e<r.length;e++){let t=r[e];if(t.kind!=="token"||!tt.has(t.token))continue;let i=e>0?r[e-1]:null;return i?.kind==="text"&&(/^[T\s]+$/.test(i.text)||i.text==="'T'")?e-1:e}return r.length},Ee=r=>{let e=nt(r);if(e.some(a=>a.kind==="token"&&rt.has(a.token)))return`exact:${r}`;let t=st(e),i=e.slice(0,t),o=e.slice(t),n="",s=!1;for(let a of i){if(a.kind==="token"){let p=a.token;p==="d"?p="dd":p==="M"?p="MM":p==="yy"&&(p="yyyy"),n+=p,s=!0;continue}s&&a.text.length===1&&it.includes(a.text)?n+=ot:n+=a.text,s=!1}for(let a of o)n+=a.kind==="token"?a.token:a.text;return n},B=null,at=()=>{if(B)return B;let r=new Set;for(let e of K){let t=Ee(e);t&&r.add(t)}return B=r,r},lt=r=>{if(!f(r))return!1;let e=et(r.trim());if(K.has(e))return!0;let t=Ee(e);return!t||t.startsWith("exact:")?!1:at().has(t)},Cr=r=>{if(!f(r))return null;let e=r.trim();return lt(e)?e:null},pt=({sourceRows:r,inputFormat:e})=>{let t=e.trim(),i=0,o=0;for(let n=0;n<r.length;n++){let s=r[n];oe(s)&&(o+=1,T(s.trim(),t)||(i+=1))}return{mismatchCount:i,totalCount:o}},xr=(r,e)=>{let t=e.trim();if(T(r,t))return!1;let i=r.trim();return/^\d{4}-\d{2}-\d{2}/.test(i)?!!(t.includes("/")||t.includes(".")&&!t.includes("/")):!1},Sr=({columnKey:r,sourceRows:e,inputFormat:t})=>{let{mismatchCount:i,totalCount:o}=pt({sourceRows:e,inputFormat:t});i!==0&&console.warn(`Ingestro: Column '${r}': ${i} of ${o} cells did not match inputFormat '${t.trim()}'.`)};import{parse as ut,format as mt}from"date-fns";import{isArray as dt,isBoolean as yt,isNil as ct,isObject as Mt}from"lodash";import C from"moment";var Ae=/([+-](?:0\d|1[0-4]):?[0-5]\d|Z)$/i,be=(r,e)=>{let o=!!r.match(Ae)?C.parseZone(r,e,!0):C(r,e,!0);return o.isValid()&&o.format(e)===r},z=class{constructor(){this.parse=(e,t)=>{if(ct(e)||dt(e)||Mt(e))return null;if(yt(e))return JSON.stringify(e);let i=t?.dataModel?.getType();if(!i)return l(`${e}`);if(typeof e=="string"){if(e==="")return null;try{if(t?.dataModel?.getType()==="date"){let o=t?.dataModel?.getOutputFormat(),n=t?.dataModel?.getInputFormat(),s=`${e}`,a=!1;if(f(n)&&!t?.skipDeclaredInputFormatNormalization){let y=ee(s);if(T(s,n)||y)y||(s=`${_([s],n)[0]}`),a=!0;else{let M=_([s],n)[0];if(M===s)return be(s,o)?s:l(s);s=`${M}`,a=!0}}if(!a&&be(s,o))return s;let m=!!s.match(Ae)?C.parseZone(s,j):C(s,J);if(m.isValid())return m.format(o);throw new Error("invalid date")}else{let o=te[i];if(!o)return l(`${e}`);let n=ut(e,Z,new Date);return mt(n,o)}}catch{let n=re[i];return n?l(ie(e,n)):l(`${e}`)}}else return l(`${e}`)}}},De=z;import{isArray as gt}from"lodash";var ft=new ye,ht=new ce,Tt=new ge,Et=new Me,bt=new se,At=new me,Dt=new de,Ct=new De,Q=class{static{this.parse=(e,t)=>{let i;switch(t?.dataModel?.getType()){case"int":i=ft;break;case"float":i=ht;break;case"boolean":i=bt;break;case"single-select":case"currency_code":case"country_code_alpha_2":case"country_code_alpha_3":i=At;break;case"percentage":i=Et;break;case"currency_eur":case"currency_usd":i=Tt;break;case"date":case"date_dmy":case"date_mdy":case"date_iso":case"datetime":case"time_hms":case"time_hms_24":case"time_hm":case"time_hm_24":i=Ct;break;case"email":case"url_www":case"url_https":case"url":case"phone":case"zip_code_de":case"bic":case"vat_eu":case"gtin":case"iban":default:i=Dt;break}return i.parse(e,t)}}static{this.parseRawValueToDisplayValue=(e,t)=>{let i=e;if(t.isNumeric)i=d.convertToFormat(e,{targetFormat:t.numberFormat||"eu",adornment:t.type==="percentage"?"percentage":void 0}),["currency_eur","currency_usd"].includes(t.type)&&(t.type==="currency_usd"?i=`$${i}`:i=`${i} \u20AC`);else if(t.type==="boolean"){let n=g.getInstance().getOptionsForReviewEntries().find(s=>`${s.value}`.includes(`${e}`));n&&(i=`${n.label}`)}else if(h.isTypeCategory(t.type))if(t.isMultiSelection){if(gt(e)){let o=t.options?.filter(n=>e.some(s=>F(n,s)));o&&(i=o.map(n=>n.label).join(", "))}}else{let o=t.options?.find(n=>F(n,e));o&&(i=`${o?.label}`)}return`${i}`}}static{this.parseDisplayValueToRawValue=(e,t)=>{if(t.isNumeric){let i=d.convertToUsWithDecimal(`${e}`,t.numberFormat??"eu");if(i===null)return e;let o=d.convertStringToNumber(i,{format:"us"});return o!==null?Number(o):e}else return e}}},Ce=Q;var ai=(r,e)=>Number(r).toLocaleString(e??"de-DE",{numberingSystem:"latn"}),Ot={ar:"ar-SA",he:"he-IL",de:"de-DE",en:"en-US",es:"es-ES",fr:"fr-FR",it:"it-IT",nl:"nl-NL",pl:"pl-PL",pt:"pt-PT",sv:"sv-SE",cz:"cs-CZ",dk:"da-DK",hu:"hu-HU",lt:"lt-LT",no:"nb-NO",ru:"ru-RU",sk:"sk-SK",zh:"zh-CN"},li=r=>r?Ot[r]??"de-DE":"de-DE",pi=(r,e)=>{let{value:t,isExact:i,columns:o,isEmptyValues:n}=e;if(n)return G(r)||r==="";if(St(r)&&o[0]?.isMultiSelection){let a=o[0],p=r.map(u=>{let m=a.options?.find(y=>`${y.value}`==`${u}`);return m?m.label:`${u}`}).join(", ");return i?p===t:p.toLowerCase().includes(t.toLowerCase())}let s=Ce.parseRawValueToDisplayValue(r,o[0]);return i&&!G(r)&&s===t?!0:!!(!i&&!G(r)&&s?.toLowerCase()?.includes(t?.toLowerCase()))},ui=(r,e,t,i)=>{let o=r.map(u=>{let m=i.options?.find(y=>`${y.value}`==`${u}`);return m?m.label:`${u}`}),n=e.split(",").map(u=>u.trim()).filter(Boolean);if(n.length===0)return r;let s=-1;for(let u=0;u<=o.length-n.length;u++){let m=!0;for(let y=0;y<n.length;y++)if(o[u+y].toLowerCase()!==n[y].toLowerCase()){m=!1;break}if(m){s=u;break}}if(s===-1)return r;let a=[...r.slice(0,s),...t,...r.slice(s+n.length)],p=new Set;return a.filter(u=>{let m=`${u}`;return p.has(m)?!1:(p.add(m),!0)})},mi=(r,e,t)=>{let i=new RegExp(xt(e),"gi");return`${r}`.replace(i,t)},di=r=>typeof r=="string"?r.replace(/(\r\n|\n|\r)/gm,""):r,yi=(r,e)=>e?e.map((t,i)=>r.map(o=>({rowIndex:i,valid:!0,key:o.key,value:t[o.key]}))):[];var q=class r extends h{constructor({description:t,key:i,example:o,label:n,type:s,options:a,validators:p,alternativeMatches:u,columnSize:m,isMultiSelection:y,allowCustomOptions:E,allowedCustomOptionTypes:M,preserveUnmappedOptions:b,creator:x,baseKey:S,baseKeyCounter:O,hidden:P,optionMappingConfiguration:R,...I}){super({description:t,key:i,example:o,label:n,type:s,validators:p,alternativeMatches:u,columnSize:m,creator:x,baseKey:S,baseKeyCounter:O,hidden:P,optionMappingConfiguration:R,...I});this.optionTypeMap=null;this.getOptions=()=>this.options;this.getOptionTypeMap=()=>{if(!this.optionTypeMap){this.optionTypeMap=new Map;for(let t=0;t<this.options.length;t++){let i=this.options[t];this.optionTypeMap.set(i.value,i.type??"string")}}return this.optionTypeMap};this.setOptions=t=>{this.options=t,this.optionTypeMap=null};this.serialize=()=>{let t={description:this.getDescription(),example:this.getExample(),isRequired:this.getIsRequired(),key:this.getKey(),label:this.getLabel(),type:this.getType(),validators:this.getValidators().map(o=>o.serialize()),alternativeMatches:this.getAlternativeMatches(),columnSize:this.getColumnSize(),columnWidth:this.getColumnWidth(),outputFormat:this.getOutputFormat(),inputFormat:this.getInputFormat(),numberFormat:this.getNumberFormat(),baseKey:this.getBaseKey(),baseKeyCounter:this.getBaseKeyCounter(),creator:this.getCreator(),hidden:this.isHidden(),disabled:this.isDisabled(),optionMappingConfiguration:this.getOptionMappingConfiguration(),excludeFromAutoMatching:this.isExcludedFromAutoMatching()},i=this.getOptions();return{...t,options:i,isMultiSelection:this.isMultiSelection,allowCustomOptions:this.allowCustomOptions,allowedCustomOptionTypes:this.allowedCustomOptionTypes?[...this.allowedCustomOptionTypes]:void 0,preserveUnmappedOptions:this.preserveUnmappedOptions}};this.getIsMultiSelection=()=>this.isMultiSelection;this.getAllowCustomOptions=()=>this.allowCustomOptions;this.getAllowedCustomOptionTypes=()=>this.allowedCustomOptionTypes?[...this.allowedCustomOptionTypes]:void 0;this.getPreserveUnmappedOptions=()=>this.preserveUnmappedOptions;this.options=a?.map(c=>({...c,baseKey:c?.baseKey||c.value,baseKeyCounter:c.baseKeyCounter||0,alternativeMatches:c.alternativeMatches.filter(xe=>xe!==c.label),validations:c.validations||[]})),this.isMultiSelection=y,this.allowCustomOptions=E,this.allowedCustomOptionTypes=M?[...M]:void 0,this.preserveUnmappedOptions=b}clone(){let t=this.serialize();return new r({description:t.description,example:t.example,key:t.key,label:t.label,type:t.type,options:t.options,validators:this.getValidators(),alternativeMatches:t.alternativeMatches,columnSize:t.columnSize,columnWidth:t.columnWidth,isMultiSelection:t.isMultiSelection,allowCustomOptions:t.allowCustomOptions,allowedCustomOptionTypes:t.allowedCustomOptionTypes,preserveUnmappedOptions:t.preserveUnmappedOptions,hidden:t.hidden,disabled:t.disabled,optionMappingConfiguration:t.optionMappingConfiguration,excludeFromAutoMatching:t.excludeFromAutoMatching})}},Ti=q;export{V as a,H as b,Yt as c,wt as d,Cr as e,xr as f,Sr as g,Pt as h,h as i,Ce as j,ai as k,li as l,pi as m,ui as n,mi as o,di as p,yi as q,Ti as r};
package/chunk-YNRGLIVA.js DELETED
@@ -1 +0,0 @@
1
- import{d as se,i as q,j as g,r as J}from"./chunk-FJK35UW2.js";import{G as pe,H as j,I as Y,K as W,L as H,M as $,b as ie,c as le,d as S,k as ue,l as p,m as M,n as _,u as me,v as de,w as E,x as he}from"./chunk-LROANN4K.js";import{b as D}from"./chunk-REPANPD5.js";import{isEmpty as He,uniq as $e}from"lodash";var ce=0,G=class{constructor({sheet:e,columnKey:t,rows:r,id:n,label:a,refJoinSheetColum:s,parserDateFormat:i}){this.removed=!1;this.label="";this.dateInputFormatSamples=null;this.parsedDateSamplesByInputFormat=new Map;this.getColumnKey=()=>this.columnKey;this.getId=()=>this.id;this.getSheet=()=>this.sheet;this.getRows=()=>this.rows;this.getUniqueRows=()=>(this.uniques===void 0&&(this.uniques=$e(this.getRows())),this.uniques);this.remove=()=>{this.removed=!0};this.unRemove=()=>{this.removed=!1};this.isRemoved=()=>this.removed;this.getType=()=>0;this.getFileName=()=>this.sheet.getSheetFileName();this.toJSON=()=>({columnKey:this.columnKey,id:this.id,rows:this.rows,type:this.getType()});this.equal=e=>this.getId()===e.getId();this.keyEqual=e=>this.columnKey===e.columnKey;this.setIndex=e=>{this.index=e};this.getIndex=()=>this.index;this.normalizeInputFormatKey=e=>{let t=typeof e=="string"?e.trim():"";return t!==""?t:null};this.dateInputFormatCacheKey=e=>this.normalizeInputFormatKey(e)??"\0auto";this.needsDateFormatParse=e=>!this.parsedDateSamplesByInputFormat.has(this.dateInputFormatCacheKey(e));this.hasParsedDateForInputFormat=e=>!this.needsDateFormatParse(e);this.getParsedDateSamplesForInputFormat=e=>this.parsedDateSamplesByInputFormat.get(this.dateInputFormatCacheKey(e));this.getDateInputFormatSamples=()=>this.dateInputFormatSamples??this.rows;this.getParserDateFormat=()=>this.parserDateFormat;this.applyDateInputFormatParse=(e,t)=>{let r=this.getDateInputFormatSamples();if(e.length!==r.length)throw new Error(`SheetColumn.applyDateInputFormatParse: parsed sample count (${e.length}) must match source sample count (${r.length}) for column "${this.columnKey}".`);this.parsedDateSamplesByInputFormat.set(this.dateInputFormatCacheKey(t),e)};this.getRefJoinSheetColum=()=>this.refJoinSheetColum;this.columnKey=t.trim(),this.sheet=e,Object.defineProperty(this,"sheet",{value:e,enumerable:!1,writable:!0,configurable:!0}),this.rows=He(r)?[""]:r,this.dateInputFormatSamples=[...this.rows],typeof n>"u"?(ce++,this.id=`${t}-${ce}`):this.id=n,a&&(this.label=a),i&&(this.parserDateFormat=i),Object.defineProperty(this,"refJoinSheetColum",{value:s,enumerable:!1,writable:!0,configurable:!0})}setRows(e){this.rows=e,this.uniques=void 0}},C=G;var Q=class extends C{constructor({sheet:t,sheetColumns:r,rows:n,id:a,columnKey:s}){super({columnKey:s,rows:n,sheet:t,id:a});this.getType=()=>1;this.getJoinedSheetColumns=()=>this.sheetColumns;this.toJSON=()=>({columnKey:this.columnKey,id:this.id,rows:this.rows,sheetColumns:this.sheetColumns.map(t=>t.toJSON()),type:this.getType()});this.sheetColumns=r}},fe=Q;var ge=["?",",","@"];import{isNaN as Ke,minBy as Ue,isString as Le,isEqual as Be,isEmpty as ye,isNil as ze}from"lodash";var ee=class{constructor({sheets:e,filename:t,type:r,fileSize:n}){this.globalNumberFormat="eu";this.columnsNumberFormat=[];this.needsConfiguration=!1;this.pendingXmlConfigKey=null;this.pendingXmlConfig=null;this.sourceXml=null;this.sourcePdfFile=null;this.pdfDocument=null;this.selectedPdfTableIds=null;this.keepSheetSelection=!1;this.addSheet=e=>{this.sheets.push(e)};this.setNeedsConfiguration=e=>{this.needsConfiguration=e};this.getNeedsConfiguration=()=>this.needsConfiguration;this.setPendingXmlConfigKey=e=>{this.pendingXmlConfigKey=e};this.getPendingXmlConfigKey=()=>this.pendingXmlConfigKey;this.setPendingXmlConfig=e=>{this.pendingXmlConfig=e};this.getPendingXmlConfig=()=>this.pendingXmlConfig;this.setSourceXml=e=>{this.sourceXml=e};this.getSourceXml=()=>this.sourceXml;this.setSourcePdfFile=e=>{this.sourcePdfFile=e};this.getSourcePdfFile=()=>this.sourcePdfFile;this.setPdfDocument=e=>{this.pdfDocument=e};this.getPdfDocument=()=>this.pdfDocument;this.setSelectedPdfTableIds=e=>{this.selectedPdfTableIds=e};this.getSelectedPdfTableIds=()=>this.selectedPdfTableIds;this.setKeepSheetSelection=e=>{this.keepSheetSelection=e};this.getKeepSheetSelection=()=>this.keepSheetSelection;this.replaceSheets=e=>{let t=this.needsConfiguration||!!this.pendingXmlConfigKey||!!this.pendingXmlConfig||!!this.sourceXml,r=!!this.sourcePdfFile||!!this.pdfDocument;this.sheets=e,this.sheets.forEach(n=>{n.setSpreadSheet(this)}),this.needsConfiguration=!1,this.pendingXmlConfigKey=null,t?this.keepSheetSelection=!0:r||(this.pendingXmlConfig=null,this.sourceXml=null),r&&(this.keepSheetSelection=!0)};this.isSelected=()=>{for(let e=0;e<this.sheets.length;e++)if(this.sheets[e].isSelected())return!0;return!1};this.getSheets=()=>this.sheets;this.getSelectedSheets=()=>this.sheets.filter(e=>e.isSelected());this.getFilename=()=>this.filename;this.selectAllSheet=e=>this.sheets.forEach(t=>{t.setSelected(e)});this.getType=()=>this.type;this.setType=e=>{this.type=e};this.getFileSize=()=>{let e=this.fileSize/1e6;return Number(parseFloat(`${e}`).toFixed(4))};this.sheets=e,this.filename=t,this.type=r,this.fileSize=n??0,this.sheets.forEach(a=>{a.setSpreadSheet(this)})}setNumberFormat(e){this.globalNumberFormat=e.global,this.columnsNumberFormat=e.columns}getNumberFormat(){return{global:this.globalNumberFormat,columns:this.columnsNumberFormat}}},Se=ee;var Je={dmy:"D/M/YYYY",us:"M/D/YY",de:"DD.MM.YYYY"},Ce=(o,e)=>o?de(o,E(e)):void 0,Fe=o=>{let e=E(o);return e==="os"?me():Je[e]},Nt=({data:o,excelDateCells:e,columnDateFormats:t,maxRow:r=50,maxCol:n=300})=>{let a=Math.min(o.length,r),s=o.slice(0,a).map(i=>i.slice(0,n));return he(s,e,i=>E(t?.[i]))};var Me=0,te=class{constructor({data:e,name:t,isNotSetColumn:r,id:n,columnDateFormats:a,excelDateCells:s}){this.selected=!1;this.isManualSelectHeader=!1;this.columns=[];this.columnsInitialized=!1;this.headerRowIndex=0;this.transposed=!1;this.headerRowIndexes=[];this.addedColumns=[];this.usedSourceCells=new Set;this.mergedHeadersActive=!1;this.mergedRowsBackup=null;this.availableRows=null;this.spreadSheet=new Se({filename:"",sheets:[],type:"xlsx",fileSize:0});this.getId=()=>this.id;this.setSpreadSheet=e=>{this.spreadSheet=e};this.getSpreadSheet=()=>this.spreadSheet;this.setSelected=e=>{this.selected=e};this.isSelected=()=>this.selected;this.setHeaderRowIndex=e=>{this.headerRowIndex=e,this.columnsInitialized=!1,this.mergedHeadersActive||(this.headerRowIndexes=[e])};this.setTransposed=e=>{this.transposed=e};this.getTransposed=()=>this.transposed;this.setHeaderRowIndexes=e=>{this.headerRowIndexes=[...e]};this.getHeaderRowIndexes=()=>this.headerRowIndexes.length>0?this.headerRowIndexes:[this.headerRowIndex];this.addAddedColumn=e=>{if(this.addedColumns.push(e),e.sourceCell){let n=`${e.sourceCell.row},${e.sourceCell.col}`;this.usedSourceCells.add(n)}let t=this.data[this.headerRowIndex],r=this.data.length>0?Math.max(...this.data.map(n=>n.length)):0;t&&t.push(e.columnName);for(let n=0;n<this.data.length;n++)if(n!==this.headerRowIndex){for(;this.data[n].length<r;)this.data[n].push("");n<this.headerRowIndex?this.data[n].push(""):this.data[n].push(e.value)}this.setColumns()};this.removeAddedColumn=e=>{let r=(this.data[this.headerRowIndex]?.length||0)-this.addedColumns.length,n=e-r;if(n<0||n>=this.addedColumns.length)return;let a=this.addedColumns[n];if(a?.sourceCell){let s=`${a.sourceCell.row},${a.sourceCell.col}`;this.usedSourceCells.delete(s)}for(let s=0;s<this.data.length;s++)this.data[s].splice(e,1);this.addedColumns.splice(n,1),this.setColumns()};this.removeColumnFromData=e=>{if(!(e<0)){for(let t=0;t<this.data.length;t++)this.data[t].length>e&&this.data[t].splice(e,1);this.columnDateFormats=void 0,this.excelDateCells=void 0}};this.clearAddedColumns=()=>{if(this.addedColumns.length>0){let t=(this.data[this.headerRowIndex]?.length||0)-this.addedColumns.length;for(let r=this.addedColumns.length-1;r>=0;r--){let n=t+r;for(let a=0;a<this.data.length;a++)this.data[a].length>n&&this.data[a].splice(n,1)}}this.addedColumns=[],this.usedSourceCells.clear(),this.setColumns()};this.isSourceCellUsed=(e,t)=>{let r=`${e},${t}`;return this.usedSourceCells.has(r)};this.getAddedColumnBySourceCell=(e,t)=>this.addedColumns.find(r=>r.sourceCell&&r.sourceCell.row===e&&r.sourceCell.col===t);this.getAddedColumns=()=>this.addedColumns;this.setMergedHeadersActive=e=>{this.mergedHeadersActive=e};this.isMergedHeadersActive=()=>this.mergedHeadersActive;this.setMergedRowsBackup=e=>{this.mergedRowsBackup=e};this.getMergedRowsBackup=()=>this.mergedRowsBackup;this.setAvailableRows=e=>{this.availableRows=e};this.getAvailableRows=()=>this.availableRows;this.isLoneWhitelistCharacter=e=>{let t=e.toString()?.trim()??"";return ge.some(r=>t===r)};this.isSignificantCell=e=>!ye(e)&&!this.isLoneWhitelistCharacter(e);this.collapseAdjacentDuplicates=e=>e.filter((t,r)=>r===0||`${t}`!=`${e[r-1]}`);this.getSignificantCells=e=>{let t=(e??[]).filter(this.isSignificantCell);return this.collapseAdjacentDuplicates(t)};this.getDataTransform=()=>this.data.map((e,t)=>({data:e,index:t,length:this.getSignificantCells(e).length}));this.getMaxLengthColumns=()=>this.getDataTransform().reduce((t,r)=>Math.max(t,r.length),0);this.isHeaderLikeCell=e=>!se.includes(Le(e)?e.toLowerCase():e)&&Ke(Number(e));this.countHeaderLikeCells=e=>this.getSignificantCells(e).filter(this.isHeaderLikeCell).length;this.setHeaderByAutoDetection=()=>{let t=this.getMaxLengthColumns(),r=this.getDataTransform().slice(0,50).filter(a=>a.length===t&&this.countHeaderLikeCells(a.data)===t),n=r.length===1?r[0].index:Ue(r,a=>a.length)?.index??0;this.setHeaderRowIndex(n)};this.getHeaderRowIndex=()=>this.headerRowIndex;this.getHeaderRow=()=>this.data[this.headerRowIndex]?.filter(e=>!!e);this.getColumns=()=>(this.ensureColumnsBuilt(),this.columns.filter(e=>!e.isRemoved()));this.getSortedColumns=()=>[...this.getColumns()].sort((e,t)=>D(e.getColumnKey())<D(t.getColumnKey())?-1:D(e.getColumnKey())>D(t.getColumnKey())?1:0);this.getColumnsWithRemoved=()=>(this.ensureColumnsBuilt(),this.columns.filter(e=>e.getType()!==1));this.getColumn=(e,t)=>(this.ensureColumnsBuilt(),this.columns.find(r=>t?D(r.getColumnKey())===D(`${e}`):r.getColumnKey()===e));this.getColumnsByKey=(e,t)=>(this.ensureColumnsBuilt(),this.columns.filter(r=>t?D(r.getColumnKey())===D(`${e}`):r.getColumnKey()===e));this.getValues=()=>{let e=this.data.filter((r,n)=>n>this.headerRowIndex);if(ye(e))return[[]];let t=[];for(let r=0;r<e.length;r++){let n=[];for(let a=0;a<this.data[this.headerRowIndex].length;a++)ze(this.data[this.headerRowIndex][a])||n.push(this.parseValue(e[r][a]));t.push(n)}return t};this.getData=()=>this.data;this.getExcelDateCells=()=>this.excelDateCells;this.getColumnDateFormats=()=>this.columnDateFormats;this.getName=()=>this.name;this.getDisplayName=({t:e})=>{if(this.getName()?.length>0)return this.getName();switch(this.spreadSheet.getType()){case"json":return`${e("txt_default_sheet_prefix_name")} 1`;case"csv":return`${e("txt_default_sheet_prefix_name")} 1`;default:return""}};this.getSheetFileName=()=>`${this.spreadSheet.getFilename()}`;this.getIsManualSelectHeader=()=>this.isManualSelectHeader;this.setIsManualSelectHeader=()=>{this.isManualSelectHeader=!0};this.clearIsManualSelectHeader=()=>{this.isManualSelectHeader=!1};this.addColumn=e=>{this.ensureColumnsBuilt(),this.columns.push(new C({columnKey:`${e}`,sheet:this,rows:this.getRowsByColumnIndex(this.getColumnIndex(e))}))};this.removeColumn=e=>{this.ensureColumnsBuilt(),this.columns.find(t=>t.getColumnKey()===e)?.remove()};this.removeColumnByIndex=e=>{this.ensureColumnsBuilt(),this.columns.find((t,r)=>r===e)?.remove()};this.setData=e=>{this.data=e,this.columnDateFormats=void 0,this.excelDateCells=void 0};this.toJSON=()=>({name:this.name,id:this.id,type:this.getType(),values:this.getValues(),headerRow:this.getHeaderRow()});this.equal=e=>this.id===e.getId();this.getType=()=>0;this.getRowsByColumnIndex=e=>{if(e===-1)return[];let t=[],r=this.columnDateFormats?.[e];for(let n=0;n<this.data.length;n++){let a=this.data[n];if(n>this.headerRowIndex){let s=a[e]??"",i=Ce(this.excelDateCells?.[`${n},${e}`],r);t.push(i??this.parseValue(s))}}return t};this.getExcelDisplayInputFormat=e=>{if(!this.excelDateCells)return;let t=!1;for(let r=this.headerRowIndex+1;r<this.data.length;r++)if((this.data[r]?.[e]??"")!==""){if(!this.excelDateCells[`${r},${e}`])return;t=!0}return t?Fe(this.columnDateFormats?.[e]):void 0};this.ensureColumnsBuilt=()=>{this.columnsInitialized||this.setColumns()};this.setColumns=()=>{let e=this.data[this.headerRowIndex];if(e){let t=[];for(let r=0;r<e.length;++r){let n=e[r];n&&t.push(new C({columnKey:`${n}`,sheet:this,rows:this.getRowsByColumnIndex(r),parserDateFormat:this.columnDateFormats?.[r]??this.getExcelDisplayInputFormat(r)}))}this.columns=t}else this.columns=[];this.columnsInitialized=!0};this.getColumnIndex=e=>this.data[this.headerRowIndex].findIndex(n=>Be(`${n}`,`${e}`));this.parseValue=e=>typeof e=="string"?e.trim():e;this.data=e,this.name=t,this.columnDateFormats=a,this.excelDateCells=s,typeof n>"u"?(Me++,this.id=`${t}-${Me}`):this.id=n,this.columnsInitialized=!!r}},Ie=te;var re=class extends Ie{constructor({joinedData:t,sheets:r,mappings:n,mappingIndexes:a}){super({data:t.data,name:"join-sheet",isNotSetColumn:!0});this.sheets=[];this.joinHistory=[];this.findRefJoinSheetColumn=t=>{let r=this.sheets.length===2?this.sheets[0]:this,n=this.sheets[this.sheets.length-1];if(t<r.getColumns().length)return r.getColumns()[t];let a=t-r.getColumns().length;return n.getColumns().filter((s,i)=>this.joinHistory[this.joinHistory.length-1].mappingIndexes.every(l=>l.target!==i))[a]};this.setJoinColumns=(t,r)=>{let n=this.data[this.headerRowIndex];if(!n){this.columns=[];return}let a=[];for(let s=0;s<n.length;++s){let i=n[s],l=r.findIndex(u=>u.source===s),m=this.columns[s]&&this.columns[s].getType()===1;if(l>=0||m){let u=t[l],d;m&&l>=0?d=[...this.columns[s].getJoinedSheetColumns(),u.target]:m?d=this.columns[s].getJoinedSheetColumns():d=[u.source.getRefJoinSheetColum()??u.source,u.target],a.push(new fe({columnKey:`${i}`,sheetColumns:d,sheet:this,rows:this.getRowsByColumnIndex(s)}))}else{let u=this.columns[s]?this.columns[s].getRefJoinSheetColum()??this.columns[s]:this.findRefJoinSheetColumn(s);a.push(new C({columnKey:`${i}`,sheet:u.getSheet(),rows:this.getRowsByColumnIndex(s),refJoinSheetColum:u}))}}this.columns=a};this.getJoinedSheets=()=>this.sheets;this.getType=()=>1;this.joinSheet=(t,r,n,a)=>{this.setData(t.data),this.sheets.push(r),this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.setJoinColumns(n,a)};this.getJoinColumns=()=>this.columns.filter(t=>t.getType()===1);this.getJoinHistory=()=>this.joinHistory;this.headerRowIndex=0,this.joinHistory.push({mappingIndexes:a,type:t.type,row:t.data.length,col:this.data[this.headerRowIndex]?.length??0}),this.sheets=r,this.setJoinColumns(n,a)}},Bt=re;var xe=({rowA:o,rowB:e},t)=>t.every(r=>{let n=`${o[r.source]??""}`,a=`${e[r.target]??""}`;return n===a&&n!==""&&a!==""}),Xe=(o,e,t)=>{let r=[],n=o.headerRow,a=e.headerRow;for(let s=0;s<n.length;++s)r.push(n[s]);for(let s=0;s<a.length;++s)t.every(i=>i.target!==s)&&r.push(a[s]);return r},qt=async(o,e)=>{let t=o.values,r=e.values,n=o.headerRow,a=e.headerRow,s=[...n,...a],i=[];i.push(s);for(let l=0;l<t.length;++l)i.push([...t[l],...r[0]]);return{data:i,type:"ADD_TO_ALL_ROWS"}},Gt=async(o,e)=>{let t=o.values,r=e.values,n=o.headerRow,a=e.headerRow,s=[...n,...a],i=[];i.push(s);for(let l=0;l<t.length;++l)i.push([...t[l],...a.map(()=>"")]);for(let l=0;l<r.length;++l)i.push([...n.map(()=>""),...r[l]]);return{data:i,type:"JOIN_WITHOUT_COLUMNS"}},Zt=async(o,e,t)=>{let r=o.values,n=e.values,a=[],s=[],i={},l=Xe(o,e,t);a.push(l);for(let m=0;m<r.length;++m){let u=!1,d=r[m];for(let h=0;h<n.length;++h){let c=n[h];xe({rowA:d,rowB:c},t)&&(i[h]=!0,u=!0,a.push([...d,...c.filter((f,O)=>t.every(P=>P.target!==O))]))}u||s.push([...d,...e.headerRow.filter((h,c)=>t.every(f=>f.target!==c)).map(()=>"")])}for(let m=0;m<n.length;++m){if(i[m])continue;let u=n[m],d=o.headerRow.map(()=>"");t.forEach(h=>{d[h.source]=u[h.target]}),s.push([...d,...u.filter((h,c)=>t.every(f=>f.target!==c))])}return s.forEach(m=>{a.push(m)}),{data:a,type:"JOIN_ON_COLUMNS"}},Qt=async(o,e,t)=>{let r=e.headerRow.filter((i,l)=>t.every(m=>m.target!==l)),a=[[...o.headerRow,...r]];for(let i=0;i<o.values.length;++i){let l=[...o.values[i],...r.map(()=>"")];a.push(l)}let s=e.values;for(let i=0;i<s.length;++i){let l=o.headerRow.map(()=>""),m=[];for(let u=0;u<e.headerRow.length;++u){let d=t.find(h=>h.target===u);d?l[d.source]=s[i][u]:m.push(s[i][u])}a.push([...l,...m])}return{data:a,type:"APPEND_TO_COLUMNS"}},er=async(o,e,t)=>{let r=o.values,n=e.values,a=r.length+n.length,s=0,i={};for(let l=0;l<r.length;l++){let m=r[l],u=null,d=0;for(let h=0;h<n.length;h++){let c=n[h];if(xe({rowA:m,rowB:c},t)&&(u=h,d++,d===2))break}d===1&&u!==null&&(s+=1,i[u]=!0)}for(let l=0;l<n.length;l++)i[l]&&(s+=1);return{count:s,total:a}};import{isNil as pt}from"lodash";var Te=o=>o.some(e=>typeof e=="string"&&p(e)&&!S(e.trim())),F=o=>!Te(o)&&!o.some(e=>typeof e=="boolean"),I=o=>o.filter(e=>typeof e=="string"&&p(e)&&!S(e.trim())),je=(o,e)=>{let t=e?.trim();return t||(F(o),"")};var x=/T\d{1,2}:\d{2}(:\d{2})?(\.\d+)?/i,k=/\b\d{1,2}:\d{2}(:\d{2})?(\.\d+)?(\s*[AaPp][Mm])?\b/,We=/\s+\d{1,2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:\s*[AaPp][Mm])?(?:Z|[+-](?:[01]\d|2[0-3])(?::?[0-5]\d)?)?\s*$/i,K=/\b[AaPp][Mm]\b/,qe=/\d{1,2}:\d{2}:\d{2}\.(\d+)/;var U=o=>o.match(qe)?.[1]?.length??0,we=o=>o<=0||o>9?"":`.${"S".repeat(o)}`,b=o=>{let e=o.trim();return x.test(e)?e.split(/T/i)[0]??"":e.replace(We,"")};var Ge=/^\d{4}([/.\- ])\d{1,2}\1\d{1,2}$/,Ze=/^\d{1,2}([/.\- ])\d{1,2}\1(?:\d{2}|\d{4})$/;var be=o=>{let e=!1,t=!1;for(let r of o){if(typeof r!="string"||!p(r))continue;let n=b(r);if(Ge.test(n)){e=!0;continue}Ze.test(n)&&(t=!0)}return{sawYearFirst:e,sawDayOrMonthFirst:t}},T=o=>{let{sawYearFirst:e,sawDayOrMonthFirst:t}=be(o);return e&&!t},Re=o=>{let{sawYearFirst:e,sawDayOrMonthFirst:t}=be(o);return e&&t};var L=o=>o?"D":"DD",B=o=>o?"M":"MM";var et=o=>{let e=U(o),t=e>0||/\d{1,2}:\d{2}:\d{2}/.test(o),r=o.match(/(?:[T\s]|^)(\d{1,2}):\d{2}/i)?.[1]??"";return{isoT:x.test(o),seconds:t,fractionDigits:e,timezone:Y(o),meridiem:K.test(o),unpaddedHour:r.length===1,paddedHour:r.length===2&&r.startsWith("0")}},tt=(o,e)=>o.isoT===e.isoT&&o.seconds===e.seconds&&o.fractionDigits===e.fractionDigits&&o.timezone===e.timezone&&o.meridiem===e.meridiem;var rt=o=>{let e=[];for(let t of o){if(typeof t!="string"||!p(t))continue;let r=pe(b(t));r&&(e.includes(r)||e.push(r))}return e},y=o=>{let e=!1,t=!1,r=null,n=!1,a=!1;for(let s of o){if(typeof s!="string"||!p(s))continue;let i=s.trim();if(!(x.test(i)||k.test(i))){if(e=!0,t)return!0;continue}if(t=!0,e)return!0;let u=et(i);if(u.fractionDigits>9)return!0;if(u.unpaddedHour&&(n=!0),u.paddedHour&&(a=!0),!r){r=u;continue}if(!tt(r,u))return!0}return!!(n&&a)};var R=o=>{if(y(o))return"";let e=!1,t=!1,r=!1,n=!1,a=0,s=!1,i=!1;for(let c of o){if(typeof c!="string"||!p(c))continue;let f=c.trim(),O=x.test(f);if(!O&&!k.test(f))continue;e=!0,O&&(t=!0),K.test(f)&&(r=!0);let P=U(f);P>0?(n=!0,a=P):/\d{1,2}:\d{2}:\d{2}/.test(f)&&(n=!0),Y(f)&&(s=!0),(f.match(/(?:[T\s]|^)(\d{1,2}):\d{2}/i)?.[1]??"").length===1&&(i=!0)}if(!e)return"";let l=t?"[T]":" ",m=r?i?"h":"hh":i?"H":"HH",u=r?" A":"",d=we(a),h=s?"Z":"";return n?`${l}${m}:mm:ss${d}${u}${h}`:`${l}${m}:mm${u}${h}`},w=(o,e)=>{let t=o.trim();if(!t||/[Hh]/.test(t))return t;let r=R(e);return r?`${t}${r}`:t};var z=(o,e="",t={firstUnpadded:!1,secondUnpadded:!1})=>`YYYY${o}${B(t.firstUnpadded)}${o}${L(t.secondUnpadded)}${e}`,N=(o,e,t="",r="YYYY",n={firstUnpadded:!1,secondUnpadded:!1})=>`${o==="dM"?[L(n.firstUnpadded),B(n.secondUnpadded),r].join(e):[B(n.firstUnpadded),L(n.secondUnpadded),r].join(e)}${t}`,Ne=(o,e="",t="YYYY",r={firstUnpadded:!1,secondUnpadded:!1})=>({dayFirst:N("dM",o,e,t,r),monthFirst:N("Md",o,e,t,r)}),Ve=["/","-","."],ot=(o="",e="YYYY",t={firstUnpadded:!1,secondUnpadded:!1},r=Ve)=>{let n=[];for(let a of r){let{dayFirst:s,monthFirst:i}=Ne(a,o,e,t);n.push(s,i)}return n};var nt=o=>o.every(e=>typeof e!="number"&&(typeof e!="string"||!p(e))),V=({colType:o,inputFormat:e,samples:t,parserDateFormat:r})=>{if(!_(o))return null;if(M(e))return"configured";if(r?.trim())return"detected";if(F(t))return nt(t)?"detected":"undetected";let n=I(t);return y(n)||Re(n)?"undetected":T(n)?"detected":H(n)===null?"undetected":"detected"},at=o=>o.getDateFormatPromptResolved?.()??o.getDeclaredInputFormat?.(),oe=o=>o.getDateFormatPromptResolved?.()??(typeof o.getDeclaredInputFormat=="function"?o.getDeclaredInputFormat():o.getInputFormat()),st=o=>o.some(e=>{let t=e.matchedDataModel?.dataModel;return!t||!e.sheetColumn?!1:V({colType:t.getType(),inputFormat:oe(t),samples:e.sheetColumn.getDateInputFormatSamples(),parserDateFormat:e.sheetColumn.getParserDateFormat?.()})==="undetected"});var X={firstUnpadded:!1,secondUnpadded:!1},ve=({colType:o,inputFormat:e,samples:t,parserDateFormat:r})=>{let n=V({colType:o,inputFormat:e,samples:t,parserDateFormat:r}),a=I(t);if(n==="configured")return w((e??"").trim(),a);if(n!=="detected")return"";let s=r?.trim();if(s)return s;let i=R(a),l=j(a);if(T(a))return z(l,i,X);let m=H(a);return m!=="dM"&&m!=="Md"?"":N(m,l,i,"YYYY",X)},it=(o,e)=>{o.forEach(t=>{let r=t.matchedDataModel?.dataModel;if(!r?.setInputFormat||!t.sheetColumn)return;let n=r.getType(),a=oe(r),s=t.sheetColumn.getDateInputFormatSamples(),i=t.sheetColumn.getParserDateFormat?.(),l=I(s),m=V({colType:n,inputFormat:a,samples:s,parserDateFormat:i});if(!m)return;let u=e?.getChosenFormat?.(t)?.trim()||"",d=u||ve({colType:n,inputFormat:a,samples:s,parserDateFormat:i});if(!d&&m==="undetected"&&e?.fallbackUndetected&&!F(s)&&!y(l)){let h=j(l),c=R(l);d=T(l)?z(h,c,X):N("dM",h,c,"YYYY",X)}!u&&!M(a)&&F(s)&&!d||d&&r.setInputFormat(w(d,l))})};var lt=o=>{if(o==null)return"";if(typeof o=="object"&&!Array.isArray(o)&&"value"in o){let e=o.value;return typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:""}return typeof o=="string"||typeof o=="number"||typeof o=="boolean"?o:""},ut=(o,e)=>o.map(t=>({sheetColumn:{getDateInputFormatSamples:()=>e.map(r=>lt(r?.[t.getKey()]))},matchedDataModel:{dataModel:t}}));import Ae from"moment";var mt=5,Oe=o=>{let e=Ae(o,ie,!0);if(e.isValid())return e;let t=Ae.parseZone(o,le,!0);return t.isValid()?t:null},dt=(o,e)=>{if(!p(o))return null;let t=$([o],e)[0];if(typeof t!="string")return null;if(t===o||t===o.trim()){if(!S(t.trim()))return null;let n=Oe(t.trim());return n?{original:o,parsedMoment:n}:null}let r=Oe(t);return r?{original:o,parsedMoment:r}:null},ht=({samples:o,inputFormat:e,outputFormat:t,maxRows:r=mt})=>o.filter(a=>p(a)).slice(0,r).map(a=>{let s=dt(a,e);return s?{original:a,formatted:s.parsedMoment.format(t)}:{original:a,formatted:null}});var Pe=(o,e)=>{if(!_(e.getType()))return g.parse(o,{dataModel:e});if(ue(o))return null;let t=`${o}`,r=e.getInputFormat();if(M(r)){if(S(t))return g.parse(t,{dataModel:e});let n=r;if(!W(t,n)){let a=w(n,[t]);if(a!==n&&W(t,a))n=a;else return t}return g.parse($([t],n)[0],{dataModel:e})}return g.parse(t,{dataModel:e})};var ne=class{constructor({sheetColumn:e,matchedDataModel:t,detectedNumberFormats:r}){this.parseSheetValue=(e,t)=>t.dataModel.getType()==="date"?Pe(e,t.dataModel):g.parse(e,t);this.getOptionValue=(e,t)=>{if(!t)if(this.matchedDataModel.dataModel){let r=this.sheetColumn.columnKey,a=this.detectedNumberFormats.columns.find(s=>s.column===r)?.numberFormat||this.detectedNumberFormats.global;return this.parseSheetValue(e,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0,numberFormat:a})}else return e;for(let r=0;r<t.length;r++)if(`${t[r]?.sheetOption}`==`${e}`){let n=!pt(t[r]?.dataModelOptions)&&(t[r]?.dataModelOptions?.length??0)>0;if(t[r]?.autoPreserved===!0&&t[r]?.dataModelOption==null&&!n){if(this.matchedDataModel.dataModel instanceof J){let a=`${e}`,s=this.matchedDataModel.dataModel.getOptions().find(i=>i.label===a||i.value===a);if(s)return g.parse(s.value,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0})}return e}return this.matchedDataModel.dataModel&&this.matchedDataModel.dataModel.getIsMultiSelection()?g.parse(t[r]?.dataModelOptions,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):this.matchedDataModel.dataModel?g.parse(t[r]?.dataModelOption,{dataModel:this.matchedDataModel.dataModel,isParseFromSheet:!0}):t[r]?.dataModelOption}};this.getValues=()=>{let e=this.sheetColumn.rows,t=[];for(let r=0;r<e.length;r++){let n=e[r],a=this.getOptionValue(n,this.matchedOptions);t.push(a)}return t};if(this.sheetColumn=e,this.matchedDataModel=t,this.matchedOptions=void 0,this.detectedNumberFormats=r||{global:"eu",columns:[]},this.matchedDataModel.matchedOptions){this.matchedOptions=[];for(let n=0;n<(this.matchedDataModel.matchedOptions?.length??0);n++){let a=this.matchedDataModel.matchedOptions[n];this.matchedDataModel.dataModel?.getIsMultiSelection()?a.dataModelOptions&&this.matchedOptions.push(a):a.dataModelOption!==void 0&&a.dataModelOption!==null?this.matchedOptions.push(a):a.autoPreserved===!0&&!a.userCleared&&this.matchedOptions.push(a)}}}},_e=ne;var ae=class{constructor(e){this.matchedColumns=[];this.parseValues=()=>{let e=[];this.matchedColumns.forEach(t=>{let r=t.matchedDataModel,a=new _e({sheetColumn:t.sheetColumn,matchedDataModel:r,detectedNumberFormats:this.detectedNumberFormats}).getValues(),s=r.dataModel.getKey();a.forEach((i,l)=>{e[l]?e[l][s]=i:e[l]={[s]:i}})});for(let t=0;t<e.length;++t)for(let r=0;r<this.columns.length;++r){let a=this.columns[r].key;e[t][a]===void 0&&(e[t][a]=null)}return e};this.getValues=()=>(this.matchedColumns=[],this.matching.filter(t=>t.matchedDataModel?.dataModel).forEach(t=>{this.matchedColumns.push({sheetColumn:t.sheetColumn,matchedDataModel:t.matchedDataModel})}),this.parseValues());let{matching:t,detectedNumberFormats:r}=e;this.matching=t,this.detectedNumberFormats=r||{global:"eu",columns:[]},this.columns=e.columns??[]}},Ee=ae;var Oo=({matching:o,detectedNumberFormats:e,columns:t})=>new Ee({matching:o,detectedNumberFormats:e,columns:t}).getValues();import*as Ye from"comlink";var v=class{static{this.serialize=e=>e.serialize()}static{this.deSerialize=e=>q.isTypeCategory(e.type)?new J({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,options:e.options,validators:[],alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,isMultiSelection:e.isMultiSelection??!1,allowCustomOptions:e.allowCustomOptions,allowedCustomOptionTypes:e.allowedCustomOptionTypes,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration}):new q({description:e.description,example:e.example,key:e.key,label:e.label,type:e.type,validators:[],alternativeMatches:e.alternativeMatches,columnSize:e.columnSize,outputFormat:e.outputFormat,inputFormat:e.inputFormat,numberFormat:e.numberFormat,hidden:e.hidden,disabled:e.disabled,optionMappingConfiguration:e.optionMappingConfiguration})}};var A=class{static{this.serialize=e=>{let t={matching:[],detectedNumberFormats:e.detectedNumberFormats,columns:e.columns};return t.matching=e.matching.map(r=>({sheetColumn:r.sheetColumn,matchedDataModel:r.matchedDataModel?{dataModel:r.matchedDataModel.dataModel?v.serialize(r.matchedDataModel.dataModel):r.matchedDataModel.dataModel,matchedOptions:r.matchedDataModel.matchedOptions}:r.matchedDataModel})),[t,[]]}}static{this.deserialize=e=>({matching:e.matching.map(t=>({sheetColumn:t.sheetColumn,matchedDataModel:t.matchedDataModel?{dataModel:t.matchedDataModel.dataModel?v.deSerialize(t.matchedDataModel.dataModel):t.matchedDataModel.dataModel,matchedOptions:t.matchedDataModel.matchedOptions}:t.matchedDataModel})),detectedNumberFormats:e.detectedNumberFormats,columns:e.columns})}};Ye.transferHandlers.set("Matching",{canHandle:o=>!!(o!==null&&typeof o=="object"&&o.matching),serialize:o=>A.serialize(o),deserialize:o=>A.deserialize(o)});export{C as a,Se as b,Nt as c,Ie as d,I as e,je as f,T as g,rt as h,y as i,R as j,z as k,Ne as l,Ve as m,ot as n,V as o,at as p,st as q,ve as r,it as s,ut as t,ht as u,Bt as v,qt as w,Gt as x,Zt as y,Qt as z,er as A,Oo as B,v as C};