@oardi/ts-utils 0.0.21 → 0.0.22
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/extensions/array-extension.d.ts +13 -0
- package/extensions/array-extension.d.ts.map +1 -0
- package/extensions/date-extension.d.ts +18 -0
- package/extensions/date-extension.d.ts.map +1 -0
- package/extensions/{index.ts → index.d.ts} +1 -0
- package/extensions/index.d.ts.map +1 -0
- package/extensions/string-extensions.d.ts +9 -0
- package/extensions/string-extensions.d.ts.map +1 -0
- package/helpers/browser/browser-type.enum.d.ts +14 -0
- package/helpers/browser/browser-type.enum.d.ts.map +1 -0
- package/helpers/browser/browser.helper.d.ts +16 -0
- package/helpers/browser/browser.helper.d.ts.map +1 -0
- package/helpers/browser/{index.ts → index.d.ts} +1 -0
- package/helpers/browser/index.d.ts.map +1 -0
- package/helpers/clipboard.helper.d.ts +2 -0
- package/helpers/clipboard.helper.d.ts.map +1 -0
- package/helpers/csv.helper.d.ts +6 -0
- package/helpers/csv.helper.d.ts.map +1 -0
- package/helpers/download.helper.d.ts +14 -0
- package/helpers/download.helper.d.ts.map +1 -0
- package/helpers/enum.helper.d.ts +6 -0
- package/helpers/enum.helper.d.ts.map +1 -0
- package/helpers/file.helper.d.ts +16 -0
- package/helpers/file.helper.d.ts.map +1 -0
- package/helpers/{index.ts → index.d.ts} +1 -0
- package/helpers/index.d.ts.map +1 -0
- package/helpers/local-storage.helper.d.ts +8 -0
- package/helpers/local-storage.helper.d.ts.map +1 -0
- package/helpers/logger/index.d.ts +4 -0
- package/helpers/logger/index.d.ts.map +1 -0
- package/helpers/logger/logger-type.enum.d.ts +8 -0
- package/helpers/logger/logger-type.enum.d.ts.map +1 -0
- package/helpers/logger/logger.helper.d.ts +15 -0
- package/helpers/logger/logger.helper.d.ts.map +1 -0
- package/helpers/logger/{logger.types.ts → logger.types.d.ts} +4 -5
- package/helpers/logger/logger.types.d.ts.map +1 -0
- package/helpers/sort.helper.d.ts +2 -0
- package/helpers/sort.helper.d.ts.map +1 -0
- package/helpers/token/{index.ts → index.d.ts} +1 -0
- package/helpers/token/index.d.ts.map +1 -0
- package/helpers/token/{token-type.enum.ts → token-type.enum.d.ts} +1 -0
- package/helpers/token/token-type.enum.d.ts.map +1 -0
- package/helpers/token/token.helper.d.ts +7 -0
- package/helpers/token/token.helper.d.ts.map +1 -0
- package/index.cjs.js +15 -0
- package/{index.ts → index.d.ts} +1 -0
- package/index.d.ts.map +1 -0
- package/index.es.js +1126 -0
- package/index.umd.js +15 -0
- package/interfaces/{index.ts → index.d.ts} +1 -0
- package/interfaces/index.d.ts.map +1 -0
- package/interfaces/keyvalue.interface.d.ts +5 -0
- package/interfaces/keyvalue.interface.d.ts.map +1 -0
- package/package.json +1 -1
- package/readme.md +15 -0
- package/services/browser/browser.consts.d.ts +3 -0
- package/services/browser/browser.consts.d.ts.map +1 -0
- package/services/browser/browser.interface.d.ts +6 -0
- package/services/browser/browser.interface.d.ts.map +1 -0
- package/services/browser/browser.service.d.ts +30 -0
- package/services/browser/browser.service.d.ts.map +1 -0
- package/services/browser/{browser.types.ts → browser.types.d.ts} +1 -1
- package/services/browser/browser.types.d.ts.map +1 -0
- package/services/browser/{index.ts → index.d.ts} +1 -0
- package/services/browser/index.d.ts.map +1 -0
- package/services/index.d.ts +2 -0
- package/services/index.d.ts.map +1 -0
- package/types/index.d.ts +9 -0
- package/types/index.d.ts.map +1 -0
- package/vite.config.d.ts +3 -0
- package/vite.config.d.ts.map +1 -0
- package/extensions/array-extension.ts +0 -54
- package/extensions/date-extension.ts +0 -69
- package/extensions/string-extensions.ts +0 -21
- package/helpers/browser/browser-type.enum.ts +0 -13
- package/helpers/browser/browser.helper.ts +0 -95
- package/helpers/clipboard.helper.ts +0 -3
- package/helpers/csv.helper.ts +0 -23
- package/helpers/download.helper.ts +0 -127
- package/helpers/enum.helper.ts +0 -20
- package/helpers/file.helper.ts +0 -105
- package/helpers/local-storage.helper.ts +0 -30
- package/helpers/logger/index.ts +0 -1
- package/helpers/logger/logger-type.enum.ts +0 -7
- package/helpers/logger/logger.helper.ts +0 -63
- package/helpers/sort.helper.ts +0 -33
- package/helpers/token/token.helper.ts +0 -16
- package/interfaces/keyvalue.interface.ts +0 -7
- package/services/browser/browser.consts.ts +0 -11
- package/services/browser/browser.interface.ts +0 -6
- package/services/browser/browser.service.ts +0 -119
- package/services/index.ts +0 -1
- package/tsconfig.json +0 -33
- package/types/index.ts +0 -11
- package/vite.config.ts +0 -21
package/index.umd.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
(function(P,ge){typeof exports=="object"&&typeof module<"u"?ge(exports):typeof define=="function"&&define.amd?define(["exports"],ge):(P=typeof globalThis<"u"?globalThis:P||self,ge(P["ts-utils"]={}))})(this,(function(P){"use strict";function ge(s){return navigator.clipboard.writeText(s)}function Se(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var we={exports:{}};/* @license
|
|
2
|
+
Papa Parse
|
|
3
|
+
v5.5.3
|
|
4
|
+
https://github.com/mholt/PapaParse
|
|
5
|
+
License: MIT
|
|
6
|
+
*/var Le=we.exports,Ee;function Ie(){return Ee||(Ee=1,(function(s,r){((i,l)=>{s.exports=l()})(Le,function i(){var l=typeof self<"u"?self:typeof window<"u"?window:l!==void 0?l:{},v,x=!l.document&&!!l.postMessage,T=l.IS_PAPA_WORKER||!1,Y={},q=0,w={};function H(e){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(t){var n=ae(t);n.chunkSize=parseInt(n.chunkSize),t.step||t.chunk||(n.chunkSize=null),this._handle=new te(n),(this._handle.streamer=this)._config=n}).call(this,e),this.parseChunk=function(t,n){var o=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<o){let S=this._config.newline;S||(g=this._config.quoteChar||'"',S=this._handle.guessLineEndings(t,g)),t=[...t.split(S).slice(o)].join(S)}this.isFirstChunk&&R(this._config.beforeFirstChunk)&&(g=this._config.beforeFirstChunk(t))!==void 0&&(t=g),this.isFirstChunk=!1,this._halted=!1;var o=this._partialLine+t,g=(this._partialLine="",this._handle.parse(o,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(t=g.meta.cursor,o=(this._finished||(this._partialLine=o.substring(t-this._baseIndex),this._baseIndex=t),g&&g.data&&(this._rowCount+=g.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),T)l.postMessage({results:g,workerId:w.WORKER_ID,finished:o});else if(R(this._config.chunk)&&!n){if(this._config.chunk(g,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=g=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(g.data),this._completeResults.errors=this._completeResults.errors.concat(g.errors),this._completeResults.meta=g.meta),this._completed||!o||!R(this._config.complete)||g&&g.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),o||g&&g.meta.paused||this._nextChunk(),g}this._halted=!0},this._sendError=function(t){R(this._config.error)?this._config.error(t):T&&this._config.error&&l.postMessage({workerId:w.WORKER_ID,error:t,finished:!1})}}function W(e){var t;(e=e||{}).chunkSize||(e.chunkSize=w.RemoteChunkSize),H.call(this,e),this._nextChunk=x?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(n){this._input=n,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),x||(t.onload=K(this._chunkLoaded,this),t.onerror=K(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!x),this._config.downloadRequestHeaders){var n,o=this._config.downloadRequestHeaders;for(n in o)t.setRequestHeader(n,o[n])}var g;this._config.chunkSize&&(g=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+g));try{t.send(this._config.downloadRequestBody)}catch(S){this._chunkError(S.message)}x&&t.status===0&&this._chunkError()}},this._chunkLoaded=function(){t.readyState===4&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(n=>(n=n.getResponseHeader("Content-Range"))!==null?parseInt(n.substring(n.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(n){n=t.statusText||n,this._sendError(new Error(n))}}function ee(e){(e=e||{}).chunkSize||(e.chunkSize=w.LocalChunkSize),H.call(this,e);var t,n,o=typeof FileReader<"u";this.stream=function(g){this._input=g,n=g.slice||g.webkitSlice||g.mozSlice,o?((t=new FileReader).onload=K(this._chunkLoaded,this),t.onerror=K(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var g=this._input,S=(this._config.chunkSize&&(S=Math.min(this._start+this._config.chunkSize,this._input.size),g=n.call(g,this._start,S)),t.readAsText(g,this._config.encoding));o||this._chunkLoaded({target:{result:S}})},this._chunkLoaded=function(g){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(g.target.result)},this._chunkError=function(){this._sendError(t.error)}}function Q(e){var t;H.call(this,e=e||{}),this.stream=function(n){return t=n,this._nextChunk()},this._nextChunk=function(){var n,o;if(!this._finished)return n=this._config.chunkSize,t=n?(o=t.substring(0,n),t.substring(n)):(o=t,""),this._finished=!t,this.parseChunk(o)}}function G(e){H.call(this,e=e||{});var t=[],n=!0,o=!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(g){this._input=g,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){o&&t.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=K(function(g){try{t.push(typeof g=="string"?g:g.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(S){this._streamError(S)}},this),this._streamError=K(function(g){this._streamCleanUp(),this._sendError(g)},this),this._streamEnd=K(function(){this._streamCleanUp(),o=!0,this._streamData("")},this),this._streamCleanUp=K(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function te(e){var t,n,o,g,S=Math.pow(2,53),m=-S,f=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\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)))$/,a=this,u=0,c=0,y=!1,p=!1,_=[],d={data:[],errors:[],meta:{}};function M(b){return e.skipEmptyLines==="greedy"?b.join("").trim()==="":b.length===1&&b[0].length===0}function $(){if(d&&o&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+w.DefaultDelimiter+"'"),o=!1),e.skipEmptyLines&&(d.data=d.data.filter(function(k){return!M(k)})),B()){let k=function(A,F){R(e.transformHeader)&&(A=e.transformHeader(A,F)),_.push(A)};if(d)if(Array.isArray(d.data[0])){for(var b=0;B()&&b<d.data.length;b++)d.data[b].forEach(k);d.data.splice(0,1)}else d.data.forEach(k)}function E(k,A){for(var F=e.header?{}:[],L=0;L<k.length;L++){var I=L,C=k[L],C=((X,D)=>(z=>(e.dynamicTypingFunction&&e.dynamicTyping[z]===void 0&&(e.dynamicTyping[z]=e.dynamicTypingFunction(z)),(e.dynamicTyping[z]||e.dynamicTyping)===!0))(X)?D==="true"||D==="TRUE"||D!=="false"&&D!=="FALSE"&&((z=>{if(f.test(z)&&(z=parseFloat(z),m<z&&z<S))return 1})(D)?parseFloat(D):h.test(D)?new Date(D):D===""?null:D):D)(I=e.header?L>=_.length?"__parsed_extra":_[L]:I,C=e.transform?e.transform(C,I):C);I==="__parsed_extra"?(F[I]=F[I]||[],F[I].push(C)):F[I]=C}return e.header&&(L>_.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+_.length+" fields but parsed "+L,c+A):L<_.length&&j("FieldMismatch","TooFewFields","Too few fields: expected "+_.length+" fields but parsed "+L,c+A)),F}var O;d&&(e.header||e.dynamicTyping||e.transform)&&(O=1,!d.data.length||Array.isArray(d.data[0])?(d.data=d.data.map(E),O=d.data.length):d.data=E(d.data,0),e.header&&d.meta&&(d.meta.fields=_),c+=O)}function B(){return e.header&&_.length===0}function j(b,E,O,k){b={type:b,code:E,message:O},k!==void 0&&(b.row=k),d.errors.push(b)}R(e.step)&&(g=e.step,e.step=function(b){d=b,B()?$():($(),d.data.length!==0&&(u+=b.data.length,e.preview&&u>e.preview?n.abort():(d.data=d.data[0],g(d,a))))}),this.parse=function(b,E,O){var k=e.quoteChar||'"',k=(e.newline||(e.newline=this.guessLineEndings(b,k)),o=!1,e.delimiter?R(e.delimiter)&&(e.delimiter=e.delimiter(b),d.meta.delimiter=e.delimiter):((k=((A,F,L,I,C)=>{var X,D,z,ce;C=C||[","," ","|",";",w.RECORD_SEP,w.UNIT_SEP];for(var de=0;de<C.length;de++){for(var re,ye=C[de],J=0,ne=0,U=0,V=(z=void 0,new fe({comments:I,delimiter:ye,newline:F,preview:10}).parse(A)),oe=0;oe<V.data.length;oe++)L&&M(V.data[oe])?U++:(re=V.data[oe].length,ne+=re,z===void 0?z=re:0<re&&(J+=Math.abs(re-z),z=re));0<V.data.length&&(ne/=V.data.length-U),(D===void 0||J<=D)&&(ce===void 0||ce<ne)&&1.99<ne&&(D=J,X=ye,ce=ne)}return{successful:!!(e.delimiter=X),bestDelimiter:X}})(b,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=k.bestDelimiter:(o=!0,e.delimiter=w.DefaultDelimiter),d.meta.delimiter=e.delimiter),ae(e));return e.preview&&e.header&&k.preview++,t=b,n=new fe(k),d=n.parse(t,E,O),$(),y?{meta:{paused:!0}}:d||{meta:{paused:!1}}},this.paused=function(){return y},this.pause=function(){y=!0,n.abort(),t=R(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){a.streamer._halted?(y=!1,a.streamer.parseChunk(t,!0)):setTimeout(a.resume,3)},this.aborted=function(){return p},this.abort=function(){p=!0,n.abort(),d.meta.aborted=!0,R(e.complete)&&e.complete(d),t=""},this.guessLineEndings=function(A,k){A=A.substring(0,1048576);var k=new RegExp(se(k)+"([^]*?)"+se(k),"gm"),O=(A=A.replace(k,"")).split("\r"),k=A.split(`
|
|
7
|
+
`),A=1<k.length&&k[0].length<O[0].length;if(O.length===1||A)return`
|
|
8
|
+
`;for(var F=0,L=0;L<O.length;L++)O[L][0]===`
|
|
9
|
+
`&&F++;return F>=O.length/2?`\r
|
|
10
|
+
`:"\r"}}function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e){var t=(e=e||{}).delimiter,n=e.newline,o=e.comments,g=e.step,S=e.preview,m=e.fastMode,f=null,h=!1,a=e.quoteChar==null?'"':e.quoteChar,u=a;if(e.escapeChar!==void 0&&(u=e.escapeChar),(typeof t!="string"||-1<w.BAD_DELIMITERS.indexOf(t))&&(t=","),o===t)throw new Error("Comment character same as delimiter");o===!0?o="#":(typeof o!="string"||-1<w.BAD_DELIMITERS.indexOf(o))&&(o=!1),n!==`
|
|
11
|
+
`&&n!=="\r"&&n!==`\r
|
|
12
|
+
`&&(n=`
|
|
13
|
+
`);var c=0,y=!1;this.parse=function(p,_,d){if(typeof p!="string")throw new Error("Input must be a string");var M=p.length,$=t.length,B=n.length,j=o.length,b=R(g),E=[],O=[],k=[],A=c=0;if(!p)return J();if(m||m!==!1&&p.indexOf(a)===-1){for(var F=p.split(n),L=0;L<F.length;L++){if(k=F[L],c+=k.length,L!==F.length-1)c+=n.length;else if(d)return J();if(!o||k.substring(0,j)!==o){if(b){if(E=[],ce(k.split(t)),ne(),y)return J()}else ce(k.split(t));if(S&&S<=L)return E=E.slice(0,S),J(!0)}}return J()}for(var I=p.indexOf(t,c),C=p.indexOf(n,c),X=new RegExp(se(u)+se(a),"g"),D=p.indexOf(a,c);;)if(p[c]===a)for(D=c,c++;;){if((D=p.indexOf(a,D+1))===-1)return d||O.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:E.length,index:c}),re();if(D===M-1)return re(p.substring(c,D).replace(X,a));if(a===u&&p[D+1]===u)D++;else if(a===u||D===0||p[D-1]!==u){I!==-1&&I<D+1&&(I=p.indexOf(t,D+1));var z=de((C=C!==-1&&C<D+1?p.indexOf(n,D+1):C)===-1?I:Math.min(I,C));if(p.substr(D+1+z,$)===t){k.push(p.substring(c,D).replace(X,a)),p[c=D+1+z+$]!==a&&(D=p.indexOf(a,c)),I=p.indexOf(t,c),C=p.indexOf(n,c);break}if(z=de(C),p.substring(D+1+z,D+1+z+B)===n){if(k.push(p.substring(c,D).replace(X,a)),ye(D+1+z+B),I=p.indexOf(t,c),D=p.indexOf(a,c),b&&(ne(),y))return J();if(S&&E.length>=S)return J(!0);break}O.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:E.length,index:c}),D++}}else if(o&&k.length===0&&p.substring(c,c+j)===o){if(C===-1)return J();c=C+B,C=p.indexOf(n,c),I=p.indexOf(t,c)}else if(I!==-1&&(I<C||C===-1))k.push(p.substring(c,I)),c=I+$,I=p.indexOf(t,c);else{if(C===-1)break;if(k.push(p.substring(c,C)),ye(C+B),b&&(ne(),y))return J();if(S&&E.length>=S)return J(!0)}return re();function ce(U){E.push(U),A=c}function de(U){var V=0;return V=U!==-1&&(U=p.substring(D+1,U))&&U.trim()===""?U.length:V}function re(U){return d||(U===void 0&&(U=p.substring(c)),k.push(U),c=M,ce(k),b&&ne()),J()}function ye(U){c=U,ce(k),k=[],C=p.indexOf(n,c)}function J(U){if(e.header&&!_&&E.length&&!h){var V=E[0],oe=Object.create(null),De=new Set(V);let Ae=!1;for(let pe=0;pe<V.length;pe++){let ie=V[pe];if(oe[ie=R(e.transformHeader)?e.transformHeader(ie,pe):ie]){let _e,Te=oe[ie];for(;_e=ie+"_"+Te,Te++,De.has(_e););De.add(_e),V[pe]=_e,oe[ie]++,Ae=!0,(f=f===null?{}:f)[_e]=ie}else oe[ie]=1,V[pe]=ie;De.add(ie)}Ae&&console.warn("Duplicate headers found and renamed."),h=!0}return{data:E,errors:O,meta:{delimiter:t,linebreak:n,aborted:y,truncated:!!U,cursor:A+(_||0),renamedHeaders:f}}}function ne(){g(J()),E=[],O=[]}},this.abort=function(){y=!0},this.getCharIndex=function(){return c}}function me(e){var t=e.data,n=Y[t.workerId],o=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var g={abort:function(){o=!0,ue(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:be,resume:be};if(R(n.userStep)){for(var S=0;S<t.results.data.length&&(n.userStep({data:t.results.data[S],errors:t.results.errors,meta:t.results.meta},g),!o);S++);delete t.results}else R(n.userChunk)&&(n.userChunk(t.results,g,t.file),delete t.results)}t.finished&&!o&&ue(t.workerId,t.results)}function ue(e,t){var n=Y[e];R(n.userComplete)&&n.userComplete(t),n.terminate(),delete Y[e]}function be(){throw new Error("Not implemented.")}function ae(e){if(typeof e!="object"||e===null)return e;var t,n=Array.isArray(e)?[]:{};for(t in e)n[t]=ae(e[t]);return n}function K(e,t){return function(){e.apply(t,arguments)}}function R(e){return typeof e=="function"}return w.parse=function(e,t){var n=(t=t||{}).dynamicTyping||!1;if(R(n)&&(t.dynamicTypingFunction=n,n={}),t.dynamicTyping=n,t.transform=!!R(t.transform)&&t.transform,!t.worker||!w.WORKERS_SUPPORTED)return n=null,w.NODE_STREAM_INPUT,typeof e=="string"?(e=(o=>o.charCodeAt(0)!==65279?o:o.slice(1))(e),n=new(t.download?W:Q)(t)):e.readable===!0&&R(e.read)&&R(e.on)?n=new G(t):(l.File&&e instanceof File||e instanceof Object)&&(n=new ee(t)),n.stream(e);(n=(()=>{var o;return!!w.WORKERS_SUPPORTED&&(o=(()=>{var g=l.URL||l.webkitURL||null,S=i.toString();return w.BLOB_URL||(w.BLOB_URL=g.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; ","(",S,")();"],{type:"text/javascript"})))})(),(o=new l.Worker(o)).onmessage=me,o.id=q++,Y[o.id]=o)})()).userStep=t.step,n.userChunk=t.chunk,n.userComplete=t.complete,n.userError=t.error,t.step=R(t.step),t.chunk=R(t.chunk),t.complete=R(t.complete),t.error=R(t.error),delete t.worker,n.postMessage({input:e,config:t,workerId:n.id})},w.unparse=function(e,t){var n=!1,o=!0,g=",",S=`\r
|
|
14
|
+
`,m='"',f=m+m,h=!1,a=null,u=!1,c=((()=>{if(typeof t=="object"){if(typeof t.delimiter!="string"||w.BAD_DELIMITERS.filter(function(_){return t.delimiter.indexOf(_)!==-1}).length||(g=t.delimiter),typeof t.quotes!="boolean"&&typeof t.quotes!="function"&&!Array.isArray(t.quotes)||(n=t.quotes),typeof t.skipEmptyLines!="boolean"&&typeof t.skipEmptyLines!="string"||(h=t.skipEmptyLines),typeof t.newline=="string"&&(S=t.newline),typeof t.quoteChar=="string"&&(m=t.quoteChar),typeof t.header=="boolean"&&(o=t.header),Array.isArray(t.columns)){if(t.columns.length===0)throw new Error("Option columns is empty");a=t.columns}t.escapeChar!==void 0&&(f=t.escapeChar+m),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:typeof t.escapeFormulae=="boolean"&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),new RegExp(se(m),"g"));if(typeof e=="string"&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return y(null,e,h);if(typeof e[0]=="object")return y(a||Object.keys(e[0]),e,h)}else if(typeof e=="object")return typeof e.data=="string"&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||a),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:typeof e.data[0]=="object"?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||typeof e.data[0]=="object"||(e.data=[e.data])),y(e.fields||[],e.data||[],h);throw new Error("Unable to serialize unrecognized input");function y(_,d,M){var $="",B=(typeof _=="string"&&(_=JSON.parse(_)),typeof d=="string"&&(d=JSON.parse(d)),Array.isArray(_)&&0<_.length),j=!Array.isArray(d[0]);if(B&&o){for(var b=0;b<_.length;b++)0<b&&($+=g),$+=p(_[b],b);0<d.length&&($+=S)}for(var E=0;E<d.length;E++){var O=(B?_:d[E]).length,k=!1,A=B?Object.keys(d[E]).length===0:d[E].length===0;if(M&&!B&&(k=M==="greedy"?d[E].join("").trim()==="":d[E].length===1&&d[E][0].length===0),M==="greedy"&&B){for(var F=[],L=0;L<O;L++){var I=j?_[L]:L;F.push(d[E][I])}k=F.join("").trim()===""}if(!k){for(var C=0;C<O;C++){0<C&&!A&&($+=g);var X=B&&j?_[C]:C;$+=p(d[E][X],C)}E<d.length-1&&(!M||0<O&&!A)&&($+=S)}}return $}function p(_,d){var M,$;return _==null?"":_.constructor===Date?JSON.stringify(_).slice(1,25):($=!1,u&&typeof _=="string"&&u.test(_)&&(_="'"+_,$=!0),M=_.toString().replace(c,f),($=$||n===!0||typeof n=="function"&&n(_,d)||Array.isArray(n)&&n[d]||((B,j)=>{for(var b=0;b<j.length;b++)if(-1<B.indexOf(j[b]))return!0;return!1})(M,w.BAD_DELIMITERS)||-1<M.indexOf(g)||M.charAt(0)===" "||M.charAt(M.length-1)===" ")?m+M+m:M)}},w.RECORD_SEP="",w.UNIT_SEP="",w.BYTE_ORDER_MARK="\uFEFF",w.BAD_DELIMITERS=["\r",`
|
|
15
|
+
`,'"',w.BYTE_ORDER_MARK],w.WORKERS_SUPPORTED=!x&&!!l.Worker,w.NODE_STREAM_INPUT=1,w.LocalChunkSize=10485760,w.RemoteChunkSize=5242880,w.DefaultDelimiter=",",w.Parser=fe,w.ParserHandle=te,w.NetworkStreamer=W,w.FileStreamer=ee,w.StringStreamer=Q,w.ReadableStreamStreamer=G,l.jQuery&&((v=l.jQuery).fn.parse=function(e){var t=e.config||{},n=[];return this.each(function(S){if(!(v(this).prop("tagName").toUpperCase()==="INPUT"&&v(this).attr("type").toLowerCase()==="file"&&l.FileReader)||!this.files||this.files.length===0)return!0;for(var m=0;m<this.files.length;m++)n.push({file:this.files[m],inputElem:this,instanceConfig:v.extend({},t)})}),o(),this;function o(){if(n.length===0)R(e.complete)&&e.complete();else{var S,m,f,h,a=n[0];if(R(e.before)){var u=e.before(a.file,a.inputElem);if(typeof u=="object"){if(u.action==="abort")return S="AbortError",m=a.file,f=a.inputElem,h=u.reason,void(R(e.error)&&e.error({name:S},m,f,h));if(u.action==="skip")return void g();typeof u.config=="object"&&(a.instanceConfig=v.extend(a.instanceConfig,u.config))}else if(u==="skip")return void g()}var c=a.instanceConfig.complete;a.instanceConfig.complete=function(y){R(c)&&c(y,a.file,a.inputElem),g()},w.parse(a.file,a.instanceConfig)}}function g(){n.splice(0,1),o()}}),T&&(l.onmessage=function(e){e=e.data,w.WORKER_ID===void 0&&e&&(w.WORKER_ID=e.workerId),typeof e.input=="string"?l.postMessage({workerId:w.WORKER_ID,results:w.parse(e.input,e.config),finished:!0}):(l.File&&e.input instanceof File||e.input instanceof Object)&&(e=w.parse(e.input,e.config))&&l.postMessage({workerId:w.WORKER_ID,results:e,finished:!0})}),(W.prototype=Object.create(H.prototype)).constructor=W,(ee.prototype=Object.create(H.prototype)).constructor=ee,(Q.prototype=Object.create(Q.prototype)).constructor=Q,(G.prototype=Object.create(H.prototype)).constructor=G,w})})(we)),we.exports}var Be=Ie();const Fe=Se(Be),{parse:ze,unparse:je}=Fe;class We{static unparse(r,i){return je(r,i)}static parse(r){return new Promise((i,l)=>{ze(r,{header:!0,complete:v=>i(v),error:v=>l(v)})})}}async function Oe(s,r,i){const l=i?.mimeType??Pe(r),v=Ue(s,l);if("showSaveFilePicker"in window&&i?.showSaveFilePicker)try{const q=await(await window.showSaveFilePicker({suggestedName:r,types:[{description:"Datei",accept:{[l]:[`.${Me(r)}`]}}]})).createWritable();await q.write(v),await q.close();return}catch{}const x=URL.createObjectURL(v),T=document.createElement("a");T.href=x,T.download=r,T.rel="noopener",T.style.display="none",document.body.appendChild(T),Ye(T),window.setTimeout(()=>{document.body.removeChild(T),URL.revokeObjectURL(x)},0),Ne()&&window.open(x,"_blank","noopener,noreferrer")}function Ue(s,r){if(s instanceof Blob)return s.type?s:new Blob([s],{type:r});if(s instanceof ArrayBuffer||s instanceof Uint8Array){const i=s instanceof Uint8Array?s:new Uint8Array(s);return new Blob([i],{type:r})}return new Blob([s],{type:r||"text/plain;charset=utf-8"})}function Pe(s){switch(Me(s).toLowerCase()){case"txt":return"text/plain;charset=utf-8";case"csv":return"text/csv;charset=utf-8";case"json":return"application/json;charset=utf-8";case"pdf":return"application/pdf";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"svg":return"image/svg+xml";case"zip":return"application/zip";default:return"application/octet-stream"}}function Me(s){const r=s.lastIndexOf(".");return r>=0&&r<s.length-1?s.slice(r+1):""}function Ye(s){const r=document.createEvent("MouseEvents");r.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),s.dispatchEvent(r)}function Ne(){const s=navigator.userAgent,r=/iPad|iPhone|iPod/.test(s),i=/^((?!chrome|android).)*safari/i.test(s);return r||i}class qe{static getEnumValue(r,i){if(i in r)return r[i];throw Error(`${i} not found in ${r}`)}static getKeyValues(r){return Object.keys(r).filter(i=>!isNaN(Number(i))).map(i=>({key:Number(i),value:r[i]}))}}class He{static getFileExtension(r){let i="";const l=r.lastIndexOf(".");return l>0&&l<r.length-1&&(i=`.${r.substring(l+1).toLowerCase()}`),i}static readAsText(r){const i=new FileReader;return new Promise((l,v)=>{i.onload=()=>{i.onload=null,i.onerror=null,typeof i.result=="string"?l(i.result):v(new Error("Unexpected result type"))},i.onerror=()=>{const x=i.error??new Error("FileReader error");i.onload=null,i.onerror=null,v(x)},i.readAsText(r)})}static readAsArrayBuffer(r){const i=new FileReader;return new Promise((l,v)=>{i.onload=()=>{i.onload=null,i.onerror=null,i.result instanceof ArrayBuffer?l(i.result):v(new Error("Unexpected result type"))},i.onerror=()=>{const x=i.error??new Error("FileReader error");i.onload=null,i.onerror=null,v(x)},i.readAsArrayBuffer(r)})}static readAsDataUrl(r){const i=new FileReader;return new Promise((l,v)=>{i.onload=x=>{l(x)},i.onerror=x=>v(x),i.readAsDataURL(r)})}static formatFileSize(r,i=2,l){if(r===0)return"0 Bytes";const v=1024,x=["Bytes","KB","MB","GB","TB"];let T=Math.floor(Math.log(r)/Math.log(v));l&&x.includes(l)&&(T=x.indexOf(l));const Y=r/Math.pow(v,T);return`${parseFloat(Y.toFixed(i))} ${x[T]}`}static save(r,i,l){const v=new Blob([r],{type:l});Oe(v,i)}}class le{static set(r,i){localStorage.setItem(r,JSON.stringify(i))}static get(r){let i=null;const l=localStorage.getItem(r);return l&&(i=JSON.parse(l)),i}static remove(r){let i=!!le.get(r);return i&&localStorage.removeItem(r),i}static removeAll(){localStorage.clear()}static getKeysBy(r){return Object.keys(localStorage).filter(i=>i.startsWith(r))}}var he=(s=>(s.log="log",s.info="info",s.warn="warn",s.debug="debug",s.error="error",s))(he||{});class N{static listeners=new Set;static enabled=!0;static log(...r){N.doLog(he.log,r)}static info(...r){N.doLog(he.info,r)}static warn(...r){N.doLog(he.warn,r)}static debug(...r){N.doLog(he.debug,r)}static error(...r){N.doLog(he.error,r)}static clearListeners(){N.listeners.clear()}static setEnabled(r){N.enabled=r}static doLog(r,i){if(!N.enabled)return;const l={type:r,args:i,timestamp:new Date().toISOString()};for(const v of N.listeners)try{if(v(l)===!1)return}catch{}console[r].apply(console,i)}static onLog(r,i=!1){if(i){const l=v=>{try{return r(v)}finally{N.listeners.delete(l)}};return N.listeners.add(l),()=>N.listeners.delete(l)}return N.listeners.add(r),()=>N.listeners.delete(r)}}const Ke=(s,r,i)=>s.localeCompare(r)*(i?1:-1),Je=(s,r)=>s<r?-1:s===r?0:1,Qe=(s,r,i)=>Je(s,r)*(i?1:-1),Ve=(s,r,i)=>{let l=0;return typeof s=="string"&&typeof r=="string"?l=Ke(s,r,i):l=Qe(s,r,i),l},xe=(s,r,i,l)=>{const v=i(s),x=i(r);return Ve(v,x,l)};class Ze{static get(r){return le.get(r)}static set(r,i){le.set(r,i)}static remove(r){le.remove(r)}}Array.prototype.distinct=function(s){const r=this;return s?r.filter((l,v,x)=>x.findIndex(T=>s(T,l))===v):r.filter((l,v,x)=>x.indexOf(l)===v)},Array.prototype.filterBy=function(s){return this.filter(r=>s(r))},Array.prototype.first=function(){return this?.length>0?this[0]:null},Array.prototype.groupBy=function(s){return this.reduce((r,i)=>{const l=s(i);return(r[l]=r[l]||[]).push(i),r},{})},Array.prototype.orderBy=function(s,r=!0){return this?.sort((i,l)=>xe(i,l,s,r)),this},Array.prototype.removeBy=function(s,r){return this.filter(i=>s(i)!==r)};var ke={exports:{}},Ge=ke.exports,Ce;function Xe(){return Ce||(Ce=1,(function(s,r){(function(i,l){s.exports=l()})(Ge,(function(){var i=1e3,l=6e4,v=36e5,x="millisecond",T="second",Y="minute",q="hour",w="day",H="week",W="month",ee="quarter",Q="year",G="date",te="Invalid Date",se=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,fe=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,me={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(m){var f=["th","st","nd","rd"],h=m%100;return"["+m+(f[(h-20)%10]||f[h]||f[0])+"]"}},ue=function(m,f,h){var a=String(m);return!a||a.length>=f?m:""+Array(f+1-a.length).join(h)+m},be={s:ue,z:function(m){var f=-m.utcOffset(),h=Math.abs(f),a=Math.floor(h/60),u=h%60;return(f<=0?"+":"-")+ue(a,2,"0")+":"+ue(u,2,"0")},m:function m(f,h){if(f.date()<h.date())return-m(h,f);var a=12*(h.year()-f.year())+(h.month()-f.month()),u=f.clone().add(a,W),c=h-u<0,y=f.clone().add(a+(c?-1:1),W);return+(-(a+(h-u)/(c?u-y:y-u))||0)},a:function(m){return m<0?Math.ceil(m)||0:Math.floor(m)},p:function(m){return{M:W,y:Q,w:H,d:w,D:G,h:q,m:Y,s:T,ms:x,Q:ee}[m]||String(m||"").toLowerCase().replace(/s$/,"")},u:function(m){return m===void 0}},ae="en",K={};K[ae]=me;var R="$isDayjsObject",e=function(m){return m instanceof g||!(!m||!m[R])},t=function m(f,h,a){var u;if(!f)return ae;if(typeof f=="string"){var c=f.toLowerCase();K[c]&&(u=c),h&&(K[c]=h,u=c);var y=f.split("-");if(!u&&y.length>1)return m(y[0])}else{var p=f.name;K[p]=f,u=p}return!a&&u&&(ae=u),u||!a&&ae},n=function(m,f){if(e(m))return m.clone();var h=typeof f=="object"?f:{};return h.date=m,h.args=arguments,new g(h)},o=be;o.l=t,o.i=e,o.w=function(m,f){return n(m,{locale:f.$L,utc:f.$u,x:f.$x,$offset:f.$offset})};var g=(function(){function m(h){this.$L=t(h.locale,null,!0),this.parse(h),this.$x=this.$x||h.x||{},this[R]=!0}var f=m.prototype;return f.parse=function(h){this.$d=(function(a){var u=a.date,c=a.utc;if(u===null)return new Date(NaN);if(o.u(u))return new Date;if(u instanceof Date)return new Date(u);if(typeof u=="string"&&!/Z$/i.test(u)){var y=u.match(se);if(y){var p=y[2]-1||0,_=(y[7]||"0").substring(0,3);return c?new Date(Date.UTC(y[1],p,y[3]||1,y[4]||0,y[5]||0,y[6]||0,_)):new Date(y[1],p,y[3]||1,y[4]||0,y[5]||0,y[6]||0,_)}}return new Date(u)})(h),this.init()},f.init=function(){var h=this.$d;this.$y=h.getFullYear(),this.$M=h.getMonth(),this.$D=h.getDate(),this.$W=h.getDay(),this.$H=h.getHours(),this.$m=h.getMinutes(),this.$s=h.getSeconds(),this.$ms=h.getMilliseconds()},f.$utils=function(){return o},f.isValid=function(){return this.$d.toString()!==te},f.isSame=function(h,a){var u=n(h);return this.startOf(a)<=u&&u<=this.endOf(a)},f.isAfter=function(h,a){return n(h)<this.startOf(a)},f.isBefore=function(h,a){return this.endOf(a)<n(h)},f.$g=function(h,a,u){return o.u(h)?this[a]:this.set(u,h)},f.unix=function(){return Math.floor(this.valueOf()/1e3)},f.valueOf=function(){return this.$d.getTime()},f.startOf=function(h,a){var u=this,c=!!o.u(a)||a,y=o.p(h),p=function(E,O){var k=o.w(u.$u?Date.UTC(u.$y,O,E):new Date(u.$y,O,E),u);return c?k:k.endOf(w)},_=function(E,O){return o.w(u.toDate()[E].apply(u.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(O)),u)},d=this.$W,M=this.$M,$=this.$D,B="set"+(this.$u?"UTC":"");switch(y){case Q:return c?p(1,0):p(31,11);case W:return c?p(1,M):p(0,M+1);case H:var j=this.$locale().weekStart||0,b=(d<j?d+7:d)-j;return p(c?$-b:$+(6-b),M);case w:case G:return _(B+"Hours",0);case q:return _(B+"Minutes",1);case Y:return _(B+"Seconds",2);case T:return _(B+"Milliseconds",3);default:return this.clone()}},f.endOf=function(h){return this.startOf(h,!1)},f.$set=function(h,a){var u,c=o.p(h),y="set"+(this.$u?"UTC":""),p=(u={},u[w]=y+"Date",u[G]=y+"Date",u[W]=y+"Month",u[Q]=y+"FullYear",u[q]=y+"Hours",u[Y]=y+"Minutes",u[T]=y+"Seconds",u[x]=y+"Milliseconds",u)[c],_=c===w?this.$D+(a-this.$W):a;if(c===W||c===Q){var d=this.clone().set(G,1);d.$d[p](_),d.init(),this.$d=d.set(G,Math.min(this.$D,d.daysInMonth())).$d}else p&&this.$d[p](_);return this.init(),this},f.set=function(h,a){return this.clone().$set(h,a)},f.get=function(h){return this[o.p(h)]()},f.add=function(h,a){var u,c=this;h=Number(h);var y=o.p(a),p=function(M){var $=n(c);return o.w($.date($.date()+Math.round(M*h)),c)};if(y===W)return this.set(W,this.$M+h);if(y===Q)return this.set(Q,this.$y+h);if(y===w)return p(1);if(y===H)return p(7);var _=(u={},u[Y]=l,u[q]=v,u[T]=i,u)[y]||1,d=this.$d.getTime()+h*_;return o.w(d,this)},f.subtract=function(h,a){return this.add(-1*h,a)},f.format=function(h){var a=this,u=this.$locale();if(!this.isValid())return u.invalidDate||te;var c=h||"YYYY-MM-DDTHH:mm:ssZ",y=o.z(this),p=this.$H,_=this.$m,d=this.$M,M=u.weekdays,$=u.months,B=u.meridiem,j=function(O,k,A,F){return O&&(O[k]||O(a,c))||A[k].slice(0,F)},b=function(O){return o.s(p%12||12,O,"0")},E=B||function(O,k,A){var F=O<12?"AM":"PM";return A?F.toLowerCase():F};return c.replace(fe,(function(O,k){return k||(function(A){switch(A){case"YY":return String(a.$y).slice(-2);case"YYYY":return o.s(a.$y,4,"0");case"M":return d+1;case"MM":return o.s(d+1,2,"0");case"MMM":return j(u.monthsShort,d,$,3);case"MMMM":return j($,d);case"D":return a.$D;case"DD":return o.s(a.$D,2,"0");case"d":return String(a.$W);case"dd":return j(u.weekdaysMin,a.$W,M,2);case"ddd":return j(u.weekdaysShort,a.$W,M,3);case"dddd":return M[a.$W];case"H":return String(p);case"HH":return o.s(p,2,"0");case"h":return b(1);case"hh":return b(2);case"a":return E(p,_,!0);case"A":return E(p,_,!1);case"m":return String(_);case"mm":return o.s(_,2,"0");case"s":return String(a.$s);case"ss":return o.s(a.$s,2,"0");case"SSS":return o.s(a.$ms,3,"0");case"Z":return y}return null})(O)||y.replace(":","")}))},f.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},f.diff=function(h,a,u){var c,y=this,p=o.p(a),_=n(h),d=(_.utcOffset()-this.utcOffset())*l,M=this-_,$=function(){return o.m(y,_)};switch(p){case Q:c=$()/12;break;case W:c=$();break;case ee:c=$()/3;break;case H:c=(M-d)/6048e5;break;case w:c=(M-d)/864e5;break;case q:c=M/v;break;case Y:c=M/l;break;case T:c=M/i;break;default:c=M}return u?c:o.a(c)},f.daysInMonth=function(){return this.endOf(W).$D},f.$locale=function(){return K[this.$L]},f.locale=function(h,a){if(!h)return this.$L;var u=this.clone(),c=t(h,a,!0);return c&&(u.$L=c),u},f.clone=function(){return o.w(this.$d,this)},f.toDate=function(){return new Date(this.valueOf())},f.toJSON=function(){return this.isValid()?this.toISOString():null},f.toISOString=function(){return this.$d.toISOString()},f.toString=function(){return this.$d.toUTCString()},m})(),S=g.prototype;return n.prototype=S,[["$ms",x],["$s",T],["$m",Y],["$H",q],["$W",w],["$M",W],["$y",Q],["$D",G]].forEach((function(m){S[m[1]]=function(f){return this.$g(f,m[0],m[1])}})),n.extend=function(m,f){return m.$i||(m(f,g,n),m.$i=!0),n},n.locale=t,n.isDayjs=e,n.unix=function(m){return n(1e3*m)},n.en=K[ae],n.Ls=K,n.p={},n}))})(ke)),ke.exports}var et=Xe();const Z=Se(et);var ve={exports:{}},tt=ve.exports,$e;function rt(){return $e||($e=1,(function(s,r){(function(i,l){s.exports=l()})(tt,(function(){var i={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(l,v,x){var T=v.prototype,Y=T.format;x.en.formats=i,T.format=function(q){q===void 0&&(q="YYYY-MM-DDTHH:mm:ssZ");var w=this.$locale().formats,H=(function(W,ee){return W.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(Q,G,te){var se=te&&te.toUpperCase();return G||ee[te]||i[te]||ee[se].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(fe,me,ue){return me||ue.slice(1)}))}))})(q,w===void 0?{}:w);return Y.call(this,H)}}}))})(ve)),ve.exports}var nt=rt();const it=Se(nt);Z.extend(it),Date.prototype.isAfter=function(s,r){return Z(this).isAfter(s,r)},Date.prototype.isBefore=function(s,r){return Z(this).isBefore(s,r)},Date.prototype.format=function(s){return Z(this).format(s)},Date.prototype.isValid=function(){return Z(this).isValid()},Date.prototype.add=function(s,r){return Z(this).add(s,r).toDate()},Date.prototype.subtract=function(s,r){return Z(this).subtract(s,r).toDate()},Date.prototype.firstDayOfMonth=function(){return Z(this).startOf("month").toDate()},Date.prototype.lastDayOfMonth=function(){return Z(this).endOf("month").toDate()},Date.prototype.set=function(s,r){return Z(this).set(s,r).toDate()},Date.prototype.diff=function(s,r){return Z(this).diff(s,r)},Date.prototype.startOf=function(s){return Z(this).startOf(s).toDate()},Date.prototype.endOf=function(s){return Z(this).endOf(s).toDate()},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.isNumber=function(){return!isNaN(Number(this))&&this.trim()!==""},String.prototype.isEmpty=function(){return this===void 0||!this||this.length===0};const Re={xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1400,xxxl:1600};class st{screenBreakpoints;screenWidth=0;lastBreakpoint;resizeListener;breakpointChangeCallbacks=new Set;onResizeCallbacks=new Set;rafId=null;emitTimeoutId=null;pendingWidth;pendingBreakpoint;duplicateThresholdMs=60;constructor(r){typeof window<"u"&&(this.screenBreakpoints=r||Re,this.screenWidth=window.innerWidth,this.resizeListener=this.onResize.bind(this),window.addEventListener("resize",this.resizeListener,{passive:!0}),this.lastBreakpoint=this.getBreakpointByScreenWidth(this.screenWidth))}destroy(){typeof window<"u"&&window.removeEventListener("resize",this.resizeListener),this.breakpointChangeCallbacks.clear(),this.onResizeCallbacks.clear(),this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}getCurrentScreenWidth(){return this.screenWidth}getCurrentBreakpoint(){return this.lastBreakpoint}onBreakpointChange(r){this.breakpointChangeCallbacks.add(r)}offBreakpointChange(r){this.breakpointChangeCallbacks.delete(r)}onResizeChange(r){this.onResizeCallbacks.add(r)}offResizeChange(r){this.onResizeCallbacks.delete(r)}getBreakpointByScreenWidth(r=this.screenWidth){let i="xs";for(const l of Object.keys(this.screenBreakpoints))this.screenBreakpoints[l]<=r&&(i=l);return{breakpoint:i,screenWidth:this.screenBreakpoints[i]}}isScreenGreaterThan(r){return this.screenWidth>this.screenBreakpoints[r]}isScreenSmallerThan(r){return this.screenWidth<this.screenBreakpoints[r]}getBreakpoint(r){return{breakpoint:r,screenWidth:this.screenBreakpoints[r]}}onResize=()=>{if(typeof window>"u")return;const r=window.innerWidth,i=this.getBreakpointByScreenWidth(r);this.lastBreakpoint?.breakpoint!==i?.breakpoint&&(this.lastBreakpoint=i,i&&this.breakpointChangeCallbacks.forEach(l=>l(i))),this.pendingWidth=r,this.pendingBreakpoint=i,this.emitTimeoutId&&clearTimeout(this.emitTimeoutId),this.emitTimeoutId=window.setTimeout(()=>{this.pendingBreakpoint&&this.onResizeCallbacks.forEach(l=>l(this.pendingWidth,this.pendingBreakpoint)),this.pendingWidth=void 0,this.pendingBreakpoint=void 0,this.emitTimeoutId=null},this.duplicateThresholdMs)}}P.BrowserService=st,P.CsvHelper=We,P.EnumHelper=qe,P.FileHelper=He,P.LocalStorageHelper=le,P.LoggerHelper=N,P.LoggerType=he,P.ScreenBreakpoints=Re,P.TokenHelper=Ze,P.copyToClipboard=ge,P.saveAs=Oe,P.sortHelper=xe,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyvalue.interface.d.ts","sourceRoot":"","sources":["../../../lib/interfaces/keyvalue.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;CACT"}
|
package/package.json
CHANGED
package/readme.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @oardi/ts-utils
|
|
2
|
+
|
|
3
|
+
Powerful set of Typescript Utility Extension Methods, Helpers, Interfaces, Services and Types.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Install npm package
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm i @oardi/ts-utils
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### about
|
|
14
|
+
|
|
15
|
+
Developed and maintained by [Ardian Shala](https://github.com/oardi)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.consts.d.ts","sourceRoot":"","sources":["../../../../lib/services/browser/browser.consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAQlD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.interface.d.ts","sourceRoot":"","sources":["../../../../lib/services/browser/browser.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Size } from '../../types';
|
|
2
|
+
import { IScreenBreakpoint } from './browser.interface';
|
|
3
|
+
import { OnResizeCallback, ResizeCallback } from './browser.types';
|
|
4
|
+
export declare class BrowserService {
|
|
5
|
+
private screenBreakpoints;
|
|
6
|
+
private screenWidth;
|
|
7
|
+
private lastBreakpoint;
|
|
8
|
+
private resizeListener;
|
|
9
|
+
private breakpointChangeCallbacks;
|
|
10
|
+
private onResizeCallbacks;
|
|
11
|
+
private rafId;
|
|
12
|
+
private emitTimeoutId;
|
|
13
|
+
private pendingWidth?;
|
|
14
|
+
private pendingBreakpoint?;
|
|
15
|
+
private duplicateThresholdMs;
|
|
16
|
+
constructor(screenBreakpoints?: Record<Size, number>);
|
|
17
|
+
destroy(): void;
|
|
18
|
+
getCurrentScreenWidth(): number;
|
|
19
|
+
getCurrentBreakpoint(): IScreenBreakpoint;
|
|
20
|
+
onBreakpointChange(callback: ResizeCallback): void;
|
|
21
|
+
offBreakpointChange(callback: ResizeCallback): void;
|
|
22
|
+
onResizeChange(callback: OnResizeCallback): void;
|
|
23
|
+
offResizeChange(callback: OnResizeCallback): void;
|
|
24
|
+
getBreakpointByScreenWidth(width?: number): IScreenBreakpoint;
|
|
25
|
+
isScreenGreaterThan(size: Size): boolean;
|
|
26
|
+
isScreenSmallerThan(size: Size): boolean;
|
|
27
|
+
getBreakpoint(size: Size): IScreenBreakpoint;
|
|
28
|
+
private onResize;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=browser.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.service.d.ts","sourceRoot":"","sources":["../../../../lib/services/browser/browser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAInE,qBAAa,cAAc;IAC1B,OAAO,CAAC,iBAAiB,CAAwB;IACjD,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,yBAAyB,CAAkC;IACnE,OAAO,CAAC,iBAAiB,CAAoC;IAC7D,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,iBAAiB,CAAC,CAAoB;IAC9C,OAAO,CAAC,oBAAoB,CAAM;gBAEtB,iBAAiB,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;IAY7C,OAAO,IAAI,IAAI;IAYf,qBAAqB,IAAI,MAAM;IAI/B,oBAAoB,IAAI,iBAAiB;IAIzC,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIlD,mBAAmB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAInD,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIhD,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIjD,0BAA0B,CAAC,KAAK,GAAE,MAAyB,GAAG,iBAAiB;IAU/E,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAIxC,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAIxC,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,iBAAiB;IAOnD,OAAO,CAAC,QAAQ,CAwBd;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.types.d.ts","sourceRoot":"","sources":["../../../../lib/services/browser/browser.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;AACrE,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/services/browser/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type Dictionary<T> = Record<string, T>;
|
|
2
|
+
export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl';
|
|
3
|
+
declare global {
|
|
4
|
+
export type UnknownObject = any;
|
|
5
|
+
export type Nullable<T> = T | null;
|
|
6
|
+
export type Optional<T> = T | undefined;
|
|
7
|
+
export const InstallTrigger: unknown;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAE9C,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;AAErE,OAAO,CAAC,MAAM,CAAC;IAEd,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC;IAChC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACxC,MAAM,CAAC,MAAM,cAAc,EAAE,OAAO,CAAC;CACrC"}
|
package/vite.config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["../../lib/vite.config.ts"],"names":[],"mappings":";AAGA,wBAiBG"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { sortHelper } from '../helpers';
|
|
2
|
-
import { Dictionary } from '../types';
|
|
3
|
-
|
|
4
|
-
export {};
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
interface Array<T> {
|
|
8
|
-
distinct<T>(comparator?: (obj1: unknown, obj2: unknown) => boolean): T[];
|
|
9
|
-
filterBy<T>(valueGetter: (a: T) => boolean): T[];
|
|
10
|
-
first(): T;
|
|
11
|
-
groupBy(valueGetter: (a: T) => string): Dictionary<T[]>;
|
|
12
|
-
orderBy<T, G>(valueGetter: (a: T) => G, ascending?: boolean): T[];
|
|
13
|
-
removeBy<T, G>(valueGetter: (a: T) => G, val: G): T[];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
Array.prototype.distinct = function <T>(comparator?: (obj1: unknown, obj2: unknown) => boolean): T[] {
|
|
18
|
-
const thisAsArray: T[] = this as T[];
|
|
19
|
-
const result: T[] = comparator
|
|
20
|
-
? thisAsArray.filter((value, index, array) => array.findIndex((o) => comparator(o, value)) === index)
|
|
21
|
-
: thisAsArray.filter((value, index, array) => array.indexOf(value) === index);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
Array.prototype.filterBy = function <T>(valueGetter: (a: T) => boolean): T[] {
|
|
26
|
-
return this.filter((obj) => {
|
|
27
|
-
return valueGetter(obj);
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
Array.prototype.first = function <T>(): Nullable<T> {
|
|
32
|
-
return this?.length > 0 ? this[0] : null;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
Array.prototype.groupBy = function <T>(valueGetter: (a: T) => string): Dictionary<T> {
|
|
36
|
-
return this.reduce((curr, obj) => {
|
|
37
|
-
const key: string = valueGetter(obj);
|
|
38
|
-
(curr[key] = curr[key] || []).push(obj);
|
|
39
|
-
return curr;
|
|
40
|
-
}, {});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
Array.prototype.orderBy = function <T, G>(valueGetter: (a: T) => G, ascending: boolean = true): T[] {
|
|
44
|
-
this?.sort((a, b) => sortHelper(a, b, valueGetter, ascending));
|
|
45
|
-
return this;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
Array.prototype.removeBy = function <T, G>(valueGetter: (a: T) => G, val: G): T[] {
|
|
49
|
-
return this.filter((curr) => {
|
|
50
|
-
const key: G = valueGetter(curr);
|
|
51
|
-
// change to split to remove only first item found
|
|
52
|
-
return key !== val;
|
|
53
|
-
});
|
|
54
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { ConfigType, ManipulateType, OpUnitType, UnitType } from 'dayjs';
|
|
2
|
-
import dayjs from 'dayjs';
|
|
3
|
-
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
4
|
-
dayjs.extend(localizedFormat);
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
interface Date {
|
|
8
|
-
isAfter(date: ConfigType, unit?: OpUnitType): boolean;
|
|
9
|
-
isBefore(date: ConfigType, unit?: OpUnitType): boolean;
|
|
10
|
-
format(template?: string): string;
|
|
11
|
-
isValid(): boolean;
|
|
12
|
-
add(value: number, unit?: ManipulateType): Date;
|
|
13
|
-
subtract(value: number, unit?: ManipulateType): Date;
|
|
14
|
-
firstDayOfMonth(): Date;
|
|
15
|
-
lastDayOfMonth(): Date;
|
|
16
|
-
set(unit: UnitType, value: number): Date;
|
|
17
|
-
diff(date: Date, unit?: UnitType): number;
|
|
18
|
-
startOf(unit: UnitType): Date;
|
|
19
|
-
endOf(unit: UnitType): Date;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Date.prototype.isAfter = function (date: dayjs.ConfigType, unit?: dayjs.OpUnitType): boolean {
|
|
24
|
-
return dayjs(this).isAfter(date, unit);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
Date.prototype.isBefore = function (date: dayjs.ConfigType, unit?: dayjs.OpUnitType): boolean {
|
|
28
|
-
return dayjs(this).isBefore(date, unit);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
Date.prototype.format = function (template?: string): string {
|
|
32
|
-
return dayjs(this).format(template);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
Date.prototype.isValid = function (): boolean {
|
|
36
|
-
return dayjs(this).isValid();
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
Date.prototype.add = function (value: number, unit?: ManipulateType): Date {
|
|
40
|
-
return dayjs(this).add(value, unit).toDate();
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
Date.prototype.subtract = function (value: number, unit?: ManipulateType): Date {
|
|
44
|
-
return dayjs(this).subtract(value, unit).toDate();
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
Date.prototype.firstDayOfMonth = function (): Date {
|
|
48
|
-
return dayjs(this).startOf('month').toDate();
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
Date.prototype.lastDayOfMonth = function (): Date {
|
|
52
|
-
return dayjs(this).endOf('month').toDate();
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
Date.prototype.set = function (unit: UnitType, value: number): Date {
|
|
56
|
-
return dayjs(this).set(unit, value).toDate();
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
Date.prototype.diff = function (date: Date, unit?: UnitType): number {
|
|
60
|
-
return dayjs(this).diff(date, unit);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
Date.prototype.startOf = function (unit: UnitType): Date {
|
|
64
|
-
return dayjs(this).startOf(unit).toDate();
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
Date.prototype.endOf = function (unit: UnitType): Date {
|
|
68
|
-
return dayjs(this).endOf(unit).toDate();
|
|
69
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
interface String {
|
|
5
|
-
capitalize(): string;
|
|
6
|
-
isNumber(): boolean;
|
|
7
|
-
isEmpty(): boolean;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
String.prototype.capitalize = function (): string {
|
|
12
|
-
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
String.prototype.isNumber = function (): boolean {
|
|
16
|
-
return !isNaN(Number(this)) && this.trim() !== '';
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
String.prototype.isEmpty = function (): boolean {
|
|
20
|
-
return this === undefined || !this || this.length === 0;
|
|
21
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export enum BrowserType {
|
|
2
|
-
opera = 'opera',
|
|
3
|
-
firefox = 'firefox',
|
|
4
|
-
safari = 'safari',
|
|
5
|
-
ie = 'ie',
|
|
6
|
-
edge = 'edge',
|
|
7
|
-
edg = 'edg',
|
|
8
|
-
electron = 'electron',
|
|
9
|
-
chrome = 'chrome',
|
|
10
|
-
iOsSafari = 'iOsSafari',
|
|
11
|
-
edgiOs = 'edgiOs',
|
|
12
|
-
headlessChrome = 'headlessChrome',
|
|
13
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { BrowserType } from './browser-type.enum';
|
|
2
|
-
|
|
3
|
-
export class BrowserHelper {
|
|
4
|
-
static isOpera(): boolean {
|
|
5
|
-
return (
|
|
6
|
-
typeof window !== 'undefined' &&
|
|
7
|
-
((!!(window as any).opr && !!(window as any).opr.addons) ||
|
|
8
|
-
!!(window as any).opera ||
|
|
9
|
-
navigator.userAgent.includes('OPR/'))
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
static isFirefox(): boolean {
|
|
14
|
-
return typeof (globalThis as any).InstallTrigger !== 'undefined';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
static isSafari(): boolean {
|
|
18
|
-
if (typeof window === 'undefined') return false;
|
|
19
|
-
return (
|
|
20
|
-
/constructor/i.test((window as any).HTMLElement) ||
|
|
21
|
-
((p: any) => p.toString() === '[object SafariRemoteNotification]')(
|
|
22
|
-
!(window as any)['safari'] || ((window as any)['safari'] && (window as any)['safari'].pushNotification)
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static isEdge(): boolean {
|
|
28
|
-
if (typeof window === 'undefined') return false;
|
|
29
|
-
return !BrowserHelper.isIE() && !!(window as any).StyleMedia;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static isIE(): boolean {
|
|
33
|
-
if (typeof document === 'undefined') return false;
|
|
34
|
-
return !!(document as any).documentMode;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static isEdg(): boolean {
|
|
38
|
-
if (typeof navigator === 'undefined') return false;
|
|
39
|
-
return navigator.userAgent.toLowerCase().includes('edg');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
static isElectron(userAgentLower: string): boolean {
|
|
43
|
-
return userAgentLower.includes('electron');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
static isChrome(): boolean {
|
|
47
|
-
if (typeof window === 'undefined') return false;
|
|
48
|
-
return (
|
|
49
|
-
!!(window as any).chrome &&
|
|
50
|
-
!BrowserHelper.isOpera() &&
|
|
51
|
-
!BrowserHelper.isEdge() &&
|
|
52
|
-
!BrowserHelper.isEdg() &&
|
|
53
|
-
!BrowserHelper.isFirefox() &&
|
|
54
|
-
!BrowserHelper.isSafari() &&
|
|
55
|
-
!BrowserHelper.isIE()
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static isIOsSafari(userAgentLower: string): boolean {
|
|
60
|
-
return (
|
|
61
|
-
userAgentLower.includes('iphone') ||
|
|
62
|
-
userAgentLower.includes('ipad') ||
|
|
63
|
-
(userAgentLower.includes('macintosh') &&
|
|
64
|
-
typeof document !== 'undefined' &&
|
|
65
|
-
'ontouchend' in document &&
|
|
66
|
-
userAgentLower.includes('safari'))
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static isEdgiOs(userAgentLower: string): boolean {
|
|
71
|
-
return userAgentLower.includes('edgios');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static isHeadlessChrome(userAgentLower: string): boolean {
|
|
75
|
-
return userAgentLower.includes('headlesschrome');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public getCurrentBrowser(): BrowserType {
|
|
79
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
80
|
-
|
|
81
|
-
if (BrowserHelper.isOpera()) return BrowserType.opera;
|
|
82
|
-
if (BrowserHelper.isFirefox()) return BrowserType.firefox;
|
|
83
|
-
if (BrowserHelper.isSafari()) return BrowserType.safari;
|
|
84
|
-
if (BrowserHelper.isIE()) return BrowserType.ie;
|
|
85
|
-
if (BrowserHelper.isEdge()) return BrowserType.edge;
|
|
86
|
-
if (BrowserHelper.isEdg()) return BrowserType.edg;
|
|
87
|
-
if (BrowserHelper.isElectron(userAgent)) return BrowserType.electron;
|
|
88
|
-
if (BrowserHelper.isChrome()) return BrowserType.chrome;
|
|
89
|
-
if (BrowserHelper.isIOsSafari(userAgent)) return BrowserType.iOsSafari;
|
|
90
|
-
if (BrowserHelper.isEdgiOs(userAgent)) return BrowserType.edgiOs;
|
|
91
|
-
if (BrowserHelper.isHeadlessChrome(userAgent)) return BrowserType.headlessChrome;
|
|
92
|
-
|
|
93
|
-
throw new Error('Browser could not be detected: ' + userAgent);
|
|
94
|
-
}
|
|
95
|
-
}
|
package/helpers/csv.helper.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ParseResult, UnparseConfig, UnparseObject } from 'papaparse';
|
|
2
|
-
import pkg from 'papaparse';
|
|
3
|
-
const { parse, unparse } = pkg;
|
|
4
|
-
|
|
5
|
-
export class CsvHelper {
|
|
6
|
-
static unparse<T>(data: T[] | UnparseObject<T>, config?: UnparseConfig): string {
|
|
7
|
-
return unparse(data, config);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
static parse<T>(content: string | File): Promise<ParseResult<T>> {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
parse(content, {
|
|
13
|
-
header: true,
|
|
14
|
-
complete: (results: ParseResult<T>) => resolve(results),
|
|
15
|
-
error: (err: Error) => reject(err),
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// usage
|
|
22
|
-
// const csvData: string = CsvHelper.unparse(data);
|
|
23
|
-
// const result: ParseResult<TranslationCsvDataModel> = CsvHelper.parse(file);
|