@updog/data-editor 0.1.74 → 0.1.75
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/index.d.ts +40 -28
- package/index.js +722 -688
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4721,57 +4721,17 @@ var Rs = "backend", zs = "manual", Bs = class {
|
|
|
4721
4721
|
for (let r of n) if (e[r] !== t[r]) return !1;
|
|
4722
4722
|
return !0;
|
|
4723
4723
|
}
|
|
4724
|
-
}, Ks =
|
|
4725
|
-
function Js(e) {
|
|
4726
|
-
return e.map((e) => {
|
|
4727
|
-
let t = e.validators;
|
|
4728
|
-
if (!t?.some((e) => Ks(e) || qs(e))) return e;
|
|
4729
|
-
let n = t.filter(Ks);
|
|
4730
|
-
n.length > 1 && console.warn(`[updog] column "${e.id}" declares ${n.length} { type: "unique" } validators; using the first, ignoring the rest.`);
|
|
4731
|
-
let r = t.filter(qs), i = {
|
|
4732
|
-
...e,
|
|
4733
|
-
validators: t.filter((e) => !Ks(e) && !qs(e))
|
|
4734
|
-
}, [a] = n;
|
|
4735
|
-
return a && (i.uniqueConfig = {
|
|
4736
|
-
...a.message !== void 0 && { message: a.message },
|
|
4737
|
-
...a.fn !== void 0 && { fn: a.fn }
|
|
4738
|
-
}), r.length > 0 && (i.asyncConfig = r), i;
|
|
4739
|
-
});
|
|
4740
|
-
}
|
|
4741
|
-
function Ys(e) {
|
|
4742
|
-
return e.uniqueConfig !== void 0;
|
|
4743
|
-
}
|
|
4744
|
-
function Xs(e) {
|
|
4745
|
-
return e.some((e) => e.asyncConfig !== void 0 || e.uniqueConfig?.fn !== void 0);
|
|
4746
|
-
}
|
|
4747
|
-
function Zs(e) {
|
|
4748
|
-
return e.map((e) => {
|
|
4749
|
-
let { uniqueConfig: t, asyncConfig: n, ...r } = e;
|
|
4750
|
-
if (!t && !n) return e;
|
|
4751
|
-
let i = [...r.validators ?? []];
|
|
4752
|
-
return t && i.push({
|
|
4753
|
-
type: "unique",
|
|
4754
|
-
...t.message !== void 0 && { message: t.message },
|
|
4755
|
-
...t.fn !== void 0 && { fn: t.fn }
|
|
4756
|
-
}), n && i.push(...n), {
|
|
4757
|
-
...r,
|
|
4758
|
-
validators: i
|
|
4759
|
-
};
|
|
4760
|
-
});
|
|
4761
|
-
}
|
|
4762
|
-
//#endregion
|
|
4763
|
-
//#region src/core/spawnWorker.ts
|
|
4764
|
-
var Qs = {
|
|
4724
|
+
}, Ks = {
|
|
4765
4725
|
filter: "\"use strict\";(()=>{var m=[],b=[],E=[],A=new Uint32Array(0),F=new Uint8Array(0),x=new Uint32Array(0),k=new Uint8Array(0),B=[],O=new Set,U=[],S=[],oe=new Set,ae=new Set,o=2,M=self;self.addEventListener(\"message\",I=>{let e=I.data;switch(e.type){case\"APPEND\":{let t=m.length,n=e.rowIds.length,s=t+n,d=new Uint32Array(s*o);d.set(A),d.set(e.errorBitmask,t*o),A=d;let a=new Uint8Array(s);a.set(F),a.set(e.newFlags,t),F=a;let u=new Uint32Array(s*o);u.set(x),u.set(e.editedBitmask,t*o),x=u;let w=new Uint8Array(s);w.set(k),w.set(e.deletedFlags,t),k=w;for(let f=0;f<n;f++)U[e.rowIds[f]]=t+f,m.push(e.rowIds[f]),b.push(e.rowTexts[f]),E.push(e.rowRawTexts[f]),B.push(e.sourceIds[f]);break}case\"UPDATE_TEXT\":{let t=U[e.rowId];t!==void 0&&(b[t]=e.rowText,E[t]=e.rowRawText);break}case\"UPDATE_TEXT_BATCH\":{for(let t=0;t<e.rowIds.length;t++){let n=U[e.rowIds[t]];n!==void 0&&(b[n]=e.rowTexts[t],E[n]=e.rowRawTexts[t])}break}case\"DELETE\":{let t=new Set;for(let r of e.rowIds){let g=U[r];g!==void 0&&(t.add(g),U[r]=void 0)}if(t.size===0)break;let n=m.length-t.size,s=[],d=[],a=[],u=new Uint32Array(n*o),w=new Uint8Array(n),f=new Uint32Array(n*o),L=new Uint8Array(n),D=[],h=[],y=0;for(let r=0;r<m.length;r++)if(!t.has(r)){s[y]=m[r],d[y]=b[r],a[y]=E[r];for(let g=0;g<o;g++)u[y*o+g]=A[r*o+g],f[y*o+g]=x[r*o+g];w[y]=F[r],L[y]=k[r],D[y]=B[r],h[m[r]]=y,y++}m=s,b=d,E=a,A=u,F=w,x=f,k=L,B=D,U=h;break}case\"INSERT\":{let t=e.positions.length;if(t===0)break;let n=m.length+t,s=new Array(n),d=new Array(n),a=new Array(n),u=new Uint32Array(n*o),w=new Uint8Array(n),f=new Uint32Array(n*o),L=new Uint8Array(n),D=new Array(n);U=[];let h=0,y=0;for(let r=0;r<n;r++){if(h<t&&e.positions[h]===r){s[r]=e.rowIds[h],d[r]=e.rowTexts[h],a[r]=e.rowRawTexts[h];for(let g=0;g<o;g++)u[r*o+g]=e.errorBitmask[h*o+g],f[r*o+g]=e.editedBitmask[h*o+g];w[r]=e.newFlags[h],D[r]=e.sourceIds[h],h++}else{s[r]=m[y],d[r]=b[y],a[r]=E[y];for(let g=0;g<o;g++)u[r*o+g]=A[y*o+g],f[r*o+g]=x[y*o+g];w[r]=F[y],L[r]=k[y],D[r]=B[y],y++}U[s[r]]=r}m=s,b=d,E=a,A=u,F=w,x=f,k=L,B=D;break}case\"UPDATE_SOURCE_VIS\":{e.isVisible?O.delete(e.sourceId):O.add(e.sourceId);break}case\"SET_ALL_FLAGS\":{A=e.errorBitmask,F=e.newFlags,x=e.editedBitmask,k=e.deletedFlags;break}case\"SET_FIELD_ORDER\":{let t=o;if(S=e.fieldOrder,o=e.wordsPerRow,oe=new Set(e.formatterFieldIndices??[]),ae=new Set(e.multiselectFieldIndices??[]),o>t&&m.length>0){let n=m.length,s=new Uint32Array(n*o),d=new Uint32Array(n*o);for(let a=0;a<n;a++)for(let u=0;u<t;u++)s[a*o+u]=A[a*t+u],d[a*o+u]=x[a*t+u];A=s,x=d}break}case\"FILTER\":{try{M.postMessage(we(e.filters,e.generation,e.sort,e.selectedErrorRowIds,e.misplacedRowIds))}catch{M.postMessage({type:\"RESULT\",filteredIds:null,baseFilteredIds:null,generation:e.generation})}break}case\"SORT_ALL\":{try{let t=Z([...m],e.sort);M.postMessage({type:\"SORT_RESULT\",sortedIds:t,generation:e.generation})}catch{M.postMessage({type:\"SORT_RESULT\",sortedIds:[...m],generation:e.generation})}break}case\"DEBUG_DUMP\":{let t={};for(let n=0;n<m.length;n++)t[m[n]]=n;M.postMessage({type:\"DEBUG_DUMP_RESULT\",rowIds:[...m],rowIndexMap:t,rowTextsLen:b.length,rowRawTextsLen:E.length,sourceIdsLen:B.length,errorBitmaskLen:A.length,newFlagsLen:F.length,editedBitmaskLen:x.length,deletedFlagsLen:k.length,wordsPerRow:o,fieldOrder:[...S],hiddenSourceIds:[...O]});break}case\"CLEAR\":{m=[],b=[],E=[],A=new Uint32Array(0),F=new Uint8Array(0),x=new Uint32Array(0),k=new Uint8Array(0),B=[],O.clear(),U=[];break}}});function ue(I,e,t){if(S.length===0)return I;let n=[],s=0,d=1;for(;d<I.length;){let a=I.indexOf(\"\\0\",d);if(a===-1)break;s<S.length&&e.has(S[s])&&n.push(I.substring(d,a)),s++,d=a+1}return n.length===0?\"\":t?\"\\0\"+n.join(\"\\0\")+\"\\0\":n.join(\" \")}function $(I,e){let t=0,n=1;for(;n<I.length;){let s=I.indexOf(\"\\0\",n);if(s===-1)break;if(t===e)return I.substring(n,s);t++,n=s+1}return\"\"}function Y(I,e){return $(oe.has(e)?E[I]:b[I],e)}function fe(I){let e=I.direction===\"asc\"?1:-1;switch(I.sortType){case\"number\":return(t,n)=>{let s=parseFloat(t),d=parseFloat(n),a=t===\"\"||Number.isNaN(s),u=n===\"\"||Number.isNaN(d);return a&&u?0:a?1:u?-1:(s-d)*e};case\"date\":return(t,n)=>!t&&!n?0:t?n?t<n?-1*e:t>n?1*e:0:-1:1;default:{let t=new Intl.Collator(I.locales,{numeric:!0,sensitivity:\"variant\"});return(n,s)=>!n&&!s?0:n?s?t.compare(n,s)*e:-1:1}}}function Z(I,e){let t=e.sortType!==\"text\",n=fe(e),s=I.length,d=new Array(s);for(let w=0;w<s;w++){let f=U[I[w]];f!==void 0&&(d[w]=t?Y(f,e.fieldIdx):$(b[f],e.fieldIdx))}let a=Array.from({length:s},(w,f)=>f);a.sort((w,f)=>n(d[w],d[f]));let u=new Array(s);for(let w=0;w<s;w++)u[w]=I[a[w]];return u}function we(I,e,t,n,s){let{search:d,matchCase:a,matchEntireCell:u,errorMessageFilters:w,showOnlyNewRows:f,showOnlyEditedRows:L,showOnlyEmptyCells:D,showOnlyMisplacedRows:h,showOnlyDeletedRows:y,filterColumns:r,columnValueFilters:g,columnRangeFilters:le,columnDateRangeFilters:de}=I,N=a?d.trim():d.toLowerCase().trim(),_=!!N,W=w.length>0,ee=f||L,v=D,V=h,te=n?new Set(n):null,ne=s?new Set(s):null,G=[];for(let[l,i]of Object.entries(g))if(i.length>0){let c=S.indexOf(l);c!==-1&&G.push({fieldIdx:c,allowed:new Set(i)})}let j=G.length>0,H=[];for(let[l,i]of Object.entries(le))if(i.min!==void 0||i.max!==void 0){let c=S.indexOf(l);c!==-1&&H.push({fieldIdx:c,...i})}let X=H.length>0,z=[];for(let[l,i]of Object.entries(de))if(i.min!==void 0||i.max!==void 0){let c=S.indexOf(l);c!==-1&&z.push({fieldIdx:c,...i})}let q=z.length>0,J=O.size>0,re=k.some(l=>l),P=new Uint32Array(o);if(r)for(let l of r){let i=S.indexOf(l);if(i>=0){let c=i>>>5;c<o&&(P[c]|=1<<(i&31))}}else P.fill(4294967295);let se=_||W||ee||v||V||J||j||X||q||y||re;if(!se&&!t)return{type:\"RESULT\",filteredIds:null,baseFilteredIds:null,generation:e};if(!se&&t){let l=Z([...m],t);return{type:\"RESULT\",filteredIds:l,baseFilteredIds:l,generation:e}}let ce=_&&!u?N.split(/\\s+/):[],K=[],Q=W?[]:K,ie=_&&r?new Set(r):null;for(let l=0;l<m.length;l++){if(y){if(!k[l])continue}else if(k[l])continue;if(!(J&&O.has(B[l]))&&!(f&&!F[l])){if(L){let i=!1,c=l*o;for(let T=0;T<o;T++)if(x[c+T]&P[T]){i=!0;break}if(!i)continue}if(!(V&&!(ne&&ne.has(m[l])))){if(v){let i=!1,c=0,T=1,R=b[l];for(;T<R.length&&c<S.length;){let p=R.indexOf(\"\\0\",T);if(p===-1)break;let C=c>>>5;if(C<o&&P[C]&1<<(c&31)&&T===p){i=!0;break}c++,T=p+1}if(!i)continue}if(j){let i=!0;for(let{fieldIdx:c,allowed:T}of G){let R=$(b[l],c);if(!(ae.has(c)?R.split(\"\").some(C=>T.has(C)):T.has(R))){i=!1;break}}if(!i)continue}if(X){let i=!0;for(let{fieldIdx:c,min:T,max:R}of H){let p=Number(Y(l,c));if(!Number.isFinite(p)){i=!1;break}if(T!==void 0&&p<T){i=!1;break}if(R!==void 0&&p>R){i=!1;break}}if(!i)continue}if(q){let i=!0;for(let{fieldIdx:c,min:T,max:R}of z){let p=Y(l,c);if(!p){i=!1;break}if(T!==void 0&&p<T){i=!1;break}if(R!==void 0&&p>R){i=!1;break}}if(!i)continue}if(_){let i=a?b[l]:b[l].toLowerCase(),c=ie?ue(i,ie,u):i;if(u){if(!c.includes(\"\\0\"+N+\"\\0\"))continue}else{let T=!0;for(let R of ce)if(!c.includes(R)){T=!1;break}if(!T)continue}}K.push(m[l]),W&&te&&te.has(m[l])&&Q.push(m[l])}}}return{type:\"RESULT\",filteredIds:t?Z(Q,t):Q,baseFilteredIds:_||ee||v||V||J||j||X||q||re?K:null,generation:e}}})();\n",
|
|
4766
4726
|
chatTransform: "\"use strict\";(()=>{function T(n){let{ops:s,rows:a,fields:d}=n,i={};for(let[t,e]of Object.entries(n.ctx.opts))i[t]=new Set(e);let r={opts:i},f=[],g=[];for(let t of s)try{let e=new Function(\"return \"+t.fn)();g.push({action:t.action,fn:e})}catch(e){f.push(`Failed to compile ${t.action} op: ${e instanceof Error?e.message:String(e)}`)}let c=new Map,w=[];for(let[t,e]of a){let l={...e},m=!1;for(let o of g)if(o.action===\"delete\")try{if(o.fn(l,r)){m=!0;break}}catch{}else try{o.fn(l,r)}catch{}if(m){w.push(t);continue}for(let o of d){let y=e[o],u=l[o];if(u!==y){let p=c.get(o);p||(p=[],c.set(o,p)),p.push([t,y,u])}}}let R=[];for(let[t,e]of c)R.push({field:t,changes:e});return{deltas:R,deleteIds:w,errors:f}}var h=self;self.addEventListener(\"message\",n=>{try{let{ops:s,ctx:a,rows:d,fields:i}=n.data,r=T({ops:s,ctx:a,rows:d,fields:i});h.postMessage({type:\"RESULT\",deltas:r.deltas,deleteIds:r.deleteIds,errors:r.errors})}catch(s){h.postMessage({type:\"ERROR\",message:s instanceof Error?s.message:\"Transform worker error\"})}});})();\n",
|
|
4767
4727
|
parseText: "\"use strict\";(()=>{var Xx=Object.create;var yx=Object.defineProperty;var Yx=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var x0=(e,x)=>()=>(x||e((x={exports:{}}).exports,x),x.exports);var re=(e,x,t,a)=>{if(x&&typeof x==\"object\"||typeof x==\"function\")for(let f of xe(x))!te.call(e,f)&&f!==t&&yx(e,f,{get:()=>x[f],enumerable:!(a=Yx(x,f))||a.enumerable});return e};var wx=(e,x,t)=>(t=e!=null?Xx(ee(e)):{},re(x||!e||!e.__esModule?yx(t,\"default\",{value:e,enumerable:!0}):t,e));var Ex=x0((D0,F0)=>{((e,x)=>{typeof define==\"function\"&&define.amd?define([],x):typeof F0==\"object\"&&typeof D0<\"u\"?F0.exports=x():e.Papa=x()})(D0,function e(){var x=typeof self<\"u\"?self:typeof window<\"u\"?window:x!==void 0?x:{},t,a=!x.document&&!!x.postMessage,f=x.IS_PAPA_WORKER||!1,s={},d=0,i={};function h(r){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine=\"\",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(n){var c=B0(n);c.chunkSize=parseInt(c.chunkSize),n.step||n.chunk||(c.chunkSize=null),this._handle=new bx(c),(this._handle.streamer=this)._config=c}.call(this,r),this.parseChunk=function(n,c){var u=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<u){let m=this._config.newline;m||(o=this._config.quoteChar||'\"',m=this._handle.guessLineEndings(n,o)),n=[...n.split(m).slice(u)].join(m)}this.isFirstChunk&&C(this._config.beforeFirstChunk)&&(o=this._config.beforeFirstChunk(n))!==void 0&&(n=o),this.isFirstChunk=!1,this._halted=!1;var u=this._partialLine+n,o=(this._partialLine=\"\",this._handle.parse(u,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(n=o.meta.cursor,u=(this._finished||(this._partialLine=u.substring(n-this._baseIndex),this._baseIndex=n),o&&o.data&&(this._rowCount+=o.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),f)x.postMessage({results:o,workerId:i.WORKER_ID,finished:u});else if(C(this._config.chunk)&&!c){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=o=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!u||!C(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),u||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(n){C(this._config.error)?this._config.error(n):f&&this._config.error&&x.postMessage({workerId:i.WORKER_ID,error:n,finished:!1})}}function g(r){var n;(r=r||{}).chunkSize||(r.chunkSize=i.RemoteChunkSize),h.call(this,r),this._nextChunk=a?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(c){this._input=c,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(n=new XMLHttpRequest,this._config.withCredentials&&(n.withCredentials=this._config.withCredentials),a||(n.onload=s0(this._chunkLoaded,this),n.onerror=s0(this._chunkError,this)),n.open(this._config.downloadRequestBody?\"POST\":\"GET\",this._input,!a),this._config.downloadRequestHeaders){var c,u=this._config.downloadRequestHeaders;for(c in u)n.setRequestHeader(c,u[c])}var o;this._config.chunkSize&&(o=this._start+this._config.chunkSize-1,n.setRequestHeader(\"Range\",\"bytes=\"+this._start+\"-\"+o));try{n.send(this._config.downloadRequestBody)}catch(m){this._chunkError(m.message)}a&&n.status===0&&this._chunkError()}},this._chunkLoaded=function(){n.readyState===4&&(n.status<200||400<=n.status?this._chunkError():(this._start+=this._config.chunkSize||n.responseText.length,this._finished=!this._config.chunkSize||this._start>=(c=>(c=c.getResponseHeader(\"Content-Range\"))!==null?parseInt(c.substring(c.lastIndexOf(\"/\")+1)):-1)(n),this.parseChunk(n.responseText)))},this._chunkError=function(c){c=n.statusText||c,this._sendError(new Error(c))}}function G(r){(r=r||{}).chunkSize||(r.chunkSize=i.LocalChunkSize),h.call(this,r);var n,c,u=typeof FileReader<\"u\";this.stream=function(o){this._input=o,c=o.slice||o.webkitSlice||o.mozSlice,u?((n=new FileReader).onload=s0(this._chunkLoaded,this),n.onerror=s0(this._chunkError,this)):n=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var o=this._input,m=(this._config.chunkSize&&(m=Math.min(this._start+this._config.chunkSize,this._input.size),o=c.call(o,this._start,m)),n.readAsText(o,this._config.encoding));u||this._chunkLoaded({target:{result:m}})},this._chunkLoaded=function(o){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(o.target.result)},this._chunkError=function(){this._sendError(n.error)}}function e0(r){var n;h.call(this,r=r||{}),this.stream=function(c){return n=c,this._nextChunk()},this._nextChunk=function(){var c,u;if(!this._finished)return c=this._config.chunkSize,n=c?(u=n.substring(0,c),n.substring(c)):(u=n,\"\"),this._finished=!n,this.parseChunk(u)}}function S0(r){h.call(this,r=r||{});var n=[],c=!0,u=!1;this.pause=function(){h.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){h.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(o){this._input=o,this._input.on(\"data\",this._streamData),this._input.on(\"end\",this._streamEnd),this._input.on(\"error\",this._streamError)},this._checkIsFinished=function(){u&&n.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),n.length?this.parseChunk(n.shift()):c=!0},this._streamData=s0(function(o){try{n.push(typeof o==\"string\"?o:o.toString(this._config.encoding)),c&&(c=!1,this._checkIsFinished(),this.parseChunk(n.shift()))}catch(m){this._streamError(m)}},this),this._streamError=s0(function(o){this._streamCleanUp(),this._sendError(o)},this),this._streamEnd=s0(function(){this._streamCleanUp(),u=!0,this._streamData(\"\")},this),this._streamCleanUp=s0(function(){this._input.removeListener(\"data\",this._streamData),this._input.removeListener(\"end\",this._streamEnd),this._input.removeListener(\"error\",this._streamError)},this)}function bx(r){var n,c,u,o,m=Math.pow(2,53),M=-m,H=/^\\s*-?(\\d+\\.?|\\.\\d+|\\d+\\.\\d+)([eE][-+]?\\d+)?\\s*$/,Z=/^((\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z)))$/,w=this,F=0,b=0,V=!1,p=!1,S=[],l={data:[],errors:[],meta:{}};function j(E){return r.skipEmptyLines===\"greedy\"?E.join(\"\").trim()===\"\":E.length===1&&E[0].length===0}function L(){if(l&&u&&(Q(\"Delimiter\",\"UndetectableDelimiter\",\"Unable to auto-detect delimiting character; defaulted to '\"+i.DefaultDelimiter+\"'\"),u=!1),r.skipEmptyLines&&(l.data=l.data.filter(function(R){return!j(R)})),N()){let R=function(z,B){C(r.transformHeader)&&(z=r.transformHeader(z,B)),S.push(z)};var _=R;if(l)if(Array.isArray(l.data[0])){for(var E=0;N()&&E<l.data.length;E++)l.data[E].forEach(R);l.data.splice(0,1)}else l.data.forEach(R)}function v(R,z){for(var B=r.header?{}:[],I=0;I<R.length;I++){var y=I,K=R[I],K=((k,A)=>(P=>(r.dynamicTypingFunction&&r.dynamicTyping[P]===void 0&&(r.dynamicTyping[P]=r.dynamicTypingFunction(P)),(r.dynamicTyping[P]||r.dynamicTyping)===!0))(k)?A===\"true\"||A===\"TRUE\"||A!==\"false\"&&A!==\"FALSE\"&&((P=>{if(H.test(P)&&(P=parseFloat(P),M<P&&P<m))return 1})(A)?parseFloat(A):Z.test(A)?new Date(A):A===\"\"?null:A):A)(y=r.header?I>=S.length?\"__parsed_extra\":S[I]:y,K=r.transform?r.transform(K,y):K);y===\"__parsed_extra\"?(B[y]=B[y]||[],B[y].push(K)):B[y]=K}return r.header&&(I>S.length?Q(\"FieldMismatch\",\"TooManyFields\",\"Too many fields: expected \"+S.length+\" fields but parsed \"+I,b+z):I<S.length&&Q(\"FieldMismatch\",\"TooFewFields\",\"Too few fields: expected \"+S.length+\" fields but parsed \"+I,b+z)),B}var T;l&&(r.header||r.dynamicTyping||r.transform)&&(T=1,!l.data.length||Array.isArray(l.data[0])?(l.data=l.data.map(v),T=l.data.length):l.data=v(l.data,0),r.header&&l.meta&&(l.meta.fields=S),b+=T)}function N(){return r.header&&S.length===0}function Q(E,v,T,_){E={type:E,code:v,message:T},_!==void 0&&(E.row=_),l.errors.push(E)}C(r.step)&&(o=r.step,r.step=function(E){l=E,N()?L():(L(),l.data.length!==0&&(F+=E.data.length,r.preview&&F>r.preview?c.abort():(l.data=l.data[0],o(l,w))))}),this.parse=function(E,v,T){var _=r.quoteChar||'\"',_=(r.newline||(r.newline=this.guessLineEndings(E,_)),u=!1,r.delimiter?C(r.delimiter)&&(r.delimiter=r.delimiter(E),l.meta.delimiter=r.delimiter):((_=((R,z,B,I,y)=>{var K,k,A,P;y=y||[\",\",\" \",\"|\",\";\",i.RECORD_SEP,i.UNIT_SEP];for(var o0=0;o0<y.length;o0++){for(var t0,b0=y[o0],$=0,r0=0,U=0,W=(A=void 0,new R0({comments:I,delimiter:b0,newline:z,preview:10}).parse(R)),c0=0;c0<W.data.length;c0++)B&&j(W.data[c0])?U++:(t0=W.data[c0].length,r0+=t0,A===void 0?A=t0:0<t0&&($+=Math.abs(t0-A),A=t0));0<W.data.length&&(r0/=W.data.length-U),(k===void 0||$<=k)&&(P===void 0||P<r0)&&1.99<r0&&(k=$,K=b0,P=r0)}return{successful:!!(r.delimiter=K),bestDelimiter:K}})(E,r.newline,r.skipEmptyLines,r.comments,r.delimitersToGuess)).successful?r.delimiter=_.bestDelimiter:(u=!0,r.delimiter=i.DefaultDelimiter),l.meta.delimiter=r.delimiter),B0(r));return r.preview&&r.header&&_.preview++,n=E,c=new R0(_),l=c.parse(n,v,T),L(),V?{meta:{paused:!0}}:l||{meta:{paused:!1}}},this.paused=function(){return V},this.pause=function(){V=!0,c.abort(),n=C(r.chunk)?\"\":n.substring(c.getCharIndex())},this.resume=function(){w.streamer._halted?(V=!1,w.streamer.parseChunk(n,!0)):setTimeout(w.resume,3)},this.aborted=function(){return p},this.abort=function(){p=!0,c.abort(),l.meta.aborted=!0,C(r.complete)&&r.complete(l),n=\"\"},this.guessLineEndings=function(R,_){R=R.substring(0,1048576);var _=new RegExp(h0(_)+\"([^]*?)\"+h0(_),\"gm\"),T=(R=R.replace(_,\"\")).split(\"\\r\"),_=R.split(`\n`),R=1<_.length&&_[0].length<T[0].length;if(T.length===1||R)return`\n`;for(var z=0,B=0;B<T.length;B++)T[B][0]===`\n`&&z++;return z>=T.length/2?`\\r\n`:\"\\r\"}}function h0(r){return r.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")}function R0(r){var n=(r=r||{}).delimiter,c=r.newline,u=r.comments,o=r.step,m=r.preview,M=r.fastMode,H=null,Z=!1,w=r.quoteChar==null?'\"':r.quoteChar,F=w;if(r.escapeChar!==void 0&&(F=r.escapeChar),(typeof n!=\"string\"||-1<i.BAD_DELIMITERS.indexOf(n))&&(n=\",\"),u===n)throw new Error(\"Comment character same as delimiter\");u===!0?u=\"#\":(typeof u!=\"string\"||-1<i.BAD_DELIMITERS.indexOf(u))&&(u=!1),c!==`\n`&&c!==\"\\r\"&&c!==`\\r\n`&&(c=`\n`);var b=0,V=!1;this.parse=function(p,S,l){if(typeof p!=\"string\")throw new Error(\"Input must be a string\");var j=p.length,L=n.length,N=c.length,Q=u.length,E=C(o),v=[],T=[],_=[],R=b=0;if(!p)return $();if(M||M!==!1&&p.indexOf(w)===-1){for(var z=p.split(c),B=0;B<z.length;B++){if(_=z[B],b+=_.length,B!==z.length-1)b+=c.length;else if(l)return $();if(!u||_.substring(0,Q)!==u){if(E){if(v=[],P(_.split(n)),r0(),V)return $()}else P(_.split(n));if(m&&m<=B)return v=v.slice(0,m),$(!0)}}return $()}for(var I=p.indexOf(n,b),y=p.indexOf(c,b),K=new RegExp(h0(F)+h0(w),\"g\"),k=p.indexOf(w,b);;)if(p[b]===w)for(k=b,b++;;){if((k=p.indexOf(w,k+1))===-1)return l||T.push({type:\"Quotes\",code:\"MissingQuotes\",message:\"Quoted field unterminated\",row:v.length,index:b}),t0();if(k===j-1)return t0(p.substring(b,k).replace(K,w));if(w===F&&p[k+1]===F)k++;else if(w===F||k===0||p[k-1]!==F){I!==-1&&I<k+1&&(I=p.indexOf(n,k+1));var A=o0((y=y!==-1&&y<k+1?p.indexOf(c,k+1):y)===-1?I:Math.min(I,y));if(p.substr(k+1+A,L)===n){_.push(p.substring(b,k).replace(K,w)),p[b=k+1+A+L]!==w&&(k=p.indexOf(w,b)),I=p.indexOf(n,b),y=p.indexOf(c,b);break}if(A=o0(y),p.substring(k+1+A,k+1+A+N)===c){if(_.push(p.substring(b,k).replace(K,w)),b0(k+1+A+N),I=p.indexOf(n,b),k=p.indexOf(w,b),E&&(r0(),V))return $();if(m&&v.length>=m)return $(!0);break}T.push({type:\"Quotes\",code:\"InvalidQuotes\",message:\"Trailing quote on quoted field is malformed\",row:v.length,index:b}),k++}}else if(u&&_.length===0&&p.substring(b,b+Q)===u){if(y===-1)return $();b=y+N,y=p.indexOf(c,b),I=p.indexOf(n,b)}else if(I!==-1&&(I<y||y===-1))_.push(p.substring(b,I)),b=I+L,I=p.indexOf(n,b);else{if(y===-1)break;if(_.push(p.substring(b,y)),b0(y+N),E&&(r0(),V))return $();if(m&&v.length>=m)return $(!0)}return t0();function P(U){v.push(U),R=b}function o0(U){var W=0;return W=U!==-1&&(U=p.substring(k+1,U))&&U.trim()===\"\"?U.length:W}function t0(U){return l||(U===void 0&&(U=p.substring(b)),_.push(U),b=j,P(_),E&&r0()),$()}function b0(U){b=U,P(_),_=[],y=p.indexOf(c,b)}function $(U){if(r.header&&!S&&v.length&&!Z){var W=v[0],c0=Object.create(null),A0=new Set(W);let mx=!1;for(let u0=0;u0<W.length;u0++){let n0=W[u0];if(c0[n0=C(r.transformHeader)?r.transformHeader(n0,u0):n0]){let p0,_x=c0[n0];for(;p0=n0+\"_\"+_x,_x++,A0.has(p0););A0.add(p0),W[u0]=p0,c0[n0]++,mx=!0,(H=H===null?{}:H)[p0]=n0}else c0[n0]=1,W[u0]=n0;A0.add(n0)}Z=!0}return{data:v,errors:T,meta:{delimiter:n,linebreak:c,aborted:V,truncated:!!U,cursor:R+(S||0),renamedHeaders:H}}}function r0(){o($()),v=[],T=[]}},this.abort=function(){V=!0},this.getCharIndex=function(){return b}}function Qx(r){var n=r.data,c=s[n.workerId],u=!1;if(n.error)c.userError(n.error,n.file);else if(n.results&&n.results.data){var o={abort:function(){u=!0,px(n.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:gx,resume:gx};if(C(c.userStep)){for(var m=0;m<n.results.data.length&&(c.userStep({data:n.results.data[m],errors:n.results.errors,meta:n.results.meta},o),!u);m++);delete n.results}else C(c.userChunk)&&(c.userChunk(n.results,o,n.file),delete n.results)}n.finished&&!u&&px(n.workerId,n.results)}function px(r,n){var c=s[r];C(c.userComplete)&&c.userComplete(n),c.terminate(),delete s[r]}function gx(){throw new Error(\"Not implemented.\")}function B0(r){if(typeof r!=\"object\"||r===null)return r;var n,c=Array.isArray(r)?[]:{};for(n in r)c[n]=B0(r[n]);return c}function s0(r,n){return function(){r.apply(n,arguments)}}function C(r){return typeof r==\"function\"}return i.parse=function(r,n){var c=(n=n||{}).dynamicTyping||!1;if(C(c)&&(n.dynamicTypingFunction=c,c={}),n.dynamicTyping=c,n.transform=!!C(n.transform)&&n.transform,!n.worker||!i.WORKERS_SUPPORTED)return c=null,i.NODE_STREAM_INPUT,typeof r==\"string\"?(r=(u=>u.charCodeAt(0)!==65279?u:u.slice(1))(r),c=new(n.download?g:e0)(n)):r.readable===!0&&C(r.read)&&C(r.on)?c=new S0(n):(x.File&&r instanceof File||r instanceof Object)&&(c=new G(n)),c.stream(r);(c=(()=>{var u;return!!i.WORKERS_SUPPORTED&&(u=(()=>{var o=x.URL||x.webkitURL||null,m=e.toString();return i.BLOB_URL||(i.BLOB_URL=o.createObjectURL(new Blob([\"var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; \",\"(\",m,\")();\"],{type:\"text/javascript\"})))})(),(u=new x.Worker(u)).onmessage=Qx,u.id=d++,s[u.id]=u)})()).userStep=n.step,c.userChunk=n.chunk,c.userComplete=n.complete,c.userError=n.error,n.step=C(n.step),n.chunk=C(n.chunk),n.complete=C(n.complete),n.error=C(n.error),delete n.worker,c.postMessage({input:r,config:n,workerId:c.id})},i.unparse=function(r,n){var c=!1,u=!0,o=\",\",m=`\\r\n`,M='\"',H=M+M,Z=!1,w=null,F=!1,b=((()=>{if(typeof n==\"object\"){if(typeof n.delimiter!=\"string\"||i.BAD_DELIMITERS.filter(function(S){return n.delimiter.indexOf(S)!==-1}).length||(o=n.delimiter),typeof n.quotes!=\"boolean\"&&typeof n.quotes!=\"function\"&&!Array.isArray(n.quotes)||(c=n.quotes),typeof n.skipEmptyLines!=\"boolean\"&&typeof n.skipEmptyLines!=\"string\"||(Z=n.skipEmptyLines),typeof n.newline==\"string\"&&(m=n.newline),typeof n.quoteChar==\"string\"&&(M=n.quoteChar),typeof n.header==\"boolean\"&&(u=n.header),Array.isArray(n.columns)){if(n.columns.length===0)throw new Error(\"Option columns is empty\");w=n.columns}n.escapeChar!==void 0&&(H=n.escapeChar+M),n.escapeFormulae instanceof RegExp?F=n.escapeFormulae:typeof n.escapeFormulae==\"boolean\"&&n.escapeFormulae&&(F=/^[=+\\-@\\t\\r].*$/)}})(),new RegExp(h0(M),\"g\"));if(typeof r==\"string\"&&(r=JSON.parse(r)),Array.isArray(r)){if(!r.length||Array.isArray(r[0]))return V(null,r,Z);if(typeof r[0]==\"object\")return V(w||Object.keys(r[0]),r,Z)}else if(typeof r==\"object\")return typeof r.data==\"string\"&&(r.data=JSON.parse(r.data)),Array.isArray(r.data)&&(r.fields||(r.fields=r.meta&&r.meta.fields||w),r.fields||(r.fields=Array.isArray(r.data[0])?r.fields:typeof r.data[0]==\"object\"?Object.keys(r.data[0]):[]),Array.isArray(r.data[0])||typeof r.data[0]==\"object\"||(r.data=[r.data])),V(r.fields||[],r.data||[],Z);throw new Error(\"Unable to serialize unrecognized input\");function V(S,l,j){var L=\"\",N=(typeof S==\"string\"&&(S=JSON.parse(S)),typeof l==\"string\"&&(l=JSON.parse(l)),Array.isArray(S)&&0<S.length),Q=!Array.isArray(l[0]);if(N&&u){for(var E=0;E<S.length;E++)0<E&&(L+=o),L+=p(S[E],E);0<l.length&&(L+=m)}for(var v=0;v<l.length;v++){var T=(N?S:l[v]).length,_=!1,R=N?Object.keys(l[v]).length===0:l[v].length===0;if(j&&!N&&(_=j===\"greedy\"?l[v].join(\"\").trim()===\"\":l[v].length===1&&l[v][0].length===0),j===\"greedy\"&&N){for(var z=[],B=0;B<T;B++){var I=Q?S[B]:B;z.push(l[v][I])}_=z.join(\"\").trim()===\"\"}if(!_){for(var y=0;y<T;y++){0<y&&!R&&(L+=o);var K=N&&Q?S[y]:y;L+=p(l[v][K],y)}v<l.length-1&&(!j||0<T&&!R)&&(L+=m)}}return L}function p(S,l){var j,L;return S==null?\"\":S.constructor===Date?JSON.stringify(S).slice(1,25):(L=!1,F&&typeof S==\"string\"&&F.test(S)&&(S=\"'\"+S,L=!0),j=S.toString().replace(b,H),(L=L||c===!0||typeof c==\"function\"&&c(S,l)||Array.isArray(c)&&c[l]||((N,Q)=>{for(var E=0;E<Q.length;E++)if(-1<N.indexOf(Q[E]))return!0;return!1})(j,i.BAD_DELIMITERS)||-1<j.indexOf(o)||j.charAt(0)===\" \"||j.charAt(j.length-1)===\" \")?M+j+M:j)}},i.RECORD_SEP=\"\",i.UNIT_SEP=\"\",i.BYTE_ORDER_MARK=\"\\uFEFF\",i.BAD_DELIMITERS=[\"\\r\",`\n`,'\"',i.BYTE_ORDER_MARK],i.WORKERS_SUPPORTED=!a&&!!x.Worker,i.NODE_STREAM_INPUT=1,i.LocalChunkSize=10485760,i.RemoteChunkSize=5242880,i.DefaultDelimiter=\",\",i.Parser=R0,i.ParserHandle=bx,i.NetworkStreamer=g,i.FileStreamer=G,i.StringStreamer=e0,i.ReadableStreamStreamer=S0,x.jQuery&&((t=x.jQuery).fn.parse=function(r){var n=r.config||{},c=[];return this.each(function(m){if(!(t(this).prop(\"tagName\").toUpperCase()===\"INPUT\"&&t(this).attr(\"type\").toLowerCase()===\"file\"&&x.FileReader)||!this.files||this.files.length===0)return!0;for(var M=0;M<this.files.length;M++)c.push({file:this.files[M],inputElem:this,instanceConfig:t.extend({},n)})}),u(),this;function u(){if(c.length===0)C(r.complete)&&r.complete();else{var m,M,H,Z,w=c[0];if(C(r.before)){var F=r.before(w.file,w.inputElem);if(typeof F==\"object\"){if(F.action===\"abort\")return m=\"AbortError\",M=w.file,H=w.inputElem,Z=F.reason,void(C(r.error)&&r.error({name:m},M,H,Z));if(F.action===\"skip\")return void o();typeof F.config==\"object\"&&(w.instanceConfig=t.extend(w.instanceConfig,F.config))}else if(F===\"skip\")return void o()}var b=w.instanceConfig.complete;w.instanceConfig.complete=function(V){C(b)&&b(V,w.file,w.inputElem),o()},i.parse(w.file,w.instanceConfig)}}function o(){c.splice(0,1),u()}}),f&&(x.onmessage=function(r){r=r.data,i.WORKER_ID===void 0&&r&&(i.WORKER_ID=r.workerId),typeof r.input==\"string\"?x.postMessage({workerId:i.WORKER_ID,results:i.parse(r.input,r.config),finished:!0}):(x.File&&r.input instanceof File||r.input instanceof Object)&&(r=i.parse(r.input,r.config))&&x.postMessage({workerId:i.WORKER_ID,results:r,finished:!0})}),(g.prototype=Object.create(h.prototype)).constructor=g,(G.prototype=Object.create(h.prototype)).constructor=G,(e0.prototype=Object.create(e0.prototype)).constructor=e0,(S0.prototype=Object.create(h.prototype)).constructor=S0,i})});var Ix=x0(T0=>{\"use strict\";Object.defineProperty(T0,\"__esModule\",{value:!0});T0.default=()=>{throw new Error(\"File system is not available\")}});var i0=x0(L0=>{\"use strict\";Object.defineProperty(L0,\"__esModule\",{value:!0});L0.default=(e,x,t)=>({confidence:t,name:x.name(e),lang:x.language?x.language():void 0})});var Cx=x0(g0=>{\"use strict\";var de=g0&&g0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(g0,\"__esModule\",{value:!0});var Ox=de(i0()),M0=class{name(){return\"ASCII\"}match(x){let t=x.rawInput;for(let a=0;a<x.rawLen;a++){let f=t[a];if(f<32||f>126)return(0,Ox.default)(x,this,0)}return(0,Ox.default)(x,this,100)}};g0.default=M0});var Rx=x0(m0=>{\"use strict\";var oe=m0&&m0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m0,\"__esModule\",{value:!0});var ue=oe(i0()),j0=class{name(){return\"UTF-8\"}match(x){let t=!1,a=0,f=0,s=0,d,i=x.rawInput;x.rawLen>=3&&(i[0]&255)==239&&(i[1]&255)==187&&(i[2]&255)==191&&(t=!0);for(let h=0;h<x.rawLen;h++){let g=i[h];if(g&128){if((g&224)==192)s=1;else if((g&240)==224)s=2;else if((g&248)==240)s=3;else{if(f++,f>5)break;s=0}for(;h++,!(h>=x.rawLen);){if((i[h]&192)!=128){f++;break}if(--s==0){a++;break}}}}if(d=0,t&&f==0)d=100;else if(t&&a>f*10)d=80;else if(a>3&&f==0)d=100;else if(a>0&&f==0)d=80;else if(a==0&&f==0)d=10;else if(a>f*10)d=25;else return null;return(0,ue.default)(x,this,d)}};m0.default=j0});var Bx=x0(X=>{\"use strict\";var le=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,\"__esModule\",{value:!0});X.UTF_32LE=X.UTF_32BE=X.UTF_16LE=X.UTF_16BE=void 0;var N0=le(i0()),P0=class{name(){return\"UTF-16BE\"}match(x){let t=x.rawInput;return t.length>=2&&(t[0]&255)==254&&(t[1]&255)==255?(0,N0.default)(x,this,100):null}};X.UTF_16BE=P0;var z0=class{name(){return\"UTF-16LE\"}match(x){let t=x.rawInput;return t.length>=2&&(t[0]&255)==255&&(t[1]&255)==254?t.length>=4&&t[2]==0&&t[3]==0?null:(0,N0.default)(x,this,100):null}};X.UTF_16LE=z0;var v0=class{name(){return\"UTF-32\"}getChar(x,t){return-1}match(x){let t=0,a=0,f=!1,s=0,d=x.rawLen/4*4,i=x.rawInput;if(d==0)return null;this.getChar(i,0)==65279&&(f=!0);for(let h=0;h<d;h+=4){let g=this.getChar(i,h);g<0||g>=1114111||g>=55296&&g<=57343?a+=1:t+=1}return f&&a==0?s=100:f&&t>a*10?s=80:t>3&&a==0?s=100:t>0&&a==0?s=80:t>a*10&&(s=25),s==0?null:(0,N0.default)(x,this,s)}},U0=class extends v0{name(){return\"UTF-32BE\"}getChar(x,t){return(x[t+0]&255)<<24|(x[t+1]&255)<<16|(x[t+2]&255)<<8|x[t+3]&255}};X.UTF_32BE=U0;var q0=class extends v0{name(){return\"UTF-32LE\"}getChar(x,t){return(x[t+3]&255)<<24|(x[t+2]&255)<<16|(x[t+1]&255)<<8|x[t+0]&255}};X.UTF_32LE=q0});var Dx=x0(J=>{\"use strict\";var he=J&&J.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(J,\"__esModule\",{value:!0});J.gb_18030=J.euc_kr=J.euc_jp=J.big5=J.sjis=void 0;var be=he(i0());function pe(e,x){let t=(a,f,s,d)=>{if(d<s)return-1;let i=Math.floor(s+d>>>1);return f>a[i]?t(a,f,i+1,d):f<a[i]?t(a,f,s,i-1):i};return t(e,x,0,e.length-1)}var V0=class{constructor(){this.charValue=0,this.index=0,this.nextIndex=0,this.error=!1,this.done=!1}reset(){this.charValue=0,this.index=-1,this.nextIndex=0,this.error=!1,this.done=!1}nextByte(x){return this.nextIndex>=x.rawLen?(this.done=!0,-1):x.rawInput[this.nextIndex++]&255}},d0=class{constructor(){this.commonChars=[]}name(){return\"mbcs\"}match(x){let t=0,a=0,f=0,s=0,d=0,i=new V0;x:{for(i.reset();this.nextChar(i,x);){if(s++,i.error)f++;else{let h=i.charValue&4294967295;h>255&&(t++,this.commonChars!=null&&pe(this.commonChars,h)>=0&&a++)}if(f>=2&&f*5>=t)break x}if(t<=10&&f==0){t==0&&s<10?d=0:d=10;break x}if(t<20*f){d=0;break x}if(this.commonChars==null)d=30+t-20*f,d>100&&(d=100);else{let g=90/Math.log(t/4);d=Math.floor(Math.log(a+1)*g+10),d=Math.min(d,100)}}return d==0?null:(0,be.default)(x,this,d)}nextChar(x,t){return!0}},K0=class extends d0{constructor(){super(...arguments),this.commonChars=[33088,33089,33090,33093,33115,33129,33130,33141,33142,33440,33442,33444,33449,33450,33451,33453,33455,33457,33459,33461,33463,33469,33470,33473,33476,33477,33478,33480,33481,33484,33485,33500,33504,33511,33512,33513,33514,33520,33521,33601,33603,33614,33615,33624,33630,33634,33639,33653,33654,33673,33674,33675,33677,33683,36502,37882,38314]}name(){return\"Shift_JIS\"}language(){return\"ja\"}nextChar(x,t){x.index=x.nextIndex,x.error=!1;let a=x.charValue=x.nextByte(t);if(a<0)return!1;if(a<=127||a>160&&a<=223)return!0;let f=x.nextByte(t);return f<0?!1:(x.charValue=a<<8|f,f>=64&&f<=127||f>=128&&f<=255||(x.error=!0),!0)}};J.sjis=K0;var $0=class extends d0{constructor(){super(...arguments),this.commonChars=[41280,41281,41282,41283,41287,41289,41333,41334,42048,42054,42055,42056,42065,42068,42071,42084,42090,42092,42103,42147,42148,42151,42177,42190,42193,42207,42216,42237,42304,42312,42328,42345,42445,42471,42583,42593,42594,42600,42608,42664,42675,42681,42707,42715,42726,42738,42816,42833,42841,42970,43171,43173,43181,43217,43219,43236,43260,43456,43474,43507,43627,43706,43710,43724,43772,44103,44111,44208,44242,44377,44745,45024,45290,45423,45747,45764,45935,46156,46158,46412,46501,46525,46544,46552,46705,47085,47207,47428,47832,47940,48033,48593,49860,50105,50240,50271]}name(){return\"Big5\"}language(){return\"zh\"}nextChar(x,t){x.index=x.nextIndex,x.error=!1;let a=x.charValue=x.nextByte(t);if(a<0)return!1;if(a<=127||a==255)return!0;let f=x.nextByte(t);return f<0?!1:(x.charValue=x.charValue<<8|f,(f<64||f==127||f==255)&&(x.error=!0),!0)}};J.big5=$0;function Ax(e,x){e.index=e.nextIndex,e.error=!1;let t=0,a=0,f=0;x:{if(t=e.charValue=e.nextByte(x),t<0){e.done=!0;break x}if(t<=141)break x;if(a=e.nextByte(x),e.charValue=e.charValue<<8|a,t>=161&&t<=254){a<161&&(e.error=!0);break x}if(t==142){a<161&&(e.error=!0);break x}t==143&&(f=e.nextByte(x),e.charValue=e.charValue<<8|f,f<161&&(e.error=!0))}return e.done==!1}var W0=class extends d0{constructor(){super(...arguments),this.commonChars=[41377,41378,41379,41382,41404,41418,41419,41430,41431,42146,42148,42150,42152,42154,42155,42156,42157,42159,42161,42163,42165,42167,42169,42171,42173,42175,42176,42177,42179,42180,42182,42183,42184,42185,42186,42187,42190,42191,42192,42206,42207,42209,42210,42212,42216,42217,42218,42219,42220,42223,42226,42227,42402,42403,42404,42406,42407,42410,42413,42415,42416,42419,42421,42423,42424,42425,42431,42435,42438,42439,42440,42441,42443,42448,42453,42454,42455,42462,42464,42465,42469,42473,42474,42475,42476,42477,42483,47273,47572,47854,48072,48880,49079,50410,50940,51133,51896,51955,52188,52689],this.nextChar=Ax}name(){return\"EUC-JP\"}language(){return\"ja\"}};J.euc_jp=W0;var J0=class extends d0{constructor(){super(...arguments),this.commonChars=[45217,45235,45253,45261,45268,45286,45293,45304,45306,45308,45496,45497,45511,45527,45538,45994,46011,46274,46287,46297,46315,46501,46517,46527,46535,46569,46835,47023,47042,47054,47270,47278,47286,47288,47291,47337,47531,47534,47564,47566,47613,47800,47822,47824,47857,48103,48115,48125,48301,48314,48338,48374,48570,48576,48579,48581,48838,48840,48863,48878,48888,48890,49057,49065,49088,49124,49131,49132,49144,49319,49327,49336,49338,49339,49341,49351,49356,49358,49359,49366,49370,49381,49403,49404,49572,49574,49590,49622,49631,49654,49656,50337,50637,50862,51151,51153,51154,51160,51173,51373],this.nextChar=Ax}name(){return\"EUC-KR\"}language(){return\"ko\"}};J.euc_kr=J0;var G0=class extends d0{constructor(){super(...arguments),this.commonChars=[41377,41378,41379,41380,41392,41393,41457,41459,41889,41900,41914,45480,45496,45502,45755,46025,46070,46323,46525,46532,46563,46767,46804,46816,47010,47016,47037,47062,47069,47284,47327,47350,47531,47561,47576,47610,47613,47821,48039,48086,48097,48122,48316,48347,48382,48588,48845,48861,49076,49094,49097,49332,49389,49611,49883,50119,50396,50410,50636,50935,51192,51371,51403,51413,51431,51663,51706,51889,51893,51911,51920,51926,51957,51965,52460,52728,52906,52932,52946,52965,53173,53186,53206,53442,53445,53456,53460,53671,53930,53938,53941,53947,53972,54211,54224,54269,54466,54490,54754,54992]}name(){return\"GB18030\"}language(){return\"zh\"}nextChar(x,t){x.index=x.nextIndex,x.error=!1;let a=0,f=0,s=0,d=0;x:{if(a=x.charValue=x.nextByte(t),a<0){x.done=!0;break x}if(a<=128)break x;if(f=x.nextByte(t),x.charValue=x.charValue<<8|f,a>=129&&a<=254){if(f>=64&&f<=126||f>=80&&f<=254)break x;if(f>=48&&f<=57&&(s=x.nextByte(t),s>=129&&s<=254&&(d=x.nextByte(t),d>=48&&d<=57))){x.charValue=x.charValue<<16|s<<8|d;break x}x.error=!0;break x}}return x.done==!1}};J.gb_18030=G0});var Tx=x0(D=>{\"use strict\";var ge=D&&D.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(D,\"__esModule\",{value:!0});D.KOI8_R=D.windows_1256=D.windows_1251=D.ISO_8859_9=D.ISO_8859_8=D.ISO_8859_7=D.ISO_8859_6=D.ISO_8859_5=D.ISO_8859_2=D.ISO_8859_1=void 0;var Fx=ge(i0()),me=16777215,k0=class{constructor(x,t){this.byteIndex=0,this.ngram=0,this.ngramCount=0,this.hitCount=0,this.spaceChar=32,this.ngramList=x,this.byteMap=t}search(x,t){let a=0;return x[a+32]<=t&&(a+=32),x[a+16]<=t&&(a+=16),x[a+8]<=t&&(a+=8),x[a+4]<=t&&(a+=4),x[a+2]<=t&&(a+=2),x[a+1]<=t&&(a+=1),x[a]>t&&(a-=1),a<0||x[a]!=t?-1:a}lookup(x){this.ngramCount+=1,this.search(this.ngramList,x)>=0&&(this.hitCount+=1)}addByte(x){this.ngram=(this.ngram<<8)+(x&255)&me,this.lookup(this.ngram)}nextByte(x){return this.byteIndex>=x.inputLen?-1:x.inputBytes[this.byteIndex++]&255}parse(x,t){let a,f=!1;for(this.spaceChar=t;(a=this.nextByte(x))>=0;){let d=this.byteMap[a];d!=0&&(d==this.spaceChar&&f||this.addByte(d),f=d==this.spaceChar)}this.addByte(this.spaceChar);let s=this.hitCount/this.ngramCount;return s>.33?98:Math.floor(s*300)}},q=class{constructor(x,t){this.fLang=x,this.fNGrams=t}},_e=e=>Array.isArray(e)&&isFinite(e[0]),Y=class{constructor(){this.spaceChar=32,this.nGramLang=void 0}ngrams(){return[]}byteMap(){return[]}name(x){return\"sbcs\"}language(){return this.nGramLang}match(x){this.nGramLang=void 0;let t=this.ngrams();if(_e(t)){let s=new k0(t,this.byteMap()).parse(x,this.spaceChar);return s<=0?null:(0,Fx.default)(x,this,s)}let a=-1;for(let f=t.length-1;f>=0;f--){let s=t[f],i=new k0(s.fNGrams,this.byteMap()).parse(x,this.spaceChar);i>a&&(a=i,this.nGramLang=s.fLang)}return a<=0?null:(0,Fx.default)(x,this,a)}},H0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,170,32,32,32,32,32,32,32,32,32,32,181,32,32,32,32,186,32,32,32,32,32,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,255]}ngrams(){return[new q(\"da\",[2122086,2122100,2122853,2123118,2123122,2123375,2123873,2124064,2125157,2125671,2126053,2126697,2126708,2126953,2127465,6383136,6385184,6385252,6386208,6386720,6579488,6579566,6579570,6579572,6627443,6644768,6644837,6647328,6647396,6648352,6648421,6648608,6648864,6713202,6776096,6776174,6776178,6907749,6908960,6909543,7038240,7039845,7103858,7104871,7105637,7169380,7234661,7234848,7235360,7235429,7300896,7302432,7303712,7398688,7479396,7479397,7479411,7496992,7566437,7610483,7628064,7628146,7629164,7759218]),new q(\"de\",[2122094,2122101,2122341,2122849,2122853,2122857,2123113,2123621,2123873,2124142,2125161,2126691,2126693,2127214,2127461,2127471,2127717,2128501,6448498,6514720,6514789,6514804,6578547,6579566,6579570,6580581,6627428,6627443,6646126,6646132,6647328,6648352,6648608,6776174,6841710,6845472,6906728,6907168,6909472,6909541,6911008,7104867,7105637,7217249,7217252,7217267,7234592,7234661,7234848,7235360,7235429,7238757,7479396,7496805,7497065,7562088,7566437,7610468,7628064,7628142,7628146,7695972,7695975,7759218]),new q(\"en\",[2122016,2122094,2122341,2122607,2123375,2123873,2123877,2124142,2125153,2125670,2125938,2126437,2126689,2126708,2126952,2126959,2127720,6383972,6384672,6385184,6385252,6386464,6386720,6386789,6386793,6561889,6561908,6627425,6627443,6627444,6644768,6647412,6648352,6648608,6713202,6840692,6841632,6841714,6906912,6909472,6909543,6909806,6910752,7217249,7217268,7234592,7235360,7238688,7300640,7302688,7303712,7496992,7500576,7544929,7544948,7561577,7566368,7610484,7628146,7628897,7628901,7629167,7630624,7631648]),new q(\"es\",[2122016,2122593,2122607,2122853,2123116,2123118,2123123,2124142,2124897,2124911,2125921,2125935,2125938,2126197,2126437,2126693,2127214,2128160,6365283,6365284,6365285,6365292,6365296,6382441,6382703,6384672,6386208,6386464,6515187,6516590,6579488,6579564,6582048,6627428,6627429,6627436,6646816,6647328,6647412,6648608,6648692,6907246,6943598,7102752,7106419,7217253,7238757,7282788,7282789,7302688,7303712,7303968,7364978,7435621,7495968,7497075,7544932,7544933,7544944,7562528,7628064,7630624,7693600,15953440]),new q(\"fr\",[2122101,2122607,2122849,2122853,2122869,2123118,2123124,2124897,2124901,2125921,2125935,2125938,2126197,2126693,2126703,2127214,2154528,6385268,6386793,6513952,6516590,6579488,6579571,6583584,6627425,6627427,6627428,6627429,6627436,6627440,6627443,6647328,6647412,6648352,6648608,6648864,6649202,6909806,6910752,6911008,7102752,7103776,7103859,7169390,7217252,7234848,7238432,7238688,7302688,7302772,7304562,7435621,7479404,7496992,7544929,7544932,7544933,7544940,7544944,7610468,7628064,7629167,7693600,7696928]),new q(\"it\",[2122092,2122600,2122607,2122853,2122857,2123040,2124140,2124142,2124897,2125925,2125938,2127214,6365283,6365284,6365296,6365299,6386799,6514789,6516590,6579564,6580512,6627425,6627427,6627428,6627433,6627436,6627440,6627443,6646816,6646892,6647412,6648352,6841632,6889569,6889571,6889572,6889587,6906144,6908960,6909472,6909806,7102752,7103776,7104800,7105633,7234848,7235872,7237408,7238757,7282785,7282788,7282793,7282803,7302688,7302757,7366002,7495968,7496992,7563552,7627040,7628064,7629088,7630624,8022383]),new q(\"nl\",[2122092,2122341,2122849,2122853,2122857,2123109,2123118,2123621,2123877,2124142,2125153,2125157,2125680,2126949,2127457,2127461,2127471,2127717,2128489,6381934,6381938,6385184,6385252,6386208,6386720,6514804,6579488,6579566,6579570,6627426,6627446,6645102,6645106,6647328,6648352,6648435,6648864,6776174,6841716,6907168,6909472,6909543,6910752,7217250,7217252,7217253,7217256,7217263,7217270,7234661,7235360,7302756,7303026,7303200,7303712,7562088,7566437,7610468,7628064,7628142,7628146,7758190,7759218,7761775]),new q(\"no\",[2122100,2122102,2122853,2123118,2123122,2123375,2123873,2124064,2125157,2125671,2126053,2126693,2126699,2126703,2126708,2126953,2127465,2155808,6385252,6386208,6386720,6579488,6579566,6579572,6627443,6644768,6647328,6647397,6648352,6648421,6648864,6648948,6713202,6776174,6908779,6908960,6909543,7038240,7039845,7103776,7105637,7169380,7169390,7217267,7234848,7235360,7235429,7237221,7300896,7302432,7303712,7398688,7479411,7496992,7565165,7566437,7610483,7628064,7628142,7628146,7629164,7631904,7631973,7759218]),new q(\"pt\",[2122016,2122607,2122849,2122853,2122863,2123040,2123123,2125153,2125423,2125600,2125921,2125935,2125938,2126197,2126437,2126693,2127213,6365281,6365283,6365284,6365296,6382693,6382703,6384672,6386208,6386273,6386464,6516589,6516590,6578464,6579488,6582048,6582131,6627425,6627428,6647072,6647412,6648608,6648692,6906144,6906721,7169390,7238757,7238767,7282785,7282787,7282788,7282789,7282800,7303968,7364978,7435621,7495968,7497075,7544929,7544932,7544933,7544944,7566433,7628064,7630624,7693600,14905120,15197039]),new q(\"sv\",[2122100,2122102,2122853,2123118,2123510,2123873,2124064,2124142,2124655,2125157,2125667,2126053,2126699,2126703,2126708,2126953,2127457,2127465,2155634,6382693,6385184,6385252,6386208,6386804,6514720,6579488,6579566,6579570,6579572,6644768,6647328,6648352,6648864,6747762,6776174,6909036,6909543,7037216,7105568,7169380,7217267,7233824,7234661,7235360,7235429,7235950,7299944,7302432,7302688,7398688,7479393,7479411,7495968,7564129,7565165,7610483,7627040,7628064,7628146,7629164,7631904,7758194,14971424,16151072])]}name(x){return x&&x.c1Bytes?\"windows-1252\":\"ISO-8859-1\"}};D.ISO_8859_1=H0;var Z0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,177,32,179,32,181,182,32,32,185,186,187,188,32,190,191,32,177,32,179,32,181,182,183,32,185,186,187,188,32,190,191,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,32]}ngrams(){return[new q(\"cs\",[2122016,2122361,2122863,2124389,2125409,2125413,2125600,2125668,2125935,2125938,2126072,2126447,2126693,2126703,2126708,2126959,2127392,2127481,2128481,6365296,6513952,6514720,6627440,6627443,6627446,6647072,6647533,6844192,6844260,6910836,6972704,7042149,7103776,7104800,7233824,7268640,7269408,7269664,7282800,7300206,7301737,7304052,7304480,7304801,7368548,7368554,7369327,7403621,7562528,7565173,7566433,7566441,7566446,7628146,7630573,7630624,7676016,12477728,14773997,15296623,15540336,15540339,15559968,16278884]),new q(\"hu\",[2122016,2122106,2122341,2123111,2123116,2123365,2123873,2123887,2124147,2124645,2124649,2124790,2124901,2125153,2125157,2125161,2125413,2126714,2126949,2156915,6365281,6365291,6365293,6365299,6384416,6385184,6388256,6447470,6448494,6645625,6646560,6646816,6646885,6647072,6647328,6648421,6648864,6648933,6648948,6781216,6844263,6909556,6910752,7020641,7075450,7169383,7170414,7217249,7233899,7234923,7234925,7238688,7300985,7544929,7567973,7567988,7568097,7596391,7610465,7631904,7659891,8021362,14773792,15299360]),new q(\"pl\",[2122618,2122863,2124064,2124389,2124655,2125153,2125161,2125409,2125417,2125668,2125935,2125938,2126697,2127648,2127721,2127737,2128416,2128481,6365296,6365303,6385257,6514720,6519397,6519417,6582048,6584937,6627440,6627443,6627447,6627450,6645615,6646304,6647072,6647401,6778656,6906144,6907168,6907242,7037216,7039264,7039333,7170405,7233824,7235937,7235941,7282800,7305057,7305065,7368556,7369313,7369327,7369338,7502437,7502457,7563754,7564137,7566433,7825765,7955304,7957792,8021280,8022373,8026400,15955744]),new q(\"ro\",[2122016,2122083,2122593,2122597,2122607,2122613,2122853,2122857,2124897,2125153,2125925,2125938,2126693,2126819,2127214,2144873,2158190,6365283,6365284,6386277,6386720,6386789,6386976,6513010,6516590,6518048,6546208,6579488,6627425,6627427,6627428,6627440,6627443,6644e3,6646048,6646885,6647412,6648692,6889569,6889571,6889572,6889584,6907168,6908192,6909472,7102752,7103776,7106418,7107945,7234848,7238770,7303712,7365998,7496992,7497057,7501088,7594784,7628064,7631477,7660320,7694624,7695392,12216608,15625760])]}name(x){return x&&x.c1Bytes?\"windows-1250\":\"ISO-8859-2\"}};D.ISO_8859_2=Z0;var Q0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,241,242,243,244,245,246,247,248,249,250,251,252,32,254,255,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,32,241,242,243,244,245,246,247,248,249,250,251,252,32,254,255]}ngrams(){return[2150944,2151134,2151646,2152400,2152480,2153168,2153182,2153936,2153941,2154193,2154462,2154464,2154704,2154974,2154978,2155230,2156514,2158050,13688280,13689580,13884960,14015468,14015960,14016994,14017056,14164191,14210336,14211104,14216992,14407133,14407712,14413021,14536736,14538016,14538965,14538991,14540320,14540498,14557394,14557407,14557409,14602784,14602960,14603230,14604576,14605292,14605344,14606818,14671579,14672085,14672088,14672094,14733522,14734804,14803664,14803666,14803672,14806816,14865883,14868e3,14868192,14871584,15196894,15459616]}name(){return\"ISO-8859-5\"}language(){return\"ru\"}};D.ISO_8859_5=Q0;var X0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,32,32,32,32,32,224,225,226,227,228,229,230,231,232,233,234,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32]}ngrams(){return[2148324,2148326,2148551,2152932,2154986,2155748,2156006,2156743,13050055,13091104,13093408,13095200,13100064,13100227,13100231,13100232,13100234,13100236,13100237,13100239,13100243,13100249,13100258,13100261,13100264,13100266,13100320,13100576,13100746,13115591,13181127,13181153,13181156,13181157,13181160,13246663,13574343,13617440,13705415,13748512,13836487,14229703,14279913,14805536,14950599,14993696,15001888,15002144,15016135,15058720,15059232,15066656,15081671,15147207,15189792,15255524,15263264,15278279,15343815,15343845,15343848,15386912,15388960,15394336]}name(){return\"ISO-8859-6\"}language(){return\"ar\"}};D.ISO_8859_6=X0;var Y0=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,161,162,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,220,32,221,222,223,32,252,32,253,254,192,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,32,243,244,245,246,247,248,249,250,251,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,32]}ngrams(){return[2154989,2154992,2155497,2155753,2156016,2156320,2157281,2157797,2158049,2158368,2158817,2158831,2158833,2159604,2159605,2159847,2159855,14672160,14754017,14754036,14805280,14806304,14807292,14807584,14936545,15067424,15069728,15147252,15199520,15200800,15278324,15327520,15330014,15331872,15393257,15393268,15525152,15540449,15540453,15540464,15589664,15725088,15725856,15790069,15790575,15793184,15868129,15868133,15868138,15868144,15868148,15983904,15984416,15987951,16048416,16048617,16050157,16050162,16050666,16052e3,16052213,16054765,16379168,16706848]}name(x){return x&&x.c1Bytes?\"windows-1253\":\"ISO-8859-7\"}language(){return\"el\"}};D.ISO_8859_7=Y0;var xx=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,181,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,32,32,32,32,32]}ngrams(){return[new q(\"he\",[2154725,2154727,2154729,2154746,2154985,2154990,2155744,2155749,2155753,2155758,2155762,2155769,2155770,2157792,2157796,2158304,2159340,2161132,14744096,14950624,14950625,14950628,14950636,14950638,14950649,15001056,15065120,15068448,15068960,15071264,15071776,15278308,15328288,15328762,15329773,15330592,15331104,15333408,15333920,15474912,15474916,15523872,15524896,15540448,15540449,15540452,15540460,15540462,15540473,15655968,15671524,15787040,15788320,15788525,15920160,16261348,16312813,16378912,16392416,16392417,16392420,16392428,16392430,16392441]),new q(\"he\",[2154725,2154732,2155753,2155756,2155758,2155760,2157040,2157810,2157817,2158053,2158057,2158565,2158569,2160869,2160873,2161376,2161381,2161385,14688484,14688492,14688493,14688506,14738464,14738916,14740512,14741024,14754020,14754029,14754042,14950628,14950633,14950636,14950637,14950639,14950648,14950650,15002656,15065120,15066144,15196192,15327264,15327520,15328288,15474916,15474925,15474938,15528480,15530272,15591913,15591920,15591928,15605988,15605997,15606010,15655200,15655968,15918112,16326884,16326893,16326906,16376864,16441376,16442400,16442857])]}name(x){return x&&x.c1Bytes?\"windows-1255\":\"ISO-8859-8\"}language(){return\"he\"}};D.ISO_8859_8=xx;var ex=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,170,32,32,32,32,32,32,32,32,32,32,181,32,32,32,32,186,32,32,32,32,32,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,105,254,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,32,248,249,250,251,252,253,254,255]}ngrams(){return[2122337,2122345,2122357,2122849,2122853,2123621,2123873,2124140,2124641,2124655,2125153,2125676,2126689,2126945,2127461,2128225,6365282,6384416,6384737,6384993,6385184,6385405,6386208,6386273,6386429,6386685,6388065,6449522,6578464,6579488,6580512,6627426,6627435,6644841,6647328,6648352,6648425,6648681,6909029,6909472,6909545,6910496,7102830,7102834,7103776,7103858,7217249,7217250,7217259,7234657,7234661,7234848,7235872,7235950,7273760,7498094,7535982,7759136,7954720,7958386,16608800,16608868,16609021,16642301]}name(x){return x&&x.c1Bytes?\"windows-1254\":\"ISO-8859-9\"}language(){return\"tr\"}};D.ISO_8859_9=ex;var tx=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,144,131,32,131,32,32,32,32,32,32,154,32,156,157,158,159,144,32,32,32,32,32,32,32,32,32,154,32,156,157,158,159,32,162,162,188,32,180,32,32,184,32,186,32,32,32,32,191,32,32,179,179,180,181,32,32,184,32,186,32,188,190,190,191,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]}ngrams(){return[2155040,2155246,2155758,2156512,2156576,2157280,2157294,2158048,2158053,2158305,2158574,2158576,2158816,2159086,2159090,2159342,2160626,2162162,14740968,14742268,14937632,15068156,15068648,15069682,15069728,15212783,15263008,15263776,15269664,15459821,15460384,15465709,15589408,15590688,15591653,15591679,15592992,15593186,15605986,15605999,15606001,15655456,15655648,15655918,15657248,15657980,15658016,15659506,15724267,15724773,15724776,15724782,15786210,15787492,15856352,15856354,15856360,15859488,15918571,15920672,15920880,15924256,16249582,16512288]}name(){return\"windows-1251\"}language(){return\"ru\"}};D.windows_1251=tx;var rx=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,129,32,131,32,32,32,32,136,32,138,32,156,141,142,143,144,32,32,32,32,32,32,32,152,32,154,32,156,32,32,159,32,32,32,32,32,32,32,32,32,32,170,32,32,32,32,32,32,32,32,32,32,181,32,32,32,32,32,32,32,32,32,32,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,32,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,32,32,32,32,244,32,32,32,32,249,32,251,252,32,32,255]}ngrams(){return[2148321,2148324,2148551,2153185,2153965,2154977,2155492,2156231,13050055,13091104,13093408,13095200,13099296,13099459,13099463,13099464,13099466,13099468,13099469,13099471,13099475,13099482,13099486,13099491,13099494,13099501,13099808,13100064,13100234,13115591,13181127,13181149,13181153,13181155,13181158,13246663,13574343,13617440,13705415,13748512,13836487,14295239,14344684,14544160,14753991,14797088,14806048,14806304,14885063,14927648,14928160,14935072,14950599,15016135,15058720,15124449,15131680,15474887,15540423,15540451,15540454,15583520,15585568,15590432]}name(){return\"windows-1256\"}language(){return\"ar\"}};D.windows_1256=rx;var nx=class extends Y{byteMap(){return[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,163,32,32,32,32,32,32,32,32,32,32,32,32,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223]}ngrams(){return[2147535,2148640,2149313,2149327,2150081,2150085,2150338,2150607,2150610,2151105,2151375,2151380,2151631,2152224,2152399,2153153,2153684,2154196,12701385,12702936,12963032,12963529,12964820,12964896,13094688,13181136,13223200,13224224,13226272,13419982,13420832,13424846,13549856,13550880,13552069,13552081,13553440,13553623,13574352,13574355,13574359,13617103,13617696,13618392,13618464,13620180,13621024,13621185,13684684,13685445,13685449,13685455,13812183,13813188,13881632,13882561,13882569,13882583,13944268,13946656,13946834,13948960,14272544,14603471]}name(){return\"KOI8-R\"}language(){return\"ru\"}};D.KOI8_R=nx});var Lx=x0(a0=>{\"use strict\";var ye=a0&&a0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(a0,\"__esModule\",{value:!0});a0.ISO_2022_CN=a0.ISO_2022_KR=a0.ISO_2022_JP=void 0;var we=ye(i0()),_0=class{constructor(){this.escapeSequences=[]}name(){return\"ISO_2022\"}match(x){let t,a,f,s=0,d=0,i=0,h,g=x.inputBytes,G=x.inputLen;x:for(t=0;t<G;t++){if(g[t]==27){e:for(f=0;f<this.escapeSequences.length;f++){let e0=this.escapeSequences[f];if(G-t<e0.length)continue e;for(a=1;a<e0.length;a++)if(e0[a]!=g[t+a])continue e;s++,t+=e0.length-1;continue x}d++}(g[t]==14||g[t]==15)&&i++}return s==0?null:(h=(100*s-100*d)/(s+d),s+i<5&&(h-=(5-(s+i))*10),h<=0?null:(0,we.default)(x,this,h))}},ax=class extends _0{constructor(){super(...arguments),this.escapeSequences=[[27,36,40,67],[27,36,40,68],[27,36,64],[27,36,65],[27,36,66],[27,38,64],[27,40,66],[27,40,72],[27,40,73],[27,40,74],[27,46,65],[27,46,70]]}name(){return\"ISO-2022-JP\"}language(){return\"ja\"}};a0.ISO_2022_JP=ax;var fx=class extends _0{constructor(){super(...arguments),this.escapeSequences=[[27,36,41,67]]}name(){return\"ISO-2022-KR\"}language(){return\"kr\"}};a0.ISO_2022_KR=fx;var cx=class extends _0{constructor(){super(...arguments),this.escapeSequences=[[27,36,41,65],[27,36,41,71],[27,36,42,72],[27,36,41,69],[27,36,43,73],[27,36,43,74],[27,36,43,75],[27,36,43,76],[27,36,43,77],[27,78],[27,79]]}name(){return\"ISO-2022-CN\"}language(){return\"zh\"}};a0.ISO_2022_CN=cx});var Mx=x0(I0=>{\"use strict\";Object.defineProperty(I0,\"__esModule\",{value:!0});I0.isByteArray=void 0;var Se=e=>e==null||typeof e!=\"object\"?!1:isFinite(e.length)&&e.length>=0;I0.isByteArray=Se});var Px=x0(O=>{\"use strict\";var Ee=O&&O.__createBinding||(Object.create?function(e,x,t,a){a===void 0&&(a=t);var f=Object.getOwnPropertyDescriptor(x,t);(!f||(\"get\"in f?!x.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return x[t]}}),Object.defineProperty(e,a,f)}:function(e,x,t,a){a===void 0&&(a=t),e[a]=x[t]}),ve=O&&O.__setModuleDefault||(Object.create?function(e,x){Object.defineProperty(e,\"default\",{enumerable:!0,value:x})}:function(e,x){e.default=x}),C0=O&&O.__importStar||function(){var e=function(x){return e=Object.getOwnPropertyNames||function(t){var a=[];for(var f in t)Object.prototype.hasOwnProperty.call(t,f)&&(a[a.length]=f);return a},e(x)};return function(x){if(x&&x.__esModule)return x;var t={};if(x!=null)for(var a=e(x),f=0;f<a.length;f++)a[f]!==\"default\"&&Ee(t,x,a[f]);return ve(t,x),t}}(),ix=O&&O.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(O,\"__esModule\",{value:!0});O.detectFileSync=O.detectFile=O.analyse=O.detect=void 0;var jx=ix(Ix()),ke=ix(Cx()),Ie=ix(Rx()),O0=C0(Bx()),y0=C0(Dx()),f0=C0(Tx()),sx=C0(Lx()),Oe=Mx(),Ce=[new Ie.default,new O0.UTF_16BE,new O0.UTF_16LE,new O0.UTF_32BE,new O0.UTF_32LE,new y0.sjis,new y0.big5,new y0.euc_jp,new y0.euc_kr,new y0.gb_18030,new sx.ISO_2022_JP,new sx.ISO_2022_KR,new sx.ISO_2022_CN,new f0.ISO_8859_1,new f0.ISO_8859_2,new f0.ISO_8859_5,new f0.ISO_8859_6,new f0.ISO_8859_7,new f0.ISO_8859_8,new f0.ISO_8859_9,new f0.windows_1251,new f0.windows_1256,new f0.KOI8_R,new ke.default],Re=e=>{let x=(0,O.analyse)(e);return x.length>0?x[0].name:null};O.detect=Re;var Be=e=>{if(!(0,Oe.isByteArray)(e))throw new Error(\"Input must be a byte array, e.g. Buffer or Uint8Array\");let x=[];for(let s=0;s<256;s++)x[s]=0;for(let s=e.length-1;s>=0;s--)x[e[s]&255]++;let t=!1;for(let s=128;s<=159;s+=1)if(x[s]!==0){t=!0;break}let a={byteStats:x,c1Bytes:t,rawInput:e,rawLen:e.length,inputBytes:e,inputLen:e.length};return Ce.map(s=>s.match(a)).filter(s=>!!s).sort((s,d)=>d.confidence-s.confidence)};O.analyse=Be;var Ae=(e,x={})=>new Promise((t,a)=>{let f,s=(0,jx.default)(),d=(h,g)=>{f&&s.closeSync(f),h?a(h):g?t((0,O.detect)(g)):a(new Error(\"No error and no buffer received\"))},i=x?.sampleSize||0;if(i>0){f=s.openSync(e,\"r\");let h=Buffer.allocUnsafe(i);s.read(f,h,0,i,x.offset,(g,G)=>{g?d(g,null):(G<i&&(h=h.subarray(0,G)),d(null,h))});return}s.readFile(e,d)});O.detectFile=Ae;var De=(e,x={})=>{let t=(0,jx.default)();if(x&&x.sampleSize){let a=t.openSync(e,\"r\"),f=Buffer.allocUnsafe(x.sampleSize),s=t.readSync(a,f,0,x.sampleSize,x.offset);return s<x.sampleSize&&(f=f.subarray(0,s)),t.closeSync(a),(0,O.detect)(f)}return(0,O.detect)(t.readFileSync(e))};O.detectFileSync=De;O.default={analyse:O.analyse,detect:O.detect,detectFileSync:O.detectFileSync,detectFile:O.detectFile}});var E0=class extends Error{code;constructor(x,t){super(x),this.name=\"IoError\",this.code=t}},ne=/invalid string length|allocation size overflow|array buffer allocation failed|invalid (?:typed )?array length|out of memory/i,Sx=(e,x)=>{if(e instanceof E0)return e;let t=e instanceof Error?e.message:x;return new E0(t,ne.test(t)?\"TOO_LARGE\":\"PARSE\")};var qx=wx(Ex(),1);var ae=/[\\u200B-\\u200D\\uFEFF\\u2060]/g,fe=/[\\u00A0\\u202F]/g,l0=e=>e.replace(ae,\"\").replace(fe,\" \").normalize(\"NFC\").trim();var vx=e=>e.length>=4&&e[0]===255&&e[1]===254&&e[2]===0&&e[3]===0?{encoding:\"utf-32le\",bomLength:4}:e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191?{encoding:\"utf-8\",bomLength:3}:e.length>=2&&e[0]===255&&e[1]===254?{encoding:\"utf-16le\",bomLength:2}:e.length>=2&&e[0]===254&&e[1]===255?{encoding:\"utf-16be\",bomLength:2}:null;var ce=[\",\",\";\",\" \",\"|\"];var se=(e,x)=>{let t=0,a=!1;for(let f=0;f<e.length;f++){let s=e[f];s==='\"'?a=!a:!a&&s===x&&t++}return t},ie=e=>{let x=e.reduce((t,a)=>t+a,0)/e.length;return e.reduce((t,a)=>t+(a-x)**2,0)/e.length},kx=e=>{let x=e.split(/\\r\\n|\\r|\\n/).filter(s=>s.length>0).slice(0,10),t=\",\",a=1/0,f=!1;for(let s of ce){let d=x.map(g=>se(g,s));if(!(d.length>0&&d.every(g=>g>0)))continue;let h=ie(d);(!f||h<a)&&(t=s,a=h,f=!0)}return t};var zx=wx(Px(),1),Fe=e=>{try{return new TextDecoder(\"utf-8\",{fatal:!0}).decode(e),!0}catch{return!1}},Te=e=>{let x=e.toLowerCase();return x===\"ascii\"?\"utf-8\":x},dx=e=>{if(Fe(e))return\"utf-8\";let x=(0,zx.detect)(e);return x?Te(x):\"windows-1252\"};var ox=e=>new Promise((x,t)=>{let a=new FileReader;a.onload=()=>x(a.result),a.onerror=()=>t(a.error),a.readAsArrayBuffer(e)});var Ux=64*1024,Le=1024*1024,Me=e=>{try{return new TextDecoder(e)}catch{return new TextDecoder(\"windows-1252\")}},je=e=>{for(let x=0;x<e.length;x++)if(e[x]>127)return x;return-1},Pe=e=>{let x=je(e),t=x<0?0:Math.max(0,x-1024);return dx(e.subarray(t,t+Le))},w0=async e=>{let x=new Uint8Array(await ox(e)),t=x.subarray(0,Ux),a=vx(x),f=a?a.encoding:dx(t),s=null;if(f===\"utf-8\")try{s=new TextDecoder(\"utf-8\",{fatal:!0}).decode(x)}catch{f=Pe(x)}s==null&&(s=Me(f).decode(x));let d=kx(s.slice(0,Ux));return{text:s,encoding:f,delimiter:d}};var ze=/^sep=.$/i,ux=(e,x)=>e.length>0&&ze.test(e[0].join(x))?e.slice(1):e;var Nx=async({file:e})=>{let{text:x,delimiter:t}=await w0(e),a=qx.default.parse(x,{header:!1,skipEmptyLines:!1,delimiter:t}),f=a.data;for(let d of f)for(let i=0;i<d.length;i++)d[i]=l0(d[i]);let s=a.errors.map(d=>({code:d.code,row:d.row}));return{kind:\"rows\",rows:ux(f,t),delimiter:t,errors:s}};var Vx=async({file:e})=>{let{text:x}=await w0(e),a=JSON.parse(x).map(i=>{let h={};for(let g of Object.keys(i))h[l0(g)]=i[g];return h}),f=new Set;for(let i of a)for(let h of Object.keys(i))f.add(h);let s=Array.from(f),d=a.map(i=>{let h={};for(let g of s){let G=i[g];h[g]=G!=null?l0(String(G)):\"\"}return h});return{kind:\"records\",headers:s,rows:d}};var Ue=/^[=@+\\-\\t\\r]/,qe=/^[+-][\\d.,'\\s\xA0 ]*$/;function Wx(e){return!Ue.test(e)||qe.test(e)?e:`'${e}`}function Kx(e){let x=Wx(e);return x.includes(\",\")||x.includes('\"')||x.includes(`\n`)||x.includes(\"\\r\")?`\"${x.replace(/\"/g,'\"\"')}\"`:x}function Ne(e,x){let t=x??(e.length>0?Object.keys(e[0]):[]);if(t.length===0)return new Blob([\"\"],{type:\"text/csv\"});let a=t.map(Kx).join(\",\"),f=e.map(d=>t.map(i=>Kx(d[i]??\"\")).join(\",\")),s=f.length>0?`${a}\n${f.join(`\n`)}`:`${a}\n`;return new Blob([`\\uFEFF${s}`],{type:\"text/csv;charset=utf-8\"})}function $x(e){let x=Wx(e);return x.includes(\" \")||x.includes('\"')||x.includes(`\n`)||x.includes(\"\\r\")?`\"${x.replace(/\"/g,'\"\"')}\"`:x}function Ve(e,x){let t=x??(e.length>0?Object.keys(e[0]):[]);if(t.length===0)return new Blob([\"\"],{type:\"text/tab-separated-values\"});let a=t.map($x).join(\" \"),f=e.map(d=>t.map(i=>$x(d[i]??\"\")).join(\" \")),s=f.length>0?`${a}\n${f.join(`\n`)}`:`${a}\n`;return new Blob([`\\uFEFF${s}`],{type:\"text/tab-separated-values;charset=utf-8\"})}function Ke(e){return new Blob([JSON.stringify(e,null,2)],{type:\"application/json;charset=utf-8\"})}function $e(e){return e.replace(/&/g,\"&\").replace(/</g,\"<\").replace(/>/g,\">\").replace(/\"/g,\""\").replace(/'/g,\"'\")}function We(e,x){let t=x??(e.length>0?Object.keys(e[0]):[]),a=`<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rows>\n`;for(let f of e){a+=` <row>\n`;for(let s of t){let d=s.replace(/\\s+/g,\"_\");a+=` <${d}>${$e(f[s]??\"\")}</${d}>\n`}a+=` </row>\n`}return a+=\"</rows>\",new Blob([a],{type:\"application/xml;charset=utf-8\"})}var lx=e=>e.columns.map(x=>x.title),Jx=e=>Ne(e.rows,lx(e)),Gx=e=>Ve(e.rows,lx(e)),Hx=e=>Ke(e.rows),Zx=e=>We(e.rows,lx(e));var Je={csv:Nx,json:Vx},Ge={csv:Jx,tsv:Gx,json:Hx,xml:Zx},hx=self;self.addEventListener(\"message\",async e=>{let x=e.data;try{if(x.type===\"PARSE\"&&(x.format===\"csv\"||x.format===\"json\")){let t=await Je[x.format]({file:x.file});hx.postMessage({type:\"PARSED\",result:t,generation:x.generation});return}if(x.type===\"SERIALIZE\"&&x.format!==\"xlsx\"){let t=await Ge[x.format]({rows:x.rows,columns:x.columns});hx.postMessage({type:\"SERIALIZED\",blob:t,generation:x.generation})}}catch(t){let a=Sx(t,\"Text worker error\");hx.postMessage({type:\"ERROR\",message:a.message,code:a.code,generation:x.generation})}});})();\n"
|
|
4768
4728
|
};
|
|
4769
|
-
function
|
|
4729
|
+
function qs(e) {
|
|
4770
4730
|
if (typeof Worker > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function") throw Error(`Worker API unavailable; cannot spawn "${e}" worker`);
|
|
4771
|
-
let t = new Blob([
|
|
4731
|
+
let t = new Blob([Ks[e]], { type: "application/javascript" }), n = URL.createObjectURL(t), r = new Worker(n);
|
|
4772
4732
|
return URL.revokeObjectURL(n), r;
|
|
4773
4733
|
}
|
|
4774
|
-
async function
|
|
4734
|
+
async function Js() {
|
|
4775
4735
|
if (typeof Worker > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function") throw Error("Worker API unavailable; cannot spawn \"sheet\" worker");
|
|
4776
4736
|
let { SHEET_WORKER_SOURCE: e } = await import("./sheetWorkerSource.generated-BRh0-P0M.js");
|
|
4777
4737
|
if (!e) throw Error("Sheet worker source not built; run pnpm build:workers");
|
|
@@ -4780,14 +4740,14 @@ async function ec() {
|
|
|
4780
4740
|
}
|
|
4781
4741
|
//#endregion
|
|
4782
4742
|
//#region src/core/FilterEngine.ts
|
|
4783
|
-
function
|
|
4743
|
+
function Ys(e) {
|
|
4784
4744
|
let t = /* @__PURE__ */ new Map();
|
|
4785
4745
|
return (n) => {
|
|
4786
4746
|
let r = t.get(n);
|
|
4787
4747
|
return r === void 0 && (r = e(n), t.set(n, r)), r;
|
|
4788
4748
|
};
|
|
4789
4749
|
}
|
|
4790
|
-
var
|
|
4750
|
+
var Xs = class {
|
|
4791
4751
|
_sortState = null;
|
|
4792
4752
|
_showOnlyDeletedRows = !1;
|
|
4793
4753
|
getFilteredRowIds() {
|
|
@@ -4864,7 +4824,7 @@ var nc = class {
|
|
|
4864
4824
|
}
|
|
4865
4825
|
clear() {}
|
|
4866
4826
|
destroy() {}
|
|
4867
|
-
},
|
|
4827
|
+
}, Zs = class {
|
|
4868
4828
|
filters = {
|
|
4869
4829
|
search: "",
|
|
4870
4830
|
matchCase: !1,
|
|
@@ -4988,7 +4948,7 @@ var nc = class {
|
|
|
4988
4948
|
}
|
|
4989
4949
|
setColumns(e) {
|
|
4990
4950
|
this.columnFormatters.clear();
|
|
4991
|
-
for (let t of e) t.formatter && this.columnFormatters.set(t.id,
|
|
4951
|
+
for (let t of e) t.formatter && this.columnFormatters.set(t.id, Ys(t.formatter));
|
|
4992
4952
|
this.fieldOrder = e.map((e) => e.id), this.multiselectFields = new Set(e.filter((e) => e.editor?.type === "multiselect").map((e) => e.id)), this._wordsPerRow = Math.max(2, Math.ceil(this.fieldOrder.length / 32)), this.rowTextCache.clear(), this.filterWorker && this.filterWorker.postMessage({
|
|
4993
4953
|
type: "SET_FIELD_ORDER",
|
|
4994
4954
|
fieldOrder: this.fieldOrder,
|
|
@@ -5439,7 +5399,7 @@ var nc = class {
|
|
|
5439
5399
|
}
|
|
5440
5400
|
initFilterWorker() {
|
|
5441
5401
|
if (!(typeof Worker > "u")) try {
|
|
5442
|
-
this.filterWorker =
|
|
5402
|
+
this.filterWorker = qs("filter"), this.filterWorker.onmessage = (e) => {
|
|
5443
5403
|
let t = e.data;
|
|
5444
5404
|
if (t.type === "SORT_RESULT") {
|
|
5445
5405
|
if (t.generation === this._sortGeneration && this._pendingSortResolve) {
|
|
@@ -5465,15 +5425,15 @@ var nc = class {
|
|
|
5465
5425
|
this._pendingFilterResolve = null, e();
|
|
5466
5426
|
}
|
|
5467
5427
|
}
|
|
5468
|
-
},
|
|
5469
|
-
function
|
|
5428
|
+
}, Qs = /^[\s\p{Sc}%]+/u, $s = /[\s\p{Sc}%]+$/u, ec = /^\d{1,3}(?: \d{3})+(?:[.,]\d+)?$/, tc = /^[\d.,]+$/;
|
|
5429
|
+
function nc(e) {
|
|
5470
5430
|
let t = e.trim();
|
|
5471
5431
|
if (!t) return null;
|
|
5472
5432
|
let n = !1;
|
|
5473
5433
|
t.startsWith("(") && t.endsWith(")") && (t = t.slice(1, -1), n = !0);
|
|
5474
5434
|
let r = !1;
|
|
5475
5435
|
for (;;) {
|
|
5476
|
-
let e = t.replace(
|
|
5436
|
+
let e = t.replace(Qs, "");
|
|
5477
5437
|
if (!r && e.startsWith("-")) {
|
|
5478
5438
|
r = !0, t = e.slice(1);
|
|
5479
5439
|
continue;
|
|
@@ -5481,38 +5441,38 @@ function cc(e) {
|
|
|
5481
5441
|
t = e;
|
|
5482
5442
|
break;
|
|
5483
5443
|
}
|
|
5484
|
-
return r && (n = !0), t = t.replace(
|
|
5444
|
+
return r && (n = !0), t = t.replace($s, ""), ec.test(t) && (t = t.replace(/ /g, "")), tc.test(t) ? {
|
|
5485
5445
|
core: t,
|
|
5486
5446
|
negative: n
|
|
5487
5447
|
} : null;
|
|
5488
5448
|
}
|
|
5489
|
-
function
|
|
5449
|
+
function rc(e) {
|
|
5490
5450
|
let t = new Intl.DateTimeFormat(e, {
|
|
5491
5451
|
day: "numeric",
|
|
5492
5452
|
month: "numeric"
|
|
5493
5453
|
}).formatToParts(new Date(2e3, 11, 31)), n = t.findIndex((e) => e.type === "day"), r = t.findIndex((e) => e.type === "month");
|
|
5494
5454
|
return n !== -1 && r !== -1 && n < r ? "EU" : "US";
|
|
5495
5455
|
}
|
|
5496
|
-
var
|
|
5497
|
-
function
|
|
5456
|
+
var ic = rc();
|
|
5457
|
+
function ac(e, t, n = 1e3) {
|
|
5498
5458
|
let r = 0, i = 0, a = Math.min(e.length, n);
|
|
5499
5459
|
for (let n = 0; n < a; n++) {
|
|
5500
5460
|
let a = e[n];
|
|
5501
5461
|
for (let e of t) {
|
|
5502
5462
|
let t = a[e];
|
|
5503
5463
|
if (typeof t != "string") continue;
|
|
5504
|
-
let n =
|
|
5464
|
+
let n = nc(t);
|
|
5505
5465
|
if (!n) continue;
|
|
5506
5466
|
let o = n.core, s = o.lastIndexOf("."), c = o.lastIndexOf(",");
|
|
5507
5467
|
if (s !== -1 && c !== -1) return c > s ? "EU" : "US";
|
|
5508
5468
|
c !== -1 && /,\d{1,2}$/.test(o) ? r++ : s !== -1 && /\.\d{1,2}$/.test(o) && i++;
|
|
5509
5469
|
}
|
|
5510
5470
|
}
|
|
5511
|
-
return r === i ?
|
|
5471
|
+
return r === i ? ic : r > i ? "EU" : "US";
|
|
5512
5472
|
}
|
|
5513
|
-
function
|
|
5473
|
+
function oc(e, t) {
|
|
5514
5474
|
if (typeof e != "string") return e;
|
|
5515
|
-
let n =
|
|
5475
|
+
let n = nc(e);
|
|
5516
5476
|
if (!n) return e;
|
|
5517
5477
|
let { core: r, negative: i } = n, a = r;
|
|
5518
5478
|
t === "EU" ? r.includes(",") ? a = r.replace(/\./g, "").replace(",", ".") : /^\d{1,3}(\.\d{3})+$/.test(r) && (a = r.replace(/\./g, "")) : r.includes(",") && (a = r.replace(/,/g, ""));
|
|
@@ -5521,7 +5481,7 @@ function fc(e, t) {
|
|
|
5521
5481
|
}
|
|
5522
5482
|
//#endregion
|
|
5523
5483
|
//#region src/core/formats/parseImportedDate.ts
|
|
5524
|
-
var
|
|
5484
|
+
var sc = [
|
|
5525
5485
|
"january",
|
|
5526
5486
|
"february",
|
|
5527
5487
|
"march",
|
|
@@ -5535,21 +5495,21 @@ var pc = [
|
|
|
5535
5495
|
"november",
|
|
5536
5496
|
"december"
|
|
5537
5497
|
];
|
|
5538
|
-
function
|
|
5498
|
+
function cc(e) {
|
|
5539
5499
|
let t = {}, n = Hr.ui.calendar.months, r = Hr.ui.calendar.monthsShort;
|
|
5540
|
-
return
|
|
5500
|
+
return sc.forEach((e, i) => {
|
|
5541
5501
|
t[n[e].toLowerCase()] = i + 1, t[r[e].toLowerCase()] = i + 1;
|
|
5542
|
-
}), e &&
|
|
5502
|
+
}), e && sc.forEach((n, r) => {
|
|
5543
5503
|
let i = e(`calendar.months.${n}`), a = e(`calendar.monthsShort.${n}`);
|
|
5544
5504
|
i && (t[i.toLowerCase().replace(/\.$/, "")] = r + 1), a && (t[a.toLowerCase().replace(/\.$/, "")] = r + 1);
|
|
5545
5505
|
}), t;
|
|
5546
5506
|
}
|
|
5547
|
-
function
|
|
5507
|
+
function lc(e, t, n) {
|
|
5548
5508
|
if (t < 1 || t > 12 || n < 1 || n > 31) return null;
|
|
5549
5509
|
let r = new Date(e, t - 1, n);
|
|
5550
5510
|
return r.getFullYear() !== e || r.getMonth() !== t - 1 || r.getDate() !== n ? null : `${e}-${String(t).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
|
|
5551
5511
|
}
|
|
5552
|
-
function
|
|
5512
|
+
function uc(e, t, n = 1e3) {
|
|
5553
5513
|
let r = /^(\d{1,2})[\/.](\d{1,2})[\/.](\d{4})$/, i = Math.min(e.length, n);
|
|
5554
5514
|
for (let n = 0; n < i; n++) {
|
|
5555
5515
|
let i = e[n];
|
|
@@ -5563,34 +5523,34 @@ function gc(e, t, n = 1e3) {
|
|
|
5563
5523
|
if (o > 12) return "US";
|
|
5564
5524
|
}
|
|
5565
5525
|
}
|
|
5566
|
-
return
|
|
5526
|
+
return ic;
|
|
5567
5527
|
}
|
|
5568
|
-
function
|
|
5528
|
+
function dc(e, t, n) {
|
|
5569
5529
|
let r = e.trim();
|
|
5570
5530
|
if (!r) return null;
|
|
5571
5531
|
let i = r.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
5572
|
-
if (i || (i = r.match(/^(\d{4})\/(\d{2})\/(\d{2})$/), i)) return
|
|
5532
|
+
if (i || (i = r.match(/^(\d{4})\/(\d{2})\/(\d{2})$/), i)) return lc(+i[1], +i[2], +i[3]);
|
|
5573
5533
|
if (i = r.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/), i) {
|
|
5574
5534
|
let e = +i[1], n = +i[2], r = +i[3];
|
|
5575
|
-
return e > 12 ?
|
|
5535
|
+
return e > 12 ? lc(r, n, e) : n > 12 ? lc(r, e, n) : t === "EU" ? lc(r, n, e) : lc(r, e, n);
|
|
5576
5536
|
}
|
|
5577
5537
|
if (i = r.match(/^(\d{1,2})\s+([A-Za-zÀ-ÖØ-öø-ÿА-яёЁ.]+),?\s+(\d{4})$/), i) {
|
|
5578
5538
|
let e = n[i[2].toLowerCase().replace(/\.$/, "")];
|
|
5579
|
-
if (e !== void 0) return
|
|
5539
|
+
if (e !== void 0) return lc(+i[3], e, +i[1]);
|
|
5580
5540
|
}
|
|
5581
5541
|
if (i = r.match(/^([A-Za-zÀ-ÖØ-öø-ÿА-яёЁ.]+)\s+(\d{1,2}),?\s+(\d{4})$/), i) {
|
|
5582
5542
|
let e = n[i[1].toLowerCase().replace(/\.$/, "")];
|
|
5583
|
-
if (e !== void 0) return
|
|
5543
|
+
if (e !== void 0) return lc(+i[3], e, +i[2]);
|
|
5584
5544
|
}
|
|
5585
5545
|
if (i = r.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/), i) {
|
|
5586
5546
|
let e = +i[1], n = +i[2], r = +i[3];
|
|
5587
|
-
return e > 12 ?
|
|
5547
|
+
return e > 12 ? lc(r, n, e) : n > 12 ? lc(r, e, n) : t === "EU" ? lc(r, n, e) : lc(r, e, n);
|
|
5588
5548
|
}
|
|
5589
5549
|
return null;
|
|
5590
5550
|
}
|
|
5591
5551
|
//#endregion
|
|
5592
5552
|
//#region src/core/formulas/FormulaRegistry.ts
|
|
5593
|
-
var
|
|
5553
|
+
var fc = class {
|
|
5594
5554
|
formulas = /* @__PURE__ */ new Map();
|
|
5595
5555
|
register(e) {
|
|
5596
5556
|
if (this.formulas.has(e.name)) throw Error(`Formula "${e.name}" is already registered`);
|
|
@@ -5611,10 +5571,10 @@ var vc = class {
|
|
|
5611
5571
|
};
|
|
5612
5572
|
//#endregion
|
|
5613
5573
|
//#region src/core/formulas/builtins/text.ts
|
|
5614
|
-
function
|
|
5574
|
+
function pc(e) {
|
|
5615
5575
|
return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
|
|
5616
5576
|
}
|
|
5617
|
-
var
|
|
5577
|
+
var mc = {
|
|
5618
5578
|
name: "UPPER",
|
|
5619
5579
|
label: "Uppercase",
|
|
5620
5580
|
category: "text",
|
|
@@ -5626,10 +5586,10 @@ var bc = {
|
|
|
5626
5586
|
},
|
|
5627
5587
|
kind: "cell",
|
|
5628
5588
|
compute: (e) => {
|
|
5629
|
-
let t =
|
|
5589
|
+
let t = pc(e.value);
|
|
5630
5590
|
return t === null ? e.value : t.toUpperCase();
|
|
5631
5591
|
}
|
|
5632
|
-
},
|
|
5592
|
+
}, hc = {
|
|
5633
5593
|
name: "LOWER",
|
|
5634
5594
|
label: "Lowercase",
|
|
5635
5595
|
category: "text",
|
|
@@ -5641,10 +5601,10 @@ var bc = {
|
|
|
5641
5601
|
},
|
|
5642
5602
|
kind: "cell",
|
|
5643
5603
|
compute: (e) => {
|
|
5644
|
-
let t =
|
|
5604
|
+
let t = pc(e.value);
|
|
5645
5605
|
return t === null ? e.value : t.toLowerCase();
|
|
5646
5606
|
}
|
|
5647
|
-
},
|
|
5607
|
+
}, gc = {
|
|
5648
5608
|
name: "TRIM",
|
|
5649
5609
|
label: "Trim whitespace",
|
|
5650
5610
|
category: "text",
|
|
@@ -5656,10 +5616,10 @@ var bc = {
|
|
|
5656
5616
|
},
|
|
5657
5617
|
kind: "cell",
|
|
5658
5618
|
compute: (e) => {
|
|
5659
|
-
let t =
|
|
5619
|
+
let t = pc(e.value);
|
|
5660
5620
|
return t === null ? e.value : t.replace(/\s+/g, " ").trim();
|
|
5661
5621
|
}
|
|
5662
|
-
},
|
|
5622
|
+
}, _c = {
|
|
5663
5623
|
name: "CAPITALIZE",
|
|
5664
5624
|
label: "Capitalize",
|
|
5665
5625
|
category: "text",
|
|
@@ -5671,20 +5631,20 @@ var bc = {
|
|
|
5671
5631
|
},
|
|
5672
5632
|
kind: "cell",
|
|
5673
5633
|
compute: (e) => {
|
|
5674
|
-
let t =
|
|
5634
|
+
let t = pc(e.value);
|
|
5675
5635
|
return t === null ? e.value : t.charAt(0).toUpperCase() + t.slice(1);
|
|
5676
5636
|
}
|
|
5677
5637
|
};
|
|
5678
5638
|
//#endregion
|
|
5679
5639
|
//#region src/core/formulas/builtins/number.ts
|
|
5680
|
-
function
|
|
5640
|
+
function vc(e) {
|
|
5681
5641
|
return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
|
|
5682
5642
|
}
|
|
5683
|
-
function
|
|
5643
|
+
function yc(e) {
|
|
5684
5644
|
let t = Number(e);
|
|
5685
5645
|
return Number.isNaN(t) ? null : t;
|
|
5686
5646
|
}
|
|
5687
|
-
function
|
|
5647
|
+
function bc(e, t, n, r) {
|
|
5688
5648
|
return {
|
|
5689
5649
|
name: e,
|
|
5690
5650
|
label: t,
|
|
@@ -5697,14 +5657,14 @@ function Ec(e, t, n, r) {
|
|
|
5697
5657
|
},
|
|
5698
5658
|
kind: "cell",
|
|
5699
5659
|
compute: (e) => {
|
|
5700
|
-
let t =
|
|
5660
|
+
let t = vc(e.value);
|
|
5701
5661
|
if (t === null) return e.value;
|
|
5702
|
-
let n =
|
|
5662
|
+
let n = yc(t);
|
|
5703
5663
|
return n === null ? e.value : String(r(n));
|
|
5704
5664
|
}
|
|
5705
5665
|
};
|
|
5706
5666
|
}
|
|
5707
|
-
var
|
|
5667
|
+
var xc = bc("ROUND", "Round", "(number)", Math.round), Sc = bc("ROUND_UP", "Round up", "(number)", Math.ceil), Cc = bc("ROUND_DOWN", "Round down", "(number)", Math.floor), wc = bc("ABS", "Absolute value", "(number)", Math.abs), Tc = {
|
|
5708
5668
|
name: "CLEAR",
|
|
5709
5669
|
label: "Clear",
|
|
5710
5670
|
category: "text",
|
|
@@ -5716,7 +5676,7 @@ var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Roun
|
|
|
5716
5676
|
},
|
|
5717
5677
|
kind: "cell",
|
|
5718
5678
|
compute: () => ""
|
|
5719
|
-
},
|
|
5679
|
+
}, Ec = {
|
|
5720
5680
|
name: "MERGE",
|
|
5721
5681
|
label: "Merge columns",
|
|
5722
5682
|
category: "text",
|
|
@@ -5752,7 +5712,7 @@ var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Roun
|
|
|
5752
5712
|
}
|
|
5753
5713
|
return i.join(r);
|
|
5754
5714
|
}
|
|
5755
|
-
},
|
|
5715
|
+
}, Dc = {
|
|
5756
5716
|
name: "SPLIT",
|
|
5757
5717
|
label: "Split column",
|
|
5758
5718
|
category: "text",
|
|
@@ -5786,7 +5746,7 @@ var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Roun
|
|
|
5786
5746
|
for (let e = 0; e < n.length; e++) o[n[e]] = e < n.length - 1 ? a[e] ?? "" : a.slice(e).join(r);
|
|
5787
5747
|
return o;
|
|
5788
5748
|
}
|
|
5789
|
-
},
|
|
5749
|
+
}, Oc = {
|
|
5790
5750
|
name: "CONCAT",
|
|
5791
5751
|
label: "Concatenate",
|
|
5792
5752
|
category: "text",
|
|
@@ -5805,10 +5765,10 @@ var Dc = Ec("ROUND", "Round", "(number)", Math.round), Oc = Ec("ROUND_UP", "Roun
|
|
|
5805
5765
|
};
|
|
5806
5766
|
//#endregion
|
|
5807
5767
|
//#region src/core/formulas/builtins/left.ts
|
|
5808
|
-
function
|
|
5768
|
+
function kc(e) {
|
|
5809
5769
|
return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
|
|
5810
5770
|
}
|
|
5811
|
-
var
|
|
5771
|
+
var Ac = {
|
|
5812
5772
|
name: "LEFT",
|
|
5813
5773
|
label: "Left",
|
|
5814
5774
|
category: "text",
|
|
@@ -5820,7 +5780,7 @@ var Ic = {
|
|
|
5820
5780
|
},
|
|
5821
5781
|
kind: "cell",
|
|
5822
5782
|
compute: (e) => {
|
|
5823
|
-
let t = e.args ?? [e.value], n =
|
|
5783
|
+
let t = e.args ?? [e.value], n = kc(t[0]);
|
|
5824
5784
|
if (n === null) return t[0];
|
|
5825
5785
|
let r = Math.floor(Number(t[1]));
|
|
5826
5786
|
return r <= 0 ? "" : n.slice(0, r);
|
|
@@ -5828,10 +5788,10 @@ var Ic = {
|
|
|
5828
5788
|
};
|
|
5829
5789
|
//#endregion
|
|
5830
5790
|
//#region src/core/formulas/builtins/right.ts
|
|
5831
|
-
function
|
|
5791
|
+
function jc(e) {
|
|
5832
5792
|
return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
|
|
5833
5793
|
}
|
|
5834
|
-
var
|
|
5794
|
+
var Mc = {
|
|
5835
5795
|
name: "RIGHT",
|
|
5836
5796
|
label: "Right",
|
|
5837
5797
|
category: "text",
|
|
@@ -5843,7 +5803,7 @@ var Rc = {
|
|
|
5843
5803
|
},
|
|
5844
5804
|
kind: "cell",
|
|
5845
5805
|
compute: (e) => {
|
|
5846
|
-
let t = e.args ?? [e.value], n =
|
|
5806
|
+
let t = e.args ?? [e.value], n = jc(t[0]);
|
|
5847
5807
|
if (n === null) return t[0];
|
|
5848
5808
|
let r = Math.floor(Number(t[1]));
|
|
5849
5809
|
return r <= 0 ? "" : n.slice(-r);
|
|
@@ -5851,10 +5811,10 @@ var Rc = {
|
|
|
5851
5811
|
};
|
|
5852
5812
|
//#endregion
|
|
5853
5813
|
//#region src/core/formulas/builtins/mid.ts
|
|
5854
|
-
function
|
|
5814
|
+
function Nc(e) {
|
|
5855
5815
|
return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
|
|
5856
5816
|
}
|
|
5857
|
-
var
|
|
5817
|
+
var Pc = {
|
|
5858
5818
|
name: "MID",
|
|
5859
5819
|
label: "Mid",
|
|
5860
5820
|
category: "text",
|
|
@@ -5866,7 +5826,7 @@ var Bc = {
|
|
|
5866
5826
|
},
|
|
5867
5827
|
kind: "cell",
|
|
5868
5828
|
compute: (e) => {
|
|
5869
|
-
let t = e.args ?? [e.value], n =
|
|
5829
|
+
let t = e.args ?? [e.value], n = Nc(t[0]);
|
|
5870
5830
|
if (n === null) return t[0];
|
|
5871
5831
|
let r = Math.max(1, Math.floor(Number(t[1]))), i = Math.floor(Number(t[2]));
|
|
5872
5832
|
return i <= 0 ? "" : n.slice(r - 1, r - 1 + i);
|
|
@@ -5874,10 +5834,10 @@ var Bc = {
|
|
|
5874
5834
|
};
|
|
5875
5835
|
//#endregion
|
|
5876
5836
|
//#region src/core/formulas/builtins/substitute.ts
|
|
5877
|
-
function
|
|
5837
|
+
function Fc(e) {
|
|
5878
5838
|
return e == null || e === "" ? null : typeof e == "string" ? e : String(e);
|
|
5879
5839
|
}
|
|
5880
|
-
function
|
|
5840
|
+
function Ic(e, t, n, r) {
|
|
5881
5841
|
let i = 0, a = 0;
|
|
5882
5842
|
for (; a <= e.length - t.length;) {
|
|
5883
5843
|
let o = e.indexOf(t, a);
|
|
@@ -5887,7 +5847,7 @@ function Hc(e, t, n, r) {
|
|
|
5887
5847
|
}
|
|
5888
5848
|
return e;
|
|
5889
5849
|
}
|
|
5890
|
-
var
|
|
5850
|
+
var Lc = {
|
|
5891
5851
|
name: "SUBSTITUTE",
|
|
5892
5852
|
label: "Substitute",
|
|
5893
5853
|
category: "text",
|
|
@@ -5899,21 +5859,21 @@ var Uc = {
|
|
|
5899
5859
|
},
|
|
5900
5860
|
kind: "cell",
|
|
5901
5861
|
compute: (e) => {
|
|
5902
|
-
let t = e.args ?? [e.value], n =
|
|
5862
|
+
let t = e.args ?? [e.value], n = Fc(t[0]);
|
|
5903
5863
|
if (n === null) return t[0];
|
|
5904
5864
|
let r = String(t[1] ?? ""), i = String(t[2] ?? ""), a = t[3] === void 0 ? void 0 : Math.floor(Number(t[3]));
|
|
5905
|
-
return a === void 0 ? n.split(r).join(i) :
|
|
5865
|
+
return a === void 0 ? n.split(r).join(i) : Ic(n, r, i, a);
|
|
5906
5866
|
}
|
|
5907
5867
|
};
|
|
5908
5868
|
//#endregion
|
|
5909
5869
|
//#region src/core/formulas/builtins/index.ts
|
|
5910
|
-
function
|
|
5911
|
-
let e = new
|
|
5912
|
-
return e.register(
|
|
5870
|
+
function Rc() {
|
|
5871
|
+
let e = new fc();
|
|
5872
|
+
return e.register(mc), e.register(hc), e.register(gc), e.register(_c), e.register(xc), e.register(Sc), e.register(Cc), e.register(wc), e.register(Tc), e.register(Ec), e.register(Dc), e.register(Oc), e.register(Ac), e.register(Mc), e.register(Pc), e.register(Lc), e;
|
|
5913
5873
|
}
|
|
5914
5874
|
//#endregion
|
|
5915
5875
|
//#region src/core/formulas/formulaDeltas.ts
|
|
5916
|
-
function
|
|
5876
|
+
function zc(e, t, n, r, i) {
|
|
5917
5877
|
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
5918
5878
|
for (let s of i) {
|
|
5919
5879
|
let i = e.getRowById(s);
|
|
@@ -5937,7 +5897,7 @@ function Gc(e, t, n, r, i) {
|
|
|
5937
5897
|
newValues: o
|
|
5938
5898
|
}];
|
|
5939
5899
|
}
|
|
5940
|
-
function
|
|
5900
|
+
function Bc(e, t, n, r, i) {
|
|
5941
5901
|
let a = n.targetFields(r), o = /* @__PURE__ */ new Map();
|
|
5942
5902
|
for (let e of a) o.set(e, {
|
|
5943
5903
|
oldValues: /* @__PURE__ */ new Map(),
|
|
@@ -5969,6 +5929,46 @@ function Kc(e, t, n, r, i) {
|
|
|
5969
5929
|
return s;
|
|
5970
5930
|
}
|
|
5971
5931
|
//#endregion
|
|
5932
|
+
//#region src/core/normalizeColumns.ts
|
|
5933
|
+
var Vc = (e) => e.type === "unique", Hc = (e) => e.type === "asyncFunction";
|
|
5934
|
+
function Uc(e) {
|
|
5935
|
+
return e.map((e) => {
|
|
5936
|
+
let t = e.validators;
|
|
5937
|
+
if (!t?.some((e) => Vc(e) || Hc(e))) return e;
|
|
5938
|
+
let n = t.filter(Vc);
|
|
5939
|
+
n.length > 1 && console.warn(`[updog] column "${e.id}" declares ${n.length} { type: "unique" } validators; using the first, ignoring the rest.`);
|
|
5940
|
+
let r = t.filter(Hc), i = {
|
|
5941
|
+
...e,
|
|
5942
|
+
validators: t.filter((e) => !Vc(e) && !Hc(e))
|
|
5943
|
+
}, [a] = n;
|
|
5944
|
+
return a && (i.uniqueConfig = {
|
|
5945
|
+
...a.message !== void 0 && { message: a.message },
|
|
5946
|
+
...a.fn !== void 0 && { fn: a.fn }
|
|
5947
|
+
}), r.length > 0 && (i.asyncConfig = r), i;
|
|
5948
|
+
});
|
|
5949
|
+
}
|
|
5950
|
+
function Wc(e) {
|
|
5951
|
+
return e.uniqueConfig !== void 0;
|
|
5952
|
+
}
|
|
5953
|
+
function Gc(e) {
|
|
5954
|
+
return e.some((e) => e.asyncConfig !== void 0 || e.uniqueConfig?.fn !== void 0);
|
|
5955
|
+
}
|
|
5956
|
+
function Kc(e) {
|
|
5957
|
+
return e.map((e) => {
|
|
5958
|
+
let { uniqueConfig: t, asyncConfig: n, ...r } = e;
|
|
5959
|
+
if (!t && !n) return e;
|
|
5960
|
+
let i = [...r.validators ?? []];
|
|
5961
|
+
return t && i.push({
|
|
5962
|
+
type: "unique",
|
|
5963
|
+
...t.message !== void 0 && { message: t.message },
|
|
5964
|
+
...t.fn !== void 0 && { fn: t.fn }
|
|
5965
|
+
}), n && i.push(...n), {
|
|
5966
|
+
...r,
|
|
5967
|
+
validators: i
|
|
5968
|
+
};
|
|
5969
|
+
});
|
|
5970
|
+
}
|
|
5971
|
+
//#endregion
|
|
5972
5972
|
//#region src/core/PendingMutations.ts
|
|
5973
5973
|
var qc = class {
|
|
5974
5974
|
inflight = /* @__PURE__ */ new Map();
|
|
@@ -7462,7 +7462,7 @@ var pl = (e) => {
|
|
|
7462
7462
|
return this._mode === "client";
|
|
7463
7463
|
}
|
|
7464
7464
|
rowStore = new Yc();
|
|
7465
|
-
formulaRegistry =
|
|
7465
|
+
formulaRegistry = Rc();
|
|
7466
7466
|
_isLoading = !0;
|
|
7467
7467
|
sourceManager = new rl();
|
|
7468
7468
|
sourceLifecycle;
|
|
@@ -7709,7 +7709,7 @@ var pl = (e) => {
|
|
|
7709
7709
|
};
|
|
7710
7710
|
orchestrator = new Us(this.bulkMutationHost, { chunkSize: Zo });
|
|
7711
7711
|
constructor(e = "client", t, n) {
|
|
7712
|
-
if (this._mode = e, this.errorHandler = n ?? new Wo(), this.dirtyTracker = new Gs(), this.validationStore = new gl(), this.history = new ps(), e === "client") this.server = null, this.valueIndex = new yl(), this.filterEngine = new
|
|
7712
|
+
if (this._mode = e, this.errorHandler = n ?? new Wo(), this.dirtyTracker = new Gs(), this.validationStore = new gl(), this.history = new ps(), e === "client") this.server = null, this.valueIndex = new yl(), this.filterEngine = new Zs(() => {
|
|
7713
7713
|
this.snapshotManager.markFilteredCountsDirty(), this.rowStore.invalidateIndex(), this.notify();
|
|
7714
7714
|
}), this.filterEngine.setReaders(this.filterRowReader, this.flagReader), this.strategy = new Os(this.filterEngine, this.rowStore, this.snapshotManager, this.dirtyTracker, this.sourceManager, () => this.notify(), this);
|
|
7715
7715
|
else {
|
|
@@ -7725,7 +7725,7 @@ var pl = (e) => {
|
|
|
7725
7725
|
applyServerRowMeta: (e, t) => this.applyServerRowMeta(e, t)
|
|
7726
7726
|
}, t.sourceLabel), this.server.setOnChanged(() => {
|
|
7727
7727
|
this.snapshotManager.markCountsDirty(), this.notify();
|
|
7728
|
-
}), this.valueIndex = new vl(), this.filterEngine = new
|
|
7728
|
+
}), this.valueIndex = new vl(), this.filterEngine = new Xs(), this.serverCounts = new Xc(), this.editBuilder = new el({
|
|
7729
7729
|
getPrimaryKey: () => this._primaryKey ?? "",
|
|
7730
7730
|
getRowById: (e) => this.rowStore.getRowById(e),
|
|
7731
7731
|
getColumnIds: () => this._effectiveColumns.map((e) => e.id),
|
|
@@ -7847,7 +7847,7 @@ var pl = (e) => {
|
|
|
7847
7847
|
if (this._lastColumnsInput === e) return;
|
|
7848
7848
|
this._lastColumnsInput = e;
|
|
7849
7849
|
let t = [], n = [];
|
|
7850
|
-
for (let r of
|
|
7850
|
+
for (let r of Uc(e)) r.id.startsWith("__dynamic__:") ? n.push(r) : t.push(r);
|
|
7851
7851
|
this._schemaColumns = t, this._dynamicColumns = n, this.syncPreLockedColumns(t), this.rebuildEffectiveColumns();
|
|
7852
7852
|
}
|
|
7853
7853
|
getDynamicColumns() {
|
|
@@ -7855,10 +7855,10 @@ var pl = (e) => {
|
|
|
7855
7855
|
}
|
|
7856
7856
|
getEffectiveColumns = () => this._effectiveColumns;
|
|
7857
7857
|
setDynamicColumns(e) {
|
|
7858
|
-
this._dynamicColumns =
|
|
7858
|
+
this._dynamicColumns = Uc(e(this._dynamicColumns)), this.rebuildEffectiveColumns();
|
|
7859
7859
|
}
|
|
7860
7860
|
addDynamicColumns(e) {
|
|
7861
|
-
this._dynamicColumns = [...this._dynamicColumns, ...
|
|
7861
|
+
this._dynamicColumns = [...this._dynamicColumns, ...Uc(e)], this.rebuildEffectiveColumns();
|
|
7862
7862
|
}
|
|
7863
7863
|
addColumnOptions(e, t) {
|
|
7864
7864
|
let n = [...this._addedOptions.get(e) ?? []];
|
|
@@ -8568,7 +8568,7 @@ var pl = (e) => {
|
|
|
8568
8568
|
};
|
|
8569
8569
|
recordLearnedSynonyms(e) {
|
|
8570
8570
|
for (let t of ["columns", "values"]) for (let n of e[t]) {
|
|
8571
|
-
let e = `${n.source}
|
|
8571
|
+
let e = `${n.source}\u0000${n.target}`;
|
|
8572
8572
|
this.learnedSynonymKeys[t].has(e) || (this.learnedSynonymKeys[t].add(e), this.learnedSynonyms[t].push(n));
|
|
8573
8573
|
}
|
|
8574
8574
|
}
|
|
@@ -8615,7 +8615,10 @@ var pl = (e) => {
|
|
|
8615
8615
|
return {
|
|
8616
8616
|
sources: Array.from(e.values()),
|
|
8617
8617
|
counts: t,
|
|
8618
|
-
learnedSynonyms:
|
|
8618
|
+
learnedSynonyms: {
|
|
8619
|
+
columns: [...this.learnedSynonyms.columns],
|
|
8620
|
+
values: [...this.learnedSynonyms.values]
|
|
8621
|
+
}
|
|
8619
8622
|
};
|
|
8620
8623
|
}
|
|
8621
8624
|
isRowVisible(e) {
|
|
@@ -8657,7 +8660,7 @@ var pl = (e) => {
|
|
|
8657
8660
|
let a = [];
|
|
8658
8661
|
for (let o = 0; o < n.length; o++) {
|
|
8659
8662
|
let s = i.filter((e) => r[o].has(e));
|
|
8660
|
-
for (let r of n[o].fields) a.push(...
|
|
8663
|
+
for (let r of n[o].fields) a.push(...zc(this.rowStore, r, e, t, s));
|
|
8661
8664
|
}
|
|
8662
8665
|
return cl(a);
|
|
8663
8666
|
},
|
|
@@ -8671,7 +8674,7 @@ var pl = (e) => {
|
|
|
8671
8674
|
code: "transforming",
|
|
8672
8675
|
allRowIds: a,
|
|
8673
8676
|
fields: e.targetFields(t),
|
|
8674
|
-
computeForRows: (r) =>
|
|
8677
|
+
computeForRows: (r) => Bc(this.rowStore, n, e, t, r),
|
|
8675
8678
|
buildCommand: f,
|
|
8676
8679
|
onServerSync: c ? (e) => this.syncFormulaToServer([{
|
|
8677
8680
|
fields: [n],
|
|
@@ -8703,14 +8706,14 @@ var pl = (e) => {
|
|
|
8703
8706
|
let a = [];
|
|
8704
8707
|
for (let o = 0; o < r.length; o++) {
|
|
8705
8708
|
let s = i.filter((e) => t[o].has(e));
|
|
8706
|
-
for (let t of r[o].fields) a.push(...
|
|
8709
|
+
for (let t of r[o].fields) a.push(...zc(this.rowStore, t, e, n, s));
|
|
8707
8710
|
}
|
|
8708
8711
|
return cl(a);
|
|
8709
8712
|
};
|
|
8710
8713
|
} else {
|
|
8711
8714
|
let t = a[0];
|
|
8712
8715
|
if (!t) return null;
|
|
8713
|
-
l = this.filterLockedFields(e.targetFields(n)), c = (r) =>
|
|
8716
|
+
l = this.filterLockedFields(e.targetFields(n)), c = (r) => Bc(this.rowStore, t, e, n, r);
|
|
8714
8717
|
}
|
|
8715
8718
|
if (l.length === 0) return null;
|
|
8716
8719
|
let u = c(o);
|
|
@@ -8793,7 +8796,7 @@ var pl = (e) => {
|
|
|
8793
8796
|
transformWorker = null;
|
|
8794
8797
|
initTransformWorker() {
|
|
8795
8798
|
if (!(typeof Worker > "u")) try {
|
|
8796
|
-
this.transformWorker =
|
|
8799
|
+
this.transformWorker = qs("chatTransform");
|
|
8797
8800
|
} catch (e) {
|
|
8798
8801
|
this.errorHandler.handleError({
|
|
8799
8802
|
code: "WORKER_ERROR",
|
|
@@ -9376,7 +9379,7 @@ var pl = (e) => {
|
|
|
9376
9379
|
}
|
|
9377
9380
|
t.push(n);
|
|
9378
9381
|
}
|
|
9379
|
-
o.size > 0 && (u =
|
|
9382
|
+
o.size > 0 && (u = ac(t, [...o.values()])), s.size > 0 && (d = uc(t, [...s.values()]), f = cc(bl));
|
|
9380
9383
|
}
|
|
9381
9384
|
let p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
9382
9385
|
for (let e = 0; e < a.length; e++) {
|
|
@@ -9387,8 +9390,8 @@ var pl = (e) => {
|
|
|
9387
9390
|
let l = this._effectiveColumns[r + n];
|
|
9388
9391
|
if (!l) continue;
|
|
9389
9392
|
let h = i[l.id], g = a[e][n], _ = g;
|
|
9390
|
-
if (u !== null && o.has(n)) _ =
|
|
9391
|
-
else if (d !== null && f !== null && s.has(n)) _ =
|
|
9393
|
+
if (u !== null && o.has(n)) _ = oc(g, u);
|
|
9394
|
+
else if (d !== null && f !== null && s.has(n)) _ = dc(g, d, f) ?? g;
|
|
9392
9395
|
else {
|
|
9393
9396
|
let e = c.get(n);
|
|
9394
9397
|
if (e && g !== "" && !e.has(g)) continue;
|
|
@@ -10882,7 +10885,7 @@ function lu(e, t, n, r) {
|
|
|
10882
10885
|
e.setValidator(o);
|
|
10883
10886
|
}, [e, o]);
|
|
10884
10887
|
let c = i("dataEditor.validation.alreadyExists"), l = v(() => {
|
|
10885
|
-
let n =
|
|
10888
|
+
let n = Gc(t);
|
|
10886
10889
|
return e.isServer() || !n ? (e.isServer() && n && console.warn("[updog] unique.fn and { type: \"asyncFunction\" } validators are client-mode only and were ignored in server mode"), new Bl()) : new Vl({
|
|
10887
10890
|
columns: t,
|
|
10888
10891
|
getRowById: (t) => e.getRowById(t),
|
|
@@ -11122,7 +11125,7 @@ var xu = class extends Error {
|
|
|
11122
11125
|
sheetWorkerPromise = null;
|
|
11123
11126
|
generation = 0;
|
|
11124
11127
|
pending = /* @__PURE__ */ new Map();
|
|
11125
|
-
constructor(e =
|
|
11128
|
+
constructor(e = qs, t = Js) {
|
|
11126
11129
|
this.spawn = e, this.spawnSheet = t;
|
|
11127
11130
|
}
|
|
11128
11131
|
async parse(e, t) {
|
|
@@ -21686,7 +21689,7 @@ function fy(e, t, n, r, i) {
|
|
|
21686
21689
|
//#region src/components/Chat/context/useViewModel.tsx
|
|
21687
21690
|
var py = 20, my = 3, hy = 300;
|
|
21688
21691
|
function gy() {
|
|
21689
|
-
let { chat: e, store: t, columns: n, primaryKey: r, enableDeleteRow: i } = Z(), a = v(() =>
|
|
21692
|
+
let { chat: e, store: t, columns: n, primaryKey: r, enableDeleteRow: i } = Z(), a = v(() => Kc(n), [n]), o = y(0), [s, c] = b([]), [l, u] = b("idle"), [d, p] = b(null), h = e?.emptyTitle, g = e?.suggestionsCount ?? my, [_, x] = b(e?.loadSuggestions ? "loading" : "empty"), [S, C] = b([]), w = y(null), T = f((e) => {
|
|
21690
21693
|
w.current = e;
|
|
21691
21694
|
}, []), E = f((e) => {
|
|
21692
21695
|
w.current?.(e);
|
|
@@ -22088,7 +22091,7 @@ function Zy(e) {
|
|
|
22088
22091
|
let { store: t, setShowUploader: n } = Z(), { t: r } = q();
|
|
22089
22092
|
return f(async () => {
|
|
22090
22093
|
let i = await e.import({
|
|
22091
|
-
monthTable:
|
|
22094
|
+
monthTable: cc(r),
|
|
22092
22095
|
structuralMismatchMessage: r("dataEditor.validation.structuralMismatch")
|
|
22093
22096
|
});
|
|
22094
22097
|
if (i.kind === "failed") {
|
|
@@ -22804,8 +22807,20 @@ var tb = ({ leftSlot: e }) => {
|
|
|
22804
22807
|
critical: ["crit", "urgent"],
|
|
22805
22808
|
yes: ["y", "true"],
|
|
22806
22809
|
no: ["n", "false"]
|
|
22807
|
-
}, rb =
|
|
22808
|
-
|
|
22810
|
+
}, rb = {
|
|
22811
|
+
columns: {},
|
|
22812
|
+
values: {}
|
|
22813
|
+
}, ib = /* @__PURE__ */ new WeakMap(), ab = (e) => {
|
|
22814
|
+
if (!e) return rb;
|
|
22815
|
+
let t = ib.get(e);
|
|
22816
|
+
if (t) return t;
|
|
22817
|
+
let n = {
|
|
22818
|
+
columns: e.columns ?? {},
|
|
22819
|
+
values: e.values ?? {}
|
|
22820
|
+
};
|
|
22821
|
+
return ib.set(e, n), n;
|
|
22822
|
+
}, ob = (e, t) => {
|
|
22823
|
+
if (!t || Object.keys(t).length === 0) return e;
|
|
22809
22824
|
let n = { ...e };
|
|
22810
22825
|
for (let [e, r] of Object.entries(t)) if (e in n) {
|
|
22811
22826
|
let t = new Set(n[e]);
|
|
@@ -22813,13 +22828,13 @@ var tb = ({ leftSlot: e }) => {
|
|
|
22813
22828
|
n[e] = [...t];
|
|
22814
22829
|
} else n[e] = r;
|
|
22815
22830
|
return n;
|
|
22816
|
-
},
|
|
22817
|
-
let n = new Set(
|
|
22831
|
+
}, sb = 60, cb = (e) => e.toLowerCase().replace(/[\s_\-.]+/g, "").trim(), lb = (e) => e.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[\s_\-.]+/g, " ").toLowerCase().split(" ").filter(Boolean), ub = (e, t) => {
|
|
22832
|
+
let n = new Set(lb(e)), r = new Set(lb(t));
|
|
22818
22833
|
if (n.size === 0 || r.size === 0) return 0;
|
|
22819
22834
|
let i = 0;
|
|
22820
22835
|
for (let e of n) r.has(e) && i++;
|
|
22821
22836
|
return i / Math.max(n.size, r.size);
|
|
22822
|
-
},
|
|
22837
|
+
}, db = (e, t) => {
|
|
22823
22838
|
if (e.length === 0) return t.length;
|
|
22824
22839
|
if (t.length === 0) return e.length;
|
|
22825
22840
|
e.length > t.length && ([e, t] = [t, e]);
|
|
@@ -22834,119 +22849,119 @@ var tb = ({ leftSlot: e }) => {
|
|
|
22834
22849
|
}
|
|
22835
22850
|
}
|
|
22836
22851
|
return i[n];
|
|
22837
|
-
},
|
|
22852
|
+
}, fb = (e) => e <= 4 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, pb = (e, t) => {
|
|
22838
22853
|
let n = Math.max(e.length, t.length);
|
|
22839
22854
|
if (n === 0) return !0;
|
|
22840
|
-
let r =
|
|
22841
|
-
return Math.abs(e.length - t.length) > r ? !1 :
|
|
22842
|
-
},
|
|
22843
|
-
let n =
|
|
22855
|
+
let r = fb(n);
|
|
22856
|
+
return Math.abs(e.length - t.length) > r ? !1 : db(e, t) <= r;
|
|
22857
|
+
}, mb = (e, t) => {
|
|
22858
|
+
let n = cb(e), r = cb(t);
|
|
22844
22859
|
return (n.length <= r.length ? n : r).length < 4 ? !1 : n.includes(r) || r.includes(n);
|
|
22845
|
-
},
|
|
22846
|
-
let t =
|
|
22860
|
+
}, hb = /* @__PURE__ */ new WeakMap(), gb = (e) => {
|
|
22861
|
+
let t = hb.get(e);
|
|
22847
22862
|
if (t) return t;
|
|
22848
22863
|
let n = /* @__PURE__ */ new Map(), r = 0;
|
|
22849
22864
|
for (let [t, i] of Object.entries(e)) {
|
|
22850
22865
|
for (let e of [t, ...i]) {
|
|
22851
|
-
let t =
|
|
22866
|
+
let t = cb(e), i = n.get(t);
|
|
22852
22867
|
i ? i.includes(r) || i.push(r) : n.set(t, [r]);
|
|
22853
22868
|
}
|
|
22854
22869
|
r++;
|
|
22855
22870
|
}
|
|
22856
|
-
return
|
|
22857
|
-
},
|
|
22858
|
-
let r =
|
|
22871
|
+
return hb.set(e, n), n;
|
|
22872
|
+
}, _b = (e, t, n) => {
|
|
22873
|
+
let r = gb(n), i = r.get(cb(e));
|
|
22859
22874
|
if (!i) return !1;
|
|
22860
|
-
let a = r.get(
|
|
22875
|
+
let a = r.get(cb(t));
|
|
22861
22876
|
if (!a) return !1;
|
|
22862
22877
|
for (let e of i) if (a.includes(e)) return !0;
|
|
22863
22878
|
return !1;
|
|
22864
|
-
},
|
|
22865
|
-
let r =
|
|
22879
|
+
}, vb = (e, t, n) => {
|
|
22880
|
+
let r = cb(e), i = cb(t);
|
|
22866
22881
|
if (r === i) return 100;
|
|
22867
|
-
if (n &&
|
|
22868
|
-
if (
|
|
22869
|
-
let a =
|
|
22870
|
-
return a >= .5 ? 70 :
|
|
22871
|
-
},
|
|
22872
|
-
let i =
|
|
22882
|
+
if (n && _b(e, t, n)) return 90;
|
|
22883
|
+
if (mb(e, t)) return 80;
|
|
22884
|
+
let a = ub(e, t);
|
|
22885
|
+
return a >= .5 ? 70 : pb(r, i) ? 65 : a > 0 ? Math.round(a * 60) : 0;
|
|
22886
|
+
}, yb = (e, t, n, r) => {
|
|
22887
|
+
let i = vb(e, t, r), a = vb(e, n, r);
|
|
22873
22888
|
return Math.max(i, a);
|
|
22874
|
-
},
|
|
22875
|
-
let t =
|
|
22889
|
+
}, bb = /* @__PURE__ */ new WeakMap(), xb = (e) => {
|
|
22890
|
+
let t = bb.get(e);
|
|
22876
22891
|
if (t) return t;
|
|
22877
22892
|
let n = e.map((e) => ({
|
|
22878
22893
|
raw: e,
|
|
22879
|
-
norm:
|
|
22880
|
-
words: new Set(
|
|
22894
|
+
norm: cb(e),
|
|
22895
|
+
words: new Set(lb(e))
|
|
22881
22896
|
}));
|
|
22882
|
-
return
|
|
22883
|
-
},
|
|
22897
|
+
return bb.set(e, n), n;
|
|
22898
|
+
}, Sb = (e, t) => (e.length <= t.length ? e : t).length < 4 ? !1 : e.includes(t) || t.includes(e), Cb = (e, t) => {
|
|
22884
22899
|
if (e.size === 0 || t.size === 0) return 0;
|
|
22885
22900
|
let n = 0;
|
|
22886
22901
|
for (let r of e) t.has(r) && n++;
|
|
22887
22902
|
return n / Math.max(e.size, t.size);
|
|
22888
|
-
},
|
|
22903
|
+
}, wb = (e, t) => {
|
|
22889
22904
|
if (!t) return !1;
|
|
22890
22905
|
for (let n of e) if (t.includes(n)) return !0;
|
|
22891
22906
|
return !1;
|
|
22892
|
-
},
|
|
22893
|
-
let i =
|
|
22907
|
+
}, Tb = (e, t, n = nb, r = sb) => {
|
|
22908
|
+
let i = xb(t), a = gb(n), o = cb(e), s = a.get(o), c = null, l, u = 0;
|
|
22894
22909
|
for (let t of i) {
|
|
22895
22910
|
let n = 0;
|
|
22896
22911
|
if (o === t.norm) n = 100;
|
|
22897
|
-
else if (s &&
|
|
22898
|
-
else if (
|
|
22912
|
+
else if (s && wb(s, a.get(t.norm))) n = 90;
|
|
22913
|
+
else if (Sb(o, t.norm)) n = 80;
|
|
22899
22914
|
else {
|
|
22900
|
-
c ??= new Set(
|
|
22901
|
-
let r =
|
|
22902
|
-
r >= .5 ? n = 70 :
|
|
22915
|
+
c ??= new Set(lb(e));
|
|
22916
|
+
let r = Cb(c, t.words);
|
|
22917
|
+
r >= .5 ? n = 70 : pb(o, t.norm) ? n = 65 : r > 0 && (n = Math.round(r * 60));
|
|
22903
22918
|
}
|
|
22904
22919
|
if (n > u && (u = n, l = t.raw, n === 100)) break;
|
|
22905
22920
|
}
|
|
22906
22921
|
return u >= r ? l : void 0;
|
|
22907
|
-
},
|
|
22908
|
-
let n =
|
|
22922
|
+
}, Eb = (e, t) => {
|
|
22923
|
+
let n = ob(nb, t), r = {};
|
|
22909
22924
|
for (let [t, { importedValues: i, options: a }] of Object.entries(e)) {
|
|
22910
22925
|
let e = {};
|
|
22911
|
-
for (let t of i) e[t] =
|
|
22926
|
+
for (let t of i) e[t] = Tb(t, a, n);
|
|
22912
22927
|
r[t] = e;
|
|
22913
22928
|
}
|
|
22914
22929
|
return r;
|
|
22915
|
-
},
|
|
22916
|
-
let r =
|
|
22930
|
+
}, Db = (e, t, n) => {
|
|
22931
|
+
let r = ob(nb, n), i = {};
|
|
22917
22932
|
for (let [n, { importedValues: a, options: o }] of Object.entries(e)) {
|
|
22918
22933
|
let e = t[n], s = {};
|
|
22919
|
-
for (let t of a) e && t in e ? s[t] = e[t] ?? void 0 : s[t] =
|
|
22934
|
+
for (let t of a) e && t in e ? s[t] = e[t] ?? void 0 : s[t] = Tb(t, o, r);
|
|
22920
22935
|
i[n] = s;
|
|
22921
22936
|
}
|
|
22922
22937
|
return i;
|
|
22923
|
-
},
|
|
22938
|
+
}, Ob = "action:create", kb = (e, t, n) => yb(e, t.id, t.title, n), Ab = (e, t, n, r, i = 60) => {
|
|
22924
22939
|
let a = null, o = 0;
|
|
22925
22940
|
for (let i of t) {
|
|
22926
22941
|
if (n.has(i.id)) continue;
|
|
22927
|
-
let t =
|
|
22942
|
+
let t = kb(e, i, r);
|
|
22928
22943
|
t > o && (o = t, a = i);
|
|
22929
22944
|
}
|
|
22930
22945
|
if (a && o >= i) return a.id;
|
|
22931
|
-
},
|
|
22946
|
+
}, jb = async (e, t, n, r) => {
|
|
22932
22947
|
let i = new Set(t.map((e) => e.id)), a = {}, o = /* @__PURE__ */ new Set();
|
|
22933
22948
|
if (n) {
|
|
22934
22949
|
let r = await n(e, t);
|
|
22935
22950
|
for (let [e, t] of Object.entries(r)) t !== null && i.has(t) && !o.has(t) && (a[e] = t, o.add(t));
|
|
22936
22951
|
}
|
|
22937
|
-
let s =
|
|
22952
|
+
let s = Mb(e.filter((e) => !(e in a)), t.filter((e) => !o.has(e.id)), r);
|
|
22938
22953
|
return {
|
|
22939
22954
|
...a,
|
|
22940
22955
|
...s
|
|
22941
22956
|
};
|
|
22942
|
-
},
|
|
22943
|
-
let r =
|
|
22957
|
+
}, Mb = (e, t, n) => {
|
|
22958
|
+
let r = ob(nb, n), i = {}, a = /* @__PURE__ */ new Set();
|
|
22944
22959
|
for (let n of e) {
|
|
22945
|
-
let e =
|
|
22960
|
+
let e = cb(n);
|
|
22946
22961
|
for (let r of t) {
|
|
22947
22962
|
let t = r.id;
|
|
22948
22963
|
if (a.has(t)) continue;
|
|
22949
|
-
let o =
|
|
22964
|
+
let o = cb(t), s = cb(r.title);
|
|
22950
22965
|
if (e === o || e === s) {
|
|
22951
22966
|
i[n] = t, a.add(t);
|
|
22952
22967
|
break;
|
|
@@ -22957,7 +22972,7 @@ var tb = ({ leftSlot: e }) => {
|
|
|
22957
22972
|
let n = 0;
|
|
22958
22973
|
for (let i of t) {
|
|
22959
22974
|
if (a.has(i.id)) continue;
|
|
22960
|
-
let t =
|
|
22975
|
+
let t = kb(e, i, r);
|
|
22961
22976
|
t > n && (n = t);
|
|
22962
22977
|
}
|
|
22963
22978
|
return n;
|
|
@@ -22966,34 +22981,34 @@ var tb = ({ leftSlot: e }) => {
|
|
|
22966
22981
|
score: o(e)
|
|
22967
22982
|
})).sort((e, t) => t.score - e.score);
|
|
22968
22983
|
for (let { header: e } of s) {
|
|
22969
|
-
let n =
|
|
22984
|
+
let n = Ab(e, t, a, r);
|
|
22970
22985
|
i[e] = n, n && a.add(n);
|
|
22971
22986
|
}
|
|
22972
22987
|
return i;
|
|
22973
|
-
},
|
|
22988
|
+
}, Nb = .5, Pb = new Set([
|
|
22974
22989
|
"true",
|
|
22975
22990
|
"false",
|
|
22976
22991
|
"yes",
|
|
22977
22992
|
"no"
|
|
22978
|
-
]),
|
|
22993
|
+
]), Fb = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, Ib = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, Lb = new Set([
|
|
22979
22994
|
"number",
|
|
22980
22995
|
"date",
|
|
22981
22996
|
"bool"
|
|
22982
22997
|
]);
|
|
22983
|
-
function
|
|
22998
|
+
function Rb(e) {
|
|
22984
22999
|
if (e == null) return "empty";
|
|
22985
23000
|
let t = String(e).trim();
|
|
22986
|
-
return t.length === 0 ? "empty" :
|
|
23001
|
+
return t.length === 0 ? "empty" : Pb.has(t.toLowerCase()) ? "bool" : Fb.test(t) ? "date" : Ib.test(t) ? "number" : "text";
|
|
22987
23002
|
}
|
|
22988
|
-
function
|
|
23003
|
+
function zb(e) {
|
|
22989
23004
|
return e.filter((e) => e != null && String(e).trim().length > 0).length;
|
|
22990
23005
|
}
|
|
22991
|
-
function
|
|
23006
|
+
function Bb(e) {
|
|
22992
23007
|
let t = 0;
|
|
22993
23008
|
for (let n of e) t = Math.max(t, n.length);
|
|
22994
23009
|
return t;
|
|
22995
23010
|
}
|
|
22996
|
-
function
|
|
23011
|
+
function Vb(e) {
|
|
22997
23012
|
let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
|
|
22998
23013
|
for (let i of e) {
|
|
22999
23014
|
let e = i.length;
|
|
@@ -23003,55 +23018,55 @@ function Rb(e) {
|
|
|
23003
23018
|
}
|
|
23004
23019
|
return r;
|
|
23005
23020
|
}
|
|
23006
|
-
function
|
|
23021
|
+
function Hb(e, t, n) {
|
|
23007
23022
|
if (t <= 0) return 0;
|
|
23008
|
-
for (let r = 0; r < e.length; r++) if (
|
|
23023
|
+
for (let r = 0; r < e.length; r++) if (zb(e[r]) / t >= n) return r;
|
|
23009
23024
|
return 0;
|
|
23010
23025
|
}
|
|
23011
|
-
function
|
|
23026
|
+
function Ub(e, t, n, r) {
|
|
23012
23027
|
let i = /* @__PURE__ */ new Map();
|
|
23013
23028
|
for (let a = t; a < n; a++) {
|
|
23014
|
-
let t =
|
|
23029
|
+
let t = Rb(e[a]?.[r]);
|
|
23015
23030
|
t !== "empty" && i.set(t, (i.get(t) ?? 0) + 1);
|
|
23016
23031
|
}
|
|
23017
23032
|
let a = "empty", o = 0;
|
|
23018
23033
|
for (let [e, t] of i) t > o && (o = t, a = e);
|
|
23019
23034
|
return a;
|
|
23020
23035
|
}
|
|
23021
|
-
function
|
|
23036
|
+
function Wb(e, t, n, r) {
|
|
23022
23037
|
let i = 0, a = 0;
|
|
23023
23038
|
for (let o = 0; o < r; o++) {
|
|
23024
|
-
let r =
|
|
23025
|
-
r !== "empty" && (a++,
|
|
23039
|
+
let r = Ub(e, t + 1, n, o);
|
|
23040
|
+
r !== "empty" && (a++, Rb(e[t]?.[o]) === "text" && Lb.has(r) && i++);
|
|
23026
23041
|
}
|
|
23027
23042
|
return a === 0 ? 0 : i / a;
|
|
23028
23043
|
}
|
|
23029
|
-
function
|
|
23044
|
+
function Gb(e, t, n, r) {
|
|
23030
23045
|
let i = 0, a = 0;
|
|
23031
23046
|
for (let o = 0; o < r; o++) {
|
|
23032
|
-
let r =
|
|
23047
|
+
let r = Ub(e, t, n, o);
|
|
23033
23048
|
if (r !== "empty") for (let s = t; s < n; s++) {
|
|
23034
|
-
let t =
|
|
23049
|
+
let t = Rb(e[s]?.[o]);
|
|
23035
23050
|
t !== "empty" && (a++, t === r && i++);
|
|
23036
23051
|
}
|
|
23037
23052
|
}
|
|
23038
23053
|
return a === 0 ? 0 : i / a;
|
|
23039
23054
|
}
|
|
23040
|
-
function
|
|
23041
|
-
let t = e.map(
|
|
23055
|
+
function Kb(e) {
|
|
23056
|
+
let t = e.map(Rb).filter((e) => e !== "empty");
|
|
23042
23057
|
return t.length === 0 ? 0 : 1 - t.filter((e) => e !== "text").length / t.length;
|
|
23043
23058
|
}
|
|
23044
|
-
function
|
|
23045
|
-
return t <= 0 ? 0 : Math.min(1,
|
|
23059
|
+
function qb(e, t) {
|
|
23060
|
+
return t <= 0 ? 0 : Math.min(1, zb(e) / t);
|
|
23046
23061
|
}
|
|
23047
|
-
function
|
|
23062
|
+
function Jb(e) {
|
|
23048
23063
|
let t = e.map((e) => String(e ?? "").trim().toLowerCase()).filter((e) => e.length > 0);
|
|
23049
23064
|
return t.length === 0 ? 0 : new Set(t).size / t.length;
|
|
23050
23065
|
}
|
|
23051
|
-
function
|
|
23052
|
-
return .45 *
|
|
23066
|
+
function Yb(e, t, n, r, i) {
|
|
23067
|
+
return .45 * Wb(e, t, n, r) + .25 * Gb(e, t + 1, n, r) + .15 * Kb(e[t] ?? []) + .1 * qb(e[t] ?? [], i) + .05 * Jb(e[t] ?? []);
|
|
23053
23068
|
}
|
|
23054
|
-
function
|
|
23069
|
+
function Xb(e, t = 100) {
|
|
23055
23070
|
if (e.length === 0) return {
|
|
23056
23071
|
headerRowIndex: 0,
|
|
23057
23072
|
dataStartIndex: 0,
|
|
@@ -23059,7 +23074,7 @@ function qb(e, t = 100) {
|
|
|
23059
23074
|
mode: "header",
|
|
23060
23075
|
review: { kind: "none" }
|
|
23061
23076
|
};
|
|
23062
|
-
let n = Math.min(t, e.length), r = e.slice(0, n), i =
|
|
23077
|
+
let n = Math.min(t, e.length), r = e.slice(0, n), i = Bb(r), a = Vb(r), o = Hb(r, a, Nb), s = e[o] ?? [], c = Wb(e, o, n, i), l = Gb(e, o + 1, n, i), u = zb(s) > 0 && Kb(s) === 0, d = Math.round(Math.max(0, Yb(e, o, n, i, a)) * 100) / 100;
|
|
23063
23078
|
if (u && c <= .15 && l >= .7) return {
|
|
23064
23079
|
headerRowIndex: -1,
|
|
23065
23080
|
dataStartIndex: o,
|
|
@@ -23079,7 +23094,7 @@ function qb(e, t = 100) {
|
|
|
23079
23094
|
review: f
|
|
23080
23095
|
};
|
|
23081
23096
|
}
|
|
23082
|
-
function
|
|
23097
|
+
function Zb(e) {
|
|
23083
23098
|
let t = /* @__PURE__ */ new Set();
|
|
23084
23099
|
return e.map((e) => {
|
|
23085
23100
|
let n = e, r = 2;
|
|
@@ -23089,15 +23104,15 @@ function Jb(e) {
|
|
|
23089
23104
|
}
|
|
23090
23105
|
//#endregion
|
|
23091
23106
|
//#region src/components/DataUploader/core/parser/headerProjection.ts
|
|
23092
|
-
var
|
|
23107
|
+
var Qb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), $b = (e, t) => {
|
|
23093
23108
|
let n = 0;
|
|
23094
23109
|
for (let r = t; r < e.length; r++) n = Math.max(n, e[r].length);
|
|
23095
23110
|
return n;
|
|
23096
|
-
},
|
|
23097
|
-
let r = Math.min(e.length, t +
|
|
23111
|
+
}, ex = 50, tx = (e, t, n) => {
|
|
23112
|
+
let r = Math.min(e.length, t + ex);
|
|
23098
23113
|
for (let i = t; i < r; i++) {
|
|
23099
23114
|
let t = e[i];
|
|
23100
|
-
if (!t ||
|
|
23115
|
+
if (!t || Qb(t)) continue;
|
|
23101
23116
|
let r = !0;
|
|
23102
23117
|
for (let e = 0; e < n; e++) {
|
|
23103
23118
|
let n = t[e];
|
|
@@ -23111,104 +23126,104 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23111
23126
|
return Array.from({ length: n }, (n, i) => {
|
|
23112
23127
|
for (let n = t; n < r; n++) {
|
|
23113
23128
|
let t = e[n];
|
|
23114
|
-
if (!t ||
|
|
23129
|
+
if (!t || Qb(t)) continue;
|
|
23115
23130
|
let r = t[i], a = r == null ? "" : String(r).trim();
|
|
23116
23131
|
if (a !== "") return a;
|
|
23117
23132
|
}
|
|
23118
23133
|
return "";
|
|
23119
23134
|
});
|
|
23120
|
-
},
|
|
23135
|
+
}, nx = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, rx = (e, t, n, r) => {
|
|
23121
23136
|
if (t < 0) {
|
|
23122
|
-
let t =
|
|
23137
|
+
let t = $b(e, n), i = tx(e, n, t);
|
|
23123
23138
|
return Array.from({ length: t }, (e, t) => r(t, i[t]));
|
|
23124
23139
|
}
|
|
23125
|
-
let i = e[t] ?? [], a = Math.max(i.length,
|
|
23126
|
-
return
|
|
23140
|
+
let i = e[t] ?? [], a = Math.max(i.length, $b(e, n)), o = tx(e, n, a);
|
|
23141
|
+
return Zb(Array.from({ length: a }, (e, t) => {
|
|
23127
23142
|
let n = String(i[t] ?? "").trim();
|
|
23128
23143
|
return n === "" ? r(t, o[t]) : n;
|
|
23129
23144
|
}));
|
|
23130
|
-
},
|
|
23145
|
+
}, ix = () => ({
|
|
23131
23146
|
headerRowIndex: 0,
|
|
23132
23147
|
dataStartIndex: 1,
|
|
23133
23148
|
confidence: 1,
|
|
23134
23149
|
mode: "header",
|
|
23135
23150
|
review: { kind: "none" }
|
|
23136
|
-
}),
|
|
23151
|
+
}), ax = (e, t) => {
|
|
23137
23152
|
let n = [e];
|
|
23138
23153
|
for (let r of t) n.push(e.map((e) => r[e] ?? ""));
|
|
23139
23154
|
return n;
|
|
23140
|
-
},
|
|
23155
|
+
}, ox = (e) => {
|
|
23141
23156
|
let t = /* @__PURE__ */ new Map();
|
|
23142
23157
|
for (let n = 0; n < e.length; n++) t.set(e[n], n);
|
|
23143
23158
|
return t;
|
|
23144
|
-
},
|
|
23159
|
+
}, sx = (e, t, n) => {
|
|
23145
23160
|
let r = [];
|
|
23146
23161
|
for (let i = t; i < e.length; i++) {
|
|
23147
23162
|
let t = e[i];
|
|
23148
|
-
if (
|
|
23163
|
+
if (Qb(t)) continue;
|
|
23149
23164
|
let a = t[n], o = a == null ? "" : String(a);
|
|
23150
23165
|
o !== "" && r.push(o);
|
|
23151
23166
|
}
|
|
23152
23167
|
return r;
|
|
23153
|
-
},
|
|
23168
|
+
}, cx = (e, t, n) => {
|
|
23154
23169
|
let r = /* @__PURE__ */ new Set();
|
|
23155
23170
|
for (let i = t; i < e.length; i++) {
|
|
23156
23171
|
let t = e[i];
|
|
23157
|
-
if (
|
|
23172
|
+
if (Qb(t)) continue;
|
|
23158
23173
|
let a = t[n], o = a == null ? "" : String(a);
|
|
23159
23174
|
o !== "" && r.add(o);
|
|
23160
23175
|
}
|
|
23161
23176
|
return [...r];
|
|
23162
|
-
},
|
|
23177
|
+
}, lx = (e, t) => {
|
|
23163
23178
|
let n = {};
|
|
23164
23179
|
for (let r = 0; r < t.length; r++) n[t[r]] = String(e[r] ?? "");
|
|
23165
23180
|
return n;
|
|
23166
|
-
},
|
|
23181
|
+
}, ux = (e, t, n, r) => {
|
|
23167
23182
|
let i = [];
|
|
23168
23183
|
for (let a = n; a < e.length && i.length < r; a++) {
|
|
23169
23184
|
let n = e[a];
|
|
23170
|
-
!n ||
|
|
23185
|
+
!n || Qb(n) || i.push(lx(n, t));
|
|
23171
23186
|
}
|
|
23172
23187
|
return i;
|
|
23173
|
-
},
|
|
23188
|
+
}, dx = 3e4, fx = (e, t) => new Promise((n, r) => {
|
|
23174
23189
|
let i = setTimeout(() => r(/* @__PURE__ */ Error(`Hook timed out after ${t}ms`)), t);
|
|
23175
23190
|
e.then((e) => {
|
|
23176
23191
|
clearTimeout(i), n(e);
|
|
23177
23192
|
}, (e) => {
|
|
23178
23193
|
clearTimeout(i), r(e);
|
|
23179
23194
|
});
|
|
23180
|
-
}),
|
|
23195
|
+
}), px = (e, t, n) => {
|
|
23181
23196
|
let r = {
|
|
23182
23197
|
...e,
|
|
23183
23198
|
[t]: n
|
|
23184
23199
|
};
|
|
23185
23200
|
if (n) for (let e in r) e !== t && r[e] === n && (r[e] = void 0);
|
|
23186
23201
|
return r;
|
|
23187
|
-
},
|
|
23202
|
+
}, mx = (e, t, n, r) => {
|
|
23188
23203
|
let i = e[t];
|
|
23189
23204
|
return i ? {
|
|
23190
23205
|
...e,
|
|
23191
|
-
[t]:
|
|
23206
|
+
[t]: px(i, n, r)
|
|
23192
23207
|
} : e;
|
|
23193
|
-
},
|
|
23208
|
+
}, hx = (e, t, n, r) => {
|
|
23194
23209
|
let i = e;
|
|
23195
23210
|
for (let e of r) {
|
|
23196
23211
|
let r = i[e];
|
|
23197
|
-
!r || !(t in r) || (i =
|
|
23212
|
+
!r || !(t in r) || (i = mx(i, e, t, n));
|
|
23198
23213
|
}
|
|
23199
23214
|
return i;
|
|
23200
|
-
},
|
|
23215
|
+
}, gx = (e, t, n) => {
|
|
23201
23216
|
let r = {};
|
|
23202
23217
|
for (let i of n) {
|
|
23203
23218
|
let n = e[i], a = t[i];
|
|
23204
23219
|
if (!(!n || !a)) for (let e in n) e in r || n[e] === a[e] || (r[e] = n[e]);
|
|
23205
23220
|
}
|
|
23206
23221
|
return r;
|
|
23207
|
-
},
|
|
23222
|
+
}, _x = (e, t) => {
|
|
23208
23223
|
let n = e;
|
|
23209
|
-
for (let r in t) r in e && (n =
|
|
23224
|
+
for (let r in t) r in e && (n = px(n, r, t[r]));
|
|
23210
23225
|
return n;
|
|
23211
|
-
},
|
|
23226
|
+
}, vx = (e, t) => {
|
|
23212
23227
|
let n = /* @__PURE__ */ new Set(), r = [];
|
|
23213
23228
|
for (let i of t) {
|
|
23214
23229
|
let t = e[i];
|
|
@@ -23218,7 +23233,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23218
23233
|
}
|
|
23219
23234
|
}
|
|
23220
23235
|
return r;
|
|
23221
|
-
},
|
|
23236
|
+
}, yx = (e, t) => {
|
|
23222
23237
|
let n = {};
|
|
23223
23238
|
for (let r of t) {
|
|
23224
23239
|
let t = e[r];
|
|
@@ -23231,19 +23246,20 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23231
23246
|
}
|
|
23232
23247
|
}
|
|
23233
23248
|
return n;
|
|
23234
|
-
},
|
|
23249
|
+
}, bx = "\0", xx = "", Sx = (e) => e.map((e) => `${e.workbookId}${bx}${e.header}`).join(xx), Cx = {
|
|
23235
23250
|
byWorkbook: {},
|
|
23236
23251
|
mappedColumnIds: [],
|
|
23237
23252
|
headersByColumn: {},
|
|
23238
23253
|
pendingColumns: [],
|
|
23239
23254
|
autoMatched: {},
|
|
23255
|
+
baseline: {},
|
|
23240
23256
|
isMatching: {}
|
|
23241
|
-
},
|
|
23257
|
+
}, wx = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), Tx = class {
|
|
23242
23258
|
deps;
|
|
23243
23259
|
notify;
|
|
23244
23260
|
workbookIds = [];
|
|
23245
23261
|
seqByWorkbook = /* @__PURE__ */ new Map();
|
|
23246
|
-
_state =
|
|
23262
|
+
_state = Cx;
|
|
23247
23263
|
constructor(e, t) {
|
|
23248
23264
|
this.deps = e, this.notify = t;
|
|
23249
23265
|
}
|
|
@@ -23251,7 +23267,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23251
23267
|
return this._state;
|
|
23252
23268
|
}
|
|
23253
23269
|
withProjections(e, t) {
|
|
23254
|
-
let n =
|
|
23270
|
+
let n = vx(t, this.workbookIds), r = yx(t, this.workbookIds), i = wx(n, e.mappedColumnIds), a = i && n.every((t) => {
|
|
23255
23271
|
let n = e.headersByColumn[t] ?? [], i = r[t] ?? [];
|
|
23256
23272
|
return n.length === i.length && n.every((e, t) => e.workbookId === i[t].workbookId && e.header === i[t].header);
|
|
23257
23273
|
});
|
|
@@ -23264,26 +23280,31 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23264
23280
|
}
|
|
23265
23281
|
autoMatch(e) {
|
|
23266
23282
|
this.workbookIds = e.map((e) => e.id);
|
|
23267
|
-
let t = {}, n = {};
|
|
23268
|
-
for (let
|
|
23269
|
-
let e =
|
|
23270
|
-
t[
|
|
23283
|
+
let t = {}, n = {}, r = {};
|
|
23284
|
+
for (let i of e) {
|
|
23285
|
+
let e = Mb(i.headers, this.deps.columns, this.deps.extraSynonyms);
|
|
23286
|
+
t[i.id] = e, n[i.id] = e, r[i.id] = e, this.seqByWorkbook.set(i.id, (this.seqByWorkbook.get(i.id) ?? 0) + 1);
|
|
23271
23287
|
}
|
|
23272
23288
|
this._state = this.withProjections({
|
|
23273
23289
|
...this._state,
|
|
23274
23290
|
autoMatched: n,
|
|
23291
|
+
baseline: r,
|
|
23275
23292
|
isMatching: {}
|
|
23276
23293
|
}, t);
|
|
23277
23294
|
}
|
|
23278
23295
|
autoMatchWorkbook(e, t) {
|
|
23279
23296
|
if (!this.workbookIds.includes(e)) return;
|
|
23280
|
-
let n =
|
|
23297
|
+
let n = Mb(t, this.deps.columns, this.deps.extraSynonyms);
|
|
23281
23298
|
this.seqByWorkbook.set(e, (this.seqByWorkbook.get(e) ?? 0) + 1), this._state = this.withProjections({
|
|
23282
23299
|
...this._state,
|
|
23283
23300
|
autoMatched: {
|
|
23284
23301
|
...this._state.autoMatched,
|
|
23285
23302
|
[e]: n
|
|
23286
23303
|
},
|
|
23304
|
+
baseline: {
|
|
23305
|
+
...this._state.baseline,
|
|
23306
|
+
[e]: n
|
|
23307
|
+
},
|
|
23287
23308
|
isMatching: {
|
|
23288
23309
|
...this._state.isMatching,
|
|
23289
23310
|
[e]: !1
|
|
@@ -23299,24 +23320,25 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23299
23320
|
added: n,
|
|
23300
23321
|
removed: r
|
|
23301
23322
|
};
|
|
23302
|
-
let i =
|
|
23323
|
+
let i = gx(this._state.byWorkbook, this._state.autoMatched, this.workbookIds.filter((e) => t.includes(e)));
|
|
23303
23324
|
for (let e of r) this.seqByWorkbook.delete(e);
|
|
23304
|
-
let a = {}, o = {}, s = {};
|
|
23325
|
+
let a = {}, o = {}, s = {}, c = {};
|
|
23305
23326
|
for (let t of e) {
|
|
23306
23327
|
if (!n.includes(t.id)) {
|
|
23307
|
-
let e = this._state.byWorkbook[t.id], n = this._state.autoMatched[t.id];
|
|
23308
|
-
e && (a[t.id] = e), n && (o[t.id] = n);
|
|
23309
|
-
let
|
|
23310
|
-
|
|
23328
|
+
let e = this._state.byWorkbook[t.id], n = this._state.autoMatched[t.id], r = this._state.baseline[t.id];
|
|
23329
|
+
e && (a[t.id] = e), n && (o[t.id] = n), r && (s[t.id] = r);
|
|
23330
|
+
let i = this._state.isMatching[t.id];
|
|
23331
|
+
i !== void 0 && (c[t.id] = i);
|
|
23311
23332
|
continue;
|
|
23312
23333
|
}
|
|
23313
|
-
let e =
|
|
23314
|
-
o[t.id] = e, a[t.id] =
|
|
23334
|
+
let e = Mb(t.headers, this.deps.columns, this.deps.extraSynonyms);
|
|
23335
|
+
o[t.id] = e, s[t.id] = e, a[t.id] = _x(e, i), this.seqByWorkbook.set(t.id, (this.seqByWorkbook.get(t.id) ?? 0) + 1);
|
|
23315
23336
|
}
|
|
23316
23337
|
return this.workbookIds = t, this._state = this.withProjections({
|
|
23317
23338
|
...this._state,
|
|
23318
23339
|
autoMatched: o,
|
|
23319
|
-
|
|
23340
|
+
baseline: s,
|
|
23341
|
+
isMatching: c
|
|
23320
23342
|
}, a), {
|
|
23321
23343
|
added: n,
|
|
23322
23344
|
removed: r
|
|
@@ -23334,10 +23356,14 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23334
23356
|
}
|
|
23335
23357
|
};
|
|
23336
23358
|
try {
|
|
23337
|
-
let i = await
|
|
23359
|
+
let i = await fx(jb(t, this.deps.columns, n, this.deps.extraSynonyms), dx);
|
|
23338
23360
|
if (r !== this.seqByWorkbook.get(e)) return;
|
|
23339
23361
|
this._state = this.withProjections({
|
|
23340
23362
|
...this._state,
|
|
23363
|
+
baseline: {
|
|
23364
|
+
...this._state.baseline,
|
|
23365
|
+
[e]: i
|
|
23366
|
+
},
|
|
23341
23367
|
isMatching: {
|
|
23342
23368
|
...this._state.isMatching,
|
|
23343
23369
|
[e]: !1
|
|
@@ -23360,7 +23386,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23360
23386
|
}
|
|
23361
23387
|
updateMapping(e, t, n, r) {
|
|
23362
23388
|
this.seqByWorkbook.set(e, (this.seqByWorkbook.get(e) ?? 0) + 1);
|
|
23363
|
-
let i =
|
|
23389
|
+
let i = hx(mx(this._state.byWorkbook, e, t, n), t, n, r);
|
|
23364
23390
|
this._state = this.withProjections(this._state, i);
|
|
23365
23391
|
}
|
|
23366
23392
|
setPendingColumns(e) {
|
|
@@ -23371,15 +23397,15 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23371
23397
|
};
|
|
23372
23398
|
}
|
|
23373
23399
|
reset() {
|
|
23374
|
-
this.seqByWorkbook.clear(), this.workbookIds = [], this._state =
|
|
23400
|
+
this.seqByWorkbook.clear(), this.workbookIds = [], this._state = Cx;
|
|
23375
23401
|
}
|
|
23376
|
-
},
|
|
23402
|
+
}, Ex = (e) => e.hasExistingData || e.columnMatchingCount > 1, Dx = (e) => {
|
|
23377
23403
|
let t = ["select-files"];
|
|
23378
23404
|
for (let n = 0; n < e.headerReviewCount; n++) t.push("header-selection");
|
|
23379
23405
|
let n = Math.max(1, e.columnMatchingCount);
|
|
23380
23406
|
for (let e = 0; e < n; e++) t.push("column-matching");
|
|
23381
|
-
return e.hasSelectColumns && t.push("match-values"), e.primaryKeyColumnCount > 0 &&
|
|
23382
|
-
},
|
|
23407
|
+
return e.hasSelectColumns && t.push("match-values"), e.primaryKeyColumnCount > 0 && Ex(e) && t.push("primary-key"), t;
|
|
23408
|
+
}, Ox = {
|
|
23383
23409
|
parser: {
|
|
23384
23410
|
workbooks: [],
|
|
23385
23411
|
parsing: null,
|
|
@@ -23392,6 +23418,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23392
23418
|
headersByColumn: {},
|
|
23393
23419
|
pendingColumns: [],
|
|
23394
23420
|
autoMatched: {},
|
|
23421
|
+
baseline: {},
|
|
23395
23422
|
isMatching: {}
|
|
23396
23423
|
},
|
|
23397
23424
|
valueMapping: {
|
|
@@ -23423,8 +23450,8 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23423
23450
|
loadingId: null,
|
|
23424
23451
|
error: null
|
|
23425
23452
|
}
|
|
23426
|
-
},
|
|
23427
|
-
snapshot =
|
|
23453
|
+
}, kx = class {
|
|
23454
|
+
snapshot = Ox;
|
|
23428
23455
|
listeners = /* @__PURE__ */ new Set();
|
|
23429
23456
|
subscribe = (e) => (this.listeners.add(e), () => {
|
|
23430
23457
|
this.listeners.delete(e);
|
|
@@ -23437,7 +23464,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23437
23464
|
} catch {}
|
|
23438
23465
|
});
|
|
23439
23466
|
}
|
|
23440
|
-
},
|
|
23467
|
+
}, Ax = class {
|
|
23441
23468
|
enabled;
|
|
23442
23469
|
taken = /* @__PURE__ */ new Set();
|
|
23443
23470
|
constructor(e) {
|
|
@@ -23462,7 +23489,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23462
23489
|
for (let r of this.taken) r !== e && !r.startsWith(t) && n.add(r);
|
|
23463
23490
|
this.taken = n;
|
|
23464
23491
|
}
|
|
23465
|
-
},
|
|
23492
|
+
}, jx = (e, t, n) => {
|
|
23466
23493
|
if (e[t] !== "column-matching") return null;
|
|
23467
23494
|
let r = t - e.indexOf("column-matching"), i = n[r];
|
|
23468
23495
|
return i === void 0 ? null : {
|
|
@@ -23470,7 +23497,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23470
23497
|
position: r,
|
|
23471
23498
|
total: n.length
|
|
23472
23499
|
};
|
|
23473
|
-
},
|
|
23500
|
+
}, Mx = (e, t) => e === t ? !0 : !e || !t ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, Nx = (e, t, n) => {
|
|
23474
23501
|
if (e[t] !== "header-selection") return null;
|
|
23475
23502
|
let r = t - e.indexOf("header-selection"), i = n[r];
|
|
23476
23503
|
return i === void 0 ? null : {
|
|
@@ -23478,7 +23505,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23478
23505
|
position: r,
|
|
23479
23506
|
total: n.length
|
|
23480
23507
|
};
|
|
23481
|
-
},
|
|
23508
|
+
}, Px = class {
|
|
23482
23509
|
_state = {
|
|
23483
23510
|
activeStepIndex: 0,
|
|
23484
23511
|
currentStepIndex: 0
|
|
@@ -23512,13 +23539,13 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23512
23539
|
currentStepIndex: Math.min(r, t)
|
|
23513
23540
|
});
|
|
23514
23541
|
}
|
|
23515
|
-
},
|
|
23542
|
+
}, Fx = [
|
|
23516
23543
|
",",
|
|
23517
23544
|
";",
|
|
23518
23545
|
"|",
|
|
23519
23546
|
"\n",
|
|
23520
23547
|
" "
|
|
23521
|
-
],
|
|
23548
|
+
], Ix = (e, t, n) => {
|
|
23522
23549
|
let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
|
|
23523
23550
|
if (e.trim() === "") return [];
|
|
23524
23551
|
if (i(e)) return [e.trim()];
|
|
@@ -23530,18 +23557,18 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23530
23557
|
a.push(e);
|
|
23531
23558
|
continue;
|
|
23532
23559
|
}
|
|
23533
|
-
a.push(...
|
|
23560
|
+
a.push(...Lx(e, t, i));
|
|
23534
23561
|
}
|
|
23535
23562
|
}
|
|
23536
23563
|
return a;
|
|
23537
|
-
},
|
|
23538
|
-
for (let r of
|
|
23564
|
+
}, Lx = (e, t, n) => {
|
|
23565
|
+
for (let r of Fx) {
|
|
23539
23566
|
if (r === t || !e.includes(r)) continue;
|
|
23540
23567
|
let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
|
|
23541
23568
|
if (i.length >= 2 && i.every(n)) return i;
|
|
23542
23569
|
}
|
|
23543
23570
|
return [e];
|
|
23544
|
-
},
|
|
23571
|
+
}, Rx = (e, t, n) => {
|
|
23545
23572
|
let r = new Map(t.map((e) => [e.id, e])), i = [];
|
|
23546
23573
|
for (let [t, a] of Object.entries(e)) a && i.push({
|
|
23547
23574
|
csvHeader: t,
|
|
@@ -23549,11 +23576,11 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23549
23576
|
column: n.has(a) ? void 0 : r.get(a)
|
|
23550
23577
|
});
|
|
23551
23578
|
return i;
|
|
23552
|
-
},
|
|
23579
|
+
}, zx = (e) => {
|
|
23553
23580
|
let t = [];
|
|
23554
23581
|
for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
|
|
23555
23582
|
return t;
|
|
23556
|
-
},
|
|
23583
|
+
}, Bx = (e, t, n) => {
|
|
23557
23584
|
let r = {};
|
|
23558
23585
|
for (let { csvHeader: i, columnId: a, column: o } of t) {
|
|
23559
23586
|
let t = e[i] ?? "";
|
|
@@ -23568,7 +23595,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23568
23595
|
continue;
|
|
23569
23596
|
}
|
|
23570
23597
|
if (s === "multiselect") {
|
|
23571
|
-
let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ?
|
|
23598
|
+
let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? Ix(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
|
|
23572
23599
|
for (let e of s) {
|
|
23573
23600
|
let t = n.valueMapping[a]?.[e.trim()];
|
|
23574
23601
|
t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
|
|
@@ -23576,16 +23603,16 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23576
23603
|
r[a] = c;
|
|
23577
23604
|
continue;
|
|
23578
23605
|
}
|
|
23579
|
-
let c = s === "number" ?
|
|
23606
|
+
let c = s === "number" ? oc(t, n.numberFormat) : s === "date" ? dc(t, n.dateFormat, n.monthTable) ?? t : t;
|
|
23580
23607
|
r[a] = o.transformer ? o.transformer(c) : c;
|
|
23581
23608
|
}
|
|
23582
23609
|
return r;
|
|
23583
|
-
},
|
|
23610
|
+
}, Vx = (e, t, n) => {
|
|
23584
23611
|
let r = [];
|
|
23585
23612
|
for (let [i, a] of Object.entries(e)) !a || n.has(a) || t.find((e) => e.id === a)?.editor?.type === "date" && r.push(i);
|
|
23586
23613
|
return r;
|
|
23587
|
-
},
|
|
23588
|
-
let t = new Set(e.pendingColumns.map((e) => e.id)), n =
|
|
23614
|
+
}, Hx = (e) => {
|
|
23615
|
+
let t = new Set(e.pendingColumns.map((e) => e.id)), n = Rx(e.columnMapping, e.columns, t), r = e.rawRows ? ux(e.rawRows, e.workbook.headers, e.workbook.dataStartIndex, 1e3) : [], i = ac(r, zx(n)), a = uc(r, Vx(e.columnMapping, e.columns, t));
|
|
23589
23616
|
return {
|
|
23590
23617
|
columnMapping: e.columnMapping,
|
|
23591
23618
|
valueMapping: e.valueMapping,
|
|
@@ -23596,7 +23623,7 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23596
23623
|
dateFormat: a,
|
|
23597
23624
|
newColumns: e.pendingColumns
|
|
23598
23625
|
};
|
|
23599
|
-
},
|
|
23626
|
+
}, Ux = class {
|
|
23600
23627
|
notify;
|
|
23601
23628
|
_state = {
|
|
23602
23629
|
isImporting: !1,
|
|
@@ -23640,35 +23667,30 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23640
23667
|
}, this.notify();
|
|
23641
23668
|
}
|
|
23642
23669
|
}
|
|
23643
|
-
},
|
|
23644
|
-
let
|
|
23645
|
-
|
|
23646
|
-
let
|
|
23647
|
-
|
|
23648
|
-
|
|
23649
|
-
|
|
23650
|
-
return t;
|
|
23651
|
-
}, Hx = (e, t, n, r) => {
|
|
23652
|
-
let i = Vx(r), a = (e, t) => i.get(ab(e))?.has(ab(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
|
|
23653
|
-
if (ab(n) === ab(r) || a(r, n)) return;
|
|
23654
|
-
let i = `${n} ${r}`;
|
|
23655
|
-
t.has(i) || (t.add(i), e.push({
|
|
23656
|
-
source: n,
|
|
23657
|
-
target: r
|
|
23670
|
+
}, Wx = ({ columnMapping: e, baselineColumnMapping: t, valueMapping: n, baselineValueMapping: r, columns: i, knownColumnSynonyms: a, knownValueSynonyms: o }) => {
|
|
23671
|
+
let s = new Map(i.map((e) => [e.id, e])), c = (e, t, n) => (r, i) => {
|
|
23672
|
+
if (cb(r) === cb(i) || _b(r, i, n)) return;
|
|
23673
|
+
let a = `${r}\u0000${i}`;
|
|
23674
|
+
t.has(a) || (t.add(a), e.push({
|
|
23675
|
+
source: r,
|
|
23676
|
+
target: i
|
|
23658
23677
|
}));
|
|
23659
|
-
},
|
|
23678
|
+
}, l = {
|
|
23660
23679
|
columns: [],
|
|
23661
23680
|
values: []
|
|
23662
|
-
},
|
|
23663
|
-
for (let [
|
|
23664
|
-
if (!n) continue;
|
|
23665
|
-
let e =
|
|
23666
|
-
e &&
|
|
23681
|
+
}, u = c(l.columns, /* @__PURE__ */ new Set(), a);
|
|
23682
|
+
for (let [n, r] of Object.entries(e)) {
|
|
23683
|
+
if (!r || t[n] === r) continue;
|
|
23684
|
+
let e = s.get(r);
|
|
23685
|
+
e && u(n, e.title);
|
|
23667
23686
|
}
|
|
23668
|
-
let
|
|
23669
|
-
for (let e
|
|
23670
|
-
|
|
23671
|
-
|
|
23687
|
+
let d = c(l.values, /* @__PURE__ */ new Set(), o);
|
|
23688
|
+
for (let [e, t] of Object.entries(n)) {
|
|
23689
|
+
let n = r[e] ?? {};
|
|
23690
|
+
for (let [e, r] of Object.entries(t)) r && n[e] !== r && d(e, r);
|
|
23691
|
+
}
|
|
23692
|
+
return l;
|
|
23693
|
+
}, Gx = (e) => {
|
|
23672
23694
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
23673
23695
|
for (let r of e) for (let e of r.headers) {
|
|
23674
23696
|
let i = t.get(e);
|
|
@@ -23678,17 +23700,17 @@ var Yb = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Xb = (e, t
|
|
|
23678
23700
|
}, t.set(e, i), n.push(i)), i.workbookIds.includes(r.id) || i.workbookIds.push(r.id);
|
|
23679
23701
|
}
|
|
23680
23702
|
return n;
|
|
23681
|
-
},
|
|
23682
|
-
function
|
|
23703
|
+
}, Kx = (e) => e.kind === "remote" ? null : e.file, qx = (e) => e.origin.kind === "sheet" ? `${e.origin.file.name} - ${e.name}` : e.name, Jx = (e, t) => e.kind === "remote" || t.kind === "remote" ? e.kind === "remote" && t.kind === "remote" && e.sourceId === t.sourceId : e.kind !== t.kind || e.file !== t.file ? !1 : e.kind === "sheet" && t.kind === "sheet" ? e.sheetName === t.sheetName : !0;
|
|
23704
|
+
function Yx(e, t, n) {
|
|
23683
23705
|
let r = e.length, i = t;
|
|
23684
|
-
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ?
|
|
23706
|
+
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? Xx(i, i - r) : Xx(r - 1, i - 1)) > 1e3 ? [] : r < i ? Zx(e, i) : Qx(e, i, n);
|
|
23685
23707
|
}
|
|
23686
|
-
function
|
|
23708
|
+
function Xx(e, t) {
|
|
23687
23709
|
let n = Math.min(t, e - t), r = 1;
|
|
23688
23710
|
for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
|
|
23689
23711
|
return r;
|
|
23690
23712
|
}
|
|
23691
|
-
function
|
|
23713
|
+
function Zx(e, t) {
|
|
23692
23714
|
let n = e.length, r = [], i = [], a = (o) => {
|
|
23693
23715
|
if (i.length === n) {
|
|
23694
23716
|
let a = Array(t).fill("");
|
|
@@ -23700,7 +23722,7 @@ function Yx(e, t) {
|
|
|
23700
23722
|
};
|
|
23701
23723
|
return a(0), r;
|
|
23702
23724
|
}
|
|
23703
|
-
function
|
|
23725
|
+
function Qx(e, t, n) {
|
|
23704
23726
|
let r = e.length, i = [], a = [], o = (s) => {
|
|
23705
23727
|
if (a.length === t - 1) {
|
|
23706
23728
|
let o = [
|
|
@@ -23718,27 +23740,27 @@ function Xx(e, t, n) {
|
|
|
23718
23740
|
}
|
|
23719
23741
|
//#endregion
|
|
23720
23742
|
//#region src/components/DataUploader/core/importing/raggedRows/pruneByValidators.ts
|
|
23721
|
-
var
|
|
23722
|
-
function
|
|
23743
|
+
var $x = {};
|
|
23744
|
+
function eS(e, t) {
|
|
23723
23745
|
for (let n of t.validators ?? []) if (!(n.type === "expression" || n.type === "asyncFunction")) {
|
|
23724
23746
|
if (n.type === "function") {
|
|
23725
|
-
if (n.fn(e,
|
|
23747
|
+
if (n.fn(e, $x) != null) return !1;
|
|
23726
23748
|
continue;
|
|
23727
23749
|
}
|
|
23728
|
-
if (Ql(n, e,
|
|
23750
|
+
if (Ql(n, e, $x) != null) return !1;
|
|
23729
23751
|
}
|
|
23730
23752
|
return !0;
|
|
23731
23753
|
}
|
|
23732
|
-
function
|
|
23733
|
-
for (let n = 0; n < t.length; n++) if (!
|
|
23754
|
+
function tS(e, t) {
|
|
23755
|
+
for (let n = 0; n < t.length; n++) if (!eS(e.cells[n] ?? "", t[n])) return !1;
|
|
23734
23756
|
return !0;
|
|
23735
23757
|
}
|
|
23736
|
-
function
|
|
23737
|
-
return e.filter((e) =>
|
|
23758
|
+
function nS(e, t) {
|
|
23759
|
+
return e.filter((e) => tS(e, t));
|
|
23738
23760
|
}
|
|
23739
23761
|
//#endregion
|
|
23740
23762
|
//#region src/components/DataUploader/core/importing/raggedRows/computeDisputeSpans.ts
|
|
23741
|
-
function
|
|
23763
|
+
function rS(e) {
|
|
23742
23764
|
if (e.length <= 1) return [];
|
|
23743
23765
|
let t = e[0].cells.length, n = [], r = -1;
|
|
23744
23766
|
for (let i = 0; i < t; i++) {
|
|
@@ -23755,25 +23777,25 @@ function tS(e) {
|
|
|
23755
23777
|
}
|
|
23756
23778
|
//#endregion
|
|
23757
23779
|
//#region src/components/DataUploader/core/importing/raggedRows/alignRow.ts
|
|
23758
|
-
function
|
|
23759
|
-
let r =
|
|
23780
|
+
function iS(e, t, n) {
|
|
23781
|
+
let r = Yx(e, t.length, n), i = nS(r, t);
|
|
23760
23782
|
return i.length === 1 ? {
|
|
23761
23783
|
kind: "confident",
|
|
23762
23784
|
alignment: i[0]
|
|
23763
23785
|
} : i.length > 1 ? {
|
|
23764
23786
|
kind: "ambiguous",
|
|
23765
23787
|
candidates: i,
|
|
23766
|
-
disputeSpans:
|
|
23788
|
+
disputeSpans: rS(i)
|
|
23767
23789
|
} : {
|
|
23768
23790
|
kind: "invalid",
|
|
23769
23791
|
candidates: r,
|
|
23770
|
-
disputeSpans:
|
|
23792
|
+
disputeSpans: rS(r)
|
|
23771
23793
|
};
|
|
23772
23794
|
}
|
|
23773
23795
|
//#endregion
|
|
23774
23796
|
//#region src/components/DataUploader/core/importing/raggedRows/resolveRaggedRow.ts
|
|
23775
|
-
function
|
|
23776
|
-
let r =
|
|
23797
|
+
function aS(e, t, n) {
|
|
23798
|
+
let r = iS(e, t, n);
|
|
23777
23799
|
if (r.kind === "confident") return {
|
|
23778
23800
|
cells: r.alignment.cells,
|
|
23779
23801
|
conflictColumns: []
|
|
@@ -23792,7 +23814,7 @@ function rS(e, t, n) {
|
|
|
23792
23814
|
}
|
|
23793
23815
|
//#endregion
|
|
23794
23816
|
//#region src/components/DataUploader/core/importing/scheduler.ts
|
|
23795
|
-
var
|
|
23817
|
+
var oS = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)) : new Promise((e) => {
|
|
23796
23818
|
let { port1: t, port2: n } = new MessageChannel();
|
|
23797
23819
|
t.onmessage = () => {
|
|
23798
23820
|
t.close(), e();
|
|
@@ -23800,11 +23822,11 @@ var iS = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)
|
|
|
23800
23822
|
});
|
|
23801
23823
|
//#endregion
|
|
23802
23824
|
//#region src/components/DataUploader/core/importing/runChunked.ts
|
|
23803
|
-
async function
|
|
23825
|
+
async function sS(e, t) {
|
|
23804
23826
|
let { rawRows: n, dataStartIndex: r, chunkSize: i, signal: a } = e, o = [];
|
|
23805
23827
|
for (let e = r; e < n.length; e++) {
|
|
23806
23828
|
let t = n[e];
|
|
23807
|
-
t && !
|
|
23829
|
+
t && !Qb(t) && o.push(e);
|
|
23808
23830
|
}
|
|
23809
23831
|
let s = 0, c = 0;
|
|
23810
23832
|
for (; s < o.length;) {
|
|
@@ -23819,14 +23841,14 @@ async function aS(e, t) {
|
|
|
23819
23841
|
isLastChunk: e >= o.length
|
|
23820
23842
|
});
|
|
23821
23843
|
for (let t = s; t < e; t++) n[o[t]] = void 0;
|
|
23822
|
-
s = e, c++, s < o.length && await
|
|
23844
|
+
s = e, c++, s < o.length && await oS();
|
|
23823
23845
|
}
|
|
23824
23846
|
return "completed";
|
|
23825
23847
|
}
|
|
23826
23848
|
//#endregion
|
|
23827
23849
|
//#region src/components/DataUploader/core/importing/runImport.ts
|
|
23828
|
-
var
|
|
23829
|
-
let t =
|
|
23850
|
+
var cS = 5e3, lS = async (e) => {
|
|
23851
|
+
let t = Kx(e.workbook.origin);
|
|
23830
23852
|
if (!t || !e.scaleClient?.onFileImport) return {
|
|
23831
23853
|
outcome: "completed",
|
|
23832
23854
|
collapsed: !1
|
|
@@ -23839,34 +23861,34 @@ var oS = 5e3, sS = async (e) => {
|
|
|
23839
23861
|
return await e.scaleClient.onFileImport({
|
|
23840
23862
|
file: t,
|
|
23841
23863
|
mappings: n,
|
|
23842
|
-
sourceName:
|
|
23864
|
+
sourceName: qx(e.workbook),
|
|
23843
23865
|
signal: e.signal
|
|
23844
23866
|
}), e.store.reloadServerData(), {
|
|
23845
23867
|
outcome: "completed",
|
|
23846
23868
|
collapsed: !1
|
|
23847
23869
|
};
|
|
23848
|
-
},
|
|
23870
|
+
}, uS = async (e) => {
|
|
23849
23871
|
let { scaleClient: t, rawRows: n } = e;
|
|
23850
23872
|
if (!n || !t?.onRowsImport) return {
|
|
23851
23873
|
outcome: "completed",
|
|
23852
23874
|
collapsed: !1
|
|
23853
23875
|
};
|
|
23854
|
-
let r = crypto.randomUUID(), i = e.buildMappings(null), a = t.importChunkSize ??
|
|
23876
|
+
let r = crypto.randomUUID(), i = e.buildMappings(null), a = t.importChunkSize ?? cS, o = new Set(e.pendingColumns.map((e) => e.id)), s = Rx(e.columnMapping, e.columns, o), c = {
|
|
23855
23877
|
numberFormat: i.numberFormat,
|
|
23856
23878
|
dateFormat: i.dateFormat,
|
|
23857
23879
|
monthTable: e.monthTable,
|
|
23858
23880
|
valueMapping: e.valueMapping,
|
|
23859
23881
|
multiselectDelimiters: e.multiselectDelimiters
|
|
23860
|
-
}, l = await
|
|
23882
|
+
}, l = await sS({
|
|
23861
23883
|
rawRows: n,
|
|
23862
23884
|
dataStartIndex: e.workbook.dataStartIndex,
|
|
23863
23885
|
chunkSize: a,
|
|
23864
23886
|
signal: e.signal
|
|
23865
23887
|
}, async (n, { chunkIndex: a, isLastChunk: o }) => {
|
|
23866
|
-
let l = n.map((t) =>
|
|
23888
|
+
let l = n.map((t) => Bx(lx(t, e.workbook.headers), s, c));
|
|
23867
23889
|
await t.onRowsImport?.({
|
|
23868
23890
|
importId: r,
|
|
23869
|
-
sourceName:
|
|
23891
|
+
sourceName: qx(e.workbook),
|
|
23870
23892
|
chunkIndex: a,
|
|
23871
23893
|
isLastChunk: o,
|
|
23872
23894
|
rows: l,
|
|
@@ -23879,7 +23901,7 @@ var oS = 5e3, sS = async (e) => {
|
|
|
23879
23901
|
outcome: l,
|
|
23880
23902
|
collapsed: !1
|
|
23881
23903
|
};
|
|
23882
|
-
},
|
|
23904
|
+
}, dS = async (e) => {
|
|
23883
23905
|
let t = e.rawRows;
|
|
23884
23906
|
if (!t) return {
|
|
23885
23907
|
outcome: "completed",
|
|
@@ -23888,11 +23910,11 @@ var oS = 5e3, sS = async (e) => {
|
|
|
23888
23910
|
let n = new Set(e.pendingColumns.map((e) => e.id));
|
|
23889
23911
|
e.pendingColumns.length > 0 && e.addDynamicColumns(e.pendingColumns);
|
|
23890
23912
|
for (let [t, n] of Object.entries(e.pendingOptions)) e.store.addColumnOptions(t, n);
|
|
23891
|
-
let r = e.store.registerSource({ name:
|
|
23892
|
-
e.store.setSourceLoading(r, !0)
|
|
23893
|
-
let i = e.workbook.headers, a = e.workbook.delimiter ?? ",", o =
|
|
23894
|
-
numberFormat:
|
|
23895
|
-
dateFormat:
|
|
23913
|
+
let r = e.store.registerSource({ name: qx(e.workbook) });
|
|
23914
|
+
e.store.setSourceLoading(r, !0);
|
|
23915
|
+
let i = e.workbook.headers, a = e.workbook.delimiter ?? ",", o = ux(t, i, e.workbook.dataStartIndex, 1e3), s = Rx(e.columnMapping, e.columns, n), c = {
|
|
23916
|
+
numberFormat: ac(o, zx(s)),
|
|
23917
|
+
dateFormat: uc(o, Vx(e.columnMapping, e.columns, n)),
|
|
23896
23918
|
monthTable: e.monthTable,
|
|
23897
23919
|
valueMapping: e.valueMapping,
|
|
23898
23920
|
multiselectDelimiters: e.multiselectDelimiters
|
|
@@ -23902,17 +23924,17 @@ var oS = 5e3, sS = async (e) => {
|
|
|
23902
23924
|
id: t,
|
|
23903
23925
|
title: t
|
|
23904
23926
|
};
|
|
23905
|
-
}), u = 0, d = 0, f = await
|
|
23927
|
+
}), u = 0, d = 0, f = await sS({
|
|
23906
23928
|
rawRows: t,
|
|
23907
23929
|
dataStartIndex: e.workbook.dataStartIndex,
|
|
23908
|
-
chunkSize:
|
|
23930
|
+
chunkSize: cS,
|
|
23909
23931
|
signal: e.signal
|
|
23910
23932
|
}, async (t) => {
|
|
23911
23933
|
let n = [], o = [];
|
|
23912
23934
|
for (let r = 0; r < t.length; r++) {
|
|
23913
|
-
let u = t[r], d =
|
|
23935
|
+
let u = t[r], d = lx(u, i);
|
|
23914
23936
|
if (u.length !== i.length) {
|
|
23915
|
-
let { cells: t, conflictColumns: n } =
|
|
23937
|
+
let { cells: t, conflictColumns: n } = aS(u.map((e) => String(e ?? "")), l, a);
|
|
23916
23938
|
if (t.length) {
|
|
23917
23939
|
let e = {};
|
|
23918
23940
|
for (let n = 0; n < i.length; n++) e[i[n]] = t[n] ?? "";
|
|
@@ -23930,10 +23952,10 @@ var oS = 5e3, sS = async (e) => {
|
|
|
23930
23952
|
});
|
|
23931
23953
|
}
|
|
23932
23954
|
}
|
|
23933
|
-
n.push(
|
|
23955
|
+
n.push(Bx(d, s, c));
|
|
23934
23956
|
}
|
|
23935
23957
|
let { rows: f, rowIds: p, addedCount: m } = e.store.upsertRows(r, n, { anchorKey: e.primaryKey ?? void 0 });
|
|
23936
|
-
u += n.length, d += m, await
|
|
23958
|
+
u += n.length, d += m, await oS(), e.validator.validateRows(f, p);
|
|
23937
23959
|
for (let { localIndex: t, columnIds: n } of o) {
|
|
23938
23960
|
let r = p[t];
|
|
23939
23961
|
for (let t of n) {
|
|
@@ -23945,41 +23967,51 @@ var oS = 5e3, sS = async (e) => {
|
|
|
23945
23967
|
}
|
|
23946
23968
|
}
|
|
23947
23969
|
o.length > 0 && e.store.notify();
|
|
23948
|
-
})
|
|
23970
|
+
});
|
|
23971
|
+
f === "completed" && e.store.recordLearnedSynonyms(Wx({
|
|
23972
|
+
columnMapping: e.columnMapping,
|
|
23973
|
+
baselineColumnMapping: e.baselineColumnMapping,
|
|
23974
|
+
valueMapping: e.valueMapping,
|
|
23975
|
+
baselineValueMapping: e.baselineValueMapping,
|
|
23976
|
+
columns: [...e.columns, ...e.pendingColumns],
|
|
23977
|
+
knownColumnSynonyms: ob(nb, e.extraSynonyms.columns),
|
|
23978
|
+
knownValueSynonyms: ob(nb, e.extraSynonyms.values)
|
|
23979
|
+
}));
|
|
23980
|
+
let p = f === "completed" && u > 0 && d === 0;
|
|
23949
23981
|
return await e.store.finalizeSource(r), e.validator.validateUniqueness(), {
|
|
23950
23982
|
outcome: f,
|
|
23951
23983
|
collapsed: p
|
|
23952
23984
|
};
|
|
23953
23985
|
};
|
|
23954
|
-
async function
|
|
23955
|
-
return e.scaleClient?.onFileImport ?
|
|
23986
|
+
async function fS(e) {
|
|
23987
|
+
return e.scaleClient?.onFileImport ? lS(e) : e.scaleClient?.onRowsImport ? uS(e) : dS(e);
|
|
23956
23988
|
}
|
|
23957
23989
|
//#endregion
|
|
23958
23990
|
//#region src/components/DataUploader/core/parser/headerView.ts
|
|
23959
|
-
var
|
|
23960
|
-
let i =
|
|
23991
|
+
var pS = (e, t, n, r) => {
|
|
23992
|
+
let i = nx(t, n);
|
|
23961
23993
|
return {
|
|
23962
23994
|
dataStartIndex: i,
|
|
23963
|
-
headers:
|
|
23995
|
+
headers: rx(e, n, i, r)
|
|
23964
23996
|
};
|
|
23965
|
-
},
|
|
23966
|
-
let { headers: i, dataStartIndex: a } =
|
|
23997
|
+
}, mS = (e) => e.kind === "remote" ? `remote:${e.sourceId}` : `file:${e.file.name}:${e.file.size}:${e.file.lastModified}`, hS = (e, t, n, r) => {
|
|
23998
|
+
let { headers: i, dataStartIndex: a } = pS(t.rawRows, t.detection, n, r);
|
|
23967
23999
|
return {
|
|
23968
24000
|
name: e,
|
|
23969
24001
|
headers: i,
|
|
23970
|
-
rows:
|
|
24002
|
+
rows: ux(t.rawRows, i, a, 15),
|
|
23971
24003
|
totalRows: Math.max(0, t.rawRows.length - a)
|
|
23972
24004
|
};
|
|
23973
|
-
},
|
|
23974
|
-
let n =
|
|
24005
|
+
}, gS = (e, t) => {
|
|
24006
|
+
let n = Xb(e.rows), r = nx(n, n.headerRowIndex), i = rx(e.rows, n.headerRowIndex, r, t);
|
|
23975
24007
|
return {
|
|
23976
24008
|
name: e.name,
|
|
23977
24009
|
headers: i,
|
|
23978
|
-
rows:
|
|
24010
|
+
rows: ux(e.rows, i, r, 15),
|
|
23979
24011
|
totalRows: e.totalRows - 1
|
|
23980
24012
|
};
|
|
23981
|
-
},
|
|
23982
|
-
let r =
|
|
24013
|
+
}, _S = (e, t, n) => {
|
|
24014
|
+
let r = Xb(e);
|
|
23983
24015
|
return {
|
|
23984
24016
|
kind: "parsed",
|
|
23985
24017
|
grid: {
|
|
@@ -23991,19 +24023,19 @@ var dS = (e, t, n, r) => {
|
|
|
23991
24023
|
csvErrors: n
|
|
23992
24024
|
};
|
|
23993
24025
|
};
|
|
23994
|
-
async function
|
|
24026
|
+
async function vS(e, t, n, r, i = {}) {
|
|
23995
24027
|
try {
|
|
23996
24028
|
if (n === "csv") {
|
|
23997
24029
|
let n = await e.parse(t, { format: "csv" });
|
|
23998
|
-
return n.kind === "rows" ?
|
|
24030
|
+
return n.kind === "rows" ? _S(n.rows, n.delimiter, n.errors) : { kind: "unexpected" };
|
|
23999
24031
|
}
|
|
24000
24032
|
if (n === "json" || n === "xml") {
|
|
24001
24033
|
let r = await e.parse(t, { format: n });
|
|
24002
24034
|
return r.kind === "records" ? {
|
|
24003
24035
|
kind: "parsed",
|
|
24004
24036
|
grid: {
|
|
24005
|
-
rawRows:
|
|
24006
|
-
detection:
|
|
24037
|
+
rawRows: ax(r.headers, r.rows),
|
|
24038
|
+
detection: ix()
|
|
24007
24039
|
},
|
|
24008
24040
|
headerRowIndex: 0,
|
|
24009
24041
|
csvErrors: []
|
|
@@ -24015,8 +24047,8 @@ async function gS(e, t, n, r, i = {}) {
|
|
|
24015
24047
|
});
|
|
24016
24048
|
return !i.sheetName && a.kind === "sheets" ? {
|
|
24017
24049
|
kind: "sheets",
|
|
24018
|
-
previews: a.sheets.map((e) =>
|
|
24019
|
-
} : a.kind === "rows" ?
|
|
24050
|
+
previews: a.sheets.map((e) => gS(e, r))
|
|
24051
|
+
} : a.kind === "rows" ? _S(a.rows, ",", []) : { kind: "unexpected" };
|
|
24020
24052
|
} catch (e) {
|
|
24021
24053
|
return {
|
|
24022
24054
|
kind: "error",
|
|
@@ -24027,20 +24059,20 @@ async function gS(e, t, n, r, i = {}) {
|
|
|
24027
24059
|
}
|
|
24028
24060
|
//#endregion
|
|
24029
24061
|
//#region src/components/DataUploader/core/parser/resolveParseFormat.ts
|
|
24030
|
-
var
|
|
24062
|
+
var yS = new Set([
|
|
24031
24063
|
"xlsx",
|
|
24032
24064
|
"xls",
|
|
24033
24065
|
"xlsb",
|
|
24034
24066
|
"ods"
|
|
24035
|
-
]),
|
|
24067
|
+
]), bS = (e) => {
|
|
24036
24068
|
let t = e.split(".").pop()?.toLowerCase();
|
|
24037
|
-
return t &&
|
|
24038
|
-
},
|
|
24069
|
+
return t && yS.has(t) ? "xlsx" : t === "json" ? "json" : t === "xml" ? "xml" : "csv";
|
|
24070
|
+
}, xS = 20, SS = {
|
|
24039
24071
|
workbooks: [],
|
|
24040
24072
|
parsing: null,
|
|
24041
24073
|
stagedItems: [],
|
|
24042
24074
|
unionHeaders: []
|
|
24043
|
-
},
|
|
24075
|
+
}, CS = (e) => e.source.kind === "remote" ? {
|
|
24044
24076
|
kind: "remote",
|
|
24045
24077
|
sourceId: e.source.sourceId
|
|
24046
24078
|
} : e.materialize.kind === "sheet" ? {
|
|
@@ -24050,7 +24082,7 @@ var _S = new Set([
|
|
|
24050
24082
|
} : {
|
|
24051
24083
|
kind: "file",
|
|
24052
24084
|
file: e.source.file
|
|
24053
|
-
},
|
|
24085
|
+
}, wS = class {
|
|
24054
24086
|
client;
|
|
24055
24087
|
synthesize;
|
|
24056
24088
|
generation = 0;
|
|
@@ -24058,7 +24090,7 @@ var _S = new Set([
|
|
|
24058
24090
|
stagedSeq = 0;
|
|
24059
24091
|
queue = [];
|
|
24060
24092
|
pumping = !1;
|
|
24061
|
-
_state =
|
|
24093
|
+
_state = SS;
|
|
24062
24094
|
constructor(e, t) {
|
|
24063
24095
|
this.client = e, this.synthesize = t;
|
|
24064
24096
|
}
|
|
@@ -24075,12 +24107,12 @@ var _S = new Set([
|
|
|
24075
24107
|
let t = {
|
|
24076
24108
|
kind: "file",
|
|
24077
24109
|
file: e
|
|
24078
|
-
}, n =
|
|
24079
|
-
for (let e of this.queue)
|
|
24110
|
+
}, n = mS(t);
|
|
24111
|
+
for (let e of this.queue) mS({
|
|
24080
24112
|
kind: "file",
|
|
24081
24113
|
file: e.file
|
|
24082
24114
|
}) === n && e.resolve(null);
|
|
24083
|
-
this.queue = this.queue.filter((e) =>
|
|
24115
|
+
this.queue = this.queue.filter((e) => mS({
|
|
24084
24116
|
kind: "file",
|
|
24085
24117
|
file: e.file
|
|
24086
24118
|
}) !== n);
|
|
@@ -24098,13 +24130,13 @@ var _S = new Set([
|
|
|
24098
24130
|
});
|
|
24099
24131
|
}
|
|
24100
24132
|
stageGrid(e, t, n, r) {
|
|
24101
|
-
let i = this.readyItem(t, n,
|
|
24133
|
+
let i = this.readyItem(t, n, hS(n, e, r, this.synthesize), {
|
|
24102
24134
|
kind: "grid",
|
|
24103
24135
|
grid: e,
|
|
24104
24136
|
headerRowIndex: r
|
|
24105
24137
|
});
|
|
24106
24138
|
this.patch({
|
|
24107
|
-
stagedItems: [...this.itemsWithoutSource(
|
|
24139
|
+
stagedItems: [...this.itemsWithoutSource(mS(t)), i],
|
|
24108
24140
|
parsing: null
|
|
24109
24141
|
});
|
|
24110
24142
|
}
|
|
@@ -24120,11 +24152,11 @@ var _S = new Set([
|
|
|
24120
24152
|
ok: !1,
|
|
24121
24153
|
attempt: null
|
|
24122
24154
|
};
|
|
24123
|
-
let t = e.map((e) =>
|
|
24155
|
+
let t = e.map((e) => CS(e)), n = this._state.workbooks.filter((e) => t.some((t) => Jx(e.origin, t)));
|
|
24124
24156
|
n.length !== this._state.workbooks.length && this.setWorkbooks(n);
|
|
24125
24157
|
for (let t of e) {
|
|
24126
|
-
let e =
|
|
24127
|
-
if (this._state.workbooks.some((t) =>
|
|
24158
|
+
let e = CS(t);
|
|
24159
|
+
if (this._state.workbooks.some((t) => Jx(t.origin, e))) continue;
|
|
24128
24160
|
if (t.materialize.kind === "grid") {
|
|
24129
24161
|
this.addWorkbook(t.materialize.grid, e, t.name, t.materialize.headerRowIndex);
|
|
24130
24162
|
continue;
|
|
@@ -24132,7 +24164,7 @@ var _S = new Set([
|
|
|
24132
24164
|
if (t.source.kind !== "file") continue;
|
|
24133
24165
|
let { file: n } = t.source, r = ++this.generation;
|
|
24134
24166
|
this.patch({ parsing: { file: n } });
|
|
24135
|
-
let i = await
|
|
24167
|
+
let i = await vS(this.client, n, "xlsx", this.synthesize, { sheetName: t.materialize.sheetName });
|
|
24136
24168
|
if (r !== this.generation) return {
|
|
24137
24169
|
ok: !1,
|
|
24138
24170
|
attempt: null
|
|
@@ -24153,7 +24185,7 @@ var _S = new Set([
|
|
|
24153
24185
|
}
|
|
24154
24186
|
removeWorkbook(e) {
|
|
24155
24187
|
let t = this._state.workbooks.find((t) => t.id === e);
|
|
24156
|
-
t && this.setWorkbooks(this._state.workbooks.filter((t) => t.id !== e), { stagedItems: this._state.stagedItems.filter((e) => e.status === "pending" || !
|
|
24188
|
+
t && this.setWorkbooks(this._state.workbooks.filter((t) => t.id !== e), { stagedItems: this._state.stagedItems.filter((e) => e.status === "pending" || !Jx(CS(e), t.origin)) });
|
|
24157
24189
|
}
|
|
24158
24190
|
cancelParse() {
|
|
24159
24191
|
!this._state.parsing && this.queue.length === 0 || (this.generation++, this.client.cancel(), this.flushQueue(), this.patch({
|
|
@@ -24168,7 +24200,7 @@ var _S = new Set([
|
|
|
24168
24200
|
});
|
|
24169
24201
|
}
|
|
24170
24202
|
reset() {
|
|
24171
|
-
this.generation++, this.client.cancel(), this.flushQueue(), this._state =
|
|
24203
|
+
this.generation++, this.client.cancel(), this.flushQueue(), this._state = SS;
|
|
24172
24204
|
}
|
|
24173
24205
|
clearWorkbooks() {
|
|
24174
24206
|
this.setWorkbooks([]);
|
|
@@ -24176,7 +24208,7 @@ var _S = new Set([
|
|
|
24176
24208
|
takeRawRows(e) {
|
|
24177
24209
|
let t = this._state.workbooks.find((t) => t.id === e);
|
|
24178
24210
|
if (!t) return null;
|
|
24179
|
-
let n = t.rawRows, r = Math.max(
|
|
24211
|
+
let n = t.rawRows, r = Math.max(xS, t.dataStartIndex + 1);
|
|
24180
24212
|
return this.setWorkbooks(this._state.workbooks.map((t) => t.id === e ? {
|
|
24181
24213
|
...t,
|
|
24182
24214
|
rawRows: n.slice(0, r)
|
|
@@ -24206,7 +24238,7 @@ var _S = new Set([
|
|
|
24206
24238
|
if (!e) break;
|
|
24207
24239
|
let t = ++this.generation;
|
|
24208
24240
|
this.patch({ parsing: { file: e.file } });
|
|
24209
|
-
let n =
|
|
24241
|
+
let n = bS(e.file.name), r = await vS(this.client, e.file, n, this.synthesize);
|
|
24210
24242
|
if (t !== this.generation) {
|
|
24211
24243
|
e.resolve(null);
|
|
24212
24244
|
continue;
|
|
@@ -24229,7 +24261,7 @@ var _S = new Set([
|
|
|
24229
24261
|
this.queue = [];
|
|
24230
24262
|
}
|
|
24231
24263
|
itemsWithoutSource(e) {
|
|
24232
|
-
return this._state.stagedItems.filter((t) =>
|
|
24264
|
+
return this._state.stagedItems.filter((t) => mS(t.source) !== e);
|
|
24233
24265
|
}
|
|
24234
24266
|
readyItem(e, t, n, r) {
|
|
24235
24267
|
return {
|
|
@@ -24243,10 +24275,10 @@ var _S = new Set([
|
|
|
24243
24275
|
};
|
|
24244
24276
|
}
|
|
24245
24277
|
applyOutcome(e, t, n) {
|
|
24246
|
-
let r = this.itemsWithoutSource(
|
|
24278
|
+
let r = this.itemsWithoutSource(mS(t));
|
|
24247
24279
|
switch (e.kind) {
|
|
24248
24280
|
case "parsed": {
|
|
24249
|
-
let i = this.readyItem(t, n,
|
|
24281
|
+
let i = this.readyItem(t, n, hS(n, e.grid, e.headerRowIndex, this.synthesize), {
|
|
24250
24282
|
kind: "grid",
|
|
24251
24283
|
grid: e.grid,
|
|
24252
24284
|
headerRowIndex: e.headerRowIndex
|
|
@@ -24288,11 +24320,11 @@ var _S = new Set([
|
|
|
24288
24320
|
headerRowIndex: r,
|
|
24289
24321
|
headers: [],
|
|
24290
24322
|
dataStartIndex: 0
|
|
24291
|
-
}), a = this._state.workbooks.findIndex((e) =>
|
|
24323
|
+
}), a = this._state.workbooks.findIndex((e) => Jx(e.origin, t)), o = a >= 0 ? this._state.workbooks.map((e, t) => t === a ? i : e) : [...this._state.workbooks, i];
|
|
24292
24324
|
return this.setWorkbooks(o, { parsing: null }), i;
|
|
24293
24325
|
}
|
|
24294
24326
|
reproject(e) {
|
|
24295
|
-
let { headers: t, dataStartIndex: n } =
|
|
24327
|
+
let { headers: t, dataStartIndex: n } = pS(e.rawRows, e.detection, e.headerRowIndex, this.synthesize);
|
|
24296
24328
|
return {
|
|
24297
24329
|
...e,
|
|
24298
24330
|
headers: t,
|
|
@@ -24305,7 +24337,7 @@ var _S = new Set([
|
|
|
24305
24337
|
...n,
|
|
24306
24338
|
...t,
|
|
24307
24339
|
workbooks: e,
|
|
24308
|
-
unionHeaders: r ?
|
|
24340
|
+
unionHeaders: r ? Gx(e) : n.unionHeaders
|
|
24309
24341
|
};
|
|
24310
24342
|
}
|
|
24311
24343
|
patch(e) {
|
|
@@ -24314,7 +24346,7 @@ var _S = new Set([
|
|
|
24314
24346
|
...e
|
|
24315
24347
|
};
|
|
24316
24348
|
}
|
|
24317
|
-
},
|
|
24349
|
+
}, TS = class {
|
|
24318
24350
|
columns;
|
|
24319
24351
|
_state;
|
|
24320
24352
|
constructor(e, t) {
|
|
@@ -24333,17 +24365,17 @@ var _S = new Set([
|
|
|
24333
24365
|
};
|
|
24334
24366
|
}
|
|
24335
24367
|
refreshEligible(e) {
|
|
24336
|
-
let t = new Set(e), n = this.columns.filter((e) =>
|
|
24368
|
+
let t = new Set(e), n = this.columns.filter((e) => Wc(e) && t.has(e.id)), r = this._state.eligibleColumns;
|
|
24337
24369
|
r.length === n.length && r.every((e, t) => e === n[t]) || (this._state = {
|
|
24338
24370
|
...this._state,
|
|
24339
24371
|
eligibleColumns: n
|
|
24340
24372
|
});
|
|
24341
24373
|
}
|
|
24342
|
-
},
|
|
24374
|
+
}, ES = {
|
|
24343
24375
|
loadingId: null,
|
|
24344
24376
|
error: null
|
|
24345
|
-
},
|
|
24346
|
-
_state =
|
|
24377
|
+
}, DS = class {
|
|
24378
|
+
_state = ES;
|
|
24347
24379
|
get state() {
|
|
24348
24380
|
return this._state;
|
|
24349
24381
|
}
|
|
@@ -24365,74 +24397,74 @@ var _S = new Set([
|
|
|
24365
24397
|
loadingId: null
|
|
24366
24398
|
};
|
|
24367
24399
|
}
|
|
24368
|
-
},
|
|
24400
|
+
}, OS = (e, t, n) => {
|
|
24369
24401
|
let r = /* @__PURE__ */ new Set();
|
|
24370
|
-
for (let i of e) if (i !== "") if (n) for (let e of
|
|
24402
|
+
for (let i of e) if (i !== "") if (n) for (let e of Ix(i, n, t)) r.add(e);
|
|
24371
24403
|
else r.add(i);
|
|
24372
24404
|
return [...r];
|
|
24373
|
-
},
|
|
24405
|
+
}, kS = 200, AS = (e, t, n) => {
|
|
24374
24406
|
if (n) return n;
|
|
24375
24407
|
let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
|
|
24376
24408
|
for (let t of e) {
|
|
24377
24409
|
let e = t.trim();
|
|
24378
|
-
if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >=
|
|
24410
|
+
if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= kS)) break;
|
|
24379
24411
|
}
|
|
24380
24412
|
if (o.length === 0) return null;
|
|
24381
24413
|
let s = null, c = 0, l = 0;
|
|
24382
|
-
for (let e of
|
|
24414
|
+
for (let e of Fx) {
|
|
24383
24415
|
let n = 0, r = 0;
|
|
24384
24416
|
for (let a of o) {
|
|
24385
24417
|
if (i(a) || !a.includes(e)) continue;
|
|
24386
24418
|
let o = a.split(e).map((e) => e.trim()).filter((e) => e !== "");
|
|
24387
24419
|
if (o.length < 2) continue;
|
|
24388
24420
|
let s = 0, c = 0;
|
|
24389
|
-
for (let e of o) i(e) ? (s++, c++) :
|
|
24421
|
+
for (let e of o) i(e) ? (s++, c++) : Tb(e, t) !== void 0 && s++;
|
|
24390
24422
|
s >= 2 && (n++, r += c);
|
|
24391
24423
|
}
|
|
24392
24424
|
(n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
|
|
24393
24425
|
}
|
|
24394
24426
|
return c > 0 ? s : null;
|
|
24395
|
-
},
|
|
24427
|
+
}, jS = (e, t) => {
|
|
24396
24428
|
let n = /* @__PURE__ */ new Map();
|
|
24397
24429
|
for (let [r, i] of Object.entries(e)) {
|
|
24398
24430
|
let e = t.find((e) => e.id === r)?.editor?.type;
|
|
24399
24431
|
e !== "select" && e !== "multiselect" || n.set(r, i);
|
|
24400
24432
|
}
|
|
24401
24433
|
return n;
|
|
24402
|
-
},
|
|
24434
|
+
}, MS = (e, t) => {
|
|
24403
24435
|
let n = t.editor;
|
|
24404
24436
|
if (!n || n.type !== "select" && n.type !== "multiselect") return null;
|
|
24405
24437
|
let r = n.options;
|
|
24406
24438
|
if (n.type === "multiselect") {
|
|
24407
|
-
let t = n.delimiter, i =
|
|
24439
|
+
let t = n.delimiter, i = AS(e, r, t);
|
|
24408
24440
|
return {
|
|
24409
|
-
importedValues:
|
|
24441
|
+
importedValues: OS(e, r, i),
|
|
24410
24442
|
options: r,
|
|
24411
24443
|
delimiter: i,
|
|
24412
24444
|
isMultiselect: !0
|
|
24413
24445
|
};
|
|
24414
24446
|
}
|
|
24415
24447
|
return {
|
|
24416
|
-
importedValues:
|
|
24448
|
+
importedValues: OS(e, r, null),
|
|
24417
24449
|
options: r,
|
|
24418
24450
|
delimiter: null,
|
|
24419
24451
|
isMultiselect: !1
|
|
24420
24452
|
};
|
|
24421
|
-
},
|
|
24453
|
+
}, NS = (e, t) => {
|
|
24422
24454
|
let n = /* @__PURE__ */ new Set();
|
|
24423
24455
|
for (let r of t) {
|
|
24424
24456
|
let t = e.find((e) => e.id === r.workbookId);
|
|
24425
24457
|
if (!t) continue;
|
|
24426
|
-
let i =
|
|
24427
|
-
if (i !== void 0) for (let e of
|
|
24458
|
+
let i = ox(t.headers).get(r.header);
|
|
24459
|
+
if (i !== void 0) for (let e of cx(t.rawRows, t.dataStartIndex, i)) n.add(e);
|
|
24428
24460
|
}
|
|
24429
24461
|
return [...n];
|
|
24430
|
-
},
|
|
24462
|
+
}, PS = (e, t, n) => {
|
|
24431
24463
|
let r = {}, i = {}, a = {};
|
|
24432
|
-
for (let [o, s] of
|
|
24464
|
+
for (let [o, s] of jS(t, n)) {
|
|
24433
24465
|
let t = n.find((e) => e.id === o);
|
|
24434
24466
|
if (!t) continue;
|
|
24435
|
-
let c =
|
|
24467
|
+
let c = NS(e, s), l = MS(c, t);
|
|
24436
24468
|
l && (a[o] = c, l.isMultiselect && (i[o] = l.delimiter), r[o] = {
|
|
24437
24469
|
importedValues: l.importedValues,
|
|
24438
24470
|
options: l.options
|
|
@@ -24443,27 +24475,27 @@ var _S = new Set([
|
|
|
24443
24475
|
delimiters: i,
|
|
24444
24476
|
rawCellsByColumn: a
|
|
24445
24477
|
};
|
|
24446
|
-
},
|
|
24478
|
+
}, FS = (e, t) => {
|
|
24447
24479
|
let n = {};
|
|
24448
24480
|
for (let [r, i] of Object.entries(e)) n[r] = {
|
|
24449
24481
|
...i,
|
|
24450
24482
|
...t[r]
|
|
24451
24483
|
};
|
|
24452
24484
|
return n;
|
|
24453
|
-
},
|
|
24485
|
+
}, IS = (e, t, n, r) => ({
|
|
24454
24486
|
...e,
|
|
24455
24487
|
[t]: {
|
|
24456
24488
|
...e[t],
|
|
24457
24489
|
[n]: r
|
|
24458
24490
|
}
|
|
24459
|
-
}),
|
|
24491
|
+
}), LS = (e, t, n) => RS(e, t, [n]), RS = (e, t, n) => {
|
|
24460
24492
|
let r = e[t] ?? [], i = new Set(r), a = [];
|
|
24461
24493
|
for (let e of n) i.has(e) || (i.add(e), a.push(e));
|
|
24462
24494
|
return a.length === 0 ? e : {
|
|
24463
24495
|
...e,
|
|
24464
24496
|
[t]: [...r, ...a]
|
|
24465
24497
|
};
|
|
24466
|
-
},
|
|
24498
|
+
}, zS = (e, t, n, r) => {
|
|
24467
24499
|
let i = t[r];
|
|
24468
24500
|
if (!i || i.length === 0) return null;
|
|
24469
24501
|
let a = n.find((e) => e.id === r);
|
|
@@ -24472,31 +24504,31 @@ var _S = new Set([
|
|
|
24472
24504
|
for (let t of i) {
|
|
24473
24505
|
let n = e.find((e) => e.id === t.workbookId);
|
|
24474
24506
|
if (!n) continue;
|
|
24475
|
-
let r =
|
|
24476
|
-
r !== void 0 && (s = !0, o.push(...
|
|
24507
|
+
let r = ox(n.headers).get(t.header);
|
|
24508
|
+
r !== void 0 && (s = !0, o.push(...sx(n.rawRows, n.dataStartIndex, r)));
|
|
24477
24509
|
}
|
|
24478
24510
|
if (!s) return null;
|
|
24479
24511
|
let c = a.editor.delimiter;
|
|
24480
|
-
return { delimiter:
|
|
24481
|
-
},
|
|
24512
|
+
return { delimiter: AS(o, a.editor.options, c) };
|
|
24513
|
+
}, BS = new Intl.Collator(), VS = {
|
|
24482
24514
|
merged: {},
|
|
24483
24515
|
computed: {},
|
|
24484
24516
|
multiselectDelimiters: {},
|
|
24485
24517
|
pendingOptions: {},
|
|
24486
24518
|
importedValues: {},
|
|
24487
24519
|
isMatching: !1
|
|
24488
|
-
},
|
|
24520
|
+
}, HS = (e, t) => {
|
|
24489
24521
|
let n = [], r = [];
|
|
24490
24522
|
for (let [r, i] of t) {
|
|
24491
24523
|
let t = e.get(r);
|
|
24492
|
-
(!t ||
|
|
24524
|
+
(!t || Sx(t) !== Sx(i)) && n.push([r, i]);
|
|
24493
24525
|
}
|
|
24494
24526
|
for (let n of e.keys()) t.has(n) || r.push(n);
|
|
24495
24527
|
return {
|
|
24496
24528
|
changed: n,
|
|
24497
24529
|
removed: r
|
|
24498
24530
|
};
|
|
24499
|
-
},
|
|
24531
|
+
}, US = class {
|
|
24500
24532
|
deps;
|
|
24501
24533
|
notify;
|
|
24502
24534
|
seq = 0;
|
|
@@ -24506,7 +24538,7 @@ var _S = new Set([
|
|
|
24506
24538
|
lastInputs = null;
|
|
24507
24539
|
cellCache = /* @__PURE__ */ new Map();
|
|
24508
24540
|
hookOutput = null;
|
|
24509
|
-
_state =
|
|
24541
|
+
_state = VS;
|
|
24510
24542
|
constructor(e, t) {
|
|
24511
24543
|
this.deps = e, this.notify = t;
|
|
24512
24544
|
}
|
|
@@ -24523,12 +24555,12 @@ var _S = new Set([
|
|
|
24523
24555
|
});
|
|
24524
24556
|
return;
|
|
24525
24557
|
}
|
|
24526
|
-
let n =
|
|
24558
|
+
let n = jS(e.headersByColumn, this.deps.columns), r = this.lastInputs;
|
|
24527
24559
|
if (this.lastInputs = {
|
|
24528
24560
|
workbooks: t,
|
|
24529
24561
|
associations: n
|
|
24530
24562
|
}, r !== null && r.workbooks === t) {
|
|
24531
|
-
let e =
|
|
24563
|
+
let e = HS(r.associations, n);
|
|
24532
24564
|
if (e.changed.length === 0 && e.removed.length === 0) return;
|
|
24533
24565
|
this.recomputeChanged(t, e);
|
|
24534
24566
|
return;
|
|
@@ -24536,14 +24568,14 @@ var _S = new Set([
|
|
|
24536
24568
|
this.cellCache.clear(), this.fullRecompute(t, e.headersByColumn);
|
|
24537
24569
|
}
|
|
24538
24570
|
fullRecompute(e, t) {
|
|
24539
|
-
let { selectData: n, delimiters: r, rawCellsByColumn: i } =
|
|
24571
|
+
let { selectData: n, delimiters: r, rawCellsByColumn: i } = PS(e, t, this.deps.columns);
|
|
24540
24572
|
this.rawCellsByColumn = i, this.lastSelectData = n;
|
|
24541
24573
|
for (let [e, t] of this.lastInputs?.associations ?? []) {
|
|
24542
24574
|
let n = i[e];
|
|
24543
|
-
n && this.cellCache.set(
|
|
24575
|
+
n && this.cellCache.set(Sx(t), n);
|
|
24544
24576
|
}
|
|
24545
24577
|
let a = {};
|
|
24546
|
-
for (let [e, t] of Object.entries(n)) a[e] = [...t.importedValues].sort(
|
|
24578
|
+
for (let [e, t] of Object.entries(n)) a[e] = [...t.importedValues].sort(BS.compare);
|
|
24547
24579
|
this.patch({
|
|
24548
24580
|
multiselectDelimiters: r,
|
|
24549
24581
|
importedValues: a,
|
|
@@ -24556,13 +24588,13 @@ var _S = new Set([
|
|
|
24556
24588
|
for (let [s, c] of t.changed) {
|
|
24557
24589
|
let t = this.deps.columns.find((e) => e.id === s);
|
|
24558
24590
|
if (!t) continue;
|
|
24559
|
-
let l =
|
|
24560
|
-
u || (u =
|
|
24561
|
-
let d =
|
|
24591
|
+
let l = Sx(c), u = this.cellCache.get(l);
|
|
24592
|
+
u || (u = NS(e, c), this.cellCache.set(l, u));
|
|
24593
|
+
let d = MS(u, t);
|
|
24562
24594
|
d && (r[s] = u, n[s] = {
|
|
24563
24595
|
importedValues: d.importedValues,
|
|
24564
24596
|
options: d.options
|
|
24565
|
-
}, d.isMultiselect && (i[s] = d.delimiter), a[s] = [...d.importedValues].sort(
|
|
24597
|
+
}, d.isMultiselect && (i[s] = d.delimiter), a[s] = [...d.importedValues].sort(BS.compare), o[s] = this.computeMatches({ [s]: n[s] })[s]);
|
|
24566
24598
|
}
|
|
24567
24599
|
this.lastSelectData = n, this.rawCellsByColumn = r, this.patch({
|
|
24568
24600
|
multiselectDelimiters: i,
|
|
@@ -24571,7 +24603,7 @@ var _S = new Set([
|
|
|
24571
24603
|
});
|
|
24572
24604
|
}
|
|
24573
24605
|
computeMatches(e) {
|
|
24574
|
-
return Object.keys(e).length === 0 ? {} : this.hookOutput ?
|
|
24606
|
+
return Object.keys(e).length === 0 ? {} : this.hookOutput ? Db(e, this.hookOutput, this.deps.extraSynonyms) : Eb(e, this.deps.extraSynonyms);
|
|
24575
24607
|
}
|
|
24576
24608
|
get hasSelectData() {
|
|
24577
24609
|
return Object.keys(this.lastSelectData).length > 0;
|
|
@@ -24582,7 +24614,7 @@ var _S = new Set([
|
|
|
24582
24614
|
let t = ++this.seq;
|
|
24583
24615
|
this.patch({ isMatching: !0 });
|
|
24584
24616
|
try {
|
|
24585
|
-
let n = await
|
|
24617
|
+
let n = await fx(Promise.resolve(e(this.lastSelectData)), dx);
|
|
24586
24618
|
if (t !== this.seq) return;
|
|
24587
24619
|
this.hookOutput = n, this.patch({
|
|
24588
24620
|
computed: this.computeMatches(this.lastSelectData),
|
|
@@ -24601,7 +24633,7 @@ var _S = new Set([
|
|
|
24601
24633
|
this.hookOutput = null, this.cancelHook();
|
|
24602
24634
|
}
|
|
24603
24635
|
updateValueMapping(e, t, n) {
|
|
24604
|
-
this.manual =
|
|
24636
|
+
this.manual = IS(this.manual, e, t, n), this.patch({});
|
|
24605
24637
|
}
|
|
24606
24638
|
applyValueMappingBatch(e, t) {
|
|
24607
24639
|
if (t.length === 0) return;
|
|
@@ -24618,7 +24650,7 @@ var _S = new Set([
|
|
|
24618
24650
|
[e]: t
|
|
24619
24651
|
} }, r = this.rawCellsByColumn[e];
|
|
24620
24652
|
if (r) {
|
|
24621
|
-
let i = this.deps.columns.find((t) => t.id === e)?.editor, a = i && (i.type === "select" || i.type === "multiselect") ? i.options : [], o =
|
|
24653
|
+
let i = this.deps.columns.find((t) => t.id === e)?.editor, a = i && (i.type === "select" || i.type === "multiselect") ? i.options : [], o = OS(r, a, t), s = {
|
|
24622
24654
|
importedValues: o,
|
|
24623
24655
|
options: a
|
|
24624
24656
|
};
|
|
@@ -24627,7 +24659,7 @@ var _S = new Set([
|
|
|
24627
24659
|
[e]: s
|
|
24628
24660
|
}, n.importedValues = {
|
|
24629
24661
|
...this._state.importedValues,
|
|
24630
|
-
[e]: [...o].sort(
|
|
24662
|
+
[e]: [...o].sort(BS.compare)
|
|
24631
24663
|
}, n.computed = {
|
|
24632
24664
|
...this._state.computed,
|
|
24633
24665
|
[e]: this.computeMatches({ [e]: s })[e] ?? {}
|
|
@@ -24636,14 +24668,14 @@ var _S = new Set([
|
|
|
24636
24668
|
this.patch(n);
|
|
24637
24669
|
}
|
|
24638
24670
|
addPendingOption(e, t) {
|
|
24639
|
-
let n =
|
|
24671
|
+
let n = LS(this._state.pendingOptions, e, t);
|
|
24640
24672
|
n !== this._state.pendingOptions && (this._state = {
|
|
24641
24673
|
...this._state,
|
|
24642
24674
|
pendingOptions: n
|
|
24643
24675
|
});
|
|
24644
24676
|
}
|
|
24645
24677
|
addPendingOptions(e, t) {
|
|
24646
|
-
let n =
|
|
24678
|
+
let n = RS(this._state.pendingOptions, e, t);
|
|
24647
24679
|
n !== this._state.pendingOptions && (this._state = {
|
|
24648
24680
|
...this._state,
|
|
24649
24681
|
pendingOptions: n
|
|
@@ -24659,19 +24691,19 @@ var _S = new Set([
|
|
|
24659
24691
|
};
|
|
24660
24692
|
this._state = {
|
|
24661
24693
|
...t,
|
|
24662
|
-
merged:
|
|
24694
|
+
merged: FS(t.computed, this.manual)
|
|
24663
24695
|
};
|
|
24664
24696
|
}
|
|
24665
|
-
},
|
|
24666
|
-
snapshots = new
|
|
24697
|
+
}, WS = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), GS = (e, t) => e === t ? !0 : e === null || t === null ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, KS = class {
|
|
24698
|
+
snapshots = new kx();
|
|
24667
24699
|
deps;
|
|
24668
24700
|
parser;
|
|
24669
24701
|
columnMapping;
|
|
24670
24702
|
valueMapping;
|
|
24671
24703
|
primaryKey;
|
|
24672
24704
|
importRunner;
|
|
24673
|
-
remoteSource = new
|
|
24674
|
-
navigator = new
|
|
24705
|
+
remoteSource = new DS();
|
|
24706
|
+
navigator = new Px();
|
|
24675
24707
|
hookGate;
|
|
24676
24708
|
lastNavInputs = null;
|
|
24677
24709
|
lastStepIds = [];
|
|
@@ -24679,17 +24711,17 @@ var _S = new Set([
|
|
|
24679
24711
|
lastNavigation = null;
|
|
24680
24712
|
importAbort = null;
|
|
24681
24713
|
constructor(e) {
|
|
24682
|
-
this.deps = e, this.parser = new
|
|
24714
|
+
this.deps = e, this.parser = new wS(e.createParseClient(), e.synthesizeHeader), this.columnMapping = new Tx({
|
|
24683
24715
|
columns: e.columns,
|
|
24684
24716
|
onColumnMatch: e.onColumnMatch,
|
|
24685
|
-
extraSynonyms: e.extraSynonyms
|
|
24717
|
+
extraSynonyms: e.extraSynonyms.columns
|
|
24686
24718
|
}, () => {
|
|
24687
24719
|
this.primaryKey.refreshEligible(this.columnMapping.state.mappedColumnIds), this.refreshValueMatch(), this.commit();
|
|
24688
|
-
}), this.valueMapping = new
|
|
24720
|
+
}), this.valueMapping = new US({
|
|
24689
24721
|
columns: e.columns,
|
|
24690
24722
|
onValueMatch: e.onValueMatch,
|
|
24691
|
-
extraSynonyms: e.extraSynonyms
|
|
24692
|
-
}, () => this.commit()), this.primaryKey = new
|
|
24723
|
+
extraSynonyms: e.extraSynonyms.values
|
|
24724
|
+
}, () => this.commit()), this.primaryKey = new TS(e.columns, e.defaultPrimaryKey), this.importRunner = new Ux(() => this.commit()), this.hookGate = new Ax({
|
|
24693
24725
|
"column-matching": !!e.onColumnMatch,
|
|
24694
24726
|
"match-values": !!e.onValueMatch
|
|
24695
24727
|
}), this.commit();
|
|
@@ -24756,7 +24788,7 @@ var _S = new Set([
|
|
|
24756
24788
|
this.valueMapping.setDelimiter(e, t), this.commit();
|
|
24757
24789
|
}
|
|
24758
24790
|
reapplyMultiselectDelimiter(e) {
|
|
24759
|
-
let t =
|
|
24791
|
+
let t = zS(this.parser.state.workbooks, this.columnMapping.state.headersByColumn, this.deps.columns, e);
|
|
24760
24792
|
t && this.valueMapping.setDelimiter(e, t.delimiter), this.commit();
|
|
24761
24793
|
}
|
|
24762
24794
|
addPendingOption(e, t) {
|
|
@@ -24792,8 +24824,8 @@ var _S = new Set([
|
|
|
24792
24824
|
return t;
|
|
24793
24825
|
});
|
|
24794
24826
|
this.parser.stageGrid({
|
|
24795
|
-
rawRows:
|
|
24796
|
-
detection:
|
|
24827
|
+
rawRows: ax(r, i),
|
|
24828
|
+
detection: ix()
|
|
24797
24829
|
}, {
|
|
24798
24830
|
kind: "remote",
|
|
24799
24831
|
sourceId: e.id
|
|
@@ -24830,7 +24862,7 @@ var _S = new Set([
|
|
|
24830
24862
|
try {
|
|
24831
24863
|
let t = await this.importRunner.run(() => $o(this.deps.store, "importing", Infinity, async () => {
|
|
24832
24864
|
for (; a < i.length; a++) {
|
|
24833
|
-
let { workbook: t, rawRows: r } = i[a], s = await
|
|
24865
|
+
let { workbook: t, rawRows: r } = i[a], s = await fS({
|
|
24834
24866
|
workbook: t,
|
|
24835
24867
|
rawRows: r,
|
|
24836
24868
|
signal: n.signal,
|
|
@@ -24841,7 +24873,9 @@ var _S = new Set([
|
|
|
24841
24873
|
pendingColumns: this.columnMapping.state.pendingColumns,
|
|
24842
24874
|
pendingOptions: this.valueMapping.state.pendingOptions,
|
|
24843
24875
|
columnMapping: this.columnMapping.state.byWorkbook[t.id] ?? {},
|
|
24876
|
+
baselineColumnMapping: this.columnMapping.state.baseline[t.id] ?? {},
|
|
24844
24877
|
valueMapping: this.valueMapping.state.merged,
|
|
24878
|
+
baselineValueMapping: this.valueMapping.state.computed,
|
|
24845
24879
|
multiselectDelimiters: this.valueMapping.state.multiselectDelimiters,
|
|
24846
24880
|
primaryKey: this.primaryKey.state.selected,
|
|
24847
24881
|
extraSynonyms: this.deps.extraSynonyms,
|
|
@@ -24851,7 +24885,7 @@ var _S = new Set([
|
|
|
24851
24885
|
buildMappings: (e) => this.buildMappings(t, e)
|
|
24852
24886
|
});
|
|
24853
24887
|
if (s.outcome === "cancelled") return "cancelled";
|
|
24854
|
-
s.collapsed && o.push(
|
|
24888
|
+
s.collapsed && o.push(qx(t)), this.importRunner.markImported(t.id);
|
|
24855
24889
|
}
|
|
24856
24890
|
return "completed";
|
|
24857
24891
|
}));
|
|
@@ -24877,7 +24911,7 @@ var _S = new Set([
|
|
|
24877
24911
|
this.importAbort?.abort();
|
|
24878
24912
|
}
|
|
24879
24913
|
buildMappings(e, t) {
|
|
24880
|
-
return
|
|
24914
|
+
return Hx({
|
|
24881
24915
|
rawRows: t,
|
|
24882
24916
|
workbook: e,
|
|
24883
24917
|
columnMapping: this.columnMapping.state.byWorkbook[e.id] ?? {},
|
|
@@ -24912,7 +24946,7 @@ var _S = new Set([
|
|
|
24912
24946
|
maybeRunStepHook() {
|
|
24913
24947
|
let e = this.lastStepIds[this.navigator.state.activeStepIndex], { workbooks: t, unionHeaders: n } = this.parser.state;
|
|
24914
24948
|
if (!(t.length === 0 || n.length === 0)) if (e === "column-matching") {
|
|
24915
|
-
let e =
|
|
24949
|
+
let e = jx(this.lastStepIds, this.navigator.state.activeStepIndex, t.map((e) => e.id)), n = e ? t.find((t) => t.id === e.workbookId) : void 0;
|
|
24916
24950
|
n && n.headers.length > 0 && this.hookGate.take("column-matching", n.id) && this.columnMapping.runHook(n.id, n.headers);
|
|
24917
24951
|
} else e === "match-values" && this.valueMapping.hasSelectData && this.hookGate.take("match-values") && this.valueMapping.runHook();
|
|
24918
24952
|
}
|
|
@@ -24940,7 +24974,7 @@ var _S = new Set([
|
|
|
24940
24974
|
if (!this.lastNavInputs || this.lastNavInputs.parser !== r.parser || this.lastNavInputs.mapping !== r.mapping || this.lastNavInputs.eligible !== r.eligible) {
|
|
24941
24975
|
let i = new Set(t), a = this.deps.columns.some((e) => (e.editor?.type === "select" || e.editor?.type === "multiselect") && i.has(e.id)), o = [];
|
|
24942
24976
|
for (let t of e.workbooks) t.detection.review.kind !== "none" && o.push(t.id);
|
|
24943
|
-
|
|
24977
|
+
WS(o, this.lastHeaderReviewIds) || (this.lastHeaderReviewIds = o), this.lastStepIds = Dx({
|
|
24944
24978
|
headerReviewCount: this.lastHeaderReviewIds.length,
|
|
24945
24979
|
columnMatchingCount: e.workbooks.length,
|
|
24946
24980
|
hasSelectColumns: a,
|
|
@@ -24955,10 +24989,10 @@ var _S = new Set([
|
|
|
24955
24989
|
currentStepIndex: a,
|
|
24956
24990
|
isFirstStep: i === 0,
|
|
24957
24991
|
isLastStep: i === this.lastStepIds.length - 1,
|
|
24958
|
-
headerReview:
|
|
24959
|
-
columnMatching:
|
|
24992
|
+
headerReview: Nx(this.lastStepIds, i, this.lastHeaderReviewIds),
|
|
24993
|
+
columnMatching: jx(this.lastStepIds, i, e.workbooks.map((e) => e.id))
|
|
24960
24994
|
}, s = this.lastNavigation;
|
|
24961
|
-
return s && s.stepIds === o.stepIds && s.activeStepIndex === o.activeStepIndex && s.currentStepIndex === o.currentStepIndex && s.isFirstStep === o.isFirstStep && s.isLastStep === o.isLastStep &&
|
|
24995
|
+
return s && s.stepIds === o.stepIds && s.activeStepIndex === o.activeStepIndex && s.currentStepIndex === o.currentStepIndex && s.isFirstStep === o.isFirstStep && s.isLastStep === o.isLastStep && GS(s.headerReview, o.headerReview) && Mx(s.columnMatching, o.columnMatching) ? s : (this.lastNavigation = o, o);
|
|
24962
24996
|
}
|
|
24963
24997
|
commit() {
|
|
24964
24998
|
this.snapshots.commit({
|
|
@@ -24971,7 +25005,7 @@ var _S = new Set([
|
|
|
24971
25005
|
remoteSource: this.remoteSource.state
|
|
24972
25006
|
});
|
|
24973
25007
|
}
|
|
24974
|
-
},
|
|
25008
|
+
}, qS = (e, t) => {
|
|
24975
25009
|
let n = /* @__PURE__ */ new Map();
|
|
24976
25010
|
for (let e of t) {
|
|
24977
25011
|
let t = e.toLowerCase();
|
|
@@ -24997,7 +25031,7 @@ var _S = new Set([
|
|
|
24997
25031
|
createdOptions: r,
|
|
24998
25032
|
updates: i
|
|
24999
25033
|
};
|
|
25000
|
-
},
|
|
25034
|
+
}, JS = (e, t) => {
|
|
25001
25035
|
let n = 0;
|
|
25002
25036
|
for (let r of e.headers) t[r] && n++;
|
|
25003
25037
|
return {
|
|
@@ -25008,12 +25042,12 @@ var _S = new Set([
|
|
|
25008
25042
|
matchedCount: n,
|
|
25009
25043
|
allMatched: n === e.headers.length
|
|
25010
25044
|
};
|
|
25011
|
-
},
|
|
25012
|
-
let { columns: e, enableCreateColumn: t } = Z(), { t: n } = q(), r = zy(), i = Xy(r, Yy), a = Xy(r, Vy), o = i ? a.find((e) => e.id === i.workbookId) ?? null : null, { byWorkbook: s, pendingColumns: c, autoMatched: l, isMatching: u } = Xy(r, Hy), d = o ? s[o.id] ??
|
|
25045
|
+
}, YS = {}, XS = {}, ZS = [], QS = () => {
|
|
25046
|
+
let { columns: e, enableCreateColumn: t } = Z(), { t: n } = q(), r = zy(), i = Xy(r, Yy), a = Xy(r, Vy), o = i ? a.find((e) => e.id === i.workbookId) ?? null : null, { byWorkbook: s, pendingColumns: c, autoMatched: l, isMatching: u } = Xy(r, Hy), d = o ? s[o.id] ?? YS : YS, p = o?.id ?? null, m = f((e, t) => {
|
|
25013
25047
|
p !== null && r.updateColumnMapping(p, e, t);
|
|
25014
25048
|
}, [r, p]), h = f((e) => {
|
|
25015
25049
|
r.setPendingColumns(e);
|
|
25016
|
-
}, [r]), g = v(() => o ?
|
|
25050
|
+
}, [r]), g = v(() => o ? JS(o, d) : null, [o, d]), _ = (i?.total ?? 0) > 1, x = g?.headers ?? ZS, [S, w] = b(null), [T, E] = b({}), D = y(null), O = f((e) => T[e] ?? !0, [T]), k = f((e, t) => {
|
|
25017
25051
|
E((n) => ({
|
|
25018
25052
|
...n,
|
|
25019
25053
|
[e]: t
|
|
@@ -25034,7 +25068,7 @@ var _S = new Set([
|
|
|
25034
25068
|
}]), m(D.current, n), D.current = null, w(null);
|
|
25035
25069
|
}, [m, h]), M = f(() => {
|
|
25036
25070
|
D.current = null, w(null);
|
|
25037
|
-
}, []), N = v(() => [...e.map((e) => e.title), ...c.map((e) => e.title)], [e, c]), P = p ? l[p] ??
|
|
25071
|
+
}, []), N = v(() => [...e.map((e) => e.title), ...c.map((e) => e.title)], [e, c]), P = p ? l[p] ?? XS : XS, F = v(() => {
|
|
25038
25072
|
let r = {
|
|
25039
25073
|
text: n("dataEditor.uploader.matchColumns.bestMatch"),
|
|
25040
25074
|
color: "green"
|
|
@@ -25057,7 +25091,7 @@ var _S = new Set([
|
|
|
25057
25091
|
id: `${n}_d`,
|
|
25058
25092
|
type: "divider"
|
|
25059
25093
|
}, {
|
|
25060
|
-
id:
|
|
25094
|
+
id: Ob,
|
|
25061
25095
|
text: a,
|
|
25062
25096
|
icon: /* @__PURE__ */ C(Se, { size: "1rem" })
|
|
25063
25097
|
}), [n, s];
|
|
@@ -25093,19 +25127,19 @@ var _S = new Set([
|
|
|
25093
25127
|
submitCreate: j,
|
|
25094
25128
|
closeCreate: M
|
|
25095
25129
|
};
|
|
25096
|
-
},
|
|
25097
|
-
function
|
|
25098
|
-
let t =
|
|
25099
|
-
return /* @__PURE__ */ C(
|
|
25130
|
+
}, $S = s(null);
|
|
25131
|
+
function eC({ children: e }) {
|
|
25132
|
+
let t = QS();
|
|
25133
|
+
return /* @__PURE__ */ C($S.Provider, {
|
|
25100
25134
|
value: t,
|
|
25101
25135
|
children: e
|
|
25102
25136
|
});
|
|
25103
25137
|
}
|
|
25104
|
-
var
|
|
25105
|
-
let e = p(
|
|
25138
|
+
var tC = () => {
|
|
25139
|
+
let e = p($S);
|
|
25106
25140
|
if (!e) throw Error("useColumnMatching must be used within ColumnMatchingProvider");
|
|
25107
25141
|
return e;
|
|
25108
|
-
},
|
|
25142
|
+
}, nC = ({ name: e, fileName: t, size: n = "sm", as: r = "div", className: i }) => /* @__PURE__ */ w(J, {
|
|
25109
25143
|
as: r,
|
|
25110
25144
|
size: n,
|
|
25111
25145
|
weight: "medium",
|
|
@@ -25125,15 +25159,15 @@ var $S = () => {
|
|
|
25125
25159
|
tooltipProps: { placement: "bottom-start" },
|
|
25126
25160
|
children: e
|
|
25127
25161
|
})]
|
|
25128
|
-
}),
|
|
25129
|
-
let { t } = q(), { isMatching: n, isMultiWorkbook: r, isShowMatched: i, setShowMatched: a } =
|
|
25162
|
+
}), rC = ({ view: e }) => {
|
|
25163
|
+
let { t } = q(), { isMatching: n, isMultiWorkbook: r, isShowMatched: i, setShowMatched: a } = tC(), o = e.allMatched ? "green" : "yellow", s = !n, c = f((t) => {
|
|
25130
25164
|
a(e.workbookId, t);
|
|
25131
25165
|
}, [a, e.workbookId]);
|
|
25132
25166
|
return /* @__PURE__ */ C("header", {
|
|
25133
25167
|
className: "updog__column-matching__header",
|
|
25134
25168
|
children: /* @__PURE__ */ w("div", {
|
|
25135
25169
|
className: "updog__column-matching__header-inner",
|
|
25136
|
-
children: [r && /* @__PURE__ */ C(
|
|
25170
|
+
children: [r && /* @__PURE__ */ C(nC, {
|
|
25137
25171
|
name: e.name,
|
|
25138
25172
|
fileName: e.fileName,
|
|
25139
25173
|
className: "updog__column-matching__header-source"
|
|
@@ -25177,7 +25211,7 @@ var $S = () => {
|
|
|
25177
25211
|
})]
|
|
25178
25212
|
})
|
|
25179
25213
|
});
|
|
25180
|
-
},
|
|
25214
|
+
}, iC = d(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a, onSelectChange: o, onClear: s }) => {
|
|
25181
25215
|
let { t: c } = q(), l = h(), u = !t, d = t?.startsWith("__dynamic__:") && !!r && !a, p = u && !a, m = f((t) => {
|
|
25182
25216
|
o(e, t);
|
|
25183
25217
|
}, [e, o]), g = f(() => {
|
|
@@ -25241,8 +25275,8 @@ var $S = () => {
|
|
|
25241
25275
|
})
|
|
25242
25276
|
]
|
|
25243
25277
|
});
|
|
25244
|
-
}),
|
|
25245
|
-
let { isMatching: t, isShowMatched: n, placeholder: r, getRowData: i, onSelectChange: a, onClear: o } =
|
|
25278
|
+
}), aC = ({ view: e }) => {
|
|
25279
|
+
let { isMatching: t, isShowMatched: n, placeholder: r, getRowData: i, onSelectChange: a, onClear: o } = tC(), { t: s } = q(), c = n(e.workbookId), l = e.headers.map((e) => ({
|
|
25246
25280
|
csvHeader: e,
|
|
25247
25281
|
...i(e)
|
|
25248
25282
|
})).filter((e) => c || !e.mappedValue);
|
|
@@ -25260,7 +25294,7 @@ var $S = () => {
|
|
|
25260
25294
|
className: "updog__column-matching__content",
|
|
25261
25295
|
children: /* @__PURE__ */ C("div", {
|
|
25262
25296
|
className: "updog__column-matching__content-inner",
|
|
25263
|
-
children: l.map(({ csvHeader: e, mappedValue: n, options: i, autoMatchId: s }) => /* @__PURE__ */ C(
|
|
25297
|
+
children: l.map(({ csvHeader: e, mappedValue: n, options: i, autoMatchId: s }) => /* @__PURE__ */ C(iC, {
|
|
25264
25298
|
csvHeader: e,
|
|
25265
25299
|
mappedValue: n,
|
|
25266
25300
|
options: i,
|
|
@@ -25272,8 +25306,8 @@ var $S = () => {
|
|
|
25272
25306
|
}, e))
|
|
25273
25307
|
})
|
|
25274
25308
|
});
|
|
25275
|
-
},
|
|
25276
|
-
let { createModalValues: e, existingNames: t, submitCreate: n, closeCreate: r } =
|
|
25309
|
+
}, oC = () => {
|
|
25310
|
+
let { createModalValues: e, existingNames: t, submitCreate: n, closeCreate: r } = tC();
|
|
25277
25311
|
return e ? /* @__PURE__ */ C(Lu, {
|
|
25278
25312
|
open: !0,
|
|
25279
25313
|
onClose: r,
|
|
@@ -25281,23 +25315,23 @@ var $S = () => {
|
|
|
25281
25315
|
existingNames: t,
|
|
25282
25316
|
onSubmit: n
|
|
25283
25317
|
}) : null;
|
|
25284
|
-
},
|
|
25285
|
-
let { view: e } =
|
|
25318
|
+
}, sC = () => {
|
|
25319
|
+
let { view: e } = tC();
|
|
25286
25320
|
return e ? /* @__PURE__ */ w("div", {
|
|
25287
25321
|
className: "updog__column-matching",
|
|
25288
25322
|
children: [
|
|
25289
|
-
/* @__PURE__ */ C(tC, { view: e }),
|
|
25290
25323
|
/* @__PURE__ */ C(rC, { view: e }),
|
|
25291
|
-
/* @__PURE__ */ C(
|
|
25324
|
+
/* @__PURE__ */ C(aC, { view: e }),
|
|
25325
|
+
/* @__PURE__ */ C(oC, {})
|
|
25292
25326
|
]
|
|
25293
25327
|
}) : null;
|
|
25294
|
-
},
|
|
25328
|
+
}, cC = () => Xy(zy(), Jy) ? /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C("div", {
|
|
25295
25329
|
className: "updog__step-column-matching__content updog__scrollbar",
|
|
25296
|
-
children: /* @__PURE__ */ C(
|
|
25330
|
+
children: /* @__PURE__ */ C(eC, { children: /* @__PURE__ */ C(sC, {}) })
|
|
25297
25331
|
}), /* @__PURE__ */ C(tb, {})] }) }) : null;
|
|
25298
25332
|
//#endregion
|
|
25299
25333
|
//#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
|
|
25300
|
-
function
|
|
25334
|
+
function lC(e, t, n, r, i) {
|
|
25301
25335
|
return v(() => ({
|
|
25302
25336
|
sample: e,
|
|
25303
25337
|
columnHeaders: t,
|
|
@@ -25314,20 +25348,20 @@ function sC(e, t, n, r, i) {
|
|
|
25314
25348
|
}
|
|
25315
25349
|
//#endregion
|
|
25316
25350
|
//#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
|
|
25317
|
-
var
|
|
25318
|
-
function
|
|
25319
|
-
let o =
|
|
25320
|
-
return /* @__PURE__ */ C(
|
|
25351
|
+
var uC = s(null);
|
|
25352
|
+
function dC({ sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i, children: a }) {
|
|
25353
|
+
let o = lC(e, t, n, r, i);
|
|
25354
|
+
return /* @__PURE__ */ C(uC.Provider, {
|
|
25321
25355
|
value: o,
|
|
25322
25356
|
children: a
|
|
25323
25357
|
});
|
|
25324
25358
|
}
|
|
25325
|
-
var
|
|
25326
|
-
let e = p(
|
|
25359
|
+
var fC = () => {
|
|
25360
|
+
let e = p(uC);
|
|
25327
25361
|
if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
|
|
25328
25362
|
return e;
|
|
25329
|
-
},
|
|
25330
|
-
let { sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i } =
|
|
25363
|
+
}, pC = () => {
|
|
25364
|
+
let { sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i } = fC(), { headers: a, rows: o } = v(() => {
|
|
25331
25365
|
let n = t.length;
|
|
25332
25366
|
return {
|
|
25333
25367
|
headers: t.map((e) => i ? e : ""),
|
|
@@ -25347,7 +25381,7 @@ var uC = () => {
|
|
|
25347
25381
|
selectedRow: i ? void 0 : n,
|
|
25348
25382
|
onSelectRow: i ? void 0 : r
|
|
25349
25383
|
});
|
|
25350
|
-
},
|
|
25384
|
+
}, mC = () => {
|
|
25351
25385
|
let { t: e } = q(), t = zy(), { headerReview: n } = Xy(t, Gy), r = Xy(t, Vy), i = n ? r.find((e) => e.id === n.workbookId) ?? null : null, a = f((e) => {
|
|
25352
25386
|
i && t.setHeaderRowIndex(i.id, e);
|
|
25353
25387
|
}, [t, i]), o = f((e) => {
|
|
@@ -25355,7 +25389,7 @@ var uC = () => {
|
|
|
25355
25389
|
}, [a, i]);
|
|
25356
25390
|
if (!i) return null;
|
|
25357
25391
|
let s = i.rawRows.slice(0, 50), c = i.headerRowIndex < 0, l = c ? void 0 : i.headerRowIndex, u = i.origin.kind === "sheet" ? i.origin.file.name : null;
|
|
25358
|
-
return /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ C(gu, { children: /* @__PURE__ */ w(
|
|
25392
|
+
return /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ C(gu, { children: /* @__PURE__ */ w(dC, {
|
|
25359
25393
|
sample: s,
|
|
25360
25394
|
columnHeaders: i.headers,
|
|
25361
25395
|
selectedRow: l,
|
|
@@ -25364,7 +25398,7 @@ var uC = () => {
|
|
|
25364
25398
|
children: [/* @__PURE__ */ w("div", {
|
|
25365
25399
|
className: "updog__step-header-selection__content updog__scrollbar",
|
|
25366
25400
|
children: [
|
|
25367
|
-
/* @__PURE__ */ C(
|
|
25401
|
+
/* @__PURE__ */ C(nC, {
|
|
25368
25402
|
as: "h3",
|
|
25369
25403
|
size: "md",
|
|
25370
25404
|
name: i.name,
|
|
@@ -25379,11 +25413,11 @@ var uC = () => {
|
|
|
25379
25413
|
label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
|
|
25380
25414
|
})
|
|
25381
25415
|
}),
|
|
25382
|
-
/* @__PURE__ */ C(
|
|
25416
|
+
/* @__PURE__ */ C(pC, {})
|
|
25383
25417
|
]
|
|
25384
25418
|
}), /* @__PURE__ */ C(tb, {})]
|
|
25385
25419
|
}) }) });
|
|
25386
|
-
},
|
|
25420
|
+
}, hC = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
|
|
25387
25421
|
let { t: a } = q();
|
|
25388
25422
|
return /* @__PURE__ */ C(Bi, {
|
|
25389
25423
|
open: e,
|
|
@@ -25396,7 +25430,7 @@ var uC = () => {
|
|
|
25396
25430
|
onSubmit: i
|
|
25397
25431
|
})
|
|
25398
25432
|
});
|
|
25399
|
-
},
|
|
25433
|
+
}, gC = "updog__value-matching__create-divider", _C = ({ options: e, extraOptions: t, enableCustomValue: n, createLabel: r, bestMatch: i }) => {
|
|
25400
25434
|
let a = e.map((e) => ({
|
|
25401
25435
|
id: e,
|
|
25402
25436
|
text: e,
|
|
@@ -25409,14 +25443,14 @@ var uC = () => {
|
|
|
25409
25443
|
text: e
|
|
25410
25444
|
}));
|
|
25411
25445
|
return a.push({
|
|
25412
|
-
id:
|
|
25446
|
+
id: gC,
|
|
25413
25447
|
type: "divider"
|
|
25414
25448
|
}, {
|
|
25415
25449
|
id: Xo,
|
|
25416
25450
|
text: r,
|
|
25417
25451
|
icon: /* @__PURE__ */ C(Se, { size: "1rem" })
|
|
25418
25452
|
}), a;
|
|
25419
|
-
},
|
|
25453
|
+
}, vC = (e, t) => {
|
|
25420
25454
|
let n = e.values.filter((e) => t || e.mapped === void 0);
|
|
25421
25455
|
return e.values.length > 500 && n.length > 3 ? {
|
|
25422
25456
|
visible: n.slice(0, 3),
|
|
@@ -25425,7 +25459,7 @@ var uC = () => {
|
|
|
25425
25459
|
visible: n,
|
|
25426
25460
|
overflow: 0
|
|
25427
25461
|
};
|
|
25428
|
-
},
|
|
25462
|
+
}, yC = () => {
|
|
25429
25463
|
let { columns: e } = Z(), { t } = q(), n = zy(), r = Xy(n, Jy), { mappedColumnIds: i } = Xy(n, Hy), { merged: a, computed: o, multiselectDelimiters: s, pendingOptions: c, importedValues: l, isMatching: u } = Xy(n, Uy), d = f((e, t, r) => n.updateValueMapping(e, t, r), [n]), p = f((e, t) => n.setMultiselectDelimiter(e, t), [n]), h = f((e) => n.reapplyMultiselectDelimiter(e), [n]), g = f((e, t) => n.addPendingOption(e, t), [n]), [_, x] = b({}), [S, C] = b({}), [w, T] = b(null), E = y(!1), D = v(() => {
|
|
25430
25464
|
if (!r) return [];
|
|
25431
25465
|
let t = [];
|
|
@@ -25474,10 +25508,10 @@ var uC = () => {
|
|
|
25474
25508
|
color: "green"
|
|
25475
25509
|
}, n = t("dataEditor.uploader.matchValues.createOption"), r = {};
|
|
25476
25510
|
for (let t of D) {
|
|
25477
|
-
let i = c[t.columnId] ?? [], a = {}, { visible: s } =
|
|
25511
|
+
let i = c[t.columnId] ?? [], a = {}, { visible: s } = vC(t, _[t.columnId] ?? !0);
|
|
25478
25512
|
for (let r of s) {
|
|
25479
25513
|
let s = o[t.columnId]?.[r.imported];
|
|
25480
|
-
a[r.imported] =
|
|
25514
|
+
a[r.imported] = _C({
|
|
25481
25515
|
options: t.options,
|
|
25482
25516
|
extraOptions: i,
|
|
25483
25517
|
enableCustomValue: t.enableCustomValue,
|
|
@@ -25497,7 +25531,7 @@ var uC = () => {
|
|
|
25497
25531
|
c,
|
|
25498
25532
|
_,
|
|
25499
25533
|
t
|
|
25500
|
-
]), k = f((e) => _[e] ?? !0, [_]), A = f((e) => S[e] ?? !1, [S]), j = f((e) =>
|
|
25534
|
+
]), k = f((e) => _[e] ?? !0, [_]), A = f((e) => S[e] ?? !1, [S]), j = f((e) => vC(e, _[e.columnId] ?? !0), [_]), M = f((e, t) => O[e]?.[t] ?? [], [O]), N = f((e, t) => {
|
|
25501
25535
|
x((n) => ({
|
|
25502
25536
|
...n,
|
|
25503
25537
|
[e]: t
|
|
@@ -25549,20 +25583,20 @@ var uC = () => {
|
|
|
25549
25583
|
submitCreate: z,
|
|
25550
25584
|
closeCreate: B
|
|
25551
25585
|
};
|
|
25552
|
-
},
|
|
25553
|
-
function
|
|
25554
|
-
let t =
|
|
25555
|
-
return /* @__PURE__ */ C(
|
|
25586
|
+
}, bC = s(null);
|
|
25587
|
+
function xC({ children: e }) {
|
|
25588
|
+
let t = yC();
|
|
25589
|
+
return /* @__PURE__ */ C(bC.Provider, {
|
|
25556
25590
|
value: t,
|
|
25557
25591
|
children: e
|
|
25558
25592
|
});
|
|
25559
25593
|
}
|
|
25560
|
-
var
|
|
25561
|
-
let e = p(
|
|
25594
|
+
var SC = () => {
|
|
25595
|
+
let e = p(bC);
|
|
25562
25596
|
if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
|
|
25563
25597
|
return e;
|
|
25564
|
-
},
|
|
25565
|
-
let { t: n } = q(), { isShowMatched: r, isCollapsed: i, setShowMatched: a, toggleCollapsed: o, isMatching: s } =
|
|
25598
|
+
}, CC = ({ section: e, panelId: t }) => {
|
|
25599
|
+
let { t: n } = q(), { isShowMatched: r, isCollapsed: i, setShowMatched: a, toggleCollapsed: o, isMatching: s } = SC(), c = i(e.columnId), l = !s, u = n(c ? "dataEditor.common.expand" : "dataEditor.common.collapse"), d = f((t) => a(e.columnId, t), [a, e.columnId]), p = f(() => o(e.columnId), [o, e.columnId]);
|
|
25566
25600
|
return /* @__PURE__ */ w("header", {
|
|
25567
25601
|
className: "updog__value-matching__section-header",
|
|
25568
25602
|
children: [/* @__PURE__ */ C("div", {
|
|
@@ -25609,14 +25643,14 @@ var bC = () => {
|
|
|
25609
25643
|
})
|
|
25610
25644
|
})]
|
|
25611
25645
|
});
|
|
25612
|
-
},
|
|
25646
|
+
}, wC = {
|
|
25613
25647
|
",": ",",
|
|
25614
25648
|
";": ";",
|
|
25615
25649
|
"|": "|",
|
|
25616
25650
|
"\n": "\\n",
|
|
25617
25651
|
" ": "\\t"
|
|
25618
|
-
},
|
|
25619
|
-
let { t } = q(), { changeDelimiter: n, reapplyDelimiter: r } =
|
|
25652
|
+
}, TC = (e) => e === null ? "" : wC[e] ?? e, EC = ({ section: e }) => {
|
|
25653
|
+
let { t } = q(), { changeDelimiter: n, reapplyDelimiter: r } = SC(), i = y(e.delimiter), a = TC(e.delimiter), [o, s] = b(a), { debouncedValue: c } = Za(o, 300), l = y(a);
|
|
25620
25654
|
m(() => {
|
|
25621
25655
|
s(a), l.current = a;
|
|
25622
25656
|
}, [a]), m(() => {
|
|
@@ -25659,7 +25693,7 @@ var bC = () => {
|
|
|
25659
25693
|
})
|
|
25660
25694
|
]
|
|
25661
25695
|
});
|
|
25662
|
-
},
|
|
25696
|
+
}, DC = d(({ value: e, options: t, isMatching: n = !1, fluid: r = !1, onSelect: i }) => {
|
|
25663
25697
|
let { t: a } = q(), o = h(), s = e.mapped === void 0, c = s && !n, l = f((t) => {
|
|
25664
25698
|
i(e.imported, t);
|
|
25665
25699
|
}, [i, e.imported]), u = f(() => {
|
|
@@ -25713,28 +25747,28 @@ var bC = () => {
|
|
|
25713
25747
|
})
|
|
25714
25748
|
]
|
|
25715
25749
|
});
|
|
25716
|
-
}),
|
|
25717
|
-
let { getSelectOptions: n, selectValue: r, isMatching: i } =
|
|
25750
|
+
}), OC = ({ section: e, value: t }) => {
|
|
25751
|
+
let { getSelectOptions: n, selectValue: r, isMatching: i } = SC(), a = f((t, n) => {
|
|
25718
25752
|
r(e.columnId, t, n);
|
|
25719
25753
|
}, [r, e.columnId]);
|
|
25720
|
-
return /* @__PURE__ */ C(
|
|
25754
|
+
return /* @__PURE__ */ C(DC, {
|
|
25721
25755
|
value: t,
|
|
25722
25756
|
options: n(e.columnId, t.imported),
|
|
25723
25757
|
isMatching: i,
|
|
25724
25758
|
onSelect: a
|
|
25725
25759
|
});
|
|
25726
|
-
},
|
|
25760
|
+
}, kC = (e, t) => {
|
|
25727
25761
|
let n = new Map(e.map((e) => [e.imported, e.mapped])), r = [];
|
|
25728
25762
|
for (let e of t) n.get(e.imported) !== e.mapped && r.push({
|
|
25729
25763
|
importedValue: e.imported,
|
|
25730
25764
|
mappedValue: e.mapped
|
|
25731
25765
|
});
|
|
25732
25766
|
return r;
|
|
25733
|
-
},
|
|
25767
|
+
}, AC = ({ scrollTop: e, viewportHeight: t, rowHeight: n, count: r, overscan: i }) => ({
|
|
25734
25768
|
start: Math.max(0, Math.floor(e / n) - i),
|
|
25735
25769
|
end: Math.min(r, Math.ceil((e + t) / n) + i)
|
|
25736
|
-
}),
|
|
25737
|
-
let r = y(null), [i, a] = b(
|
|
25770
|
+
}), jC = 3.625, MC = 5, NC = 16, PC = ({ values: e, options: t, onSelect: n }) => {
|
|
25771
|
+
let r = y(null), [i, a] = b(NC), [o, s] = b({
|
|
25738
25772
|
start: 0,
|
|
25739
25773
|
end: 0
|
|
25740
25774
|
});
|
|
@@ -25745,12 +25779,12 @@ var bC = () => {
|
|
|
25745
25779
|
let c = f(() => {
|
|
25746
25780
|
let t = r.current;
|
|
25747
25781
|
if (!t) return;
|
|
25748
|
-
let n =
|
|
25782
|
+
let n = AC({
|
|
25749
25783
|
scrollTop: t.scrollTop,
|
|
25750
25784
|
viewportHeight: t.clientHeight,
|
|
25751
|
-
rowHeight:
|
|
25785
|
+
rowHeight: jC * i,
|
|
25752
25786
|
count: e.length,
|
|
25753
|
-
overscan:
|
|
25787
|
+
overscan: MC
|
|
25754
25788
|
});
|
|
25755
25789
|
s((e) => e.start === n.start && e.end === n.end ? e : n);
|
|
25756
25790
|
}, [i, e.length]);
|
|
@@ -25770,14 +25804,14 @@ var bC = () => {
|
|
|
25770
25804
|
className: "updog__values-drawer__list updog__scrollbar",
|
|
25771
25805
|
children: /* @__PURE__ */ C("div", {
|
|
25772
25806
|
className: "updog__values-drawer__list-inner",
|
|
25773
|
-
style: { height: `${e.length *
|
|
25807
|
+
style: { height: `${e.length * jC}rem` },
|
|
25774
25808
|
children: l.map((e, r) => /* @__PURE__ */ C("div", {
|
|
25775
25809
|
className: "updog__values-drawer__list-item",
|
|
25776
25810
|
style: {
|
|
25777
|
-
height: `${
|
|
25778
|
-
transform: `translateY(${(o.start + r) *
|
|
25811
|
+
height: `${jC}rem`,
|
|
25812
|
+
transform: `translateY(${(o.start + r) * jC}rem)`
|
|
25779
25813
|
},
|
|
25780
|
-
children: /* @__PURE__ */ C(
|
|
25814
|
+
children: /* @__PURE__ */ C(DC, {
|
|
25781
25815
|
value: e,
|
|
25782
25816
|
options: t,
|
|
25783
25817
|
fluid: !0,
|
|
@@ -25786,7 +25820,7 @@ var bC = () => {
|
|
|
25786
25820
|
}, e.imported))
|
|
25787
25821
|
})
|
|
25788
25822
|
});
|
|
25789
|
-
},
|
|
25823
|
+
}, FC = ({ section: e, onCancel: t, onSave: n }) => {
|
|
25790
25824
|
let { t: r } = q(), [i] = b(e.values), [a, o] = b(i), [s] = b(e.delimiter), [c, l] = b([]), [u, d] = b(null), p = v(() => [
|
|
25791
25825
|
...e.options,
|
|
25792
25826
|
...e.pendingOptions,
|
|
@@ -25795,7 +25829,7 @@ var bC = () => {
|
|
|
25795
25829
|
e.options,
|
|
25796
25830
|
e.pendingOptions,
|
|
25797
25831
|
c
|
|
25798
|
-
]), m = v(() =>
|
|
25832
|
+
]), m = v(() => _C({
|
|
25799
25833
|
options: e.options,
|
|
25800
25834
|
extraOptions: [...e.pendingOptions, ...c],
|
|
25801
25835
|
enableCustomValue: e.enableCustomValue,
|
|
@@ -25822,7 +25856,7 @@ var bC = () => {
|
|
|
25822
25856
|
}, []), y = f((e) => {
|
|
25823
25857
|
u !== null && (l((t) => [...t, e]), h(u, e), d(null));
|
|
25824
25858
|
}, [u, h]), x = f(() => {
|
|
25825
|
-
let e =
|
|
25859
|
+
let e = qS(a, p);
|
|
25826
25860
|
if (e.updates.length === 0) return;
|
|
25827
25861
|
let t = new Map(e.updates.map((e) => [e.importedValue, e.mappedValue]));
|
|
25828
25862
|
l((t) => [...t, ...e.createdOptions]), o((e) => e.map((e) => {
|
|
@@ -25834,7 +25868,7 @@ var bC = () => {
|
|
|
25834
25868
|
}));
|
|
25835
25869
|
}, [a, p]), T = f(() => {
|
|
25836
25870
|
n({
|
|
25837
|
-
updates:
|
|
25871
|
+
updates: kC(i, a),
|
|
25838
25872
|
delimiter: s,
|
|
25839
25873
|
createdOptions: c
|
|
25840
25874
|
});
|
|
@@ -25858,7 +25892,7 @@ var bC = () => {
|
|
|
25858
25892
|
}) }),
|
|
25859
25893
|
/* @__PURE__ */ C(La, {
|
|
25860
25894
|
className: "updog__values-drawer__body",
|
|
25861
|
-
children: /* @__PURE__ */ C(
|
|
25895
|
+
children: /* @__PURE__ */ C(PC, {
|
|
25862
25896
|
values: a,
|
|
25863
25897
|
options: m,
|
|
25864
25898
|
onSelect: g
|
|
@@ -25883,7 +25917,7 @@ var bC = () => {
|
|
|
25883
25917
|
children: r("dataEditor.common.save")
|
|
25884
25918
|
})
|
|
25885
25919
|
] }),
|
|
25886
|
-
u !== null && /* @__PURE__ */ C(
|
|
25920
|
+
u !== null && /* @__PURE__ */ C(hC, {
|
|
25887
25921
|
open: !0,
|
|
25888
25922
|
existingOptions: p,
|
|
25889
25923
|
initialName: u,
|
|
@@ -25891,8 +25925,8 @@ var bC = () => {
|
|
|
25891
25925
|
onSubmit: y
|
|
25892
25926
|
})
|
|
25893
25927
|
] });
|
|
25894
|
-
},
|
|
25895
|
-
let { applyValueMappingBatch: r } =
|
|
25928
|
+
}, IC = ({ open: e, onDismiss: t, section: n }) => {
|
|
25929
|
+
let { applyValueMappingBatch: r } = SC();
|
|
25896
25930
|
return /* @__PURE__ */ C(za, {
|
|
25897
25931
|
open: e,
|
|
25898
25932
|
onOpenChange: f((e) => {
|
|
@@ -25900,7 +25934,7 @@ var bC = () => {
|
|
|
25900
25934
|
}, [t]),
|
|
25901
25935
|
className: "updog__values-drawer",
|
|
25902
25936
|
closeOnOutsidePress: !1,
|
|
25903
|
-
children: /* @__PURE__ */ C(
|
|
25937
|
+
children: /* @__PURE__ */ C(FC, {
|
|
25904
25938
|
section: n,
|
|
25905
25939
|
onCancel: t,
|
|
25906
25940
|
onSave: f((e) => {
|
|
@@ -25912,8 +25946,8 @@ var bC = () => {
|
|
|
25912
25946
|
])
|
|
25913
25947
|
})
|
|
25914
25948
|
});
|
|
25915
|
-
},
|
|
25916
|
-
let { t } = q(), { getVisibleValues: n } =
|
|
25949
|
+
}, LC = ({ section: e }) => {
|
|
25950
|
+
let { t } = q(), { getVisibleValues: n } = SC(), { visible: r, overflow: i } = n(e), a = r.length === 0, { value: o, setTrue: s, setFalse: c } = Uo(!1);
|
|
25917
25951
|
return /* @__PURE__ */ w("div", {
|
|
25918
25952
|
className: "updog__value-matching__table",
|
|
25919
25953
|
children: [
|
|
@@ -25934,7 +25968,7 @@ var bC = () => {
|
|
|
25934
25968
|
size: "sm",
|
|
25935
25969
|
weight: "medium",
|
|
25936
25970
|
children: t("dataEditor.uploader.matchValues.importedValues")
|
|
25937
|
-
}), e.isMultiselect && /* @__PURE__ */ C(
|
|
25971
|
+
}), e.isMultiselect && /* @__PURE__ */ C(EC, { section: e })]
|
|
25938
25972
|
}),
|
|
25939
25973
|
/* @__PURE__ */ C("div", { className: "updog__value-matching__arrow-spacer" }),
|
|
25940
25974
|
/* @__PURE__ */ C(J, {
|
|
@@ -25947,7 +25981,7 @@ var bC = () => {
|
|
|
25947
25981
|
/* @__PURE__ */ C("div", { className: "updog__value-matching__action" })
|
|
25948
25982
|
]
|
|
25949
25983
|
}),
|
|
25950
|
-
r.map((t) => /* @__PURE__ */ C(
|
|
25984
|
+
r.map((t) => /* @__PURE__ */ C(OC, {
|
|
25951
25985
|
section: e,
|
|
25952
25986
|
value: t
|
|
25953
25987
|
}, t.imported)),
|
|
@@ -25968,7 +26002,7 @@ var bC = () => {
|
|
|
25968
26002
|
onClick: s,
|
|
25969
26003
|
children: t("dataEditor.uploader.matchValues.showAll")
|
|
25970
26004
|
}),
|
|
25971
|
-
/* @__PURE__ */ C(
|
|
26005
|
+
/* @__PURE__ */ C(IC, {
|
|
25972
26006
|
open: o,
|
|
25973
26007
|
onDismiss: c,
|
|
25974
26008
|
section: e
|
|
@@ -25977,25 +26011,25 @@ var bC = () => {
|
|
|
25977
26011
|
})
|
|
25978
26012
|
]
|
|
25979
26013
|
});
|
|
25980
|
-
},
|
|
25981
|
-
let { isCollapsed: t } =
|
|
26014
|
+
}, RC = ({ section: e }) => {
|
|
26015
|
+
let { isCollapsed: t } = SC(), n = !t(e.columnId), r = h();
|
|
25982
26016
|
return /* @__PURE__ */ w("div", {
|
|
25983
26017
|
className: "updog__value-matching__section",
|
|
25984
|
-
children: [/* @__PURE__ */ C(
|
|
26018
|
+
children: [/* @__PURE__ */ C(CC, {
|
|
25985
26019
|
section: e,
|
|
25986
26020
|
panelId: r
|
|
25987
26021
|
}), /* @__PURE__ */ C("div", {
|
|
25988
26022
|
id: r,
|
|
25989
26023
|
inert: !n,
|
|
25990
26024
|
className: E("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
|
|
25991
|
-
children: /* @__PURE__ */ C(
|
|
26025
|
+
children: /* @__PURE__ */ C(LC, { section: e })
|
|
25992
26026
|
})]
|
|
25993
26027
|
});
|
|
25994
|
-
},
|
|
25995
|
-
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } =
|
|
26028
|
+
}, zC = () => {
|
|
26029
|
+
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = SC();
|
|
25996
26030
|
return /* @__PURE__ */ w("div", {
|
|
25997
26031
|
className: "updog__value-matching",
|
|
25998
|
-
children: [e.map((e) => /* @__PURE__ */ C(
|
|
26032
|
+
children: [e.map((e) => /* @__PURE__ */ C(RC, { section: e }, e.columnId)), t && /* @__PURE__ */ C(hC, {
|
|
25999
26033
|
open: !0,
|
|
26000
26034
|
existingOptions: n,
|
|
26001
26035
|
initialName: r,
|
|
@@ -26003,13 +26037,13 @@ var bC = () => {
|
|
|
26003
26037
|
onSubmit: i
|
|
26004
26038
|
})]
|
|
26005
26039
|
});
|
|
26006
|
-
},
|
|
26040
|
+
}, BC = () => /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C("div", {
|
|
26007
26041
|
className: "updog__step-match-values__content updog__scrollbar",
|
|
26008
|
-
children: /* @__PURE__ */ C(
|
|
26009
|
-
}), /* @__PURE__ */ C(tb, {})] }) }),
|
|
26042
|
+
children: /* @__PURE__ */ C(xC, { children: /* @__PURE__ */ C(zC, {}) })
|
|
26043
|
+
}), /* @__PURE__ */ C(tb, {})] }) }), VC = 20, HC = (e, t) => {
|
|
26010
26044
|
let n = /* @__PURE__ */ new Map(), r = (e) => {
|
|
26011
26045
|
let t = n.get(e.id);
|
|
26012
|
-
return t || (t =
|
|
26046
|
+
return t || (t = ux(e.rawRows, e.headers, e.dataStartIndex, VC), n.set(e.id, t)), t;
|
|
26013
26047
|
}, i = {};
|
|
26014
26048
|
for (let [n, a] of Object.entries(t)) for (let t of a) {
|
|
26015
26049
|
let a = e.find((e) => e.id === t.workbookId);
|
|
@@ -26021,8 +26055,8 @@ var bC = () => {
|
|
|
26021
26055
|
}
|
|
26022
26056
|
}
|
|
26023
26057
|
return i;
|
|
26024
|
-
},
|
|
26025
|
-
let { store: e } = Z(), { t } = q(), n = zy(), r = Xy(n, Vy), { headersByColumn: i } = Xy(n, Hy), { selected: a, eligibleColumns: o } = Xy(n, Wy), s = f((e) => n.setPrimaryKey(e), [n]), c = e.isClient(), l = f(() => s(null), [s]), u = v(() =>
|
|
26058
|
+
}, UC = () => {
|
|
26059
|
+
let { store: e } = Z(), { t } = q(), n = zy(), r = Xy(n, Vy), { headersByColumn: i } = Xy(n, Hy), { selected: a, eligibleColumns: o } = Xy(n, Wy), s = f((e) => n.setPrimaryKey(e), [n]), c = e.isClient(), l = f(() => s(null), [s]), u = v(() => HC(r, i), [r, i]);
|
|
26026
26060
|
return /* @__PURE__ */ w("div", {
|
|
26027
26061
|
className: "updog__primary-key-selection updog__scrollbar",
|
|
26028
26062
|
children: [c && /* @__PURE__ */ w(Xa, {
|
|
@@ -26070,10 +26104,10 @@ var bC = () => {
|
|
|
26070
26104
|
}, e.id);
|
|
26071
26105
|
})]
|
|
26072
26106
|
});
|
|
26073
|
-
},
|
|
26107
|
+
}, WC = () => /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w(gu, { children: [/* @__PURE__ */ C(UC, {}), /* @__PURE__ */ C(tb, {})] }) });
|
|
26074
26108
|
//#endregion
|
|
26075
26109
|
//#region src/components/DataUploader/hooks/useRemoteSource.ts
|
|
26076
|
-
function
|
|
26110
|
+
function GC(e) {
|
|
26077
26111
|
let { t } = q(), { loadingId: n, error: r } = Xy(e, qy), i = Qy(), a = f((t) => {
|
|
26078
26112
|
e.loadRemoteSource(t).then(i);
|
|
26079
26113
|
}, [e, i]);
|
|
@@ -26085,8 +26119,8 @@ function UC(e) {
|
|
|
26085
26119
|
}
|
|
26086
26120
|
//#endregion
|
|
26087
26121
|
//#region src/components/DataUploader/components/StepSelectFiles/context/useViewModel.tsx
|
|
26088
|
-
var
|
|
26089
|
-
let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = Z(), i = t === !1 ? [] : t, { t: a } = q(), o = zy(), { stagedItems: s } = Xy(o, By), { remoteSourceLoading: c, remoteSourceError: l, handleRemoteSourceSelect: u } =
|
|
26122
|
+
var KC = () => {
|
|
26123
|
+
let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = Z(), i = t === !1 ? [] : t, { t: a } = q(), o = zy(), { stagedItems: s } = Xy(o, By), { remoteSourceLoading: c, remoteSourceError: l, handleRemoteSourceSelect: u } = GC(o), d = $y(o), p = f((e) => {
|
|
26090
26124
|
o.toggleStagedItem(e);
|
|
26091
26125
|
}, [o]), m = f(() => {
|
|
26092
26126
|
o.reset();
|
|
@@ -26143,19 +26177,19 @@ var WC = () => {
|
|
|
26143
26177
|
onExampleDownload: g,
|
|
26144
26178
|
handleRemoteSourceSelect: u
|
|
26145
26179
|
};
|
|
26146
|
-
},
|
|
26147
|
-
function
|
|
26148
|
-
let t =
|
|
26149
|
-
return /* @__PURE__ */ C(
|
|
26180
|
+
}, qC = s(null);
|
|
26181
|
+
function JC({ children: e }) {
|
|
26182
|
+
let t = KC();
|
|
26183
|
+
return /* @__PURE__ */ C(qC.Provider, {
|
|
26150
26184
|
value: t,
|
|
26151
26185
|
children: e
|
|
26152
26186
|
});
|
|
26153
26187
|
}
|
|
26154
|
-
var
|
|
26155
|
-
let e = p(
|
|
26188
|
+
var YC = () => {
|
|
26189
|
+
let e = p(qC);
|
|
26156
26190
|
if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
|
|
26157
26191
|
return e;
|
|
26158
|
-
},
|
|
26192
|
+
}, XC = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
|
|
26159
26193
|
className: "updog__remote-source-btn__icon",
|
|
26160
26194
|
dangerouslySetInnerHTML: { __html: e.icon }
|
|
26161
26195
|
}) : /* @__PURE__ */ C("span", {
|
|
@@ -26164,7 +26198,7 @@ var qC = () => {
|
|
|
26164
26198
|
src: e.icon,
|
|
26165
26199
|
alt: e.label
|
|
26166
26200
|
})
|
|
26167
|
-
}),
|
|
26201
|
+
}), ZC = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(Y, {
|
|
26168
26202
|
variant: "filled",
|
|
26169
26203
|
color: "neutral",
|
|
26170
26204
|
size: "sm",
|
|
@@ -26174,11 +26208,11 @@ var qC = () => {
|
|
|
26174
26208
|
disabled: !t && n,
|
|
26175
26209
|
loading: t,
|
|
26176
26210
|
spinnerPosition: "start",
|
|
26177
|
-
startIcon: /* @__PURE__ */ C(
|
|
26211
|
+
startIcon: /* @__PURE__ */ C(XC, { source: e }),
|
|
26178
26212
|
title: e.description,
|
|
26179
26213
|
children: e.label
|
|
26180
|
-
}),
|
|
26181
|
-
let { t: e } = q(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } =
|
|
26214
|
+
}), QC = () => {
|
|
26215
|
+
let { t: e } = q(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = YC(), o = n.length > 0;
|
|
26182
26216
|
return /* @__PURE__ */ w("div", {
|
|
26183
26217
|
className: "updog__source-picker",
|
|
26184
26218
|
children: [
|
|
@@ -26205,7 +26239,7 @@ var qC = () => {
|
|
|
26205
26239
|
}),
|
|
26206
26240
|
o && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(Ba, {}), /* @__PURE__ */ C("div", {
|
|
26207
26241
|
className: "updog__source-picker__sources-list",
|
|
26208
|
-
children: n.map((e) => /* @__PURE__ */ C(
|
|
26242
|
+
children: n.map((e) => /* @__PURE__ */ C(ZC, {
|
|
26209
26243
|
source: e,
|
|
26210
26244
|
loading: r === e.id,
|
|
26211
26245
|
disabled: !!r,
|
|
@@ -26219,18 +26253,18 @@ var qC = () => {
|
|
|
26219
26253
|
})
|
|
26220
26254
|
]
|
|
26221
26255
|
});
|
|
26222
|
-
},
|
|
26256
|
+
}, $C = () => /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
|
|
26223
26257
|
className: "updog__upload-prompt__icon-container",
|
|
26224
26258
|
children: /* @__PURE__ */ C(Le, {
|
|
26225
26259
|
size: "1rem",
|
|
26226
26260
|
className: "updog__upload-prompt__icon"
|
|
26227
26261
|
})
|
|
26228
|
-
}), /* @__PURE__ */ C(
|
|
26262
|
+
}), /* @__PURE__ */ C(QC, {})] }), ew = ({ onClick: e }) => /* @__PURE__ */ C("div", {
|
|
26229
26263
|
className: "updog__add-files-card",
|
|
26230
26264
|
onClick: e,
|
|
26231
|
-
children: /* @__PURE__ */ C(
|
|
26232
|
-
}),
|
|
26233
|
-
let { t: e } = q(), { exampleMenuOptions: t, onExampleDownload: n } =
|
|
26265
|
+
children: /* @__PURE__ */ C($C, {})
|
|
26266
|
+
}), tw = () => {
|
|
26267
|
+
let { t: e } = q(), { exampleMenuOptions: t, onExampleDownload: n } = YC();
|
|
26234
26268
|
return /* @__PURE__ */ C(qa, {
|
|
26235
26269
|
options: t,
|
|
26236
26270
|
onSelect: n,
|
|
@@ -26242,8 +26276,8 @@ var qC = () => {
|
|
|
26242
26276
|
children: e("dataEditor.uploader.uploadFile.downloadExample")
|
|
26243
26277
|
})
|
|
26244
26278
|
});
|
|
26245
|
-
},
|
|
26246
|
-
let { t: e } = q(), { reset: t } =
|
|
26279
|
+
}, nw = () => {
|
|
26280
|
+
let { t: e } = q(), { reset: t } = YC();
|
|
26247
26281
|
return /* @__PURE__ */ C(Y, {
|
|
26248
26282
|
variant: "outlined",
|
|
26249
26283
|
color: "neutral",
|
|
@@ -26251,7 +26285,7 @@ var qC = () => {
|
|
|
26251
26285
|
onClick: t,
|
|
26252
26286
|
children: e("dataEditor.uploader.uploadFile.reset")
|
|
26253
26287
|
});
|
|
26254
|
-
},
|
|
26288
|
+
}, rw = ({ item: e, onToggle: t }) => {
|
|
26255
26289
|
let { t: n } = q(), r = e.status === "ready", i = e.status === "ready" && e.selected, a = e.status === "ready" ? Math.max(0, e.preview.totalRows) : 0, o = f(() => {
|
|
26256
26290
|
t(e.id);
|
|
26257
26291
|
}, [t, e.id]), s = e.status === "ready" && e.materialize.kind === "sheet" && e.source.kind === "file" ? e.source.file.name : null, c = v(() => {
|
|
@@ -26303,15 +26337,15 @@ var qC = () => {
|
|
|
26303
26337
|
})]
|
|
26304
26338
|
})
|
|
26305
26339
|
});
|
|
26306
|
-
},
|
|
26307
|
-
let { isBlocked: e, open: t } =
|
|
26340
|
+
}, iw = () => {
|
|
26341
|
+
let { isBlocked: e, open: t } = YC();
|
|
26308
26342
|
return /* @__PURE__ */ C("div", {
|
|
26309
26343
|
className: E("updog__step-select-files__upload-area", e && "updog__step-select-files__upload-area--disabled"),
|
|
26310
26344
|
onClick: e ? void 0 : t,
|
|
26311
|
-
children: /* @__PURE__ */ C(
|
|
26345
|
+
children: /* @__PURE__ */ C($C, {})
|
|
26312
26346
|
});
|
|
26313
|
-
},
|
|
26314
|
-
let { t: e } = q(), { getRootProps: t, getInputProps: n, isDragActive: r, open: i, stagedItems: a, toggleItem: o } =
|
|
26347
|
+
}, aw = () => {
|
|
26348
|
+
let { t: e } = q(), { getRootProps: t, getInputProps: n, isDragActive: r, open: i, stagedItems: a, toggleItem: o } = YC(), s = a.length > 0;
|
|
26315
26349
|
return /* @__PURE__ */ C(vu, { children: /* @__PURE__ */ w("div", {
|
|
26316
26350
|
className: "updog__step-select-files__dropzone",
|
|
26317
26351
|
...t(),
|
|
@@ -26321,19 +26355,19 @@ var qC = () => {
|
|
|
26321
26355
|
className: "updog__sheet-preview-wrapper updog__scrollbar",
|
|
26322
26356
|
children: /* @__PURE__ */ w("div", {
|
|
26323
26357
|
className: "updog__sheet-preview-grid",
|
|
26324
|
-
children: [a.map((e) => /* @__PURE__ */ C(
|
|
26358
|
+
children: [a.map((e) => /* @__PURE__ */ C(rw, {
|
|
26325
26359
|
item: e,
|
|
26326
26360
|
onToggle: o
|
|
26327
|
-
}, e.id)), /* @__PURE__ */ C(
|
|
26361
|
+
}, e.id)), /* @__PURE__ */ C(ew, { onClick: i })]
|
|
26328
26362
|
})
|
|
26329
|
-
}) : /* @__PURE__ */ C(
|
|
26363
|
+
}) : /* @__PURE__ */ C(iw, {}), /* @__PURE__ */ C(tb, { leftSlot: C(s ? nw : tw, {}) })] }),
|
|
26330
26364
|
r && /* @__PURE__ */ C(_u, {})
|
|
26331
26365
|
]
|
|
26332
26366
|
}) });
|
|
26333
|
-
},
|
|
26367
|
+
}, ow = () => /* @__PURE__ */ C(JC, { children: /* @__PURE__ */ C(aw, {}) });
|
|
26334
26368
|
//#endregion
|
|
26335
26369
|
//#region src/components/DataUploader/hooks/useUploadFlow.ts
|
|
26336
|
-
function
|
|
26370
|
+
function sw(e) {
|
|
26337
26371
|
let t = y(null);
|
|
26338
26372
|
t.current === null && (t.current = e());
|
|
26339
26373
|
let n = t.current;
|
|
@@ -26341,11 +26375,11 @@ function aw(e) {
|
|
|
26341
26375
|
}
|
|
26342
26376
|
//#endregion
|
|
26343
26377
|
//#region src/components/DataUploader/context/index.tsx
|
|
26344
|
-
function
|
|
26378
|
+
function cw({ children: e }) {
|
|
26345
26379
|
let { store: t, validator: n, columns: r, primaryKey: i, pendingImportFiles: a, setPendingImportFiles: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = Z(), { t: p } = q(), h = f((e, t) => t ? p("dataEditor.uploader.matchColumns.syntheticColumnValue", {
|
|
26346
26380
|
index: e + 1,
|
|
26347
26381
|
value: t
|
|
26348
|
-
}) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), g =
|
|
26382
|
+
}) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), g = sw(() => new KS({
|
|
26349
26383
|
store: t,
|
|
26350
26384
|
validator: n,
|
|
26351
26385
|
columns: r,
|
|
@@ -26353,7 +26387,7 @@ function ow({ children: e }) {
|
|
|
26353
26387
|
scaleClient: d,
|
|
26354
26388
|
onColumnMatch: s,
|
|
26355
26389
|
onValueMatch: c,
|
|
26356
|
-
extraSynonyms: l,
|
|
26390
|
+
extraSynonyms: ab(l),
|
|
26357
26391
|
addDynamicColumns: u,
|
|
26358
26392
|
synthesizeHeader: h,
|
|
26359
26393
|
hasExistingData: t.getLocalRowCount() > 0,
|
|
@@ -26383,27 +26417,27 @@ function ow({ children: e }) {
|
|
|
26383
26417
|
}
|
|
26384
26418
|
//#endregion
|
|
26385
26419
|
//#region src/components/DataUploader/index.tsx
|
|
26386
|
-
var
|
|
26420
|
+
var lw = () => {
|
|
26387
26421
|
let { stepIds: e, activeStepIndex: t, headerReview: n, columnMatching: r } = Xy(zy(), Gy), i = Iy(), { t: a } = q(), o = v(() => ({
|
|
26388
26422
|
"select-files": {
|
|
26389
26423
|
title: a("dataEditor.uploader.steps.selectFiles"),
|
|
26390
|
-
content: /* @__PURE__ */ C(
|
|
26424
|
+
content: /* @__PURE__ */ C(ow, {})
|
|
26391
26425
|
},
|
|
26392
26426
|
"header-selection": {
|
|
26393
26427
|
title: a("dataEditor.uploader.steps.headerSelection"),
|
|
26394
|
-
content: /* @__PURE__ */ C(
|
|
26428
|
+
content: /* @__PURE__ */ C(mC, {})
|
|
26395
26429
|
},
|
|
26396
26430
|
"column-matching": {
|
|
26397
26431
|
title: a("dataEditor.uploader.steps.matchColumns"),
|
|
26398
|
-
content: /* @__PURE__ */ C(
|
|
26432
|
+
content: /* @__PURE__ */ C(cC, {})
|
|
26399
26433
|
},
|
|
26400
26434
|
"match-values": {
|
|
26401
26435
|
title: a("dataEditor.uploader.steps.matchValues"),
|
|
26402
|
-
content: /* @__PURE__ */ C(
|
|
26436
|
+
content: /* @__PURE__ */ C(BC, {})
|
|
26403
26437
|
},
|
|
26404
26438
|
"primary-key": {
|
|
26405
26439
|
title: a("dataEditor.uploader.steps.primaryKey"),
|
|
26406
|
-
content: /* @__PURE__ */ C(
|
|
26440
|
+
content: /* @__PURE__ */ C(WC, {})
|
|
26407
26441
|
}
|
|
26408
26442
|
}), [a]), s = e[t], c = s ? o[s] : void 0, l = s === "header-selection" && n && n.total > 1 ? a("dataEditor.uploader.steps.headerSelectionOf", {
|
|
26409
26443
|
current: n.position + 1,
|
|
@@ -26421,82 +26455,82 @@ var sw = () => {
|
|
|
26421
26455
|
children: c?.content
|
|
26422
26456
|
})]
|
|
26423
26457
|
});
|
|
26424
|
-
},
|
|
26458
|
+
}, uw = () => /* @__PURE__ */ C(cw, { children: /* @__PURE__ */ w("div", {
|
|
26425
26459
|
className: "updog__data-uploader",
|
|
26426
|
-
children: [/* @__PURE__ */ C(
|
|
26427
|
-
}) }),
|
|
26460
|
+
children: [/* @__PURE__ */ C(lw, {}), /* @__PURE__ */ C(yu, {})]
|
|
26461
|
+
}) }), dw = {
|
|
26428
26462
|
kty: "EC",
|
|
26429
26463
|
crv: "P-256",
|
|
26430
26464
|
x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
|
|
26431
26465
|
y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
|
|
26432
|
-
},
|
|
26466
|
+
}, fw = "updog_license_grant", pw = new Set([
|
|
26433
26467
|
"updog.tech",
|
|
26434
26468
|
"landing.updog.tech",
|
|
26435
26469
|
"demo.updog.tech"
|
|
26436
26470
|
]);
|
|
26437
|
-
function
|
|
26438
|
-
return
|
|
26471
|
+
function mw() {
|
|
26472
|
+
return pw.has(window.location.hostname);
|
|
26439
26473
|
}
|
|
26440
|
-
function
|
|
26474
|
+
function hw() {
|
|
26441
26475
|
return !1;
|
|
26442
26476
|
}
|
|
26443
|
-
function
|
|
26477
|
+
function gw() {
|
|
26444
26478
|
return "https://api.updog.tech";
|
|
26445
26479
|
}
|
|
26446
|
-
function
|
|
26480
|
+
function _w(e) {
|
|
26447
26481
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
|
|
26448
26482
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
26449
26483
|
return i;
|
|
26450
26484
|
}
|
|
26451
|
-
async function
|
|
26485
|
+
async function vw(e) {
|
|
26452
26486
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
26453
26487
|
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
26454
26488
|
}
|
|
26455
|
-
var
|
|
26456
|
-
async function
|
|
26457
|
-
return
|
|
26489
|
+
var yw = null;
|
|
26490
|
+
async function bw() {
|
|
26491
|
+
return yw || (yw = await crypto.subtle.importKey("jwk", dw, {
|
|
26458
26492
|
name: "ECDSA",
|
|
26459
26493
|
namedCurve: "P-256"
|
|
26460
|
-
}, !1, ["verify"]),
|
|
26494
|
+
}, !1, ["verify"]), yw);
|
|
26461
26495
|
}
|
|
26462
|
-
function
|
|
26496
|
+
function xw() {
|
|
26463
26497
|
try {
|
|
26464
|
-
return localStorage.getItem(
|
|
26498
|
+
return localStorage.getItem(fw);
|
|
26465
26499
|
} catch {
|
|
26466
26500
|
return null;
|
|
26467
26501
|
}
|
|
26468
26502
|
}
|
|
26469
|
-
function
|
|
26503
|
+
function Sw(e) {
|
|
26470
26504
|
try {
|
|
26471
|
-
localStorage.setItem(
|
|
26505
|
+
localStorage.setItem(fw, e);
|
|
26472
26506
|
} catch {}
|
|
26473
26507
|
}
|
|
26474
|
-
function
|
|
26508
|
+
function Cw() {
|
|
26475
26509
|
try {
|
|
26476
|
-
localStorage.removeItem(
|
|
26510
|
+
localStorage.removeItem(fw);
|
|
26477
26511
|
} catch {}
|
|
26478
26512
|
}
|
|
26479
|
-
async function
|
|
26513
|
+
async function ww(e, t, n) {
|
|
26480
26514
|
let r = e.indexOf(".");
|
|
26481
26515
|
if (r === -1) return !1;
|
|
26482
|
-
let i = e.slice(0, r), a = e.slice(r + 1), o =
|
|
26516
|
+
let i = e.slice(0, r), a = e.slice(r + 1), o = _w(i), s = _w(a), c = await bw();
|
|
26483
26517
|
if (!await crypto.subtle.verify({
|
|
26484
26518
|
name: "ECDSA",
|
|
26485
26519
|
hash: "SHA-256"
|
|
26486
26520
|
}, c, new Uint8Array(s), new Uint8Array(o))) return !1;
|
|
26487
26521
|
let l = JSON.parse(new TextDecoder().decode(o));
|
|
26488
26522
|
if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
|
|
26489
|
-
let u = await
|
|
26523
|
+
let u = await vw(t);
|
|
26490
26524
|
return !(l.key !== u || l.domain !== n);
|
|
26491
26525
|
}
|
|
26492
|
-
async function
|
|
26493
|
-
let t =
|
|
26526
|
+
async function Tw(e) {
|
|
26527
|
+
let t = xw();
|
|
26494
26528
|
if (!t) return {
|
|
26495
26529
|
valid: !1,
|
|
26496
26530
|
errorCode: "license.invalid"
|
|
26497
26531
|
};
|
|
26498
26532
|
try {
|
|
26499
|
-
if (await
|
|
26533
|
+
if (await ww(t, e, window.location.hostname.toLowerCase().trim())) return {
|
|
26500
26534
|
valid: !0,
|
|
26501
26535
|
errorCode: null
|
|
26502
26536
|
};
|
|
@@ -26506,23 +26540,23 @@ async function Cw(e) {
|
|
|
26506
26540
|
errorCode: "license.invalid"
|
|
26507
26541
|
};
|
|
26508
26542
|
}
|
|
26509
|
-
async function
|
|
26510
|
-
if (
|
|
26543
|
+
async function Ew(e, t = !0) {
|
|
26544
|
+
if (mw() || hw()) return {
|
|
26511
26545
|
valid: !0,
|
|
26512
26546
|
errorCode: null
|
|
26513
26547
|
};
|
|
26514
|
-
let n =
|
|
26548
|
+
let n = gw();
|
|
26515
26549
|
try {
|
|
26516
26550
|
let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
|
|
26517
26551
|
if (r.ok) {
|
|
26518
26552
|
let e = await r.json();
|
|
26519
|
-
return t && e.grant &&
|
|
26553
|
+
return t && e.grant && Sw(e.grant), {
|
|
26520
26554
|
valid: !0,
|
|
26521
26555
|
errorCode: null
|
|
26522
26556
|
};
|
|
26523
26557
|
}
|
|
26524
26558
|
if (r.status >= 400 && r.status < 500) {
|
|
26525
|
-
t &&
|
|
26559
|
+
t && Cw();
|
|
26526
26560
|
try {
|
|
26527
26561
|
return await r.json();
|
|
26528
26562
|
} catch {
|
|
@@ -26534,7 +26568,7 @@ async function ww(e, t = !0) {
|
|
|
26534
26568
|
}
|
|
26535
26569
|
throw Error(`Server error: ${r.status}`);
|
|
26536
26570
|
} catch {
|
|
26537
|
-
return t ?
|
|
26571
|
+
return t ? Tw(e) : {
|
|
26538
26572
|
valid: !1,
|
|
26539
26573
|
errorCode: "license.invalid"
|
|
26540
26574
|
};
|
|
@@ -26542,7 +26576,7 @@ async function ww(e, t = !0) {
|
|
|
26542
26576
|
}
|
|
26543
26577
|
//#endregion
|
|
26544
26578
|
//#region src/hooks/useLicenseValidation.ts
|
|
26545
|
-
function
|
|
26579
|
+
function Dw(e, t, n = !0) {
|
|
26546
26580
|
let [r, i] = b({
|
|
26547
26581
|
isValidating: t,
|
|
26548
26582
|
isValid: !1,
|
|
@@ -26562,7 +26596,7 @@ function Tw(e, t, n = !0) {
|
|
|
26562
26596
|
isValidating: !0,
|
|
26563
26597
|
isValid: !1,
|
|
26564
26598
|
errorCode: null
|
|
26565
|
-
}),
|
|
26599
|
+
}), Ew(e, n).then((e) => {
|
|
26566
26600
|
r || i({
|
|
26567
26601
|
isValidating: !1,
|
|
26568
26602
|
isValid: e.valid,
|
|
@@ -26585,7 +26619,7 @@ function Tw(e, t, n = !0) {
|
|
|
26585
26619
|
}
|
|
26586
26620
|
//#endregion
|
|
26587
26621
|
//#region src/server/auth/AuthState.ts
|
|
26588
|
-
var
|
|
26622
|
+
var Ow = class {
|
|
26589
26623
|
token = null;
|
|
26590
26624
|
get() {
|
|
26591
26625
|
return this.token;
|
|
@@ -26596,13 +26630,13 @@ var Ew = class {
|
|
|
26596
26630
|
clear() {
|
|
26597
26631
|
this.token = null;
|
|
26598
26632
|
}
|
|
26599
|
-
},
|
|
26633
|
+
}, kw = class extends Error {
|
|
26600
26634
|
status;
|
|
26601
26635
|
code;
|
|
26602
26636
|
constructor(e) {
|
|
26603
26637
|
super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
|
|
26604
26638
|
}
|
|
26605
|
-
},
|
|
26639
|
+
}, Aw = class {
|
|
26606
26640
|
baseUrl;
|
|
26607
26641
|
apiKey;
|
|
26608
26642
|
auth;
|
|
@@ -26632,7 +26666,7 @@ var Ew = class {
|
|
|
26632
26666
|
signal: r?.signal
|
|
26633
26667
|
});
|
|
26634
26668
|
} catch (e) {
|
|
26635
|
-
this.notify(new
|
|
26669
|
+
this.notify(new kw({
|
|
26636
26670
|
status: 0,
|
|
26637
26671
|
code: "network",
|
|
26638
26672
|
message: e instanceof Error ? e.message : String(e)
|
|
@@ -26643,7 +26677,7 @@ var Ew = class {
|
|
|
26643
26677
|
try {
|
|
26644
26678
|
e = await s.json();
|
|
26645
26679
|
} catch {}
|
|
26646
|
-
this.notify(new
|
|
26680
|
+
this.notify(new kw({
|
|
26647
26681
|
status: s.status,
|
|
26648
26682
|
code: e.error ?? `http_${s.status}`,
|
|
26649
26683
|
message: e.message ?? s.statusText
|
|
@@ -26654,23 +26688,23 @@ var Ew = class {
|
|
|
26654
26688
|
};
|
|
26655
26689
|
//#endregion
|
|
26656
26690
|
//#region src/server/endpoints/workspaces.ts
|
|
26657
|
-
async function
|
|
26691
|
+
async function jw(e, t) {
|
|
26658
26692
|
return e.post("/workspaces", {
|
|
26659
26693
|
primaryKey: t.primaryKey,
|
|
26660
26694
|
columns: t.columns
|
|
26661
26695
|
}, { signal: t.signal });
|
|
26662
26696
|
}
|
|
26663
|
-
async function
|
|
26697
|
+
async function Mw(e) {
|
|
26664
26698
|
try {
|
|
26665
26699
|
await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
|
|
26666
26700
|
} catch (e) {
|
|
26667
|
-
if (e instanceof
|
|
26701
|
+
if (e instanceof kw && e.status === 404) return;
|
|
26668
26702
|
throw e;
|
|
26669
26703
|
}
|
|
26670
26704
|
}
|
|
26671
26705
|
//#endregion
|
|
26672
26706
|
//#region src/server/endpoints/query.ts
|
|
26673
|
-
async function
|
|
26707
|
+
async function Nw(e, t) {
|
|
26674
26708
|
let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
|
|
26675
26709
|
page: {
|
|
26676
26710
|
limit: t.limit,
|
|
@@ -26688,12 +26722,12 @@ async function jw(e, t) {
|
|
|
26688
26722
|
}
|
|
26689
26723
|
//#endregion
|
|
26690
26724
|
//#region src/server/ScaleClient.ts
|
|
26691
|
-
var
|
|
26725
|
+
var Pw = class {
|
|
26692
26726
|
disposed = !1;
|
|
26693
26727
|
constructor(e) {
|
|
26694
26728
|
this.deps = e;
|
|
26695
26729
|
}
|
|
26696
|
-
onQuery = (e) =>
|
|
26730
|
+
onQuery = (e) => Nw(this.deps, e);
|
|
26697
26731
|
onEdit = async (e) => ({
|
|
26698
26732
|
rejected: !0,
|
|
26699
26733
|
reason: "Edits are not yet supported in server mode (v0)."
|
|
@@ -26710,7 +26744,7 @@ var Mw = class {
|
|
|
26710
26744
|
pageSize = void 0;
|
|
26711
26745
|
scrollSensitivity = void 0;
|
|
26712
26746
|
dispose = async () => {
|
|
26713
|
-
this.disposed || (this.disposed = !0, await
|
|
26747
|
+
this.disposed || (this.disposed = !0, await Mw({
|
|
26714
26748
|
http: this.deps.http,
|
|
26715
26749
|
workspaceId: this.deps.workspaceId
|
|
26716
26750
|
}));
|
|
@@ -26718,25 +26752,25 @@ var Mw = class {
|
|
|
26718
26752
|
};
|
|
26719
26753
|
//#endregion
|
|
26720
26754
|
//#region src/server/createScaleClient.ts
|
|
26721
|
-
async function
|
|
26722
|
-
let t = new
|
|
26755
|
+
async function Fw(e) {
|
|
26756
|
+
let t = new Ow(), n = new Aw({
|
|
26723
26757
|
baseUrl: e.url,
|
|
26724
26758
|
apiKey: e.apiKey,
|
|
26725
26759
|
auth: t,
|
|
26726
26760
|
onDegraded: e.onDegraded
|
|
26727
|
-
}), { workspaceId: r, accessToken: i } = await
|
|
26761
|
+
}), { workspaceId: r, accessToken: i } = await jw(n, {
|
|
26728
26762
|
primaryKey: e.primaryKey,
|
|
26729
26763
|
columns: e.columns,
|
|
26730
26764
|
signal: e.signal
|
|
26731
26765
|
});
|
|
26732
|
-
return t.set(i), new
|
|
26766
|
+
return t.set(i), new Pw({
|
|
26733
26767
|
workspaceId: r,
|
|
26734
26768
|
http: n
|
|
26735
26769
|
});
|
|
26736
26770
|
}
|
|
26737
26771
|
//#endregion
|
|
26738
26772
|
//#region src/server/errors.ts
|
|
26739
|
-
function
|
|
26773
|
+
function Iw(e, t, n) {
|
|
26740
26774
|
return {
|
|
26741
26775
|
code: e,
|
|
26742
26776
|
message: t,
|
|
@@ -26746,7 +26780,7 @@ function Pw(e, t, n) {
|
|
|
26746
26780
|
}
|
|
26747
26781
|
//#endregion
|
|
26748
26782
|
//#region src/hooks/useScaleClient.ts
|
|
26749
|
-
function
|
|
26783
|
+
function Lw(e) {
|
|
26750
26784
|
let [t, n] = b({ status: "idle" }), r = y(e.columns), i = y(e.primaryKey);
|
|
26751
26785
|
return m(() => {
|
|
26752
26786
|
if (!e.enabled) {
|
|
@@ -26755,7 +26789,7 @@ function Fw(e) {
|
|
|
26755
26789
|
}
|
|
26756
26790
|
n({ status: "bootstrapping" });
|
|
26757
26791
|
let t = new AbortController(), a = null;
|
|
26758
|
-
return
|
|
26792
|
+
return Fw({
|
|
26759
26793
|
url: e.url,
|
|
26760
26794
|
apiKey: e.apiKey,
|
|
26761
26795
|
primaryKey: i.current,
|
|
@@ -26764,7 +26798,7 @@ function Fw(e) {
|
|
|
26764
26798
|
onDegraded: (e) => {
|
|
26765
26799
|
t.signal.aborted || n({
|
|
26766
26800
|
status: "failed",
|
|
26767
|
-
error:
|
|
26801
|
+
error: zw(e)
|
|
26768
26802
|
});
|
|
26769
26803
|
}
|
|
26770
26804
|
}).then((e) => {
|
|
@@ -26779,7 +26813,7 @@ function Fw(e) {
|
|
|
26779
26813
|
}).catch((e) => {
|
|
26780
26814
|
t.signal.aborted || n({
|
|
26781
26815
|
status: "failed",
|
|
26782
|
-
error:
|
|
26816
|
+
error: Rw(e)
|
|
26783
26817
|
});
|
|
26784
26818
|
}), () => {
|
|
26785
26819
|
t.abort(), a?.dispose().catch(() => {});
|
|
@@ -26790,30 +26824,30 @@ function Fw(e) {
|
|
|
26790
26824
|
e.apiKey
|
|
26791
26825
|
]), t;
|
|
26792
26826
|
}
|
|
26793
|
-
function
|
|
26794
|
-
return e instanceof
|
|
26827
|
+
function Rw(e) {
|
|
26828
|
+
return e instanceof kw ? e.status === 401 ? Iw(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? Iw("scale.unreachable", e.message, e) : e.status >= 500 ? Iw("scale.server_error", e.message, e) : Iw("scale.bootstrap_failed", e.message, e) : Iw("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
|
|
26795
26829
|
}
|
|
26796
|
-
function
|
|
26797
|
-
return e.status === 0 ?
|
|
26830
|
+
function zw(e) {
|
|
26831
|
+
return e.status === 0 ? Iw("scale.unreachable", e.message, e) : e.status === 404 ? Iw("scale.workspace_lost", e.message, e) : Iw("scale.server_error", e.message, e);
|
|
26798
26832
|
}
|
|
26799
26833
|
//#endregion
|
|
26800
26834
|
//#region src/index.tsx
|
|
26801
|
-
function
|
|
26835
|
+
function Bw(e) {
|
|
26802
26836
|
return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
|
|
26803
26837
|
}
|
|
26804
|
-
function
|
|
26838
|
+
function Vw(e) {
|
|
26805
26839
|
let t = v(() => new Wo(e.onError), [e.onError]);
|
|
26806
26840
|
return /* @__PURE__ */ C(Ny, {
|
|
26807
26841
|
errorHandler: t,
|
|
26808
26842
|
children: /* @__PURE__ */ C(fu, {
|
|
26809
26843
|
...e,
|
|
26810
26844
|
errorHandler: t,
|
|
26811
|
-
children: e.showUploader ? /* @__PURE__ */ C(
|
|
26845
|
+
children: e.showUploader ? /* @__PURE__ */ C(uw, {}) : /* @__PURE__ */ C(ky, {})
|
|
26812
26846
|
})
|
|
26813
26847
|
});
|
|
26814
26848
|
}
|
|
26815
|
-
function
|
|
26816
|
-
let t = e.mode ?? "modal", { t: n, rtl: r } = q(), i = r ? "rtl" : "ltr", a =
|
|
26849
|
+
function Hw(e) {
|
|
26850
|
+
let t = e.mode ?? "modal", { t: n, rtl: r } = q(), i = r ? "rtl" : "ltr", a = Bw(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = Dw(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = Lw({
|
|
26817
26851
|
enabled: !s && c && u,
|
|
26818
26852
|
url: e.__server?.url ?? "",
|
|
26819
26853
|
apiKey: e.apiKey,
|
|
@@ -26868,7 +26902,7 @@ function Bw(e) {
|
|
|
26868
26902
|
code: e,
|
|
26869
26903
|
message: "License validation failed",
|
|
26870
26904
|
source: "license"
|
|
26871
|
-
} }), F = () => s ? N(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? N(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(jy, { error: d.error }) : /* @__PURE__ */ C(
|
|
26905
|
+
} }), F = () => s ? N(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? N(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(jy, { error: d.error }) : /* @__PURE__ */ C(Vw, { ...M }) : P(l ?? "license.invalid");
|
|
26872
26906
|
return t === "inline" ? /* @__PURE__ */ C("div", {
|
|
26873
26907
|
className: "updog__data-editor updog__data-editor-inline",
|
|
26874
26908
|
dir: i,
|
|
@@ -26891,14 +26925,14 @@ function Bw(e) {
|
|
|
26891
26925
|
})
|
|
26892
26926
|
});
|
|
26893
26927
|
}
|
|
26894
|
-
function
|
|
26928
|
+
function Uw(e) {
|
|
26895
26929
|
let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
|
|
26896
26930
|
return /* @__PURE__ */ C(Xr, {
|
|
26897
26931
|
translations: t,
|
|
26898
26932
|
rtl: n,
|
|
26899
26933
|
locale: r,
|
|
26900
|
-
children: /* @__PURE__ */ C(
|
|
26934
|
+
children: /* @__PURE__ */ C(Hw, { ...a })
|
|
26901
26935
|
});
|
|
26902
26936
|
}
|
|
26903
26937
|
//#endregion
|
|
26904
|
-
export {
|
|
26938
|
+
export { Uw as DataEditor, ju as downloadExampleFile, Mu as exportDataEditor };
|