utilzify 1.7.1 → 1.7.3
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/lib/browser/bundle.iife.js +1 -1
- package/lib/browser/bundle.umd.js +1 -1
- package/lib/cjs/utils/extract-error-message.d.ts.map +1 -1
- package/lib/cjs/utils/extract-error-message.js +1 -1
- package/lib/cjs/utils/mappers.js +1 -1
- package/lib/esm/utils/extract-error-message.d.ts.map +1 -1
- package/lib/esm/utils/extract-error-message.js +1 -1
- package/lib/esm/utils/mappers.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var utilzify=function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),a=n(r);const s=()=>"undefined"!=typeof window&&"undefined"!=typeof document,i=()=>"undefined"!=typeof process&&Boolean(process.versions?.node),c=e=>{const t=s(),r=i();if("frontend"===e&&!t)throw new Error("This function can only be used in a frontend environment.");if("backend"===e&&!r)throw new Error("This function can only be used in a backend environment.");return"frontend"===e?t:r},l=[{name:"Chrome",tokens:["Chrome","Safari"],prefix:"Mozilla/5.0"},{name:"Firefox",tokens:["Gecko"],prefix:"Mozilla/5.0"},{name:"Opera",tokens:["Presto"],prefix:"Opera/9.80"},{name:"Edge",tokens:["Edg"],prefix:"Mozilla/5.0"},{name:"Safari",tokens:["Version","Safari"],prefix:"Mozilla/5.0"},{name:"IE",tokens:["MSIE","Trident"],prefix:"Mozilla/4.0"}],u=["Windows NT 10.0","Windows NT 6.1","Windows 3.1","Macintosh; Intel Mac OS X 10_15_7","X11; Linux x86_64","X11; Ubuntu; Linux i686","Android 12; Mobile","Android 11; Tablet","iPhone; CPU iPhone OS 16_6 like Mac OS X","iPad; CPU OS 15_4 like Mac OS X"],f=["en","ru","de","fr","es","it","pl","ko","ja","tr"],d=["Trident","Gecko","Presto","Blink"],p=["WOW64","Win64; x64",".NET CLR 3.5.30729","SLCC2","InfoPath.3","Media Center PC 6.0","Tablet PC 2.0"],h=["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","application/json, text/plain, */*"],m=["google.com","bing.com","yandex.ru","duckduckgo.com","example.com","wikipedia.org"],g=e=>e[Math.floor(Math.random()*e.length)],y=()=>`${g([13,14,15,16,17,18,19,20])}.${Math.floor(256*Math.random())}.${Math.floor(256*Math.random())}.${Math.floor(1+254*Math.random())}`,v=(e=15)=>`${Math.floor(Math.random()*e)+1}.${Math.floor(10*Math.random())}`,b=e=>{const t=[];for(let r=0;r<e;r++){const e=g(l),r=g(u),n=g(f),o=g(d),a=v(),s=g(e.tokens),i=Math.random()>.5?`; ${g(p)}`:"",c="IE"===e.name?`${e.prefix} (compatible; ${s} ${a}; ${r}${i}; ${n})`:`${e.prefix} (${r}${i}; ${n}) ${s}/${a} ${o}/${v(5)}`;t.push(c)}return Array.from(new Set(t))},w=(e={},t=[])=>{const r=new Set(["host","connection","content-length","sec-ch-ua-platform","sec-ch-ua","sec-ch-ua-mobile","user-agent","origin","sec-fetch-site","sec-fetch-mode","sec-fetch-dest","referer","cookie","accept-encoding","if-none-match",...t.map((e=>e.toLowerCase()))]);for(const t of Object.keys(e)){const n=t.toLowerCase(),o=n.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("-");(r.has(n)||r.has(o.toLowerCase()))&&delete e[t]}return e},x=b(200),_=()=>{const e={},t=!s();return e.Accept||(e.Accept=g(h)),e.Connection||(e.Connection="keep-alive"),e["User-Agent"]||e["user-agent"]||!t||(e["User-Agent"]=g(x)),!e.Referer&&t&&(e.Referer=(()=>{const e=g(m),t=g(["","search","images","news","video","docs"]),r=Math.random()>.5?`?q=test${Math.floor(1e3*Math.random())}`:"";return`${Math.random()>.5?"https":"http"}://www.${e}/${t}${r}`})()),!e["X-Forwarded-For"]&&t&&(e["X-Forwarded-For"]=y()),!e["Cache-Control"]&&t&&(e["Cache-Control"]="max-age=0"),e};const $=e=>/^(\d{1,3}(,\d{2})*(\.\d+)?)$/.test(e)||/^(\d{1,3}(,\d{3})*(\.\d+)?)$/.test(e),S=e=>parseFloat(e.replace(/,/g,"")),E=e=>parseFloat(e.replace(/\./g,"").replace(",",".")),M=(e,t=0)=>null==e?t:"number"==typeof e?e:e&&"string"==typeof e&&/[\d,.]/.test(e)?(e=e.replace(/\s/g,"").trim(),$(e)?S(e):e.includes(",")?E(e):e.includes(".")||!e.includes(",")?parseFloat(e.replace(/,/g,"")):t):t,j=(e=Date.now(),t="DD/MM/YYYY HH:mm:ss")=>{const r=o.default(e);return r.isValid()?r.format(t):""},C=e=>e.replace(/<[^>]*>/g,"").trim();var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O=Array.isArray,N="object"==typeof T&&T&&T.Object===Object&&T,A="object"==typeof self&&self&&self.Object===Object&&self,F=N||A||Function("return this")(),P=F.Symbol,D=P,R=Object.prototype,I=R.hasOwnProperty,L=R.toString,U=D?D.toStringTag:void 0;var z=function(e){var t=I.call(e,U),r=e[U];try{e[U]=void 0;var n=!0}catch(e){}var o=L.call(e);return n&&(t?e[U]=r:delete e[U]),o},B=Object.prototype.toString;var W=z,X=function(e){return B.call(e)},q=P?P.toStringTag:void 0;var G=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":q&&q in Object(e)?W(e):X(e)};var H=G,J=function(e){return null!=e&&"object"==typeof e};var V=function(e){return"symbol"==typeof e||J(e)&&"[object Symbol]"==H(e)},Y=O,K=V,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/;var ee=function(e,t){if(Y(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!K(e))||(Q.test(e)||!Z.test(e)||null!=t&&e in Object(t))};var te=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},re=G,ne=te;var oe,ae=function(e){if(!ne(e))return!1;var t=re(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},se=F["__core-js_shared__"],ie=(oe=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||""))?"Symbol(src)_1."+oe:"";var ce=function(e){return!!ie&&ie in e},le=Function.prototype.toString;var ue=ae,fe=ce,de=te,pe=function(e){if(null!=e){try{return le.call(e)}catch(e){}try{return e+""}catch(e){}}return""},he=/^\[object .+?Constructor\]$/,me=Function.prototype,ge=Object.prototype,ye=me.toString,ve=ge.hasOwnProperty,be=RegExp("^"+ye.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var we=function(e){return!(!de(e)||fe(e))&&(ue(e)?be:he).test(pe(e))},xe=function(e,t){return null==e?void 0:e[t]};var _e=function(e,t){var r=xe(e,t);return we(r)?r:void 0},$e=_e(Object,"create"),Se=$e;var Ee=function(){this.__data__=Se?Se(null):{},this.size=0};var Me=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},je=$e,Ce=Object.prototype.hasOwnProperty;var Te=function(e){var t=this.__data__;if(je){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ce.call(t,e)?t[e]:void 0},ke=$e,Oe=Object.prototype.hasOwnProperty;var Ne=$e;var Ae=Ee,Fe=Me,Pe=Te,De=function(e){var t=this.__data__;return ke?void 0!==t[e]:Oe.call(t,e)},Re=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ne&&void 0===t?"__lodash_hash_undefined__":t,this};function Ie(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ie.prototype.clear=Ae,Ie.prototype.delete=Fe,Ie.prototype.get=Pe,Ie.prototype.has=De,Ie.prototype.set=Re;var Le=Ie;var Ue=function(){this.__data__=[],this.size=0};var ze=function(e,t){return e===t||e!=e&&t!=t};var Be=function(e,t){for(var r=e.length;r--;)if(ze(e[r][0],t))return r;return-1},We=Be,Xe=Array.prototype.splice;var qe=Be;var Ge=Be;var He=Be;var Je=Ue,Ve=function(e){var t=this.__data__,r=We(t,e);return!(r<0)&&(r==t.length-1?t.pop():Xe.call(t,r,1),--this.size,!0)},Ye=function(e){var t=this.__data__,r=qe(t,e);return r<0?void 0:t[r][1]},Ke=function(e){return Ge(this.__data__,e)>-1},Ze=function(e,t){var r=this.__data__,n=He(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Qe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Qe.prototype.clear=Je,Qe.prototype.delete=Ve,Qe.prototype.get=Ye,Qe.prototype.has=Ke,Qe.prototype.set=Ze;var et=Qe,tt=_e(F,"Map"),rt=Le,nt=et,ot=tt;var at=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var st=function(e,t){var r=e.__data__;return at(t)?r["string"==typeof t?"string":"hash"]:r.map},it=st;var ct=st;var lt=st;var ut=st;var ft=function(){this.size=0,this.__data__={hash:new rt,map:new(ot||nt),string:new rt}},dt=function(e){var t=it(this,e).delete(e);return this.size-=t?1:0,t},pt=function(e){return ct(this,e).get(e)},ht=function(e){return lt(this,e).has(e)},mt=function(e,t){var r=ut(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function gt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}gt.prototype.clear=ft,gt.prototype.delete=dt,gt.prototype.get=pt,gt.prototype.has=ht,gt.prototype.set=mt;var yt=gt;function vt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return r.cache=a.set(o,s)||a,s};return r.cache=new(vt.Cache||yt),r}vt.Cache=yt;var bt=vt;var wt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xt=/\\(\\)?/g,_t=function(e){var t=bt(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(wt,(function(e,r,n,o){t.push(n?o.replace(xt,"$1"):r||e)})),t}));var $t=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},St=O,Et=V,Mt=P?P.prototype:void 0,jt=Mt?Mt.toString:void 0;var Ct=function e(t){if("string"==typeof t)return t;if(St(t))return $t(t,e)+"";if(Et(t))return jt?jt.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r},Tt=Ct;var kt=O,Ot=ee,Nt=_t,At=function(e){return null==e?"":Tt(e)};var Ft=V;var Pt=function(e,t){return kt(e)?e:Ot(e,t)?[e]:Nt(At(e))},Dt=function(e){if("string"==typeof e||Ft(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Rt=function(e,t){for(var r=0,n=(t=Pt(t,e)).length;null!=e&&r<n;)e=e[Dt(t[r++])];return r&&r==n?e:void 0};var It=k((function(e,t,r){var n=null==e?void 0:Rt(e,t);return void 0===n?r:n}));const Lt={columnIndexCache:new Map,columnNameCache:new Map};function Ut(e){const t=e.toUpperCase();if(Lt.columnIndexCache.has(t))return Lt.columnIndexCache.get(t);let r=0;for(let e=0;e<t.length;e++)r=26*r+(t.charCodeAt(e)-65+1);const n=r-1;return Lt.columnIndexCache.set(t,n),n}const zt={getStr(e=[],t,r=""){const n=It(e,`[${t}]`,"");return"number"==typeof n?String(n):String(n||r).trim()},getNum(e=[],t,r=0){const n=String(It(e,`[${t}]`,"")).replace(/\s/g,"");if(!n)return r;const o=Number(n);return isNaN(o)?r:o},getBool(e=[],t,r=!1){if(!Array.isArray(e))return r;const n=It(e,`[${t}]`,r);return["TRUE","FALSE"].includes(n)?"TRUE"===n:"boolean"==typeof n?n:r},getPrice(e=[],t){const r=this.getStr(e,t);if(!r)return 0;const n=M(r);return isNaN(n)?0:n},getDate(e=[],t,r){const n=this.getStr(e,t);if(!n)return null;return o.default(n,r).toDate()},getDateFormatted(e=[],t,r,n){const a=this.getStr(e,t);if(!a)return null;const s=o.default(a);return r?j(s.toDate(),r):j(s.toDate())}},Bt={getStr(e=[],t,r=""){const n=Ut(t),o=It(e,`[${n}]`,"");return"number"==typeof o?String(o):String(o||r).trim()},getNum(e=[],t,r=0){const n=Ut(t),o=String(It(e,`[${n}]`,"")).replace(/\s/g,"");if(!o)return r;const a=Number(o);return isNaN(a)?r:a},getBool(e=[],t,r=!1){const n=Ut(t);if(!Array.isArray(e))return r;const o=It(e,`[${n}]`,r);return["TRUE","FALSE"].includes(o)?"TRUE"===o:"boolean"==typeof o?o:r},getPrice(e=[],t){const r=this.getStr(e,t);if(!r)return 0;const n=M(r);return isNaN(n)?0:n},getDate(e=[],t,r){const n=this.getStr(e,t);if(!n)return null;return o.default(n,r).toDate()},getDateFormatted(e=[],t,r,n){const a=this.getStr(e,t);if(!a)return null;const s=o.default(a);return r?j(s.toDate(),r):j(s.toDate())}},Wt=(e,t)=>{const r=Math.floor(e/1e3),n=Math.floor(r/60),o=Math.floor(n/60),a=r%60;switch(t){case"ms":return`${e} millisoniya`;case"s":return`${(e/1e3).toFixed(2)} soniya`;case"min":return`${(e/6e4).toFixed(2)} daqiqa`;default:return`${o>0?`${o} soat `:""}${n%60>0?n%60+" daqiqa ":""}${(a>0?`${a} soniya`:"")||"0 soniya"}`.trim()}},Xt=(e,t)=>{const r=t.split(".");let n=e;for(const e of r){if(!n&&"number"!=typeof n)return;n=n[e]}return n},qt=(e,t)=>{if(c("frontend"),window.navigator){const r=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=r,n.download=t,document.body.appendChild(n),n.click(),setTimeout((()=>{window.URL.revokeObjectURL(r),document.body.removeChild(n)}),1e3)}};const Gt=["err.cause.message","detailMessage","error_description","error.message","description","msg","message","error","errors","errorDetails","errorMessage","error_type","errorMsg","errorMessages","error_info","error_info.message","error_info.error_message","error_info.details","data.message","response.message","response.error_message","response.details","httpError","validationError","status_description","messages","alert_message","alert","userMessage","user_error","client_error","response.data.error","response.data.message","response.data.error_description","response.data.details","errorMessages[*].message","errors[*].msg","errors[*].message","[*].msg","[*].message"],Ht=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}return e},Jt=(e,t,r=0,n=5)=>{if(r>n||"object"!=typeof e||null===e)return null;for(const o of t){const a=o.split(".");let s=e;for(const e of a){if(null==s)break;if("[*]"===e){if(Array.isArray(s)){for(const t of s){const o=Jt(t,[a.slice(a.indexOf(e)+1).join(".")],r+1,n);if(o)return o}s=null;break}s=null;break}if(e.endsWith("]")){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const[,e,r]=t;s=s?.[e]?.[Number(r)]}else s=s?.[e]}else s=s?.[e]}if(s=Ht(s),Array.isArray(s)){const e=s.map((e=>"string"==typeof e?e:e?.message||e?.msg||"")).filter(Boolean).join("\n");if(e)return e}if("string"==typeof s)return C(s);if("object"==typeof s&&null!==s){const e=Jt(s,t,r+1,n);if(e)return e}}return null},Vt=(e,t,r=0,n=5)=>{if(r>n||"object"!=typeof e||null===e)return[];const o=[];for(const a of t){const s=a.split(".");let i=e;for(let e=0;e<s.length;e++){const t=s[e];if(null==i)break;if("[*]"===t){if(Array.isArray(i)){const t=s.slice(e+1).join(".");for(const e of i)o.push(...Vt(e,[t],r+1,n))}i=null;break}if(t.endsWith("]")){const e=t.match(/(\w+)\[(\d+)\]/);if(e){const[,t,r]=e;i=i?.[t]?.[Number(r)]}else i=i?.[t]}else i=i?.[t]}if(i=Ht(i),"string"==typeof i)o.push(C(i));else if(Array.isArray(i)){for(const e of i)if("string"==typeof e)o.push(C(e));else if("object"==typeof e){const a=e?.message||e?.msg;"string"==typeof a?o.push(C(a)):o.push(...Vt(e,t,r+1,n))}}else"object"==typeof i&&o.push(...Vt(i,t,r+1,n))}return o},Yt=(e,t="",r=[])=>{const n=[...r,...Gt];if(!e)return t;if("string"==typeof e){const r=Ht(e);return"object"==typeof r?Jt(r,n)||t:C(e)}const o=Ht(e?.response?.data||e?.data||e),a=Jt(o,n)||e?.message;return C(a||"").trim()||t},Kt={PDF:"pdf",PNG:"image/png",JPEG:"image/jpeg",EXCEL:"excel",WORD:"word",TEXT:"text"},Zt={[Kt.PDF]:{mimeType:"application/pdf",extension:"pdf"},[Kt.PNG]:{mimeType:"image/png",extension:"png"},[Kt.JPEG]:{mimeType:"image/jpeg",extension:"jpg"},[Kt.EXCEL]:{mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"},[Kt.WORD]:{mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"},[Kt.TEXT]:{mimeType:"text/plain",extension:"txt"}};return e.ColumnMapper=Bt,e.Excel=class{constructor(){c("frontend")}async readFromArrayBuffer(e,t){try{let r;r=e instanceof Buffer?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):await e.arrayBuffer();const n=new a.default.Workbook;await n.xlsx.load(r);const o=n.getWorksheet(t),s=[];return o?(o.eachRow({includeEmpty:!0},(e=>{const t=[];e.eachCell({includeEmpty:!0},(e=>{t.push(void 0!==e.value?e.value:null)})),s.push(t)})),s):[]}catch(e){return[]}}async read(e,t=1){try{const r=new a.default.Workbook;await r.xlsx.readFile(e);const n=r.getWorksheet(t);if(!n)throw new Error(`Excelda ${t}-raqamli jadval topilmadi. Iltimos, faylda ushbu jadval mavjudligini tekshiring.`);const o=[];return n.eachRow({includeEmpty:!0},(e=>{const t=[];e.eachCell({includeEmpty:!0},(e=>{t.push(void 0!==e.value?e.value:null)})),o.push(t)})),o}catch(e){return this.handleError(e,this.read),[]}}async write(e,t,r,n="file",o="Sheet1",s=""){try{const i=new a.default.Workbook,c=i.addWorksheet(o);c.addRow(t),e.forEach((e=>{const t=r.map((t=>{const r=Xt(e,t);return!(null==r||"null"===r||"undefined"===r||"NaN"===r||"number"==typeof r&&isNaN(r))?r:s}));c.addRow(t)}));const l=`${n}_${(new Date).toISOString().slice(0,10)}.xlsx`,u=await i.xlsx.writeBuffer(),f=new Blob([u],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});return await qt(f,l),!0}catch(e){return this.handleError(e,this.write),!1}}async writeFromArray(e,t=[],r="file",n="Sheet1",o=""){try{const s=new a.default.Workbook,i=s.addWorksheet(n);t.length>0&&i.addRow(t),e.forEach((e=>{const t=e.map((e=>null==e||"null"===e||"undefined"===e||"NaN"===e||"number"==typeof e&&isNaN(e)?o:e));i.addRow(t)}));const c=`${r}_${(new Date).toISOString().slice(0,10)}.xlsx`,l=await s.xlsx.writeBuffer(),u=new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});return await qt(u,c),!0}catch(e){return this.handleError(e,this.writeFromArray),!1}}handleError(e,t){const r=t.name;throw new Error(`Xatolik Excel.${r} metodida yuz berdi: ${Yt(e)}`)}},e.FileType=Kt,e.IndexMapper=zt,e.StyledLogger=class{static getStyle(e){switch(e){case"log":return"color: #3498db; font-weight: bold;";case"info":return"color: #2ecc71; font-weight: bold;";case"warn":return"color: #f39c12; font-weight: bold;";case"error":return"color: #e74c3c; font-weight: bold;";case"success":return"color: #27ae60; font-weight: bold;";case"debug":return"color: #9b59b6; font-weight: bold;";default:return""}}static log(e,t="",...r){if(s())console.log(`%c${t}`,this.getStyle(e),...r);else{const n={log:"[34m",info:"[32m",warn:"[33m",error:"[31m",success:"[32m",debug:"[35m"};console.log(`${n[e]}[${e.toUpperCase()}] ${t}[0m`,...r)}}static info(e,...t){this.log("info",e,...t)}static warn(e,...t){this.log("warn",e,...t)}static error(e,...t){this.log("error",e,...t)}static success(e,...t){this.log("success",e,...t)}static debug(e,...t){this.log("debug",e,...t)}},e.axiosErrorHandler=(e,t=!0)=>r=>{const n=(r.message||"").trim();r.message="";const o=Yt(r).trim()||n,a={error:o,data:r.response?.data,status:r.response?.status,statusText:r.response?.statusText,type:"ERROR"};return e?.(r,o),t?Promise.reject(a):Promise.resolve(a)},e.axiosSuccessHandler=e=>t=>(e?.(t.data),{...t,type:"SUCCESS"}),e.checkEnvironment=c,e.clearHeaders=w,e.convertBase64ToFile=(e,t="converted_file",r)=>{c("frontend");const n=Zt[Kt[r]];if(!n)throw new Error(`Invalid file type: ${r}`);const{mimeType:o,extension:a}=n,s=e.replace(/^data:.*;base64,/,""),i=window.atob(s),l=i.length,u=new Uint8Array(l);for(let e=0;e<l;e++)u[e]=i.charCodeAt(e);const f=new Blob([u],{type:o});qt(f,`${t}.${a}`)},e.convertDigitalSize=(e,t,r)=>{if(r<=0)return 0;const n={bit:1,byte:8,kb:8192,mb:8388608,gb:8*1024**3,tb:8*1024**4};if(!n[e]||!n[t])throw new Error("Invalid unit");return parseFloat((r*n[e]/n[t]).toFixed(2))},e.copyToClipboard=async e=>{c("frontend"),await navigator.clipboard.writeText(e)},e.debounce=(e,t=300,r=!1)=>{let n=null;return(...o)=>new Promise((a=>{const s=r&&!n;n&&clearTimeout(n),n=setTimeout((()=>{n=null,r||a(e(...o))}),t),s&&a(e(...o))}))},e.delay=e=>new Promise((t=>setTimeout(t,e))),e.delayRun=function(e,t){return new Promise((r=>{setTimeout((async()=>{if(t)try{const e=await t();r(e)}catch(e){throw e}r(null)}),e)}))},e.extractErrorMessage=Yt,e.extractErrorMessages=(e,t=[])=>{const r=[...Gt,...t];if(!e)return[];const n=Ht("string"==typeof e?e:e?.response?.data||e?.data||e);return Vt(n,r)},e.fileConfigs=Zt,e.formatCurrencyPrice=(e,t,r="en-US")=>e?.toLocaleString(r,{style:"currency",currency:t}),e.formatDateLocaleString=(e,t="en-GB",r="Asia/Tashkent")=>new Date(e).toLocaleString(t,{timeZone:r}),e.formatDuration=Wt,e.formatJsonForTelegram=e=>{try{"string"==typeof e&&(e=JSON.parse(e));return`<pre>${JSON.stringify(e,null,2)}</pre>`}catch(t){return`<pre>${e}</pre>`}},e.formatStringToFloat=M,e.generateAndAssignRandomHeaders=e=>{e.headers=e.headers||{},w(e.headers);const t=_();return Object.assign(e.headers,t),e},e.generateIdempotencyKey=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),e.generateRandomHeaders=_,e.generateUserAgents=b,e.getColumnIndex=Ut,e.getColumnName=function(e){if(Lt.columnNameCache.has(e))return Lt.columnNameCache.get(e);let t="";for(;e>=0;){const r=e%26;t=String.fromCharCode(65+r)+t,e=Math.floor(e/26)-1}return Lt.columnNameCache.set(e,t),t},e.getFormattedDate=j,e.getLocalIP=async()=>{c("backend");const e=(await import("os")).networkInterfaces();for(const t in e)for(const r of e[t]||[])if("IPv4"===r.family&&!r.internal)return r.address;return"127.0.0.1"},e.getNestedValue=Xt,e.getRandomInt=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),e.getValidDate=(e,t)=>o.default(e,t).toDate(),e.getValueByName=function(e=[],t,r=null){if(!Array.isArray(e))return r;const n=Ut(t);return It(e,`[${n}]`,r)},e.isBrowser=s,e.isIndianFormat=$,e.isNode=i,e.measureExecutionTime=(e,t="Execution",r)=>{const n=new Date;console.log(`[${t}] Boshladi: ${j(n)}`);const o=e(),a=e=>{const o=e.getTime()-n.getTime();console.log(`[${t}] Tugadi: ${j(e)}`),console.log(`[${t}] Davomiyligi: ${Wt(o,r)}`)};return o instanceof Promise?o.then((e=>(a(new Date),e))):(a(new Date),o)},e.objectItemToArray=(e,t,r="")=>t.map((t=>{const n=Xt(e,t);return n||"number"==typeof n?n:r})),e.objectToArray=(e,t,r=[],n="")=>{const o=[];return r.length>0&&o.push(r.map((e=>e.trim()||n))),e.forEach((e=>{const r=t.map((t=>{const r=Xt(e,t);return r||"number"==typeof r?r:n}));o.push(r)})),o},e.parseEuropeanFormat=E,e.parseIndianFormat=S,e.parseSeparatedNumber=e=>{const t=Number(e?.replace(/,/g,""));return isNaN(t)?0:t},e.rand=g,e.randIp=y,e.saveFile=qt,e.scrollToElement=e=>{c("frontend");const t=document.querySelector(e);t&&t.scrollIntoView({behavior:"smooth"})},e.stripHtmlTags=C,e.toMilliseconds=e=>{const{milliseconds:t=0,seconds:r=0,minutes:n=0,hours:o=0,days:a=0,weeks:s=0,months:i=0,years:c=0}=e,l=36e5,u=864e5;return t+1e3*r+6e4*n+o*l+a*u+6048e5*s+2630016e3*i+315576e5*c},Object.defineProperty(e,"__esModule",{value:!0}),e}({},moment,ExcelJS);
|
|
1
|
+
var utilzify=function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),a=n(r);const s=()=>"undefined"!=typeof window&&"undefined"!=typeof document,i=()=>"undefined"!=typeof process&&Boolean(process.versions?.node),c=e=>{const t=s(),r=i();if("frontend"===e&&!t)throw new Error("This function can only be used in a frontend environment.");if("backend"===e&&!r)throw new Error("This function can only be used in a backend environment.");return"frontend"===e?t:r},l=[{name:"Chrome",tokens:["Chrome","Safari"],prefix:"Mozilla/5.0"},{name:"Firefox",tokens:["Gecko"],prefix:"Mozilla/5.0"},{name:"Opera",tokens:["Presto"],prefix:"Opera/9.80"},{name:"Edge",tokens:["Edg"],prefix:"Mozilla/5.0"},{name:"Safari",tokens:["Version","Safari"],prefix:"Mozilla/5.0"},{name:"IE",tokens:["MSIE","Trident"],prefix:"Mozilla/4.0"}],u=["Windows NT 10.0","Windows NT 6.1","Windows 3.1","Macintosh; Intel Mac OS X 10_15_7","X11; Linux x86_64","X11; Ubuntu; Linux i686","Android 12; Mobile","Android 11; Tablet","iPhone; CPU iPhone OS 16_6 like Mac OS X","iPad; CPU OS 15_4 like Mac OS X"],f=["en","ru","de","fr","es","it","pl","ko","ja","tr"],d=["Trident","Gecko","Presto","Blink"],p=["WOW64","Win64; x64",".NET CLR 3.5.30729","SLCC2","InfoPath.3","Media Center PC 6.0","Tablet PC 2.0"],h=["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","application/json, text/plain, */*"],m=["google.com","bing.com","yandex.ru","duckduckgo.com","example.com","wikipedia.org"],g=e=>e[Math.floor(Math.random()*e.length)],y=()=>`${g([13,14,15,16,17,18,19,20])}.${Math.floor(256*Math.random())}.${Math.floor(256*Math.random())}.${Math.floor(1+254*Math.random())}`,v=(e=15)=>`${Math.floor(Math.random()*e)+1}.${Math.floor(10*Math.random())}`,b=e=>{const t=[];for(let r=0;r<e;r++){const e=g(l),r=g(u),n=g(f),o=g(d),a=v(),s=g(e.tokens),i=Math.random()>.5?`; ${g(p)}`:"",c="IE"===e.name?`${e.prefix} (compatible; ${s} ${a}; ${r}${i}; ${n})`:`${e.prefix} (${r}${i}; ${n}) ${s}/${a} ${o}/${v(5)}`;t.push(c)}return Array.from(new Set(t))},w=(e={},t=[])=>{const r=new Set(["host","connection","content-length","sec-ch-ua-platform","sec-ch-ua","sec-ch-ua-mobile","user-agent","origin","sec-fetch-site","sec-fetch-mode","sec-fetch-dest","referer","cookie","accept-encoding","if-none-match",...t.map((e=>e.toLowerCase()))]);for(const t of Object.keys(e)){const n=t.toLowerCase(),o=n.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("-");(r.has(n)||r.has(o.toLowerCase()))&&delete e[t]}return e},x=b(200),_=()=>{const e={},t=!s();return e.Accept||(e.Accept=g(h)),e.Connection||(e.Connection="keep-alive"),e["User-Agent"]||e["user-agent"]||!t||(e["User-Agent"]=g(x)),!e.Referer&&t&&(e.Referer=(()=>{const e=g(m),t=g(["","search","images","news","video","docs"]),r=Math.random()>.5?`?q=test${Math.floor(1e3*Math.random())}`:"";return`${Math.random()>.5?"https":"http"}://www.${e}/${t}${r}`})()),!e["X-Forwarded-For"]&&t&&(e["X-Forwarded-For"]=y()),!e["Cache-Control"]&&t&&(e["Cache-Control"]="max-age=0"),e};const $=e=>/^(\d{1,3}(,\d{2})*(\.\d+)?)$/.test(e)||/^(\d{1,3}(,\d{3})*(\.\d+)?)$/.test(e),S=e=>parseFloat(e.replace(/,/g,"")),E=e=>parseFloat(e.replace(/\./g,"").replace(",",".")),M=(e,t=0)=>null==e?t:"number"==typeof e?e:e&&"string"==typeof e&&/[\d,.]/.test(e)?(e=e.replace(/\s/g,"").trim(),$(e)?S(e):e.includes(",")?E(e):e.includes(".")||!e.includes(",")?parseFloat(e.replace(/,/g,"")):t):t,j=(e=Date.now(),t="DD/MM/YYYY HH:mm:ss")=>{const r=o.default(e);return r.isValid()?r.format(t):""},C=e=>e.replace(/<[^>]*>/g,"").trim();var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O=Array.isArray,N="object"==typeof T&&T&&T.Object===Object&&T,A="object"==typeof self&&self&&self.Object===Object&&self,F=N||A||Function("return this")(),P=F.Symbol,D=P,R=Object.prototype,I=R.hasOwnProperty,L=R.toString,U=D?D.toStringTag:void 0;var z=function(e){var t=I.call(e,U),r=e[U];try{e[U]=void 0;var n=!0}catch(e){}var o=L.call(e);return n&&(t?e[U]=r:delete e[U]),o},B=Object.prototype.toString;var W=z,X=function(e){return B.call(e)},q=P?P.toStringTag:void 0;var G=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":q&&q in Object(e)?W(e):X(e)};var H=G,J=function(e){return null!=e&&"object"==typeof e};var V=function(e){return"symbol"==typeof e||J(e)&&"[object Symbol]"==H(e)},Y=O,K=V,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/;var ee=function(e,t){if(Y(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!K(e))||(Q.test(e)||!Z.test(e)||null!=t&&e in Object(t))};var te=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},re=G,ne=te;var oe,ae=function(e){if(!ne(e))return!1;var t=re(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},se=F["__core-js_shared__"],ie=(oe=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||""))?"Symbol(src)_1."+oe:"";var ce=function(e){return!!ie&&ie in e},le=Function.prototype.toString;var ue=ae,fe=ce,de=te,pe=function(e){if(null!=e){try{return le.call(e)}catch(e){}try{return e+""}catch(e){}}return""},he=/^\[object .+?Constructor\]$/,me=Function.prototype,ge=Object.prototype,ye=me.toString,ve=ge.hasOwnProperty,be=RegExp("^"+ye.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var we=function(e){return!(!de(e)||fe(e))&&(ue(e)?be:he).test(pe(e))},xe=function(e,t){return null==e?void 0:e[t]};var _e=function(e,t){var r=xe(e,t);return we(r)?r:void 0},$e=_e(Object,"create"),Se=$e;var Ee=function(){this.__data__=Se?Se(null):{},this.size=0};var Me=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},je=$e,Ce=Object.prototype.hasOwnProperty;var Te=function(e){var t=this.__data__;if(je){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ce.call(t,e)?t[e]:void 0},ke=$e,Oe=Object.prototype.hasOwnProperty;var Ne=$e;var Ae=Ee,Fe=Me,Pe=Te,De=function(e){var t=this.__data__;return ke?void 0!==t[e]:Oe.call(t,e)},Re=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ne&&void 0===t?"__lodash_hash_undefined__":t,this};function Ie(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ie.prototype.clear=Ae,Ie.prototype.delete=Fe,Ie.prototype.get=Pe,Ie.prototype.has=De,Ie.prototype.set=Re;var Le=Ie;var Ue=function(){this.__data__=[],this.size=0};var ze=function(e,t){return e===t||e!=e&&t!=t};var Be=function(e,t){for(var r=e.length;r--;)if(ze(e[r][0],t))return r;return-1},We=Be,Xe=Array.prototype.splice;var qe=Be;var Ge=Be;var He=Be;var Je=Ue,Ve=function(e){var t=this.__data__,r=We(t,e);return!(r<0)&&(r==t.length-1?t.pop():Xe.call(t,r,1),--this.size,!0)},Ye=function(e){var t=this.__data__,r=qe(t,e);return r<0?void 0:t[r][1]},Ke=function(e){return Ge(this.__data__,e)>-1},Ze=function(e,t){var r=this.__data__,n=He(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Qe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Qe.prototype.clear=Je,Qe.prototype.delete=Ve,Qe.prototype.get=Ye,Qe.prototype.has=Ke,Qe.prototype.set=Ze;var et=Qe,tt=_e(F,"Map"),rt=Le,nt=et,ot=tt;var at=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var st=function(e,t){var r=e.__data__;return at(t)?r["string"==typeof t?"string":"hash"]:r.map},it=st;var ct=st;var lt=st;var ut=st;var ft=function(){this.size=0,this.__data__={hash:new rt,map:new(ot||nt),string:new rt}},dt=function(e){var t=it(this,e).delete(e);return this.size-=t?1:0,t},pt=function(e){return ct(this,e).get(e)},ht=function(e){return lt(this,e).has(e)},mt=function(e,t){var r=ut(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function gt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}gt.prototype.clear=ft,gt.prototype.delete=dt,gt.prototype.get=pt,gt.prototype.has=ht,gt.prototype.set=mt;var yt=gt;function vt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return r.cache=a.set(o,s)||a,s};return r.cache=new(vt.Cache||yt),r}vt.Cache=yt;var bt=vt;var wt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xt=/\\(\\)?/g,_t=function(e){var t=bt(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(wt,(function(e,r,n,o){t.push(n?o.replace(xt,"$1"):r||e)})),t}));var $t=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},St=O,Et=V,Mt=P?P.prototype:void 0,jt=Mt?Mt.toString:void 0;var Ct=function e(t){if("string"==typeof t)return t;if(St(t))return $t(t,e)+"";if(Et(t))return jt?jt.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r},Tt=Ct;var kt=O,Ot=ee,Nt=_t,At=function(e){return null==e?"":Tt(e)};var Ft=V;var Pt=function(e,t){return kt(e)?e:Ot(e,t)?[e]:Nt(At(e))},Dt=function(e){if("string"==typeof e||Ft(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Rt=function(e,t){for(var r=0,n=(t=Pt(t,e)).length;null!=e&&r<n;)e=e[Dt(t[r++])];return r&&r==n?e:void 0};var It=k((function(e,t,r){var n=null==e?void 0:Rt(e,t);return void 0===n?r:n}));const Lt={columnIndexCache:new Map,columnNameCache:new Map};function Ut(e){const t=e.toUpperCase();if(Lt.columnIndexCache.has(t))return Lt.columnIndexCache.get(t);let r=0;for(let e=0;e<t.length;e++)r=26*r+(t.charCodeAt(e)-65+1);const n=r-1;return Lt.columnIndexCache.set(t,n),n}const zt={getStr(e=[],t,r=""){const n=It(e,`[${t}]`,"");return"number"==typeof n?String(n):String(n||r).trim()},getNum(e=[],t,r=0){const n=String(It(e,`[${t}]`,"")).replace(/\s/g,"");if(!n)return r;const o=Number(n);return isNaN(o)?r:o},getBool(e=[],t,r=!1){if(!Array.isArray(e))return r;const n=It(e,`[${t}]`,r);return["TRUE","FALSE"].includes(n)?"TRUE"===n:"boolean"==typeof n?n:r},getPrice(e=[],t){const r=this.getStr(e,t);if(!r)return 0;const n=M(r);return isNaN(n)?0:n},getDate(e=[],t,r){const n=this.getStr(e,t);if(!n)return null;return o.default(n,r).toDate()},getDateFormatted(e=[],t,r,n){const a=this.getStr(e,t);if(!a)return null;const s=o.default(a,n);return r?j(s.toDate(),r):j(s.toDate())}},Bt={getStr(e=[],t,r=""){const n=Ut(t),o=It(e,`[${n}]`,"");return"number"==typeof o?String(o):String(o||r).trim()},getNum(e=[],t,r=0){const n=Ut(t),o=String(It(e,`[${n}]`,"")).replace(/\s/g,"");if(!o)return r;const a=Number(o);return isNaN(a)?r:a},getBool(e=[],t,r=!1){const n=Ut(t);if(!Array.isArray(e))return r;const o=It(e,`[${n}]`,r);return["TRUE","FALSE"].includes(o)?"TRUE"===o:"boolean"==typeof o?o:r},getPrice(e=[],t){const r=this.getStr(e,t);if(!r)return 0;const n=M(r);return isNaN(n)?0:n},getDate(e=[],t,r){const n=this.getStr(e,t);if(!n)return null;return o.default(n,r).toDate()},getDateFormatted(e=[],t,r,n){const a=this.getStr(e,t);if(!a)return null;const s=o.default(a,n);return r?j(s.toDate(),r):j(s.toDate())}},Wt=(e,t)=>{const r=Math.floor(e/1e3),n=Math.floor(r/60),o=Math.floor(n/60),a=r%60;switch(t){case"ms":return`${e} millisoniya`;case"s":return`${(e/1e3).toFixed(2)} soniya`;case"min":return`${(e/6e4).toFixed(2)} daqiqa`;default:return`${o>0?`${o} soat `:""}${n%60>0?n%60+" daqiqa ":""}${(a>0?`${a} soniya`:"")||"0 soniya"}`.trim()}},Xt=(e,t)=>{const r=t.split(".");let n=e;for(const e of r){if(!n&&"number"!=typeof n)return;n=n[e]}return n},qt=(e,t)=>{if(c("frontend"),window.navigator){const r=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=r,n.download=t,document.body.appendChild(n),n.click(),setTimeout((()=>{window.URL.revokeObjectURL(r),document.body.removeChild(n)}),1e3)}};const Gt=["err.cause.message","cause.stack","detailMessage","error_description","error.message","description","msg","message","error","errors","errorDetails","errorMessage","error_type","errorMsg","errorMessages","error_info","error_info.message","error_info.error_message","error_info.details","data.message","response.message","response.error_message","response.details","httpError","validationError","status_description","messages","alert_message","alert","userMessage","user_error","client_error","response.data.error","response.data.message","response.data.error_description","response.data.details","errorMessages[*].message","errors[*].msg","errors[*].message","[*].msg","[*].message"],Ht=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}return e},Jt=(e,t,r=0,n=5)=>{if(r>n||"object"!=typeof e||null===e)return null;for(const o of t){const a=o.split(".");let s=e;for(const e of a){if(null==s)break;if("[*]"===e){if(Array.isArray(s)){for(const t of s){const o=Jt(t,[a.slice(a.indexOf(e)+1).join(".")],r+1,n);if(o)return o}s=null;break}s=null;break}if(e.endsWith("]")){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const[,e,r]=t;s=s?.[e]?.[Number(r)]}else s=s?.[e]}else s=s?.[e]}if(s=Ht(s),Array.isArray(s)){const e=s.map((e=>"string"==typeof e?e:e?.message||e?.msg||"")).filter(Boolean).join("\n");if(e)return e}if("string"==typeof s)return C(s);if("object"==typeof s&&null!==s){const e=Jt(s,t,r+1,n);if(e)return e}}return null},Vt=(e,t,r=0,n=5)=>{if(r>n||"object"!=typeof e||null===e)return[];const o=[];for(const a of t){const s=a.split(".");let i=e;for(let e=0;e<s.length;e++){const t=s[e];if(null==i)break;if("[*]"===t){if(Array.isArray(i)){const t=s.slice(e+1).join(".");for(const e of i)o.push(...Vt(e,[t],r+1,n))}i=null;break}if(t.endsWith("]")){const e=t.match(/(\w+)\[(\d+)\]/);if(e){const[,t,r]=e;i=i?.[t]?.[Number(r)]}else i=i?.[t]}else i=i?.[t]}if(i=Ht(i),"string"==typeof i)o.push(C(i));else if(Array.isArray(i)){for(const e of i)if("string"==typeof e)o.push(C(e));else if("object"==typeof e){const a=e?.message||e?.msg;"string"==typeof a?o.push(C(a)):o.push(...Vt(e,t,r+1,n))}}else"object"==typeof i&&o.push(...Vt(i,t,r+1,n))}return o},Yt=(e,t="",r=[])=>{const n=[...r,...Gt];if(!e)return t;if("string"==typeof e){const r=Ht(e);return"object"==typeof r?Jt(r,n)||t:C(e)}const o=Ht(e?.response?.data||e?.data||e),a=Jt(o,n)||e?.message;return C(a||"").trim()||t},Kt={PDF:"pdf",PNG:"image/png",JPEG:"image/jpeg",EXCEL:"excel",WORD:"word",TEXT:"text"},Zt={[Kt.PDF]:{mimeType:"application/pdf",extension:"pdf"},[Kt.PNG]:{mimeType:"image/png",extension:"png"},[Kt.JPEG]:{mimeType:"image/jpeg",extension:"jpg"},[Kt.EXCEL]:{mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"},[Kt.WORD]:{mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"},[Kt.TEXT]:{mimeType:"text/plain",extension:"txt"}};return e.ColumnMapper=Bt,e.Excel=class{constructor(){c("frontend")}async readFromArrayBuffer(e,t){try{let r;r=e instanceof Buffer?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):await e.arrayBuffer();const n=new a.default.Workbook;await n.xlsx.load(r);const o=n.getWorksheet(t),s=[];return o?(o.eachRow({includeEmpty:!0},(e=>{const t=[];e.eachCell({includeEmpty:!0},(e=>{t.push(void 0!==e.value?e.value:null)})),s.push(t)})),s):[]}catch(e){return[]}}async read(e,t=1){try{const r=new a.default.Workbook;await r.xlsx.readFile(e);const n=r.getWorksheet(t);if(!n)throw new Error(`Excelda ${t}-raqamli jadval topilmadi. Iltimos, faylda ushbu jadval mavjudligini tekshiring.`);const o=[];return n.eachRow({includeEmpty:!0},(e=>{const t=[];e.eachCell({includeEmpty:!0},(e=>{t.push(void 0!==e.value?e.value:null)})),o.push(t)})),o}catch(e){return this.handleError(e,this.read),[]}}async write(e,t,r,n="file",o="Sheet1",s=""){try{const i=new a.default.Workbook,c=i.addWorksheet(o);c.addRow(t),e.forEach((e=>{const t=r.map((t=>{const r=Xt(e,t);return!(null==r||"null"===r||"undefined"===r||"NaN"===r||"number"==typeof r&&isNaN(r))?r:s}));c.addRow(t)}));const l=`${n}_${(new Date).toISOString().slice(0,10)}.xlsx`,u=await i.xlsx.writeBuffer(),f=new Blob([u],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});return await qt(f,l),!0}catch(e){return this.handleError(e,this.write),!1}}async writeFromArray(e,t=[],r="file",n="Sheet1",o=""){try{const s=new a.default.Workbook,i=s.addWorksheet(n);t.length>0&&i.addRow(t),e.forEach((e=>{const t=e.map((e=>null==e||"null"===e||"undefined"===e||"NaN"===e||"number"==typeof e&&isNaN(e)?o:e));i.addRow(t)}));const c=`${r}_${(new Date).toISOString().slice(0,10)}.xlsx`,l=await s.xlsx.writeBuffer(),u=new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});return await qt(u,c),!0}catch(e){return this.handleError(e,this.writeFromArray),!1}}handleError(e,t){const r=t.name;throw new Error(`Xatolik Excel.${r} metodida yuz berdi: ${Yt(e)}`)}},e.FileType=Kt,e.IndexMapper=zt,e.StyledLogger=class{static getStyle(e){switch(e){case"log":return"color: #3498db; font-weight: bold;";case"info":return"color: #2ecc71; font-weight: bold;";case"warn":return"color: #f39c12; font-weight: bold;";case"error":return"color: #e74c3c; font-weight: bold;";case"success":return"color: #27ae60; font-weight: bold;";case"debug":return"color: #9b59b6; font-weight: bold;";default:return""}}static log(e,t="",...r){if(s())console.log(`%c${t}`,this.getStyle(e),...r);else{const n={log:"[34m",info:"[32m",warn:"[33m",error:"[31m",success:"[32m",debug:"[35m"};console.log(`${n[e]}[${e.toUpperCase()}] ${t}[0m`,...r)}}static info(e,...t){this.log("info",e,...t)}static warn(e,...t){this.log("warn",e,...t)}static error(e,...t){this.log("error",e,...t)}static success(e,...t){this.log("success",e,...t)}static debug(e,...t){this.log("debug",e,...t)}},e.axiosErrorHandler=(e,t=!0)=>r=>{const n=(r.message||"").trim();r.message="";const o=Yt(r).trim()||n,a={error:o,data:r.response?.data,status:r.response?.status,statusText:r.response?.statusText,type:"ERROR"};return e?.(r,o),t?Promise.reject(a):Promise.resolve(a)},e.axiosSuccessHandler=e=>t=>(e?.(t.data),{...t,type:"SUCCESS"}),e.checkEnvironment=c,e.clearHeaders=w,e.convertBase64ToFile=(e,t="converted_file",r)=>{c("frontend");const n=Zt[Kt[r]];if(!n)throw new Error(`Invalid file type: ${r}`);const{mimeType:o,extension:a}=n,s=e.replace(/^data:.*;base64,/,""),i=window.atob(s),l=i.length,u=new Uint8Array(l);for(let e=0;e<l;e++)u[e]=i.charCodeAt(e);const f=new Blob([u],{type:o});qt(f,`${t}.${a}`)},e.convertDigitalSize=(e,t,r)=>{if(r<=0)return 0;const n={bit:1,byte:8,kb:8192,mb:8388608,gb:8*1024**3,tb:8*1024**4};if(!n[e]||!n[t])throw new Error("Invalid unit");return parseFloat((r*n[e]/n[t]).toFixed(2))},e.copyToClipboard=async e=>{c("frontend"),await navigator.clipboard.writeText(e)},e.debounce=(e,t=300,r=!1)=>{let n=null;return(...o)=>new Promise((a=>{const s=r&&!n;n&&clearTimeout(n),n=setTimeout((()=>{n=null,r||a(e(...o))}),t),s&&a(e(...o))}))},e.delay=e=>new Promise((t=>setTimeout(t,e))),e.delayRun=function(e,t){return new Promise((r=>{setTimeout((async()=>{if(t)try{const e=await t();r(e)}catch(e){throw e}r(null)}),e)}))},e.extractErrorMessage=Yt,e.extractErrorMessages=(e,t=[])=>{const r=[...Gt,...t];if(!e)return[];const n=Ht("string"==typeof e?e:e?.response?.data||e?.data||e);return Vt(n,r)},e.fileConfigs=Zt,e.formatCurrencyPrice=(e,t,r="en-US")=>e?.toLocaleString(r,{style:"currency",currency:t}),e.formatDateLocaleString=(e,t="en-GB",r="Asia/Tashkent")=>new Date(e).toLocaleString(t,{timeZone:r}),e.formatDuration=Wt,e.formatJsonForTelegram=e=>{try{"string"==typeof e&&(e=JSON.parse(e));return`<pre>${JSON.stringify(e,null,2)}</pre>`}catch(t){return`<pre>${e}</pre>`}},e.formatStringToFloat=M,e.generateAndAssignRandomHeaders=e=>{e.headers=e.headers||{},w(e.headers);const t=_();return Object.assign(e.headers,t),e},e.generateIdempotencyKey=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),e.generateRandomHeaders=_,e.generateUserAgents=b,e.getColumnIndex=Ut,e.getColumnName=function(e){if(Lt.columnNameCache.has(e))return Lt.columnNameCache.get(e);let t="";for(;e>=0;){const r=e%26;t=String.fromCharCode(65+r)+t,e=Math.floor(e/26)-1}return Lt.columnNameCache.set(e,t),t},e.getFormattedDate=j,e.getLocalIP=async()=>{c("backend");const e=(await import("os")).networkInterfaces();for(const t in e)for(const r of e[t]||[])if("IPv4"===r.family&&!r.internal)return r.address;return"127.0.0.1"},e.getNestedValue=Xt,e.getRandomInt=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),e.getValidDate=(e,t)=>o.default(e,t).toDate(),e.getValueByName=function(e=[],t,r=null){if(!Array.isArray(e))return r;const n=Ut(t);return It(e,`[${n}]`,r)},e.isBrowser=s,e.isIndianFormat=$,e.isNode=i,e.measureExecutionTime=(e,t="Execution",r)=>{const n=new Date;console.log(`[${t}] Boshladi: ${j(n)}`);const o=e(),a=e=>{const o=e.getTime()-n.getTime();console.log(`[${t}] Tugadi: ${j(e)}`),console.log(`[${t}] Davomiyligi: ${Wt(o,r)}`)};return o instanceof Promise?o.then((e=>(a(new Date),e))):(a(new Date),o)},e.objectItemToArray=(e,t,r="")=>t.map((t=>{const n=Xt(e,t);return n||"number"==typeof n?n:r})),e.objectToArray=(e,t,r=[],n="")=>{const o=[];return r.length>0&&o.push(r.map((e=>e.trim()||n))),e.forEach((e=>{const r=t.map((t=>{const r=Xt(e,t);return r||"number"==typeof r?r:n}));o.push(r)})),o},e.parseEuropeanFormat=E,e.parseIndianFormat=S,e.parseSeparatedNumber=e=>{const t=Number(e?.replace(/,/g,""));return isNaN(t)?0:t},e.rand=g,e.randIp=y,e.saveFile=qt,e.scrollToElement=e=>{c("frontend");const t=document.querySelector(e);t&&t.scrollIntoView({behavior:"smooth"})},e.stripHtmlTags=C,e.toMilliseconds=e=>{const{milliseconds:t=0,seconds:r=0,minutes:n=0,hours:o=0,days:a=0,weeks:s=0,months:i=0,years:c=0}=e,l=36e5,u=864e5;return t+1e3*r+6e4*n+o*l+a*u+6048e5*s+2630016e3*i+315576e5*c},Object.defineProperty(e,"__esModule",{value:!0}),e}({},moment,ExcelJS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("moment"),require("exceljs")):"function"==typeof define&&define.amd?define(["exports","moment","exceljs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).utilzify={},e.moment,e.ExcelJS)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),a=n(r);const s=()=>"undefined"!=typeof window&&"undefined"!=typeof document,i=()=>"undefined"!=typeof process&&Boolean(process.versions?.node),c=e=>{const t=s(),r=i();if("frontend"===e&&!t)throw new Error("This function can only be used in a frontend environment.");if("backend"===e&&!r)throw new Error("This function can only be used in a backend environment.");return"frontend"===e?t:r},l=[{name:"Chrome",tokens:["Chrome","Safari"],prefix:"Mozilla/5.0"},{name:"Firefox",tokens:["Gecko"],prefix:"Mozilla/5.0"},{name:"Opera",tokens:["Presto"],prefix:"Opera/9.80"},{name:"Edge",tokens:["Edg"],prefix:"Mozilla/5.0"},{name:"Safari",tokens:["Version","Safari"],prefix:"Mozilla/5.0"},{name:"IE",tokens:["MSIE","Trident"],prefix:"Mozilla/4.0"}],u=["Windows NT 10.0","Windows NT 6.1","Windows 3.1","Macintosh; Intel Mac OS X 10_15_7","X11; Linux x86_64","X11; Ubuntu; Linux i686","Android 12; Mobile","Android 11; Tablet","iPhone; CPU iPhone OS 16_6 like Mac OS X","iPad; CPU OS 15_4 like Mac OS X"],f=["en","ru","de","fr","es","it","pl","ko","ja","tr"],d=["Trident","Gecko","Presto","Blink"],p=["WOW64","Win64; x64",".NET CLR 3.5.30729","SLCC2","InfoPath.3","Media Center PC 6.0","Tablet PC 2.0"],h=["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","application/json, text/plain, */*"],m=["google.com","bing.com","yandex.ru","duckduckgo.com","example.com","wikipedia.org"],g=e=>e[Math.floor(Math.random()*e.length)],y=()=>`${g([13,14,15,16,17,18,19,20])}.${Math.floor(256*Math.random())}.${Math.floor(256*Math.random())}.${Math.floor(1+254*Math.random())}`,v=(e=15)=>`${Math.floor(Math.random()*e)+1}.${Math.floor(10*Math.random())}`,b=e=>{const t=[];for(let r=0;r<e;r++){const e=g(l),r=g(u),n=g(f),o=g(d),a=v(),s=g(e.tokens),i=Math.random()>.5?`; ${g(p)}`:"",c="IE"===e.name?`${e.prefix} (compatible; ${s} ${a}; ${r}${i}; ${n})`:`${e.prefix} (${r}${i}; ${n}) ${s}/${a} ${o}/${v(5)}`;t.push(c)}return Array.from(new Set(t))},w=(e={},t=[])=>{const r=new Set(["host","connection","content-length","sec-ch-ua-platform","sec-ch-ua","sec-ch-ua-mobile","user-agent","origin","sec-fetch-site","sec-fetch-mode","sec-fetch-dest","referer","cookie","accept-encoding","if-none-match",...t.map((e=>e.toLowerCase()))]);for(const t of Object.keys(e)){const n=t.toLowerCase(),o=n.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("-");(r.has(n)||r.has(o.toLowerCase()))&&delete e[t]}return e},x=b(200),_=()=>{const e={},t=!s();return e.Accept||(e.Accept=g(h)),e.Connection||(e.Connection="keep-alive"),e["User-Agent"]||e["user-agent"]||!t||(e["User-Agent"]=g(x)),!e.Referer&&t&&(e.Referer=(()=>{const e=g(m),t=g(["","search","images","news","video","docs"]),r=Math.random()>.5?`?q=test${Math.floor(1e3*Math.random())}`:"";return`${Math.random()>.5?"https":"http"}://www.${e}/${t}${r}`})()),!e["X-Forwarded-For"]&&t&&(e["X-Forwarded-For"]=y()),!e["Cache-Control"]&&t&&(e["Cache-Control"]="max-age=0"),e};const $=e=>/^(\d{1,3}(,\d{2})*(\.\d+)?)$/.test(e)||/^(\d{1,3}(,\d{3})*(\.\d+)?)$/.test(e),S=e=>parseFloat(e.replace(/,/g,"")),E=e=>parseFloat(e.replace(/\./g,"").replace(",",".")),j=(e,t=0)=>null==e?t:"number"==typeof e?e:e&&"string"==typeof e&&/[\d,.]/.test(e)?(e=e.replace(/\s/g,"").trim(),$(e)?S(e):e.includes(",")?E(e):e.includes(".")||!e.includes(",")?parseFloat(e.replace(/,/g,"")):t):t,M=(e=Date.now(),t="DD/MM/YYYY HH:mm:ss")=>{const r=o.default(e);return r.isValid()?r.format(t):""},T=e=>e.replace(/<[^>]*>/g,"").trim();var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O=Array.isArray,N="object"==typeof C&&C&&C.Object===Object&&C,A="object"==typeof self&&self&&self.Object===Object&&self,F=N||A||Function("return this")(),P=F.Symbol,D=P,R=Object.prototype,I=R.hasOwnProperty,L=R.toString,U=D?D.toStringTag:void 0;var z=function(e){var t=I.call(e,U),r=e[U];try{e[U]=void 0;var n=!0}catch(e){}var o=L.call(e);return n&&(t?e[U]=r:delete e[U]),o},B=Object.prototype.toString;var W=z,X=function(e){return B.call(e)},q=P?P.toStringTag:void 0;var G=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":q&&q in Object(e)?W(e):X(e)};var H=G,J=function(e){return null!=e&&"object"==typeof e};var V=function(e){return"symbol"==typeof e||J(e)&&"[object Symbol]"==H(e)},Y=O,K=V,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/;var ee=function(e,t){if(Y(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!K(e))||(Q.test(e)||!Z.test(e)||null!=t&&e in Object(t))};var te=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},re=G,ne=te;var oe,ae=function(e){if(!ne(e))return!1;var t=re(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},se=F["__core-js_shared__"],ie=(oe=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||""))?"Symbol(src)_1."+oe:"";var ce=function(e){return!!ie&&ie in e},le=Function.prototype.toString;var ue=ae,fe=ce,de=te,pe=function(e){if(null!=e){try{return le.call(e)}catch(e){}try{return e+""}catch(e){}}return""},he=/^\[object .+?Constructor\]$/,me=Function.prototype,ge=Object.prototype,ye=me.toString,ve=ge.hasOwnProperty,be=RegExp("^"+ye.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var we=function(e){return!(!de(e)||fe(e))&&(ue(e)?be:he).test(pe(e))},xe=function(e,t){return null==e?void 0:e[t]};var _e=function(e,t){var r=xe(e,t);return we(r)?r:void 0},$e=_e(Object,"create"),Se=$e;var Ee=function(){this.__data__=Se?Se(null):{},this.size=0};var je=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Me=$e,Te=Object.prototype.hasOwnProperty;var Ce=function(e){var t=this.__data__;if(Me){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Te.call(t,e)?t[e]:void 0},ke=$e,Oe=Object.prototype.hasOwnProperty;var Ne=$e;var Ae=Ee,Fe=je,Pe=Ce,De=function(e){var t=this.__data__;return ke?void 0!==t[e]:Oe.call(t,e)},Re=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ne&&void 0===t?"__lodash_hash_undefined__":t,this};function Ie(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ie.prototype.clear=Ae,Ie.prototype.delete=Fe,Ie.prototype.get=Pe,Ie.prototype.has=De,Ie.prototype.set=Re;var Le=Ie;var Ue=function(){this.__data__=[],this.size=0};var ze=function(e,t){return e===t||e!=e&&t!=t};var Be=function(e,t){for(var r=e.length;r--;)if(ze(e[r][0],t))return r;return-1},We=Be,Xe=Array.prototype.splice;var qe=Be;var Ge=Be;var He=Be;var Je=Ue,Ve=function(e){var t=this.__data__,r=We(t,e);return!(r<0)&&(r==t.length-1?t.pop():Xe.call(t,r,1),--this.size,!0)},Ye=function(e){var t=this.__data__,r=qe(t,e);return r<0?void 0:t[r][1]},Ke=function(e){return Ge(this.__data__,e)>-1},Ze=function(e,t){var r=this.__data__,n=He(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Qe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Qe.prototype.clear=Je,Qe.prototype.delete=Ve,Qe.prototype.get=Ye,Qe.prototype.has=Ke,Qe.prototype.set=Ze;var et=Qe,tt=_e(F,"Map"),rt=Le,nt=et,ot=tt;var at=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var st=function(e,t){var r=e.__data__;return at(t)?r["string"==typeof t?"string":"hash"]:r.map},it=st;var ct=st;var lt=st;var ut=st;var ft=function(){this.size=0,this.__data__={hash:new rt,map:new(ot||nt),string:new rt}},dt=function(e){var t=it(this,e).delete(e);return this.size-=t?1:0,t},pt=function(e){return ct(this,e).get(e)},ht=function(e){return lt(this,e).has(e)},mt=function(e,t){var r=ut(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function gt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}gt.prototype.clear=ft,gt.prototype.delete=dt,gt.prototype.get=pt,gt.prototype.has=ht,gt.prototype.set=mt;var yt=gt;function vt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return r.cache=a.set(o,s)||a,s};return r.cache=new(vt.Cache||yt),r}vt.Cache=yt;var bt=vt;var wt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xt=/\\(\\)?/g,_t=function(e){var t=bt(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(wt,(function(e,r,n,o){t.push(n?o.replace(xt,"$1"):r||e)})),t}));var $t=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},St=O,Et=V,jt=P?P.prototype:void 0,Mt=jt?jt.toString:void 0;var Tt=function e(t){if("string"==typeof t)return t;if(St(t))return $t(t,e)+"";if(Et(t))return Mt?Mt.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r},Ct=Tt;var kt=O,Ot=ee,Nt=_t,At=function(e){return null==e?"":Ct(e)};var Ft=V;var Pt=function(e,t){return kt(e)?e:Ot(e,t)?[e]:Nt(At(e))},Dt=function(e){if("string"==typeof e||Ft(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Rt=function(e,t){for(var r=0,n=(t=Pt(t,e)).length;null!=e&&r<n;)e=e[Dt(t[r++])];return r&&r==n?e:void 0};var It=k((function(e,t,r){var n=null==e?void 0:Rt(e,t);return void 0===n?r:n}));const Lt={columnIndexCache:new Map,columnNameCache:new Map};function Ut(e){const t=e.toUpperCase();if(Lt.columnIndexCache.has(t))return Lt.columnIndexCache.get(t);let r=0;for(let e=0;e<t.length;e++)r=26*r+(t.charCodeAt(e)-65+1);const n=r-1;return Lt.columnIndexCache.set(t,n),n}const zt={getStr(e=[],t,r=""){const n=It(e,`[${t}]`,"");return"number"==typeof n?String(n):String(n||r).trim()},getNum(e=[],t,r=0){const n=String(It(e,`[${t}]`,"")).replace(/\s/g,"");if(!n)return r;const o=Number(n);return isNaN(o)?r:o},getBool(e=[],t,r=!1){if(!Array.isArray(e))return r;const n=It(e,`[${t}]`,r);return["TRUE","FALSE"].includes(n)?"TRUE"===n:"boolean"==typeof n?n:r},getPrice(e=[],t){const r=this.getStr(e,t);if(!r)return 0;const n=j(r);return isNaN(n)?0:n},getDate(e=[],t,r){const n=this.getStr(e,t);if(!n)return null;return o.default(n,r).toDate()},getDateFormatted(e=[],t,r,n){const a=this.getStr(e,t);if(!a)return null;const s=o.default(a);return r?M(s.toDate(),r):M(s.toDate())}},Bt={getStr(e=[],t,r=""){const n=Ut(t),o=It(e,`[${n}]`,"");return"number"==typeof o?String(o):String(o||r).trim()},getNum(e=[],t,r=0){const n=Ut(t),o=String(It(e,`[${n}]`,"")).replace(/\s/g,"");if(!o)return r;const a=Number(o);return isNaN(a)?r:a},getBool(e=[],t,r=!1){const n=Ut(t);if(!Array.isArray(e))return r;const o=It(e,`[${n}]`,r);return["TRUE","FALSE"].includes(o)?"TRUE"===o:"boolean"==typeof o?o:r},getPrice(e=[],t){const r=this.getStr(e,t);if(!r)return 0;const n=j(r);return isNaN(n)?0:n},getDate(e=[],t,r){const n=this.getStr(e,t);if(!n)return null;return o.default(n,r).toDate()},getDateFormatted(e=[],t,r,n){const a=this.getStr(e,t);if(!a)return null;const s=o.default(a);return r?M(s.toDate(),r):M(s.toDate())}},Wt=(e,t)=>{const r=Math.floor(e/1e3),n=Math.floor(r/60),o=Math.floor(n/60),a=r%60;switch(t){case"ms":return`${e} millisoniya`;case"s":return`${(e/1e3).toFixed(2)} soniya`;case"min":return`${(e/6e4).toFixed(2)} daqiqa`;default:return`${o>0?`${o} soat `:""}${n%60>0?n%60+" daqiqa ":""}${(a>0?`${a} soniya`:"")||"0 soniya"}`.trim()}},Xt=(e,t)=>{const r=t.split(".");let n=e;for(const e of r){if(!n&&"number"!=typeof n)return;n=n[e]}return n},qt=(e,t)=>{if(c("frontend"),window.navigator){const r=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=r,n.download=t,document.body.appendChild(n),n.click(),setTimeout((()=>{window.URL.revokeObjectURL(r),document.body.removeChild(n)}),1e3)}};const Gt=["err.cause.message","detailMessage","error_description","error.message","description","msg","message","error","errors","errorDetails","errorMessage","error_type","errorMsg","errorMessages","error_info","error_info.message","error_info.error_message","error_info.details","data.message","response.message","response.error_message","response.details","httpError","validationError","status_description","messages","alert_message","alert","userMessage","user_error","client_error","response.data.error","response.data.message","response.data.error_description","response.data.details","errorMessages[*].message","errors[*].msg","errors[*].message","[*].msg","[*].message"],Ht=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}return e},Jt=(e,t,r=0,n=5)=>{if(r>n||"object"!=typeof e||null===e)return null;for(const o of t){const a=o.split(".");let s=e;for(const e of a){if(null==s)break;if("[*]"===e){if(Array.isArray(s)){for(const t of s){const o=Jt(t,[a.slice(a.indexOf(e)+1).join(".")],r+1,n);if(o)return o}s=null;break}s=null;break}if(e.endsWith("]")){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const[,e,r]=t;s=s?.[e]?.[Number(r)]}else s=s?.[e]}else s=s?.[e]}if(s=Ht(s),Array.isArray(s)){const e=s.map((e=>"string"==typeof e?e:e?.message||e?.msg||"")).filter(Boolean).join("\n");if(e)return e}if("string"==typeof s)return T(s);if("object"==typeof s&&null!==s){const e=Jt(s,t,r+1,n);if(e)return e}}return null},Vt=(e,t,r=0,n=5)=>{if(r>n||"object"!=typeof e||null===e)return[];const o=[];for(const a of t){const s=a.split(".");let i=e;for(let e=0;e<s.length;e++){const t=s[e];if(null==i)break;if("[*]"===t){if(Array.isArray(i)){const t=s.slice(e+1).join(".");for(const e of i)o.push(...Vt(e,[t],r+1,n))}i=null;break}if(t.endsWith("]")){const e=t.match(/(\w+)\[(\d+)\]/);if(e){const[,t,r]=e;i=i?.[t]?.[Number(r)]}else i=i?.[t]}else i=i?.[t]}if(i=Ht(i),"string"==typeof i)o.push(T(i));else if(Array.isArray(i)){for(const e of i)if("string"==typeof e)o.push(T(e));else if("object"==typeof e){const a=e?.message||e?.msg;"string"==typeof a?o.push(T(a)):o.push(...Vt(e,t,r+1,n))}}else"object"==typeof i&&o.push(...Vt(i,t,r+1,n))}return o},Yt=(e,t="",r=[])=>{const n=[...r,...Gt];if(!e)return t;if("string"==typeof e){const r=Ht(e);return"object"==typeof r?Jt(r,n)||t:T(e)}const o=Ht(e?.response?.data||e?.data||e),a=Jt(o,n)||e?.message;return T(a||"").trim()||t},Kt={PDF:"pdf",PNG:"image/png",JPEG:"image/jpeg",EXCEL:"excel",WORD:"word",TEXT:"text"},Zt={[Kt.PDF]:{mimeType:"application/pdf",extension:"pdf"},[Kt.PNG]:{mimeType:"image/png",extension:"png"},[Kt.JPEG]:{mimeType:"image/jpeg",extension:"jpg"},[Kt.EXCEL]:{mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"},[Kt.WORD]:{mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"},[Kt.TEXT]:{mimeType:"text/plain",extension:"txt"}};e.ColumnMapper=Bt,e.Excel=class{constructor(){c("frontend")}async readFromArrayBuffer(e,t){try{let r;r=e instanceof Buffer?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):await e.arrayBuffer();const n=new a.default.Workbook;await n.xlsx.load(r);const o=n.getWorksheet(t),s=[];return o?(o.eachRow({includeEmpty:!0},(e=>{const t=[];e.eachCell({includeEmpty:!0},(e=>{t.push(void 0!==e.value?e.value:null)})),s.push(t)})),s):[]}catch(e){return[]}}async read(e,t=1){try{const r=new a.default.Workbook;await r.xlsx.readFile(e);const n=r.getWorksheet(t);if(!n)throw new Error(`Excelda ${t}-raqamli jadval topilmadi. Iltimos, faylda ushbu jadval mavjudligini tekshiring.`);const o=[];return n.eachRow({includeEmpty:!0},(e=>{const t=[];e.eachCell({includeEmpty:!0},(e=>{t.push(void 0!==e.value?e.value:null)})),o.push(t)})),o}catch(e){return this.handleError(e,this.read),[]}}async write(e,t,r,n="file",o="Sheet1",s=""){try{const i=new a.default.Workbook,c=i.addWorksheet(o);c.addRow(t),e.forEach((e=>{const t=r.map((t=>{const r=Xt(e,t);return!(null==r||"null"===r||"undefined"===r||"NaN"===r||"number"==typeof r&&isNaN(r))?r:s}));c.addRow(t)}));const l=`${n}_${(new Date).toISOString().slice(0,10)}.xlsx`,u=await i.xlsx.writeBuffer(),f=new Blob([u],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});return await qt(f,l),!0}catch(e){return this.handleError(e,this.write),!1}}async writeFromArray(e,t=[],r="file",n="Sheet1",o=""){try{const s=new a.default.Workbook,i=s.addWorksheet(n);t.length>0&&i.addRow(t),e.forEach((e=>{const t=e.map((e=>null==e||"null"===e||"undefined"===e||"NaN"===e||"number"==typeof e&&isNaN(e)?o:e));i.addRow(t)}));const c=`${r}_${(new Date).toISOString().slice(0,10)}.xlsx`,l=await s.xlsx.writeBuffer(),u=new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});return await qt(u,c),!0}catch(e){return this.handleError(e,this.writeFromArray),!1}}handleError(e,t){const r=t.name;throw new Error(`Xatolik Excel.${r} metodida yuz berdi: ${Yt(e)}`)}},e.FileType=Kt,e.IndexMapper=zt,e.StyledLogger=class{static getStyle(e){switch(e){case"log":return"color: #3498db; font-weight: bold;";case"info":return"color: #2ecc71; font-weight: bold;";case"warn":return"color: #f39c12; font-weight: bold;";case"error":return"color: #e74c3c; font-weight: bold;";case"success":return"color: #27ae60; font-weight: bold;";case"debug":return"color: #9b59b6; font-weight: bold;";default:return""}}static log(e,t="",...r){if(s())console.log(`%c${t}`,this.getStyle(e),...r);else{const n={log:"[34m",info:"[32m",warn:"[33m",error:"[31m",success:"[32m",debug:"[35m"};console.log(`${n[e]}[${e.toUpperCase()}] ${t}[0m`,...r)}}static info(e,...t){this.log("info",e,...t)}static warn(e,...t){this.log("warn",e,...t)}static error(e,...t){this.log("error",e,...t)}static success(e,...t){this.log("success",e,...t)}static debug(e,...t){this.log("debug",e,...t)}},e.axiosErrorHandler=(e,t=!0)=>r=>{const n=(r.message||"").trim();r.message="";const o=Yt(r).trim()||n,a={error:o,data:r.response?.data,status:r.response?.status,statusText:r.response?.statusText,type:"ERROR"};return e?.(r,o),t?Promise.reject(a):Promise.resolve(a)},e.axiosSuccessHandler=e=>t=>(e?.(t.data),{...t,type:"SUCCESS"}),e.checkEnvironment=c,e.clearHeaders=w,e.convertBase64ToFile=(e,t="converted_file",r)=>{c("frontend");const n=Zt[Kt[r]];if(!n)throw new Error(`Invalid file type: ${r}`);const{mimeType:o,extension:a}=n,s=e.replace(/^data:.*;base64,/,""),i=window.atob(s),l=i.length,u=new Uint8Array(l);for(let e=0;e<l;e++)u[e]=i.charCodeAt(e);const f=new Blob([u],{type:o});qt(f,`${t}.${a}`)},e.convertDigitalSize=(e,t,r)=>{if(r<=0)return 0;const n={bit:1,byte:8,kb:8192,mb:8388608,gb:8*1024**3,tb:8*1024**4};if(!n[e]||!n[t])throw new Error("Invalid unit");return parseFloat((r*n[e]/n[t]).toFixed(2))},e.copyToClipboard=async e=>{c("frontend"),await navigator.clipboard.writeText(e)},e.debounce=(e,t=300,r=!1)=>{let n=null;return(...o)=>new Promise((a=>{const s=r&&!n;n&&clearTimeout(n),n=setTimeout((()=>{n=null,r||a(e(...o))}),t),s&&a(e(...o))}))},e.delay=e=>new Promise((t=>setTimeout(t,e))),e.delayRun=function(e,t){return new Promise((r=>{setTimeout((async()=>{if(t)try{const e=await t();r(e)}catch(e){throw e}r(null)}),e)}))},e.extractErrorMessage=Yt,e.extractErrorMessages=(e,t=[])=>{const r=[...Gt,...t];if(!e)return[];const n=Ht("string"==typeof e?e:e?.response?.data||e?.data||e);return Vt(n,r)},e.fileConfigs=Zt,e.formatCurrencyPrice=(e,t,r="en-US")=>e?.toLocaleString(r,{style:"currency",currency:t}),e.formatDateLocaleString=(e,t="en-GB",r="Asia/Tashkent")=>new Date(e).toLocaleString(t,{timeZone:r}),e.formatDuration=Wt,e.formatJsonForTelegram=e=>{try{"string"==typeof e&&(e=JSON.parse(e));return`<pre>${JSON.stringify(e,null,2)}</pre>`}catch(t){return`<pre>${e}</pre>`}},e.formatStringToFloat=j,e.generateAndAssignRandomHeaders=e=>{e.headers=e.headers||{},w(e.headers);const t=_();return Object.assign(e.headers,t),e},e.generateIdempotencyKey=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),e.generateRandomHeaders=_,e.generateUserAgents=b,e.getColumnIndex=Ut,e.getColumnName=function(e){if(Lt.columnNameCache.has(e))return Lt.columnNameCache.get(e);let t="";for(;e>=0;){const r=e%26;t=String.fromCharCode(65+r)+t,e=Math.floor(e/26)-1}return Lt.columnNameCache.set(e,t),t},e.getFormattedDate=M,e.getLocalIP=async()=>{c("backend");const e=(await import("os")).networkInterfaces();for(const t in e)for(const r of e[t]||[])if("IPv4"===r.family&&!r.internal)return r.address;return"127.0.0.1"},e.getNestedValue=Xt,e.getRandomInt=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),e.getValidDate=(e,t)=>o.default(e,t).toDate(),e.getValueByName=function(e=[],t,r=null){if(!Array.isArray(e))return r;const n=Ut(t);return It(e,`[${n}]`,r)},e.isBrowser=s,e.isIndianFormat=$,e.isNode=i,e.measureExecutionTime=(e,t="Execution",r)=>{const n=new Date;console.log(`[${t}] Boshladi: ${M(n)}`);const o=e(),a=e=>{const o=e.getTime()-n.getTime();console.log(`[${t}] Tugadi: ${M(e)}`),console.log(`[${t}] Davomiyligi: ${Wt(o,r)}`)};return o instanceof Promise?o.then((e=>(a(new Date),e))):(a(new Date),o)},e.objectItemToArray=(e,t,r="")=>t.map((t=>{const n=Xt(e,t);return n||"number"==typeof n?n:r})),e.objectToArray=(e,t,r=[],n="")=>{const o=[];return r.length>0&&o.push(r.map((e=>e.trim()||n))),e.forEach((e=>{const r=t.map((t=>{const r=Xt(e,t);return r||"number"==typeof r?r:n}));o.push(r)})),o},e.parseEuropeanFormat=E,e.parseIndianFormat=S,e.parseSeparatedNumber=e=>{const t=Number(e?.replace(/,/g,""));return isNaN(t)?0:t},e.rand=g,e.randIp=y,e.saveFile=qt,e.scrollToElement=e=>{c("frontend");const t=document.querySelector(e);t&&t.scrollIntoView({behavior:"smooth"})},e.stripHtmlTags=T,e.toMilliseconds=e=>{const{milliseconds:t=0,seconds:r=0,minutes:n=0,hours:o=0,days:a=0,weeks:s=0,months:i=0,years:c=0}=e,l=36e5,u=864e5;return t+1e3*r+6e4*n+o*l+a*u+6048e5*s+2630016e3*i+315576e5*c},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("moment"),require("exceljs")):"function"==typeof define&&define.amd?define(["exports","moment","exceljs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).utilzify={},e.moment,e.ExcelJS)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),a=n(r);const s=()=>"undefined"!=typeof window&&"undefined"!=typeof document,i=()=>"undefined"!=typeof process&&Boolean(process.versions?.node),c=e=>{const t=s(),r=i();if("frontend"===e&&!t)throw new Error("This function can only be used in a frontend environment.");if("backend"===e&&!r)throw new Error("This function can only be used in a backend environment.");return"frontend"===e?t:r},l=[{name:"Chrome",tokens:["Chrome","Safari"],prefix:"Mozilla/5.0"},{name:"Firefox",tokens:["Gecko"],prefix:"Mozilla/5.0"},{name:"Opera",tokens:["Presto"],prefix:"Opera/9.80"},{name:"Edge",tokens:["Edg"],prefix:"Mozilla/5.0"},{name:"Safari",tokens:["Version","Safari"],prefix:"Mozilla/5.0"},{name:"IE",tokens:["MSIE","Trident"],prefix:"Mozilla/4.0"}],u=["Windows NT 10.0","Windows NT 6.1","Windows 3.1","Macintosh; Intel Mac OS X 10_15_7","X11; Linux x86_64","X11; Ubuntu; Linux i686","Android 12; Mobile","Android 11; Tablet","iPhone; CPU iPhone OS 16_6 like Mac OS X","iPad; CPU OS 15_4 like Mac OS X"],f=["en","ru","de","fr","es","it","pl","ko","ja","tr"],d=["Trident","Gecko","Presto","Blink"],p=["WOW64","Win64; x64",".NET CLR 3.5.30729","SLCC2","InfoPath.3","Media Center PC 6.0","Tablet PC 2.0"],h=["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","application/json, text/plain, */*"],m=["google.com","bing.com","yandex.ru","duckduckgo.com","example.com","wikipedia.org"],g=e=>e[Math.floor(Math.random()*e.length)],y=()=>`${g([13,14,15,16,17,18,19,20])}.${Math.floor(256*Math.random())}.${Math.floor(256*Math.random())}.${Math.floor(1+254*Math.random())}`,v=(e=15)=>`${Math.floor(Math.random()*e)+1}.${Math.floor(10*Math.random())}`,b=e=>{const t=[];for(let r=0;r<e;r++){const e=g(l),r=g(u),n=g(f),o=g(d),a=v(),s=g(e.tokens),i=Math.random()>.5?`; ${g(p)}`:"",c="IE"===e.name?`${e.prefix} (compatible; ${s} ${a}; ${r}${i}; ${n})`:`${e.prefix} (${r}${i}; ${n}) ${s}/${a} ${o}/${v(5)}`;t.push(c)}return Array.from(new Set(t))},w=(e={},t=[])=>{const r=new Set(["host","connection","content-length","sec-ch-ua-platform","sec-ch-ua","sec-ch-ua-mobile","user-agent","origin","sec-fetch-site","sec-fetch-mode","sec-fetch-dest","referer","cookie","accept-encoding","if-none-match",...t.map((e=>e.toLowerCase()))]);for(const t of Object.keys(e)){const n=t.toLowerCase(),o=n.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("-");(r.has(n)||r.has(o.toLowerCase()))&&delete e[t]}return e},x=b(200),_=()=>{const e={},t=!s();return e.Accept||(e.Accept=g(h)),e.Connection||(e.Connection="keep-alive"),e["User-Agent"]||e["user-agent"]||!t||(e["User-Agent"]=g(x)),!e.Referer&&t&&(e.Referer=(()=>{const e=g(m),t=g(["","search","images","news","video","docs"]),r=Math.random()>.5?`?q=test${Math.floor(1e3*Math.random())}`:"";return`${Math.random()>.5?"https":"http"}://www.${e}/${t}${r}`})()),!e["X-Forwarded-For"]&&t&&(e["X-Forwarded-For"]=y()),!e["Cache-Control"]&&t&&(e["Cache-Control"]="max-age=0"),e};const $=e=>/^(\d{1,3}(,\d{2})*(\.\d+)?)$/.test(e)||/^(\d{1,3}(,\d{3})*(\.\d+)?)$/.test(e),S=e=>parseFloat(e.replace(/,/g,"")),E=e=>parseFloat(e.replace(/\./g,"").replace(",",".")),j=(e,t=0)=>null==e?t:"number"==typeof e?e:e&&"string"==typeof e&&/[\d,.]/.test(e)?(e=e.replace(/\s/g,"").trim(),$(e)?S(e):e.includes(",")?E(e):e.includes(".")||!e.includes(",")?parseFloat(e.replace(/,/g,"")):t):t,M=(e=Date.now(),t="DD/MM/YYYY HH:mm:ss")=>{const r=o.default(e);return r.isValid()?r.format(t):""},T=e=>e.replace(/<[^>]*>/g,"").trim();var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O=Array.isArray,N="object"==typeof C&&C&&C.Object===Object&&C,A="object"==typeof self&&self&&self.Object===Object&&self,F=N||A||Function("return this")(),P=F.Symbol,D=P,R=Object.prototype,I=R.hasOwnProperty,L=R.toString,U=D?D.toStringTag:void 0;var z=function(e){var t=I.call(e,U),r=e[U];try{e[U]=void 0;var n=!0}catch(e){}var o=L.call(e);return n&&(t?e[U]=r:delete e[U]),o},B=Object.prototype.toString;var W=z,X=function(e){return B.call(e)},q=P?P.toStringTag:void 0;var G=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":q&&q in Object(e)?W(e):X(e)};var H=G,J=function(e){return null!=e&&"object"==typeof e};var V=function(e){return"symbol"==typeof e||J(e)&&"[object Symbol]"==H(e)},Y=O,K=V,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/;var ee=function(e,t){if(Y(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!K(e))||(Q.test(e)||!Z.test(e)||null!=t&&e in Object(t))};var te=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},re=G,ne=te;var oe,ae=function(e){if(!ne(e))return!1;var t=re(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},se=F["__core-js_shared__"],ie=(oe=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||""))?"Symbol(src)_1."+oe:"";var ce=function(e){return!!ie&&ie in e},le=Function.prototype.toString;var ue=ae,fe=ce,de=te,pe=function(e){if(null!=e){try{return le.call(e)}catch(e){}try{return e+""}catch(e){}}return""},he=/^\[object .+?Constructor\]$/,me=Function.prototype,ge=Object.prototype,ye=me.toString,ve=ge.hasOwnProperty,be=RegExp("^"+ye.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var we=function(e){return!(!de(e)||fe(e))&&(ue(e)?be:he).test(pe(e))},xe=function(e,t){return null==e?void 0:e[t]};var _e=function(e,t){var r=xe(e,t);return we(r)?r:void 0},$e=_e(Object,"create"),Se=$e;var Ee=function(){this.__data__=Se?Se(null):{},this.size=0};var je=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Me=$e,Te=Object.prototype.hasOwnProperty;var Ce=function(e){var t=this.__data__;if(Me){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Te.call(t,e)?t[e]:void 0},ke=$e,Oe=Object.prototype.hasOwnProperty;var Ne=$e;var Ae=Ee,Fe=je,Pe=Ce,De=function(e){var t=this.__data__;return ke?void 0!==t[e]:Oe.call(t,e)},Re=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ne&&void 0===t?"__lodash_hash_undefined__":t,this};function Ie(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ie.prototype.clear=Ae,Ie.prototype.delete=Fe,Ie.prototype.get=Pe,Ie.prototype.has=De,Ie.prototype.set=Re;var Le=Ie;var Ue=function(){this.__data__=[],this.size=0};var ze=function(e,t){return e===t||e!=e&&t!=t};var Be=function(e,t){for(var r=e.length;r--;)if(ze(e[r][0],t))return r;return-1},We=Be,Xe=Array.prototype.splice;var qe=Be;var Ge=Be;var He=Be;var Je=Ue,Ve=function(e){var t=this.__data__,r=We(t,e);return!(r<0)&&(r==t.length-1?t.pop():Xe.call(t,r,1),--this.size,!0)},Ye=function(e){var t=this.__data__,r=qe(t,e);return r<0?void 0:t[r][1]},Ke=function(e){return Ge(this.__data__,e)>-1},Ze=function(e,t){var r=this.__data__,n=He(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Qe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Qe.prototype.clear=Je,Qe.prototype.delete=Ve,Qe.prototype.get=Ye,Qe.prototype.has=Ke,Qe.prototype.set=Ze;var et=Qe,tt=_e(F,"Map"),rt=Le,nt=et,ot=tt;var at=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var st=function(e,t){var r=e.__data__;return at(t)?r["string"==typeof t?"string":"hash"]:r.map},it=st;var ct=st;var lt=st;var ut=st;var ft=function(){this.size=0,this.__data__={hash:new rt,map:new(ot||nt),string:new rt}},dt=function(e){var t=it(this,e).delete(e);return this.size-=t?1:0,t},pt=function(e){return ct(this,e).get(e)},ht=function(e){return lt(this,e).has(e)},mt=function(e,t){var r=ut(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function gt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}gt.prototype.clear=ft,gt.prototype.delete=dt,gt.prototype.get=pt,gt.prototype.has=ht,gt.prototype.set=mt;var yt=gt;function vt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return r.cache=a.set(o,s)||a,s};return r.cache=new(vt.Cache||yt),r}vt.Cache=yt;var bt=vt;var wt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xt=/\\(\\)?/g,_t=function(e){var t=bt(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(wt,(function(e,r,n,o){t.push(n?o.replace(xt,"$1"):r||e)})),t}));var $t=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},St=O,Et=V,jt=P?P.prototype:void 0,Mt=jt?jt.toString:void 0;var Tt=function e(t){if("string"==typeof t)return t;if(St(t))return $t(t,e)+"";if(Et(t))return Mt?Mt.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r},Ct=Tt;var kt=O,Ot=ee,Nt=_t,At=function(e){return null==e?"":Ct(e)};var Ft=V;var Pt=function(e,t){return kt(e)?e:Ot(e,t)?[e]:Nt(At(e))},Dt=function(e){if("string"==typeof e||Ft(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Rt=function(e,t){for(var r=0,n=(t=Pt(t,e)).length;null!=e&&r<n;)e=e[Dt(t[r++])];return r&&r==n?e:void 0};var It=k((function(e,t,r){var n=null==e?void 0:Rt(e,t);return void 0===n?r:n}));const Lt={columnIndexCache:new Map,columnNameCache:new Map};function Ut(e){const t=e.toUpperCase();if(Lt.columnIndexCache.has(t))return Lt.columnIndexCache.get(t);let r=0;for(let e=0;e<t.length;e++)r=26*r+(t.charCodeAt(e)-65+1);const n=r-1;return Lt.columnIndexCache.set(t,n),n}const zt={getStr(e=[],t,r=""){const n=It(e,`[${t}]`,"");return"number"==typeof n?String(n):String(n||r).trim()},getNum(e=[],t,r=0){const n=String(It(e,`[${t}]`,"")).replace(/\s/g,"");if(!n)return r;const o=Number(n);return isNaN(o)?r:o},getBool(e=[],t,r=!1){if(!Array.isArray(e))return r;const n=It(e,`[${t}]`,r);return["TRUE","FALSE"].includes(n)?"TRUE"===n:"boolean"==typeof n?n:r},getPrice(e=[],t){const r=this.getStr(e,t);if(!r)return 0;const n=j(r);return isNaN(n)?0:n},getDate(e=[],t,r){const n=this.getStr(e,t);if(!n)return null;return o.default(n,r).toDate()},getDateFormatted(e=[],t,r,n){const a=this.getStr(e,t);if(!a)return null;const s=o.default(a,n);return r?M(s.toDate(),r):M(s.toDate())}},Bt={getStr(e=[],t,r=""){const n=Ut(t),o=It(e,`[${n}]`,"");return"number"==typeof o?String(o):String(o||r).trim()},getNum(e=[],t,r=0){const n=Ut(t),o=String(It(e,`[${n}]`,"")).replace(/\s/g,"");if(!o)return r;const a=Number(o);return isNaN(a)?r:a},getBool(e=[],t,r=!1){const n=Ut(t);if(!Array.isArray(e))return r;const o=It(e,`[${n}]`,r);return["TRUE","FALSE"].includes(o)?"TRUE"===o:"boolean"==typeof o?o:r},getPrice(e=[],t){const r=this.getStr(e,t);if(!r)return 0;const n=j(r);return isNaN(n)?0:n},getDate(e=[],t,r){const n=this.getStr(e,t);if(!n)return null;return o.default(n,r).toDate()},getDateFormatted(e=[],t,r,n){const a=this.getStr(e,t);if(!a)return null;const s=o.default(a,n);return r?M(s.toDate(),r):M(s.toDate())}},Wt=(e,t)=>{const r=Math.floor(e/1e3),n=Math.floor(r/60),o=Math.floor(n/60),a=r%60;switch(t){case"ms":return`${e} millisoniya`;case"s":return`${(e/1e3).toFixed(2)} soniya`;case"min":return`${(e/6e4).toFixed(2)} daqiqa`;default:return`${o>0?`${o} soat `:""}${n%60>0?n%60+" daqiqa ":""}${(a>0?`${a} soniya`:"")||"0 soniya"}`.trim()}},Xt=(e,t)=>{const r=t.split(".");let n=e;for(const e of r){if(!n&&"number"!=typeof n)return;n=n[e]}return n},qt=(e,t)=>{if(c("frontend"),window.navigator){const r=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=r,n.download=t,document.body.appendChild(n),n.click(),setTimeout((()=>{window.URL.revokeObjectURL(r),document.body.removeChild(n)}),1e3)}};const Gt=["err.cause.message","cause.stack","detailMessage","error_description","error.message","description","msg","message","error","errors","errorDetails","errorMessage","error_type","errorMsg","errorMessages","error_info","error_info.message","error_info.error_message","error_info.details","data.message","response.message","response.error_message","response.details","httpError","validationError","status_description","messages","alert_message","alert","userMessage","user_error","client_error","response.data.error","response.data.message","response.data.error_description","response.data.details","errorMessages[*].message","errors[*].msg","errors[*].message","[*].msg","[*].message"],Ht=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}return e},Jt=(e,t,r=0,n=5)=>{if(r>n||"object"!=typeof e||null===e)return null;for(const o of t){const a=o.split(".");let s=e;for(const e of a){if(null==s)break;if("[*]"===e){if(Array.isArray(s)){for(const t of s){const o=Jt(t,[a.slice(a.indexOf(e)+1).join(".")],r+1,n);if(o)return o}s=null;break}s=null;break}if(e.endsWith("]")){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const[,e,r]=t;s=s?.[e]?.[Number(r)]}else s=s?.[e]}else s=s?.[e]}if(s=Ht(s),Array.isArray(s)){const e=s.map((e=>"string"==typeof e?e:e?.message||e?.msg||"")).filter(Boolean).join("\n");if(e)return e}if("string"==typeof s)return T(s);if("object"==typeof s&&null!==s){const e=Jt(s,t,r+1,n);if(e)return e}}return null},Vt=(e,t,r=0,n=5)=>{if(r>n||"object"!=typeof e||null===e)return[];const o=[];for(const a of t){const s=a.split(".");let i=e;for(let e=0;e<s.length;e++){const t=s[e];if(null==i)break;if("[*]"===t){if(Array.isArray(i)){const t=s.slice(e+1).join(".");for(const e of i)o.push(...Vt(e,[t],r+1,n))}i=null;break}if(t.endsWith("]")){const e=t.match(/(\w+)\[(\d+)\]/);if(e){const[,t,r]=e;i=i?.[t]?.[Number(r)]}else i=i?.[t]}else i=i?.[t]}if(i=Ht(i),"string"==typeof i)o.push(T(i));else if(Array.isArray(i)){for(const e of i)if("string"==typeof e)o.push(T(e));else if("object"==typeof e){const a=e?.message||e?.msg;"string"==typeof a?o.push(T(a)):o.push(...Vt(e,t,r+1,n))}}else"object"==typeof i&&o.push(...Vt(i,t,r+1,n))}return o},Yt=(e,t="",r=[])=>{const n=[...r,...Gt];if(!e)return t;if("string"==typeof e){const r=Ht(e);return"object"==typeof r?Jt(r,n)||t:T(e)}const o=Ht(e?.response?.data||e?.data||e),a=Jt(o,n)||e?.message;return T(a||"").trim()||t},Kt={PDF:"pdf",PNG:"image/png",JPEG:"image/jpeg",EXCEL:"excel",WORD:"word",TEXT:"text"},Zt={[Kt.PDF]:{mimeType:"application/pdf",extension:"pdf"},[Kt.PNG]:{mimeType:"image/png",extension:"png"},[Kt.JPEG]:{mimeType:"image/jpeg",extension:"jpg"},[Kt.EXCEL]:{mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"},[Kt.WORD]:{mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"},[Kt.TEXT]:{mimeType:"text/plain",extension:"txt"}};e.ColumnMapper=Bt,e.Excel=class{constructor(){c("frontend")}async readFromArrayBuffer(e,t){try{let r;r=e instanceof Buffer?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):await e.arrayBuffer();const n=new a.default.Workbook;await n.xlsx.load(r);const o=n.getWorksheet(t),s=[];return o?(o.eachRow({includeEmpty:!0},(e=>{const t=[];e.eachCell({includeEmpty:!0},(e=>{t.push(void 0!==e.value?e.value:null)})),s.push(t)})),s):[]}catch(e){return[]}}async read(e,t=1){try{const r=new a.default.Workbook;await r.xlsx.readFile(e);const n=r.getWorksheet(t);if(!n)throw new Error(`Excelda ${t}-raqamli jadval topilmadi. Iltimos, faylda ushbu jadval mavjudligini tekshiring.`);const o=[];return n.eachRow({includeEmpty:!0},(e=>{const t=[];e.eachCell({includeEmpty:!0},(e=>{t.push(void 0!==e.value?e.value:null)})),o.push(t)})),o}catch(e){return this.handleError(e,this.read),[]}}async write(e,t,r,n="file",o="Sheet1",s=""){try{const i=new a.default.Workbook,c=i.addWorksheet(o);c.addRow(t),e.forEach((e=>{const t=r.map((t=>{const r=Xt(e,t);return!(null==r||"null"===r||"undefined"===r||"NaN"===r||"number"==typeof r&&isNaN(r))?r:s}));c.addRow(t)}));const l=`${n}_${(new Date).toISOString().slice(0,10)}.xlsx`,u=await i.xlsx.writeBuffer(),f=new Blob([u],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});return await qt(f,l),!0}catch(e){return this.handleError(e,this.write),!1}}async writeFromArray(e,t=[],r="file",n="Sheet1",o=""){try{const s=new a.default.Workbook,i=s.addWorksheet(n);t.length>0&&i.addRow(t),e.forEach((e=>{const t=e.map((e=>null==e||"null"===e||"undefined"===e||"NaN"===e||"number"==typeof e&&isNaN(e)?o:e));i.addRow(t)}));const c=`${r}_${(new Date).toISOString().slice(0,10)}.xlsx`,l=await s.xlsx.writeBuffer(),u=new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});return await qt(u,c),!0}catch(e){return this.handleError(e,this.writeFromArray),!1}}handleError(e,t){const r=t.name;throw new Error(`Xatolik Excel.${r} metodida yuz berdi: ${Yt(e)}`)}},e.FileType=Kt,e.IndexMapper=zt,e.StyledLogger=class{static getStyle(e){switch(e){case"log":return"color: #3498db; font-weight: bold;";case"info":return"color: #2ecc71; font-weight: bold;";case"warn":return"color: #f39c12; font-weight: bold;";case"error":return"color: #e74c3c; font-weight: bold;";case"success":return"color: #27ae60; font-weight: bold;";case"debug":return"color: #9b59b6; font-weight: bold;";default:return""}}static log(e,t="",...r){if(s())console.log(`%c${t}`,this.getStyle(e),...r);else{const n={log:"[34m",info:"[32m",warn:"[33m",error:"[31m",success:"[32m",debug:"[35m"};console.log(`${n[e]}[${e.toUpperCase()}] ${t}[0m`,...r)}}static info(e,...t){this.log("info",e,...t)}static warn(e,...t){this.log("warn",e,...t)}static error(e,...t){this.log("error",e,...t)}static success(e,...t){this.log("success",e,...t)}static debug(e,...t){this.log("debug",e,...t)}},e.axiosErrorHandler=(e,t=!0)=>r=>{const n=(r.message||"").trim();r.message="";const o=Yt(r).trim()||n,a={error:o,data:r.response?.data,status:r.response?.status,statusText:r.response?.statusText,type:"ERROR"};return e?.(r,o),t?Promise.reject(a):Promise.resolve(a)},e.axiosSuccessHandler=e=>t=>(e?.(t.data),{...t,type:"SUCCESS"}),e.checkEnvironment=c,e.clearHeaders=w,e.convertBase64ToFile=(e,t="converted_file",r)=>{c("frontend");const n=Zt[Kt[r]];if(!n)throw new Error(`Invalid file type: ${r}`);const{mimeType:o,extension:a}=n,s=e.replace(/^data:.*;base64,/,""),i=window.atob(s),l=i.length,u=new Uint8Array(l);for(let e=0;e<l;e++)u[e]=i.charCodeAt(e);const f=new Blob([u],{type:o});qt(f,`${t}.${a}`)},e.convertDigitalSize=(e,t,r)=>{if(r<=0)return 0;const n={bit:1,byte:8,kb:8192,mb:8388608,gb:8*1024**3,tb:8*1024**4};if(!n[e]||!n[t])throw new Error("Invalid unit");return parseFloat((r*n[e]/n[t]).toFixed(2))},e.copyToClipboard=async e=>{c("frontend"),await navigator.clipboard.writeText(e)},e.debounce=(e,t=300,r=!1)=>{let n=null;return(...o)=>new Promise((a=>{const s=r&&!n;n&&clearTimeout(n),n=setTimeout((()=>{n=null,r||a(e(...o))}),t),s&&a(e(...o))}))},e.delay=e=>new Promise((t=>setTimeout(t,e))),e.delayRun=function(e,t){return new Promise((r=>{setTimeout((async()=>{if(t)try{const e=await t();r(e)}catch(e){throw e}r(null)}),e)}))},e.extractErrorMessage=Yt,e.extractErrorMessages=(e,t=[])=>{const r=[...Gt,...t];if(!e)return[];const n=Ht("string"==typeof e?e:e?.response?.data||e?.data||e);return Vt(n,r)},e.fileConfigs=Zt,e.formatCurrencyPrice=(e,t,r="en-US")=>e?.toLocaleString(r,{style:"currency",currency:t}),e.formatDateLocaleString=(e,t="en-GB",r="Asia/Tashkent")=>new Date(e).toLocaleString(t,{timeZone:r}),e.formatDuration=Wt,e.formatJsonForTelegram=e=>{try{"string"==typeof e&&(e=JSON.parse(e));return`<pre>${JSON.stringify(e,null,2)}</pre>`}catch(t){return`<pre>${e}</pre>`}},e.formatStringToFloat=j,e.generateAndAssignRandomHeaders=e=>{e.headers=e.headers||{},w(e.headers);const t=_();return Object.assign(e.headers,t),e},e.generateIdempotencyKey=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),e.generateRandomHeaders=_,e.generateUserAgents=b,e.getColumnIndex=Ut,e.getColumnName=function(e){if(Lt.columnNameCache.has(e))return Lt.columnNameCache.get(e);let t="";for(;e>=0;){const r=e%26;t=String.fromCharCode(65+r)+t,e=Math.floor(e/26)-1}return Lt.columnNameCache.set(e,t),t},e.getFormattedDate=M,e.getLocalIP=async()=>{c("backend");const e=(await import("os")).networkInterfaces();for(const t in e)for(const r of e[t]||[])if("IPv4"===r.family&&!r.internal)return r.address;return"127.0.0.1"},e.getNestedValue=Xt,e.getRandomInt=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),e.getValidDate=(e,t)=>o.default(e,t).toDate(),e.getValueByName=function(e=[],t,r=null){if(!Array.isArray(e))return r;const n=Ut(t);return It(e,`[${n}]`,r)},e.isBrowser=s,e.isIndianFormat=$,e.isNode=i,e.measureExecutionTime=(e,t="Execution",r)=>{const n=new Date;console.log(`[${t}] Boshladi: ${M(n)}`);const o=e(),a=e=>{const o=e.getTime()-n.getTime();console.log(`[${t}] Tugadi: ${M(e)}`),console.log(`[${t}] Davomiyligi: ${Wt(o,r)}`)};return o instanceof Promise?o.then((e=>(a(new Date),e))):(a(new Date),o)},e.objectItemToArray=(e,t,r="")=>t.map((t=>{const n=Xt(e,t);return n||"number"==typeof n?n:r})),e.objectToArray=(e,t,r=[],n="")=>{const o=[];return r.length>0&&o.push(r.map((e=>e.trim()||n))),e.forEach((e=>{const r=t.map((t=>{const r=Xt(e,t);return r||"number"==typeof r?r:n}));o.push(r)})),o},e.parseEuropeanFormat=E,e.parseIndianFormat=S,e.parseSeparatedNumber=e=>{const t=Number(e?.replace(/,/g,""));return isNaN(t)?0:t},e.rand=g,e.randIp=y,e.saveFile=qt,e.scrollToElement=e=>{c("frontend");const t=document.querySelector(e);t&&t.scrollIntoView({behavior:"smooth"})},e.stripHtmlTags=T,e.toMilliseconds=e=>{const{milliseconds:t=0,seconds:r=0,minutes:n=0,hours:o=0,days:a=0,weeks:s=0,months:i=0,years:c=0}=e,l=36e5,u=864e5;return t+1e3*r+6e4*n+o*l+a*u+6048e5*s+2630016e3*i+315576e5*c},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-error-message.d.ts","sourceRoot":"","sources":["../../../src/utils/extract-error-message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract-error-message.d.ts","sourceRoot":"","sources":["../../../src/utils/extract-error-message.ts"],"names":[],"mappings":"AAgLA,eAAO,MAAM,mBAAmB,UAAW,GAAG,qBAAoB,MAAM,mBAAuB,MAAM,EAAE,KAAQ,MAiB9G,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAW,GAAG,mBAAkB,MAAM,EAAE,KAAQ,MAAM,EAUtF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./tools.js");const r=["err.cause.message","detailMessage","error_description","error.message","description","msg","message","error","errors","errorDetails","errorMessage","error_type","errorMsg","errorMessages","error_info","error_info.message","error_info.error_message","error_info.details","data.message","response.message","response.error_message","response.details","httpError","validationError","status_description","messages","alert_message","alert","userMessage","user_error","client_error","response.data.error","response.data.message","response.data.error_description","response.data.details","errorMessages[*].message","errors[*].msg","errors[*].message","[*].msg","[*].message"],s=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(r){return e}return e},t=(r,o,n=0,a=5)=>{if(n>a||"object"!=typeof r||null===r)return null;for(const i of o){const f=i.split(".");let l=r;for(const e of f){if(null==l)break;if("[*]"===e){if(Array.isArray(l)){for(const r of l){const s=t(r,[f.slice(f.indexOf(e)+1).join(".")],n+1,a);if(s)return s}l=null;break}l=null;break}if(e.endsWith("]")){const r=e.match(/(\w+)\[(\d+)\]/);if(r){const[,e,s]=r;l=l?.[e]?.[Number(s)]}else l=l?.[e]}else l=l?.[e]}if(l=s(l),Array.isArray(l)){const e=l.map((e=>"string"==typeof e?e:e?.message||e?.msg||"")).filter(Boolean).join("\n");if(e)return e}if("string"==typeof l)return e.stripHtmlTags(l);if("object"==typeof l&&null!==l){const e=t(l,o,n+1,a);if(e)return e}}return null},o=(r,t,n=0,a=5)=>{if(n>a||"object"!=typeof r||null===r)return[];const i=[];for(const f of t){const l=f.split(".");let
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./tools.js");const r=["err.cause.message","cause.stack","detailMessage","error_description","error.message","description","msg","message","error","errors","errorDetails","errorMessage","error_type","errorMsg","errorMessages","error_info","error_info.message","error_info.error_message","error_info.details","data.message","response.message","response.error_message","response.details","httpError","validationError","status_description","messages","alert_message","alert","userMessage","user_error","client_error","response.data.error","response.data.message","response.data.error_description","response.data.details","errorMessages[*].message","errors[*].msg","errors[*].message","[*].msg","[*].message"],s=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(r){return e}return e},t=(r,o,n=0,a=5)=>{if(n>a||"object"!=typeof r||null===r)return null;for(const i of o){const f=i.split(".");let l=r;for(const e of f){if(null==l)break;if("[*]"===e){if(Array.isArray(l)){for(const r of l){const s=t(r,[f.slice(f.indexOf(e)+1).join(".")],n+1,a);if(s)return s}l=null;break}l=null;break}if(e.endsWith("]")){const r=e.match(/(\w+)\[(\d+)\]/);if(r){const[,e,s]=r;l=l?.[e]?.[Number(s)]}else l=l?.[e]}else l=l?.[e]}if(l=s(l),Array.isArray(l)){const e=l.map((e=>"string"==typeof e?e:e?.message||e?.msg||"")).filter(Boolean).join("\n");if(e)return e}if("string"==typeof l)return e.stripHtmlTags(l);if("object"==typeof l&&null!==l){const e=t(l,o,n+1,a);if(e)return e}}return null},o=(r,t,n=0,a=5)=>{if(n>a||"object"!=typeof r||null===r)return[];const i=[];for(const f of t){const l=f.split(".");let c=r;for(let e=0;e<l.length;e++){const r=l[e];if(null==c)break;if("[*]"===r){if(Array.isArray(c)){const r=l.slice(e+1).join(".");for(const e of c)i.push(...o(e,[r],n+1,a))}c=null;break}if(r.endsWith("]")){const e=r.match(/(\w+)\[(\d+)\]/);if(e){const[,r,s]=e;c=c?.[r]?.[Number(s)]}else c=c?.[r]}else c=c?.[r]}if(c=s(c),"string"==typeof c)i.push(e.stripHtmlTags(c));else if(Array.isArray(c)){for(const r of c)if("string"==typeof r)i.push(e.stripHtmlTags(r));else if("object"==typeof r){const s=r?.message||r?.msg;"string"==typeof s?i.push(e.stripHtmlTags(s)):i.push(...o(r,t,n+1,a))}}else"object"==typeof c&&i.push(...o(c,t,n+1,a))}return i};exports.extractErrorMessage=(o,n="",a=[])=>{const i=[...a,...r];if(!o)return n;if("string"==typeof o){const r=s(o);return"object"==typeof r?t(r,i)||n:e.stripHtmlTags(o)}const f=s(o?.response?.data||o?.data||o),l=t(f,i)||o?.message;return e.stripHtmlTags(l||"").trim()||n},exports.extractErrorMessages=(e,t=[])=>{const n=[...r,...t];if(!e)return[];const a=s("string"==typeof e?e:e?.response?.data||e?.data||e);return o(a,n)};
|
package/lib/cjs/utils/mappers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../node_modules/lodash/get.js"),e=require("./tools.js");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(require("moment"));const o={columnIndexCache:new Map,columnNameCache:new Map};function a(t){const e=t.toUpperCase();if(o.columnIndexCache.has(e))return o.columnIndexCache.get(e);let r=0;for(let t=0;t<e.length;t++)r=26*r+(e.charCodeAt(t)-65+1);const n=r-1;return o.columnIndexCache.set(e,n),n}const u={getStr(e=[],r,n=""){const o=t.default(e,`[${r}]`,"");return"number"==typeof o?String(o):String(o||n).trim()},getNum(e=[],r,n=0){const o=String(t.default(e,`[${r}]`,"")).replace(/\s/g,"");if(!o)return n;const a=Number(o);return isNaN(a)?n:a},getBool(e=[],r,n=!1){if(!Array.isArray(e))return n;const o=t.default(e,`[${r}]`,n);return["TRUE","FALSE"].includes(o)?"TRUE"===o:"boolean"==typeof o?o:n},getPrice(t=[],r){const n=this.getStr(t,r);if(!n)return 0;const o=e.formatStringToFloat(n);return isNaN(o)?0:o},getDate(t=[],e,r){const o=this.getStr(t,e);if(!o)return null;return n.default(o,r).toDate()},getDateFormatted(t=[],r,o,a){const u=this.getStr(t,r);if(!u)return null;const s=n.default(u);return o?e.getFormattedDate(s.toDate(),o):e.getFormattedDate(s.toDate())}},s={getStr(e=[],r,n=""){const o=a(r),u=t.default(e,`[${o}]`,"");return"number"==typeof u?String(u):String(u||n).trim()},getNum(e=[],r,n=0){const o=a(r),u=String(t.default(e,`[${o}]`,"")).replace(/\s/g,"");if(!u)return n;const s=Number(u);return isNaN(s)?n:s},getBool(e=[],r,n=!1){const o=a(r);if(!Array.isArray(e))return n;const u=t.default(e,`[${o}]`,n);return["TRUE","FALSE"].includes(u)?"TRUE"===u:"boolean"==typeof u?u:n},getPrice(t=[],r){const n=this.getStr(t,r);if(!n)return 0;const o=e.formatStringToFloat(n);return isNaN(o)?0:o},getDate(t=[],e,r){const o=this.getStr(t,e);if(!o)return null;return n.default(o,r).toDate()},getDateFormatted(t=[],r,o,a){const u=this.getStr(t,r);if(!u)return null;const s=n.default(u);return o?e.getFormattedDate(s.toDate(),o):e.getFormattedDate(s.toDate())}};exports.ColumnMapper=s,exports.IndexMapper=u,exports.getColumnIndex=a,exports.getColumnName=function(t){if(o.columnNameCache.has(t))return o.columnNameCache.get(t);let e="";for(;t>=0;){const r=t%26;e=String.fromCharCode(65+r)+e,t=Math.floor(t/26)-1}return o.columnNameCache.set(t,e),e},exports.getValueByName=function(e=[],r,n=null){if(!Array.isArray(e))return n;const o=a(r);return t.default(e,`[${o}]`,n)};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../node_modules/lodash/get.js"),e=require("./tools.js");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(require("moment"));const o={columnIndexCache:new Map,columnNameCache:new Map};function a(t){const e=t.toUpperCase();if(o.columnIndexCache.has(e))return o.columnIndexCache.get(e);let r=0;for(let t=0;t<e.length;t++)r=26*r+(e.charCodeAt(t)-65+1);const n=r-1;return o.columnIndexCache.set(e,n),n}const u={getStr(e=[],r,n=""){const o=t.default(e,`[${r}]`,"");return"number"==typeof o?String(o):String(o||n).trim()},getNum(e=[],r,n=0){const o=String(t.default(e,`[${r}]`,"")).replace(/\s/g,"");if(!o)return n;const a=Number(o);return isNaN(a)?n:a},getBool(e=[],r,n=!1){if(!Array.isArray(e))return n;const o=t.default(e,`[${r}]`,n);return["TRUE","FALSE"].includes(o)?"TRUE"===o:"boolean"==typeof o?o:n},getPrice(t=[],r){const n=this.getStr(t,r);if(!n)return 0;const o=e.formatStringToFloat(n);return isNaN(o)?0:o},getDate(t=[],e,r){const o=this.getStr(t,e);if(!o)return null;return n.default(o,r).toDate()},getDateFormatted(t=[],r,o,a){const u=this.getStr(t,r);if(!u)return null;const s=n.default(u,a);return o?e.getFormattedDate(s.toDate(),o):e.getFormattedDate(s.toDate())}},s={getStr(e=[],r,n=""){const o=a(r),u=t.default(e,`[${o}]`,"");return"number"==typeof u?String(u):String(u||n).trim()},getNum(e=[],r,n=0){const o=a(r),u=String(t.default(e,`[${o}]`,"")).replace(/\s/g,"");if(!u)return n;const s=Number(u);return isNaN(s)?n:s},getBool(e=[],r,n=!1){const o=a(r);if(!Array.isArray(e))return n;const u=t.default(e,`[${o}]`,n);return["TRUE","FALSE"].includes(u)?"TRUE"===u:"boolean"==typeof u?u:n},getPrice(t=[],r){const n=this.getStr(t,r);if(!n)return 0;const o=e.formatStringToFloat(n);return isNaN(o)?0:o},getDate(t=[],e,r){const o=this.getStr(t,e);if(!o)return null;return n.default(o,r).toDate()},getDateFormatted(t=[],r,o,a){const u=this.getStr(t,r);if(!u)return null;const s=n.default(u,a);return o?e.getFormattedDate(s.toDate(),o):e.getFormattedDate(s.toDate())}};exports.ColumnMapper=s,exports.IndexMapper=u,exports.getColumnIndex=a,exports.getColumnName=function(t){if(o.columnNameCache.has(t))return o.columnNameCache.get(t);let e="";for(;t>=0;){const r=t%26;e=String.fromCharCode(65+r)+e,t=Math.floor(t/26)-1}return o.columnNameCache.set(t,e),e},exports.getValueByName=function(e=[],r,n=null){if(!Array.isArray(e))return n;const o=a(r);return t.default(e,`[${o}]`,n)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-error-message.d.ts","sourceRoot":"","sources":["../../../src/utils/extract-error-message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract-error-message.d.ts","sourceRoot":"","sources":["../../../src/utils/extract-error-message.ts"],"names":[],"mappings":"AAgLA,eAAO,MAAM,mBAAmB,UAAW,GAAG,qBAAoB,MAAM,mBAAuB,MAAM,EAAE,KAAQ,MAiB9G,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAW,GAAG,mBAAkB,MAAM,EAAE,KAAQ,MAAM,EAUtF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stripHtmlTags as e}from"./tools.js";const r=["err.cause.message","detailMessage","error_description","error.message","description","msg","message","error","errors","errorDetails","errorMessage","error_type","errorMsg","errorMessages","error_info","error_info.message","error_info.error_message","error_info.details","data.message","response.message","response.error_message","response.details","httpError","validationError","status_description","messages","alert_message","alert","userMessage","user_error","client_error","response.data.error","response.data.message","response.data.error_description","response.data.details","errorMessages[*].message","errors[*].msg","errors[*].message","[*].msg","[*].message"],s=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(r){return e}return e},t=(r,o,n=0,
|
|
1
|
+
import{stripHtmlTags as e}from"./tools.js";const r=["err.cause.message","cause.stack","detailMessage","error_description","error.message","description","msg","message","error","errors","errorDetails","errorMessage","error_type","errorMsg","errorMessages","error_info","error_info.message","error_info.error_message","error_info.details","data.message","response.message","response.error_message","response.details","httpError","validationError","status_description","messages","alert_message","alert","userMessage","user_error","client_error","response.data.error","response.data.message","response.data.error_description","response.data.details","errorMessages[*].message","errors[*].msg","errors[*].message","[*].msg","[*].message"],s=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(r){return e}return e},t=(r,o,n=0,a=5)=>{if(n>a||"object"!=typeof r||null===r)return null;for(const i of o){const f=i.split(".");let l=r;for(const e of f){if(null==l)break;if("[*]"===e){if(Array.isArray(l)){for(const r of l){const s=t(r,[f.slice(f.indexOf(e)+1).join(".")],n+1,a);if(s)return s}l=null;break}l=null;break}if(e.endsWith("]")){const r=e.match(/(\w+)\[(\d+)\]/);if(r){const[,e,s]=r;l=l?.[e]?.[Number(s)]}else l=l?.[e]}else l=l?.[e]}if(l=s(l),Array.isArray(l)){const e=l.map((e=>"string"==typeof e?e:e?.message||e?.msg||"")).filter(Boolean).join("\n");if(e)return e}if("string"==typeof l)return e(l);if("object"==typeof l&&null!==l){const e=t(l,o,n+1,a);if(e)return e}}return null},o=(r,t,n=0,a=5)=>{if(n>a||"object"!=typeof r||null===r)return[];const i=[];for(const f of t){const l=f.split(".");let c=r;for(let e=0;e<l.length;e++){const r=l[e];if(null==c)break;if("[*]"===r){if(Array.isArray(c)){const r=l.slice(e+1).join(".");for(const e of c)i.push(...o(e,[r],n+1,a))}c=null;break}if(r.endsWith("]")){const e=r.match(/(\w+)\[(\d+)\]/);if(e){const[,r,s]=e;c=c?.[r]?.[Number(s)]}else c=c?.[r]}else c=c?.[r]}if(c=s(c),"string"==typeof c)i.push(e(c));else if(Array.isArray(c)){for(const r of c)if("string"==typeof r)i.push(e(r));else if("object"==typeof r){const s=r?.message||r?.msg;"string"==typeof s?i.push(e(s)):i.push(...o(r,t,n+1,a))}}else"object"==typeof c&&i.push(...o(c,t,n+1,a))}return i},n=(o,n="",a=[])=>{const i=[...a,...r];if(!o)return n;if("string"==typeof o){const r=s(o);return"object"==typeof r?t(r,i)||n:e(o)}const f=s(o?.response?.data||o?.data||o),l=t(f,i)||o?.message;return e(l||"").trim()||n},a=(e,t=[])=>{const n=[...r,...t];if(!e)return[];const a=s("string"==typeof e?e:e?.response?.data||e?.data||e);return o(a,n)};export{n as extractErrorMessage,a as extractErrorMessages};
|
package/lib/esm/utils/mappers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"../node_modules/lodash/get.js";import{formatStringToFloat as e,getFormattedDate as r}from"./tools.js";import n from"moment";const o={columnIndexCache:new Map,columnNameCache:new Map};function u(t){const e=t.toUpperCase();if(o.columnIndexCache.has(e))return o.columnIndexCache.get(e);let r=0;for(let t=0;t<e.length;t++)r=26*r+(e.charCodeAt(t)-65+1);const n=r-1;return o.columnIndexCache.set(e,n),n}function s(t){if(o.columnNameCache.has(t))return o.columnNameCache.get(t);let e="";for(;t>=0;){const r=t%26;e=String.fromCharCode(65+r)+e,t=Math.floor(t/26)-1}return o.columnNameCache.set(t,e),e}function c(e=[],r,n=null){if(!Array.isArray(e))return n;const o=u(r);return t(e,`[${o}]`,n)}const a={getStr(e=[],r,n=""){const o=t(e,`[${r}]`,"");return"number"==typeof o?String(o):String(o||n).trim()},getNum(e=[],r,n=0){const o=String(t(e,`[${r}]`,"")).replace(/\s/g,"");if(!o)return n;const u=Number(o);return isNaN(u)?n:u},getBool(e=[],r,n=!1){if(!Array.isArray(e))return n;const o=t(e,`[${r}]`,n);return["TRUE","FALSE"].includes(o)?"TRUE"===o:"boolean"==typeof o?o:n},getPrice(t=[],r){const n=this.getStr(t,r);if(!n)return 0;const o=e(n);return isNaN(o)?0:o},getDate(t=[],e,r){const o=this.getStr(t,e);if(!o)return null;return n(o,r).toDate()},getDateFormatted(t=[],e,o,u){const s=this.getStr(t,e);if(!s)return null;const c=n(s);return o?r(c.toDate(),o):r(c.toDate())}},i={getStr(e=[],r,n=""){const o=u(r),s=t(e,`[${o}]`,"");return"number"==typeof s?String(s):String(s||n).trim()},getNum(e=[],r,n=0){const o=u(r),s=String(t(e,`[${o}]`,"")).replace(/\s/g,"");if(!s)return n;const c=Number(s);return isNaN(c)?n:c},getBool(e=[],r,n=!1){const o=u(r);if(!Array.isArray(e))return n;const s=t(e,`[${o}]`,n);return["TRUE","FALSE"].includes(s)?"TRUE"===s:"boolean"==typeof s?s:n},getPrice(t=[],r){const n=this.getStr(t,r);if(!n)return 0;const o=e(n);return isNaN(o)?0:o},getDate(t=[],e,r){const o=this.getStr(t,e);if(!o)return null;return n(o,r).toDate()},getDateFormatted(t=[],e,o,u){const s=this.getStr(t,e);if(!s)return null;const c=n(s);return o?r(c.toDate(),o):r(c.toDate())}};export{i as ColumnMapper,a as IndexMapper,u as getColumnIndex,s as getColumnName,c as getValueByName};
|
|
1
|
+
import t from"../node_modules/lodash/get.js";import{formatStringToFloat as e,getFormattedDate as r}from"./tools.js";import n from"moment";const o={columnIndexCache:new Map,columnNameCache:new Map};function u(t){const e=t.toUpperCase();if(o.columnIndexCache.has(e))return o.columnIndexCache.get(e);let r=0;for(let t=0;t<e.length;t++)r=26*r+(e.charCodeAt(t)-65+1);const n=r-1;return o.columnIndexCache.set(e,n),n}function s(t){if(o.columnNameCache.has(t))return o.columnNameCache.get(t);let e="";for(;t>=0;){const r=t%26;e=String.fromCharCode(65+r)+e,t=Math.floor(t/26)-1}return o.columnNameCache.set(t,e),e}function c(e=[],r,n=null){if(!Array.isArray(e))return n;const o=u(r);return t(e,`[${o}]`,n)}const a={getStr(e=[],r,n=""){const o=t(e,`[${r}]`,"");return"number"==typeof o?String(o):String(o||n).trim()},getNum(e=[],r,n=0){const o=String(t(e,`[${r}]`,"")).replace(/\s/g,"");if(!o)return n;const u=Number(o);return isNaN(u)?n:u},getBool(e=[],r,n=!1){if(!Array.isArray(e))return n;const o=t(e,`[${r}]`,n);return["TRUE","FALSE"].includes(o)?"TRUE"===o:"boolean"==typeof o?o:n},getPrice(t=[],r){const n=this.getStr(t,r);if(!n)return 0;const o=e(n);return isNaN(o)?0:o},getDate(t=[],e,r){const o=this.getStr(t,e);if(!o)return null;return n(o,r).toDate()},getDateFormatted(t=[],e,o,u){const s=this.getStr(t,e);if(!s)return null;const c=n(s,u);return o?r(c.toDate(),o):r(c.toDate())}},i={getStr(e=[],r,n=""){const o=u(r),s=t(e,`[${o}]`,"");return"number"==typeof s?String(s):String(s||n).trim()},getNum(e=[],r,n=0){const o=u(r),s=String(t(e,`[${o}]`,"")).replace(/\s/g,"");if(!s)return n;const c=Number(s);return isNaN(c)?n:c},getBool(e=[],r,n=!1){const o=u(r);if(!Array.isArray(e))return n;const s=t(e,`[${o}]`,n);return["TRUE","FALSE"].includes(s)?"TRUE"===s:"boolean"==typeof s?s:n},getPrice(t=[],r){const n=this.getStr(t,r);if(!n)return 0;const o=e(n);return isNaN(o)?0:o},getDate(t=[],e,r){const o=this.getStr(t,e);if(!o)return null;return n(o,r).toDate()},getDateFormatted(t=[],e,o,u){const s=this.getStr(t,e);if(!s)return null;const c=n(s,u);return o?r(c.toDate(),o):r(c.toDate())}};export{i as ColumnMapper,a as IndexMapper,u as getColumnIndex,s as getColumnName,c as getValueByName};
|