UNPKG

ucc-utils

Version:
1 lines 18.4 kB
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,o,i,u){try{var s=e[i](u);var a=s.value}catch(e){n(e);return}if(s.done){t(a)}else{Promise.resolve(a).then(r,o)}}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var u=e.apply(t,n);function s(e){r(u,o,i,s,a,"next",e)}function a(e){r(u,o,i,s,a,"throw",e)}s(undefined)})}}function i(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function u(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function s(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var o=true;var i=false;var u,s;try{for(n=n.call(e);!(o=(u=n.next()).done);o=true){r.push(u.value);if(t&&r.length===t)break}}catch(e){i=true;s=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw s}}return r}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,n){return t(e)||s(e,n)||d(e,n)||a()}function l(e){return n(e)||u(e)||d(e)||c()}function p(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function d(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function y(e,t){var n,r,o,i,u={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return a([e,t])}}function a(i){if(n)throw new TypeError("Generator is already executing.");while(u)try{if(n=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:u.label++;return{value:i[1],done:false};case 5:u.label++;r=i[1];i=[0];continue;case 7:i=u.ops.pop();u.trys.pop();continue;default:if(!(o=u.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){u=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(i[0]===6&&u.label<o[1]){u.label=o[1];o=i;break}if(o&&u.label<o[2]){u.label=o[2];u.ops.push(i);break}if(o[2])u.ops.pop();u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e];r=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var h=require("../chunk-I7AUKTXE.js");var v=require("lodash-es");var b=typeof document!=="undefined"?document.currentScript:null;var g=function(){return typeof h.a=="function"&&(typeof module==="undefined"?"undefined":p(module))=="object"&&module!==null&&p(module.exports)=="object"||(typeof global==="undefined"?"undefined":p(global))=="object"&&(typeof process==="undefined"?"undefined":p(process))=="object"&&typeof __dirname=="string"},m=function(){var e;return typeof h.a=="function"&&(typeof module==="undefined"?"undefined":p(module))<"u"&&module.exports?!1:p({url:typeof document==="undefined"?require("u"+"rl").pathToFileURL(__filename).href:b&&b.src||new URL("index.js",document.baseURI).href})<"u"||(typeof document==="undefined"?"undefined":p(document))<"u"&&((e=document.currentScript)===null||e===void 0?void 0:e.type)==="module"},x=function(e){return typeof e=="number"||typeof e=="string"||typeof e=="boolean"||(typeof e==="undefined"?"undefined":p(e))=="symbol"||e===null||e===void 0},w=function(e){return x(e)?j(e)?!!(e===null||e===void 0?void 0:e.description):!!e:I(e)?e.length>0:O(e)?Object.keys(e).length>0:!1},S=function(e){return e===null},_=function(e){return e==null},A=function(e){return e===void 0},j=function(e){return(typeof e==="undefined"?"undefined":p(e))=="symbol"},E=function(e){return typeof e=="function"},O=function(e){return(typeof e==="undefined"?"undefined":p(e))=="object"&&e!==null},P=function(e){if((typeof e==="undefined"?"undefined":p(e))!="object"||e===null)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},R=function(e){return P(e)&&Object.keys(e).length===0||I(e)&&e.length===0},T=function(e){return P(e)&&Object.keys(e).length===0},C=function(e){return typeof e=="string"},I=function(e){return Array.isArray(e)},N=function(e){return Array.isArray(e)&&e.length===0},W=function(e){return typeof e=="number"&&!Number.isInteger(e)},U=function(e){return typeof e=="number"},F=function(e){return typeof e=="number"&&Number.isInteger(e)},k=function(e){if(typeof e!="string"||(e=e.trim(),!e.startsWith("{")&&!e.startsWith("[")))return!1;try{return JSON.parse(e),!0}catch(e){return!1}},M=/^\d+(\.\d+)?$/,$=function(e){return typeof e!="string"?!1:M.test(e.trim())},L=function(e){return typeof e!="string"?!1:["true","false"].includes(e.trim())},J=function(e){return typeof e=="string"&&e.startsWith("[")&&e.endsWith("]")},V=function(e){return typeof e=="string"&&e.startsWith("{")&&e.endsWith("}")},z=function(e){return typeof e!="string"?!1:(e=e.replace(/\s+/g,""),e.startsWith("function")||e.startsWith("()=>")||e.startsWith("_=>"))},B=[/Win/i,/Win(?:dows)?/i],q=function(e){return(typeof e==="undefined"?"undefined":p(e))<"u"&&e.userAgent?B[0].test(e.platform)||B[1].test(e.userAgent):!1},Q=[/Mac(?:intosh|Intel|PPC|68K)/i,/Mac/i],D=function(e){return(typeof e==="undefined"?"undefined":p(e))<"u"&&e.userAgent?Q[0].test(e.platform)||Q[1].test(e.userAgent):!1},G=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone|Windows Mobile|MeeGo|Tizen|Bada|Kindle|Silk|MiuiBrowser|SamsungBrowser|OPR\/|Fennec/i,K=function(e){return(typeof e==="undefined"?"undefined":p(e))<"u"&&e.userAgent?G.test(e.userAgent.toLocaleLowerCase()):!1},Z=function(e){return!K(e)},X=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,H=function(e){return X.test(e)},Y=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,ee=function(e){return Y.test(e)},et=[/^(?:(?:\+|00)86)?1[3-9]\d{9}$/,/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/],en=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return t?et[1].test(e):et[0].test(e)},er=/^[1-9][0-9]{4,10}$/,eo=function(e){return er.test(e)},ei=function(e){return!!e&&((typeof e==="undefined"?"undefined":p(e))=="object"||typeof e=="function")&&typeof e.then=="function"},eu=function(e){return!!e&&(typeof e==="undefined"?"undefined":p(e))=="object"&&e.name==="AsyncComponentWrapper"&&typeof e.__asyncLoader=="function"},es=function(e){return(typeof e==="undefined"?"undefined":p(e))=="object"&&e!==null&&(typeof e.setup=="function"||typeof e.render=="function"||typeof e.template=="string"||typeof e.name=="string"||e.functional===!0)},ea=function(e){return e!=null&&!Number.isNaN(e)},ec=function(e){return e&&Array.isArray(e)&&e.length>0},ef=function(e){return e&&(typeof e==="undefined"?"undefined":p(e))=="object"&&!Array.isArray(e)&&Object.keys(e).length>0};var el=/\s+/g,ep=/\n+/g,ed=/\r+/g,ey=/\t+/g,eh=/\s+/g,ev=/(\w+):()/g,eb=/\b\w/g,eg=/Symbol\("([^"]*)"\)/g,em=/([A-Z])/g,ex=/_(\w)/g,ew=/\{(\d+)\}/g;var eS=(typeof window==="undefined"?"undefined":p(window))=="object"&&window.Object===Object?window:(typeof globalThis==="undefined"?"undefined":p(globalThis))=="object"&&globalThis.Object===Object?globalThis:(typeof global==="undefined"?"undefined":p(global))=="object"&&global.Object===Object?global:(typeof self==="undefined"?"undefined":p(self))=="object"&&self.Object===Object?self:Function("return this")(),e_=function(e){return e.replace(el,"")},eA=function(e){return e.replace(ep,"")},ej=function(e){return e.replace(ed,"")},eE=function(e){return e.replace(ey,"")},eO=function(e){return e.replace(eh,"")},eP=function(e){return e.replace(ev,'"$1":$2')},eR=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=t.fld,r=n===void 0?"id":n,o=t.glFld,i=o===void 0?"parentId":o,u=t.childFld,s=u===void 0?"children":u,a=t.isJudgeType,c=a===void 0?!0:a,f=t.isChangeOwner,l=f===void 0?!0:f,p=l?e:v.cloneDeep(e);var d=true,y=false,h=undefined;try{var b=function(){var e=m.value;if(e[i]){var t=c?p.find(function(t){return t[r]&&t[r]===e[i]}):p.find(function(t){return t[r]&&t[r]==e[i]});if(!t)return"continue";(t[s]=t[s]||[]).push(e)}};for(var g=p[Symbol.iterator](),m;!(d=(m=g.next()).done);d=true)b()}catch(e){y=true;h=e}finally{try{if(!d&&g.return!=null){g.return()}}finally{if(y){throw h}}}return e.filter(function(e){return!e[i]})},eT=function(e,t){return(e===null||e===void 0?void 0:e.length)?e.reduce(function(e,n){var r=n[t];return(e[r]||(e[r]=[])).push(n),e},{}):e},eC=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||typeof e!="string")return t;try{return JSON.parse(e)}catch(e){return t}},eI=function(e){return e?e.replace(eb,function(e){return e.toUpperCase()}):""},eN=function(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()};function eW(e){var t=e.startsWith("linear-gradient"),n=e.startsWith("radial-gradient"),r=/rgba?\((\d+), (\d+), (\d+),? ([\d.]+)?\)\s(\d+)%/g,o,i=[];for(;(o=r.exec(e))!==null;){var u=f(o.slice(1),5),s=u[0],a=u[1],c=u[2],l=u[3],p=l===void 0?"1":l,d=u[4];i.push({offset:parseInt(d)/100,color:"rgba(".concat(s,", ").concat(a,", ").concat(c,", ").concat(p,")")})}if(t){var y=/linear-gradient\(([\d.]+)deg/.exec(e),h=y?parseFloat(y[1]):0;return{type:"linear",x:Math.cos(h*Math.PI/180),y:Math.sin(h*Math.PI/180),x2:1,y2:0,colorStops:i,global:!1,value:e}}else return n?{type:"radial",x:.5,y:.5,r:.5,colorStops:i,global:!1,value:e}:e}function eU(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".";if(typeof t=="string"){if(t.indexOf(r)===-1)return e[t]=n,[e,t];t=t.split(r)}var o=e,i=t.length;for(var u=0;u<i-1;u++){var s=t[u];o=o[s]=o[s]||{}}var a=t[i-1];return Array.isArray(o[a])?o[a].push(n):o[a]=n,[o,a]}function eF(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";return typeof t=="string"&&(t=t.split(n)),t.reduce(function(e,t){return(e||{})[t]},e)}function ek(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.delay,i=r===void 0?100:r,u=n.limit,s=u===void 0?1:u,a=n.timeout,c=a===void 0?0:a,f=n.timeoutFn,l=0,p=Date.now(),d=setInterval(/*#__PURE__*/o(function(){var n;return y(this,function(r){switch(r.label){case 0:if(c&&Date.now()-p>c){f&&typeof f=="function"&&f(),clearInterval(d);return[2]}return[4,e()];case 1:if(!r.sent())return[3,3];return[4,t()];case 2:n=(r.sent(),++l>=s&&clearInterval(d));return[3,4];case 3:n=l=0;r.label=4;case 4:n;return[2]}})}),i);return function(){return clearInterval(d)}}var eM=function(e,t){return t?e.call(t):e()},e$=function(e){try{return new Function("return ".concat(e))()}catch(t){return e}};function eL(e){if(typeof e!="string")return e;if(e=e.trim(),e!=="undefined")return e==="null"?null:e==="true"?!0:e==="false"?!1:e==="NaN"?NaN:e==="Infinity"?1/0:e==="-Infinity"?-1/0:$(e)?Number(e):J(e)||V(e)||z(e)?e$(e):e}function eJ(e){try{return JSON.parse(e,function(e,t){if(v.startsWith(t,"function-"))return new Function("return ".concat(t.slice(9)))();if(v.startsWith(t,"symbol-")){var n=t.slice(7).match(eg);return n?Symbol(n[1]):t}if(!v.startsWith(t,"undef-"))return eL(t)})}catch(t){return e}}function eV(e){return JSON.stringify(e,function(e,t){return typeof t=="function"?"function-".concat(t.toString()):(typeof t==="undefined"?"undefined":p(t))=="symbol"?"symbol-".concat(t.toString()):t===void 0?"undef-":t})}function ez(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:" ";return e.replace(em,t+"$1").trim().toLowerCase()}var eB=function(e){return e.replace(ex,function(e,t){return t.toUpperCase()})},eq=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;var n=e.toString(),r=n.indexOf(".");return r===-1?e:Number(n.slice(0,r+t+1))},eQ=function(e,t){return e.replace(ew,function(e,n){var r=parseInt(n,10);return isNaN(r)?t[n]:t[r]})};function eD(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=t.isReverse,r=n===void 0?!1:n,o=t.isNumber,i=o===void 0?!1:o,u=t.rootFontSize,s=u===void 0?parseInt(getComputedStyle(document.documentElement).fontSize,10)||window.innerWidth/100:u;if(v.isNil(e))return e;var a=r?"px":"rem",c=r?e*s:e/s;return i?c:"".concat(c).concat(a)}var eG=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"\n";return e.split("").reduce(function(r,o,i){return(i+1)%t===0&&i<e.length-1?r+o+n:r+o},"")},eK=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n=t.timeout,r=t.isComplete,u=r===void 0?!0:r,s=Array(e.length).fill(void 0),a=!1;return e.reduce(/*#__PURE__*/function(){var e=o(function(e,t,r){return y(this,function(c){switch(c.label){case 0:return[4,e];case 1:if(c.sent(),!(a&&!u))return[2,new Promise(/*#__PURE__*/function(){var e=o(function(e){var o,u,c,f;return y(this,function(l){switch(l.label){case 0:o=null,u=function(t){o&&clearTimeout(o),s[r]=t,i(t,Error)&&(a=!0),e()};l.label=1;case 1:l.trys.push([1,3,,4]);n&&(o=setTimeout(function(){return u(new Error("chain: step ".concat(r," timeout")))},n));c=r>0?s[r-1]:null;return[4,t(c,u)];case 2:l.sent();return[3,4];case 3:f=l.sent();u(i(f,Error)?f:new Error(String(f)));return[3,4];case 4:return[2]}})});return function(t){return e.apply(this,arguments)}}())];return[2]}})});return function(t,n,r){return e.apply(this,arguments)}}(),Promise.resolve()),s};var eZ=function(e){return window.requestIdleCallback(/*#__PURE__*/function(){var t=o(function(t){var n;return y(this,function(r){switch(r.label){case 0:if(!(t.timeRemaining()>0))return[3,4];n=e&&typeof e=="function";if(!n)return[3,2];return[4,e()];case 1:n=r.sent();r.label=2;case 2:n;r.label=3;case 3:return[3,0];case 4:return[2]}})});return function(e){return t.apply(this,arguments)}}())},eX=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new WeakMap;if(!e)return e;if(Array.isArray(e))eX(e,t);else{var n=window.requestIdleCallback(/*#__PURE__*/function(){var n=o(function(n){var r,o;return y(this,function(i){switch(i.label){case 0:r=Array.isArray(e),o=r?e.shift():e;i.label=1;case 1:if(!(n.timeRemaining()>0))return[3,4];return[4,o()];case 2:i.sent();i.label=3;case 3:return[3,1];case 4:r&&e.length>0&&eX(e,t);return[2]}})});return function(e){return n.apply(this,arguments)}}());t.set(e,n)}},eH=/*#__PURE__*/function(){var e=o(function(e){var t,n,r;var i=arguments;return y(this,function(u){t=i.length>1&&i[1]!==void 0?i[1]:{};n=t.limit,r=n===void 0?3:n;return[2,(e=e.map(function(e){return ei(e)?e:Promise.resolve(e)}),new Promise(/*#__PURE__*/function(){var t=o(function(t,n){var i,u,s,a,c;return y(this,function(n){if(e.length===0)return[2,t([])];i=[],u=0,s=0,a=/*#__PURE__*/function(){var t=o(function(){var t,n,r,o;return y(this,function(s){switch(s.label){case 0:t=u++,n=e[t];s.label=1;case 1:s.trys.push([1,3,,4]);r={success:!0};return[4,n];case 2:i[t]=(r.value=s.sent(),r);return[3,4];case 3:o=s.sent();i[t]={success:!1,value:o};return[3,4];case 4:return[2]}})});return function e(){return t.apply(this,arguments)}}();if(u<e.length&&a(),++s===e.length)return[2,t(i)];for(c=0;c<Math.min(r,e.length);c++)a();return[2]})});return function(e,n){return t.apply(this,arguments)}}()))]})});return function t(t){return e.apply(this,arguments)}}();var eY=/*#__PURE__*/function(){var e=o(function(e,t){var n,r,o,i,u,s,a,c,f;return y(this,function(p){switch(p.label){case 0:n=t.fnArgs,r=n===void 0?[]:n,o=t.isToThrow,i=o===void 0?!1:o,u=t.onErrorFn,s=u===void 0?null:u,a=[];p.label=1;case 1:p.trys.push([1,3,,4]);c=1;return[4,e.apply(void 0,l(r))];case 2:a[c]=p.sent();return[3,4];case 3:f=p.sent();if(i)throw new Error(f);s&&typeof s=="function"&&s(f.message||f),a[0]=f;return[3,4];case 4:return[2,a]}})});return function t(t,n){return e.apply(this,arguments)}}();exports.AddQuotesToPropsRegExp=ev;exports.CamelCaseRegExp=em;exports.PlaceholderRegExp=ew;exports.SymbolRegExp=eg;exports.TrimCRRegExp=ed;exports.TrimNLRegExp=ep;exports.TrimSpaceRegExp=el;exports.TrimTabRegExp=ey;exports.TrimWhitespaceRegExp=eh;exports.UnderlineToCamelCaseRegExp=ex;exports.UpperCaseRegExp=eb;exports.addCustomSeparator=eG;exports.addQuotesToProps=eP;exports.capitalizeForWord=eI;exports.chain=eK;exports.concurRequest=eH;exports.convertRoutesToLevel=eR;exports.cssGradientToECharts=eW;exports.expandCamelCase=ez;exports.fillTemplate=eQ;exports.getType=eN;exports.getValue=eF;exports.groupByProp=eT;exports.hasWeightValue=w;exports.idleCallback=eZ;exports.idleTaskQueue=eX;exports.isArray=I;exports.isAsyncComponent=eu;exports.isCJS=g;exports.isESM=m;exports.isEmail=ee;exports.isEmptyArray=N;exports.isEmptyObject=R;exports.isEmptyPlainObject=T;exports.isFloat=W;exports.isFunction=E;exports.isInteger=F;exports.isJSONString=k;exports.isMacOS=D;exports.isMobile=K;exports.isNull=S;exports.isNullish=_;exports.isNumber=U;exports.isObject=O;exports.isPC=Z;exports.isPhone=en;exports.isPlainObject=P;exports.isPrimitive=x;exports.isPromise=ei;exports.isQQ=eo;exports.isString=C;exports.isStringArray=J;exports.isStringBoolean=L;exports.isStringFunction=z;exports.isStringNumber=$;exports.isStringObject=V;exports.isSymbol=j;exports.isURL=H;exports.isUndefined=A;exports.isValidArray=ec;exports.isValidPlainObject=ef;exports.isValue=ea;exports.isVueComponent=es;exports.isWindows=q;exports.parseJSON=eC;exports.parseStrWithType=e$;exports.parseStringify=eJ;exports.pxToRem=eD;exports.restoreValue=eL;exports.root=eS;exports.runFn=eM;exports.setValue=eU;exports.toFixed=eq;exports.toStringify=eV;exports.trimCR=ej;exports.trimNL=eA;exports.trimSpace=e_;exports.trimTab=eE;exports.trimWhitespace=eO;exports.tryit=eY;exports.underlineToCamelCase=eB;exports.watchFn=ek;