@nano-lib/util 1.0.13 → 1.0.14
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/constant/index.d.ts +48 -2
- package/lib/index.d.ts +36 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +301 -279
- package/lib/utils/to.d.ts +2 -2
- package/package.json +1 -1
package/lib/constant/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const dateFormats: readonly [readonly ["date", "YYYY-MM-DD"], readonly ["daterange", "YYYY-MM-DD"], readonly ["datetime", "YYYY-MM-DD HH:mm:ss"], readonly ["datetimerange", "YYYY-MM-DD HH:mm:ss"], readonly ["month", "YYYY-MM"], readonly ["monthrange", "YYYY-MM"], readonly ["year", "YYYY"], readonly ["yearrange", "YYYY"], readonly ["time", "HH:mm:ss"]];
|
|
2
2
|
export type DateFormat = (typeof dateFormats)[number][1];
|
|
3
3
|
export declare const DATE_VALUE_FORMAT: Map<string, DateFormat>;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const COMMON_TEXT: {
|
|
5
5
|
readonly view: "查看";
|
|
6
6
|
readonly add: "添加";
|
|
7
7
|
readonly edit: "编辑";
|
|
8
|
-
readonly
|
|
8
|
+
readonly delete: "删除";
|
|
9
9
|
readonly save: "保存";
|
|
10
10
|
readonly reset: "重置";
|
|
11
11
|
readonly close: "关闭";
|
|
@@ -16,6 +16,52 @@ export declare const OPERATE_STATE: {
|
|
|
16
16
|
readonly fail: "失败";
|
|
17
17
|
readonly open: "启用";
|
|
18
18
|
readonly disable: "禁用";
|
|
19
|
+
readonly refresh: "刷新";
|
|
20
|
+
readonly show: "显示";
|
|
21
|
+
readonly hide: "隐藏";
|
|
22
|
+
readonly search: "搜索";
|
|
23
|
+
readonly expand: "展开";
|
|
24
|
+
readonly collapse: "收起";
|
|
25
|
+
readonly upload: "上传";
|
|
26
|
+
readonly download: "下载";
|
|
27
|
+
readonly copy: "复制";
|
|
28
|
+
readonly clear: "清除";
|
|
29
|
+
readonly fuzzyQuery: "模糊查询";
|
|
30
|
+
readonly ing: "中";
|
|
31
|
+
readonly loading: "加载中...";
|
|
32
|
+
readonly select: "请选择";
|
|
33
|
+
readonly attachment: "附件";
|
|
34
|
+
readonly icon: "图标";
|
|
35
|
+
readonly picture: "图片";
|
|
36
|
+
readonly start: "开始";
|
|
37
|
+
readonly end: "结束";
|
|
38
|
+
readonly range: "范围";
|
|
39
|
+
readonly date: "日期";
|
|
40
|
+
readonly month: "月份";
|
|
41
|
+
readonly year: "年份";
|
|
42
|
+
readonly time: "时间";
|
|
43
|
+
readonly yes: "是";
|
|
44
|
+
readonly no: "否";
|
|
45
|
+
readonly have: "有";
|
|
46
|
+
readonly noHave: "无";
|
|
47
|
+
readonly unfilled: "未填写";
|
|
48
|
+
readonly selectAll: "全选";
|
|
49
|
+
readonly all: "全部";
|
|
50
|
+
readonly export: "导出";
|
|
51
|
+
readonly import: "导入";
|
|
52
|
+
readonly defaultErrorCode: "系统未知错误,请反馈给管理员";
|
|
53
|
+
};
|
|
54
|
+
export declare const ERROR_CODE: {
|
|
55
|
+
readonly 400: "请求失败,请您稍后重试!";
|
|
56
|
+
readonly 401: "认证失败,无法访问系统资源!";
|
|
57
|
+
readonly 403: "当前操作没有权限!";
|
|
58
|
+
readonly 404: "你所访问的资源不存在!";
|
|
59
|
+
readonly 405: "请求错误,禁止访问系统资源!";
|
|
60
|
+
readonly 408: "请求超时,请您稍后重试!";
|
|
61
|
+
readonly 500: "服务异常!";
|
|
62
|
+
readonly 502: "网关错误!";
|
|
63
|
+
readonly 503: "服务不可用!";
|
|
64
|
+
readonly 504: "网关超时!";
|
|
19
65
|
};
|
|
20
66
|
export declare const IMAGE_TYPE: string[];
|
|
21
67
|
export declare const MEDIA_TYPE: string[];
|
package/lib/index.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export { faceLivingEvent, faceLivingEventHint, getFaceGestureResult, getFaceVide
|
|
|
9
9
|
export { NOOP, debounce, sleep, countdownTimer, creatCancelTask, downloadFile, getRandomItemInArray, getFullUrl, getArrayFullUrl, getGenderByIdNumber, getBirthdayByIdNumber, getPercentage, trimArray, loadCss, loadJs } from './utils/common';
|
|
10
10
|
export declare const CONSTANTS: {
|
|
11
11
|
DATE_VALUE_FORMAT: Map<string, "YYYY-MM-DD" | "YYYY-MM-DD HH:mm:ss" | "YYYY-MM" | "YYYY" | "HH:mm:ss">;
|
|
12
|
-
|
|
12
|
+
COMMON_TEXT: {
|
|
13
13
|
readonly view: "查看";
|
|
14
14
|
readonly add: "添加";
|
|
15
15
|
readonly edit: "编辑";
|
|
16
|
-
readonly
|
|
16
|
+
readonly delete: "删除";
|
|
17
17
|
readonly save: "保存";
|
|
18
18
|
readonly reset: "重置";
|
|
19
19
|
readonly close: "关闭";
|
|
@@ -24,6 +24,40 @@ export declare const CONSTANTS: {
|
|
|
24
24
|
readonly fail: "失败";
|
|
25
25
|
readonly open: "启用";
|
|
26
26
|
readonly disable: "禁用";
|
|
27
|
+
readonly refresh: "刷新";
|
|
28
|
+
readonly show: "显示";
|
|
29
|
+
readonly hide: "隐藏";
|
|
30
|
+
readonly search: "搜索";
|
|
31
|
+
readonly expand: "展开";
|
|
32
|
+
readonly collapse: "收起";
|
|
33
|
+
readonly upload: "上传";
|
|
34
|
+
readonly download: "下载";
|
|
35
|
+
readonly copy: "复制";
|
|
36
|
+
readonly clear: "清除";
|
|
37
|
+
readonly fuzzyQuery: "模糊查询";
|
|
38
|
+
readonly ing: "中";
|
|
39
|
+
readonly loading: "加载中...";
|
|
40
|
+
readonly select: "请选择";
|
|
41
|
+
readonly attachment: "附件";
|
|
42
|
+
readonly icon: "图标";
|
|
43
|
+
readonly picture: "图片";
|
|
44
|
+
readonly start: "开始";
|
|
45
|
+
readonly end: "结束";
|
|
46
|
+
readonly range: "范围";
|
|
47
|
+
readonly date: "日期";
|
|
48
|
+
readonly month: "月份";
|
|
49
|
+
readonly year: "年份";
|
|
50
|
+
readonly time: "时间";
|
|
51
|
+
readonly yes: "是";
|
|
52
|
+
readonly no: "否";
|
|
53
|
+
readonly have: "有";
|
|
54
|
+
readonly noHave: "无";
|
|
55
|
+
readonly unfilled: "未填写";
|
|
56
|
+
readonly selectAll: "全选";
|
|
57
|
+
readonly all: "全部";
|
|
58
|
+
readonly export: "导出";
|
|
59
|
+
readonly import: "导入";
|
|
60
|
+
readonly defaultErrorCode: "系统未知错误,请反馈给管理员";
|
|
27
61
|
};
|
|
28
62
|
IMAGE_TYPE: string[];
|
|
29
63
|
MEDIA_TYPE: string[];
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=(e,t,n,r)=>(e/=r/2,e<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t)),P=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||(e=>window.setTimeout(e,1e3/60));function B(e,t){if(t){document.querySelector(t).scrollTop=e;return}document.documentElement.scrollTop=e,document.body.parentNode.scrollTop=e,document.body.scrollTop=e}function U(e){return e?document.querySelector(e).scrollTop:document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function j(e){const{target:t,to:n=0,duration:r=500,callback:o}=e??{},i=U(t),s=n-i,c=20;let a=0;const u=function(){a+=c;const f=H(a,i,s,r);B(f,t),a<r?P(u):o&&o()};u()}function q(e,t){switch(arguments.length){case 1:return parseInt((Math.random()*e+1).toString(),10);case 2:return parseInt((Math.random()*(t-e+1)+e).toString(),10);default:return 0}}function G(){let e="";const t=[];for(let n=0;n<=15;n++)t[n]=n.toString(16);for(let n=1;n<=36;n++)n===9||n===14||n===19||n===24?e+="-":n===15?e+=4:n===20?e+=t[Math.random()*4|8]:e+=t[Math.random()*16|0];return e}function g(e,t){if(!e)return"-";e.toString().length===10&&(e=+e*1e3),t??(t="YYYY-MM-DD HH:mm:ss");const n=new Date(e),r=(s,c,a=" ")=>{if(s.length>=c)return s;const u=c-s.length;let f=Math.ceil(u/a.length);for(;f>>=1;)a+=a,f===1&&(a+=a);return a.slice(0,u)+s};let o;const i={"Y+":n.getFullYear().toString(),"M+":(n.getMonth()+1).toString(),"D+":n.getDate().toString(),"H+":n.getHours().toString(),"m+":n.getMinutes().toString(),"s+":n.getSeconds().toString()};for(const s in i)o=new RegExp("("+s+")").exec(t),o&&(t=t.replace(o[1],o[1].length==1?i[s]:r(i[s],o[1].length,"0")));return t}function J(e,t){`${e}`.length===10?e=parseInt(e+"")*1e3:e=+e;const n=new Date(e),o=(Date.now()-Number(n))/1e3;return o<30?"刚刚":o<3600?`${Math.ceil(o/60)}分钟前`:o<3600*24?`${Math.ceil(o/3600)}小时前`:o<3600*24*2?"1天前":t?g(e,t):`${n.getMonth()+1}月${n.getDate()}日${n.getHours()}时${n.getMinutes()}分`}function Z(e){const t=e||new Date,n=new Date(t),r=new Date(t);return n.setHours(0,0,0),r.setHours(23,59,59),{dateRange:[g(n),g(r)],timestampRange:[n.getTime(),r.getTime()]}}const W={set(e,t){sessionStorage&&e&&t&&sessionStorage.setItem(e,t)},get(e){return!sessionStorage||!e?null:sessionStorage.getItem(e)},setJSON(e,t){t&&this.set(e,JSON.stringify(t))},getJSON(e){const t=this.get(e);return t?JSON.parse(t):null},remove(e){sessionStorage.removeItem(e)},clear(){sessionStorage.clear()}},V={set(e,t){localStorage&&e&&t&&localStorage.setItem(e,t)},get(e){return!localStorage||!e?null:localStorage.getItem(e)},setJSON(e,t){t&&this.set(e,JSON.stringify(t))},getJSON(e){const t=this.get(e);return t?JSON.parse(t):null},remove(e){localStorage.removeItem(e)},clear(){localStorage.clear()}};function X(e,t){if(!e||!t)return;let n=e.className;const r=n.indexOf(t);r===-1?n+=`${t}`:n=n.substring(0,r)+n.substring(r+t.length),e.className=n}function E(e,t){return e.className.match(new RegExp("(?:\\s|^)"+t+"(?:\\s|$)"))}function K(e,t){E(e,t)||(e.className+=` ${t}`)}function Q(e,t){if(E(e,t)){const n=new RegExp("(?:\\s|^)"+t+"(?:\\s|$)");e.className=e.className.replace(n," ")}}function ee(e){let t=!1;return function(...n){t||(t=!0,window.requestAnimationFrame(()=>{e.apply(this,n),t=!1}))}}function te(e){e&&(e.oncontextmenu=()=>!1)}function ne(e){return/^(http(s)?:\/\/)/.test(e)}function re(e){return/^(https?:|mailto:|tel:)/.test(e)}function oe(e){return Object.prototype.toString.call(e)==="[object String]"}function ie(e){return/^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(e)}function se(e){return!Object.keys(e).length}function ce(e){return/^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(e)}function ae(e,t=8){return new RegExp(`^S*(?=S{${t}},})(?=S*d)(?=S*[A-Z])(?=S*[a-z])(?=S*[!@#$%^&*?])S*$`).test(e)}function ue(e){return/^(([^<>()\[\]\\.,;:\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,}))$/.test(e)}function O(e){return/^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/.test(e)}function fe(e){return/^0\d{2,3}-?\d{7,8}$/.test(e)}function le(e){return/^1[3-9]\d{9}$/.test(e)}const y=()=>{};function de(e){return new Promise(t=>setTimeout(t,e))}function he(e,t){return new Promise(n=>{const r=setInterval(()=>{if(e===0)return clearInterval(r),n(!0),!1;t&&t(e),e--},1e3)})}function pe(e,t){const n=e.slice(),r=[];let o=n.length;const i=[];if(t>o)return null;for(;t--;){const s=Math.floor(Math.random()*o);r[t]=n[s in i?i[s]:s],i[s]=--o in i?i[o]:o}return r}function ge(e,t){let n=null;return function(...r){n!==null&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r),n=null},t)}}function me(e){if(!O(e))throw new Error("Please provide a valid ID number!");const t=e.length,n=t===15?e[t-1]:e[t-2];return parseInt(n)%2===1?"1":"2"}function ve(e){if(!O(e))throw new Error("Please provide a valid ID number!");return e.substring(6,10)+"-"+e.substring(10,12)+"-"+e.substring(12,14)}const S=(e,t="")=>{t||(t=location.origin);const n=new RegExp(/^http(s)?:\/\//),r=new RegExp(/^((?:[a-z]+:)?\/\/|data:image\/)(.*)/i);return n.test(e)||r.test(e)?e:t+e},be=(e,t="")=>{typeof e=="string"&&(e=e===""?[]:e.split(","));for(const n in e)e[n]=S(e[n],t);return e};function _e(e){let t=y;return(...n)=>new Promise((r,o)=>{t(),t=()=>{r=o=y},e(...n).then(i=>r(i),i=>o(i))})}function ye(e,t){const n=document.createElement("a");n.download=t,n.href=e,n.click()}function x(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}function we(e,t,n=!1){let r=Math.round(e/t*1e4)/100;return Number.isNaN(r)&&(r=0),n?Math.floor(r):r}function Ee(e){const t=document.createElement("link");t.rel="stylesheet",t.href=e,t.crossOrigin="anonymous",document.getElementsByTagName("head")[0].appendChild(t)}function Oe(e){return new Promise((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=()=>t(),r.onerror=o=>n(o),document.getElementsByTagName("head")[0].appendChild(r)})}function Te(e){switch(e){case 400:return"请求失败!请您稍后重试";case 401:return"认证失败,无法访问系统资源";case 403:return"当前操作没有权限!";case 404:return"你所访问的资源不存在!";case 405:return"请求方式错误!请您稍后重试";case 408:return"请求超时!请您稍后重试";case 500:return"服务异常!";case 502:return"网关错误!";case 503:return"服务不可用!";case 504:return"网关超时!";default:return"系统未知错误,请反馈给管理员"}}function Me(e){return e==null?"未填写":(e=typeof e=="number"?`${e}`:e,e==="1"?"是":"否")}function Re(e){return e==null?"未填写":(e=typeof e=="number"?`${e}`:e,e==="1"?"有":"无")}function Ae(e){return e?e.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2"):""}function Se(e,t,n){if(t??(t=4),n??(n=4),e){const r=e.length;return e.substring(0,t)+"*".repeat(r-t-n)+e.substring(r-n)}return""}function xe(e){return e.replace(/( |^)[a-z]/g,t=>t.toUpperCase())}function De(e){return e.replace(/( |^)[A-Z]/g,t=>t.toLowerCase())}function Ie(e,t){const n=e.find(r=>r.value===t);return n?n.label:""}function Ye(e,t,n){const r=[],o=t.split(","),i=n.split(",");return Array.from(new Set(o)).forEach(c=>{const a=e.find(u=>u.value===c);a&&i.forEach(u=>{var h;const f=(h=a.children)==null?void 0:h.find(N=>N.value===u);f&&r.push(f)})}),r.map(c=>c.label).join()}function D(e,t,n){var i;if(!t)return"";const r=t.split(","),o=n.find(s=>s.value===r[e]);return o?((i=o.children)!=null&&i.length&&D(e+1,t,o.children),o.label):""}function ze(e,t,n){if(!e)return"";const r=e.split(","),o=[],i=r.length-1,s=r.findIndex(c=>c===n);if(s!==-1){const c=r[i]===n;r.splice(c?0:s,c?i:1)}return r.forEach(c=>{const a=t.find(u=>u.value===c);a&&o.push(a)}),o.map(c=>c.label).join()}function Ce(e){let t="";for(const n of Object.keys(e)){const r=e[n],o=`${encodeURIComponent(n)}=`;if(r!==null&&typeof r<"u")if(typeof r=="object"){for(const i of Object.keys(r))if(r[i]!==null&&typeof r[i]<"u"){const s=`${n}[${i}]`,c=`${encodeURIComponent(s)}=`;t+=`${c+encodeURIComponent(r[i])}&`}}else t+=`${o+encodeURIComponent(r)}&`}return t}function Le(e){return e?x(Object.keys(e).map(t=>e[t]===void 0?"":`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&"):""}function $e(e){const t=decodeURIComponent(e.split("?")[1]).replace(/\+/g," ");if(!t)return{};const n={};return t.split("&").forEach(o=>{const i=o.indexOf("=");if(i!==-1){const s=o.substring(0,i),c=o.substring(i+1,o.length);n[s]=c}}),n}const Fe=[["date","YYYY-MM-DD"],["daterange","YYYY-MM-DD"],["datetime","YYYY-MM-DD HH:mm:ss"],["datetimerange","YYYY-MM-DD HH:mm:ss"],["month","YYYY-MM"],["monthrange","YYYY-MM"],["year","YYYY"],["yearrange","YYYY"],["time","HH:mm:ss"]],ke={view:"查看",add:"添加",edit:"编辑",del:"删除",save:"保存",reset:"重置",close:"关闭",confirm:"确定",submit:"提交",cancel:"取消",success:"成功",fail:"失败",open:"启用",disable:"禁用"},Ne=new Map(Fe),He=ke,I=["jpg","jpeg","png","bmp","gif"],Y=["mp3","mp4","webm","ogg","3gp"],z=["doc","docx","xls","xlsx","ppt","txt","pdf","zip"],Pe=[...I,...Y,...z];var C=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var s=i[o];n.call(r,s[1],s[0])}},t}()}(),w=typeof window<"u"&&typeof document<"u"&&window.document===document,m=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Be=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(m):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Ue=2;function je(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function s(){Be(i)}function c(){var a=Date.now();if(n){if(a-o<Ue)return;r=!0}else n=!0,r=!1,setTimeout(s,t);o=a}return c}var qe=20,Ge=["top","right","bottom","left","width","height","size","weight"],Je=typeof MutationObserver<"u",Ze=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=je(this.refresh.bind(this),qe)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!w||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Je?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!w||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=Ge.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),L=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},l=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||m},$=b(0,0,0,0);function v(e){return parseFloat(e)||0}function T(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var i=e["border-"+o+"-width"];return r+v(i)},0)}function We(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var i=o[r],s=e["padding-"+i];n[i]=v(s)}return n}function Ve(e){var t=e.getBBox();return b(0,0,t.width,t.height)}function Xe(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return $;var r=l(e).getComputedStyle(e),o=We(r),i=o.left+o.right,s=o.top+o.bottom,c=v(r.width),a=v(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==t&&(c-=T(r,"left","right")+i),Math.round(a+s)!==n&&(a-=T(r,"top","bottom")+s)),!Qe(e)){var u=Math.round(c+i)-t,f=Math.round(a+s)-n;Math.abs(u)!==1&&(c-=u),Math.abs(f)!==1&&(a-=f)}return b(o.left,o.top,c,a)}var Ke=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof l(e).SVGGraphicsElement}:function(e){return e instanceof l(e).SVGElement&&typeof e.getBBox=="function"}}();function Qe(e){return e===l(e).document.documentElement}function et(e){return w?Ke(e)?Ve(e):Xe(e):$}function tt(e){var t=e.x,n=e.y,r=e.width,o=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,s=Object.create(i.prototype);return L(s,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),s}function b(e,t,n,r){return{x:e,y:t,width:n,height:r}}var nt=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=b(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=et(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),rt=function(){function e(t,n){var r=tt(n);L(this,{target:t,contentRect:r})}return e}(),ot=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new C,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof l(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new nt(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof l(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new rt(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),F=typeof WeakMap<"u"?new WeakMap:new C,k=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Ze.getInstance(),r=new ot(t,n,this);F.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){k.prototype[e]=function(){var t;return(t=F.get(this))[e].apply(t,arguments)}});var it=function(){return typeof m.ResizeObserver<"u"?m.ResizeObserver:k}();function st(e){for(const t of e){const n=t.target.__resizeListeners__||[];n.length&&n.forEach(r=>r())}}function ct(e,t){typeof window>"u"||(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new it(st),e.__ro__.observe(e)),e.__resizeListeners__.push(t))}function at(e,t){!e||!e.__resizeListeners__||(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__.disconnect())}let d=[],ut={consecutiveFrames:0,lastBlinkTime:0},ft={consecutiveFrames:0,lastBlinkTime:0};const lt=new Map([["nod",[yt,30,100]],["shake",[_t,7,100]],["mouth",[bt,.35,100]],["eye",[vt,.3,100]]]),dt=["nod","shake","mouth","eye"],ht={nod:"请点点头",shake:"请摇摇头",mouth:"请张张嘴",eye:"请眨眨眼"};function M(e,t){if(e.length!==t.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");const n=Array.from(e),r=Array.from(t);return Math.sqrt(n.map((o,i)=>o-r[i]).reduce((o,i)=>o+Math.pow(i,2),0))}function*pt(e,t,n=8,r=0){for(let o=n;o>0;o--)yield e(t,.5,r)}function p(e){return[e.x,e.y]}function _(e,t){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function R(e){const t=_(e[1],e[5]),n=_(e[2],e[4]),r=_(e[0],e[3]);return(t+n)/(2*r)}function gt(e){const t=M(p(e[13]),p(e[19])),n=M(p(e[0]),p(e[6]));return t/n}function mt(e){const t=e.positions[30],n=e.positions[36],r=e.positions[45],o=(n.x+r.x)/2;return(t.x-o)/(r.x-n.x)*30}function vt(e,t){const n=Date.now(),r=A(R(e.getLeftEye()),t,ut,n),o=A(R(e.getRightEye()),t,ft,n);return!!(r||o)}function A(e,t,n,r){if(e<t)n.consecutiveFrames++;else if(n.consecutiveFrames>=3&&r-n.lastBlinkTime>500)return n.lastBlinkTime=r,n.consecutiveFrames=0,!0;return!1}function bt(e,t){return gt(e.getMouth())>t}function _t(e,t){const n=mt(e);return Math.abs(n)>t}function yt(e,t){const n=d.length,r=e.positions[33];if(n<5)d.push(r.y);else if(n===5){const o=Math.min(...d);if(Math.max(...d)-o>t)return!0;d=[]}return!1}function wt(e,t="blob",n=1){return new Promise(r=>{const o=document.createElement("canvas"),i=o.getContext("2d");o.width=e.videoWidth,o.height=e.videoHeight,i==null||i.drawImage(e,0,0,o.width,o.height),t==="blob"?o.toBlob(s=>{const c=new FileReader;c.onload=()=>r(c.result),c.readAsArrayBuffer(s)},"image/png",n):r(o.toDataURL("image/png",n))})}async function Et(e,t,n,r=5){const[o,i,s]=lt.get(n);if(!o)return!1;const c=[],a=pt(e,t,r,s);for(const u of a){const f=await u;if(!f)continue;const h=o(f.landmarks,i);c.push(h)}return c.includes(!0)}const Ot={DATE_VALUE_FORMAT:Ne,OPERATE_STATE:He,IMAGE_TYPE:I,MEDIA_TYPE:Y,DOC_TYPE:z,FILE_TYPE:Pe},Tt={encodeURIToParams:Ce,paramsToQueryString:Le,queryStringToParams:$e,errorCodeToString:Te,YNToString:Me,HNToString:Re,valueToLabel:Ie,chargeToLabel:Ye,cascaderToLabel:D,multipleSelectToLabel:ze,phoneToAsterisk:Ae,idNumberToAsterisk:Se,firstLetterToUpperCase:xe,firstLetterToLowerCase:De},Mt={validHttp:ne,validExternal:re,validString:oe,validNumberStr:ie,validEmptyObject:se,validURL:ce,validPassword:ae,validEmail:ue,validIdNumber:O,validPhone:le,validTel:fe},Rt={scrollTo:j,addClass:K,removeClass:Q,hasClass:E,toggleClass:X,noContextmenu:te,useRafThrottle:ee},At={parseTime:g,getTimeDistance:J,getDayRange:Z},St={local:V,session:W},xt={uuid:G,randomNum:q};exports.CONSTANTS=Ot;exports.NOOP=y;exports.addResizeListener=ct;exports.cacheUtil=St;exports.countdownTimer=he;exports.creatCancelTask=_e;exports.dateUtil=At;exports.debounce=ge;exports.downloadFile=ye;exports.elementUtil=Rt;exports.faceLivingEvent=dt;exports.faceLivingEventHint=ht;exports.getArrayFullUrl=be;exports.getBirthdayByIdNumber=ve;exports.getFaceGestureResult=Et;exports.getFaceVideoFrame=wt;exports.getFullUrl=S;exports.getGenderByIdNumber=me;exports.getPercentage=we;exports.getRandomItemInArray=pe;exports.loadCss=Ee;exports.loadJs=Oe;exports.randomUtil=xt;exports.removeResizeListener=at;exports.sleep=de;exports.toUtil=Tt;exports.trimArray=x;exports.validUtil=Mt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=(e,t,n,r)=>(e/=r/2,e<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t)),B=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||(e=>window.setTimeout(e,1e3/60));function U(e,t){if(t){document.querySelector(t).scrollTop=e;return}document.documentElement.scrollTop=e,document.body.parentNode.scrollTop=e,document.body.scrollTop=e}function j(e){return e?document.querySelector(e).scrollTop:document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function q(e){const{target:t,to:n=0,duration:r=500,callback:o}=e??{},i=j(t),s=n-i,c=20;let a=0;const u=function(){a+=c;const f=P(a,i,s,r);U(f,t),a<r?B(u):o&&o()};u()}function G(e,t){switch(arguments.length){case 1:return parseInt((Math.random()*e+1).toString(),10);case 2:return parseInt((Math.random()*(t-e+1)+e).toString(),10);default:return 0}}function J(){let e="";const t=[];for(let n=0;n<=15;n++)t[n]=n.toString(16);for(let n=1;n<=36;n++)n===9||n===14||n===19||n===24?e+="-":n===15?e+=4:n===20?e+=t[Math.random()*4|8]:e+=t[Math.random()*16|0];return e}function m(e,t){if(!e)return"-";e.toString().length===10&&(e=+e*1e3),t??(t="YYYY-MM-DD HH:mm:ss");const n=new Date(e),r=(s,c,a=" ")=>{if(s.length>=c)return s;const u=c-s.length;let f=Math.ceil(u/a.length);for(;f>>=1;)a+=a,f===1&&(a+=a);return a.slice(0,u)+s};let o;const i={"Y+":n.getFullYear().toString(),"M+":(n.getMonth()+1).toString(),"D+":n.getDate().toString(),"H+":n.getHours().toString(),"m+":n.getMinutes().toString(),"s+":n.getSeconds().toString()};for(const s in i)o=new RegExp("("+s+")").exec(t),o&&(t=t.replace(o[1],o[1].length==1?i[s]:r(i[s],o[1].length,"0")));return t}function Z(e,t){`${e}`.length===10?e=parseInt(e+"")*1e3:e=+e;const n=new Date(e),o=(Date.now()-Number(n))/1e3;return o<30?"刚刚":o<3600?`${Math.ceil(o/60)}分钟前`:o<3600*24?`${Math.ceil(o/3600)}小时前`:o<3600*24*2?"1天前":t?m(e,t):`${n.getMonth()+1}月${n.getDate()}日${n.getHours()}时${n.getMinutes()}分`}function W(e){const t=e||new Date,n=new Date(t),r=new Date(t);return n.setHours(0,0,0),r.setHours(23,59,59),{dateRange:[m(n),m(r)],timestampRange:[n.getTime(),r.getTime()]}}const V={set(e,t){sessionStorage&&e&&t&&sessionStorage.setItem(e,t)},get(e){return!sessionStorage||!e?null:sessionStorage.getItem(e)},setJSON(e,t){t&&this.set(e,JSON.stringify(t))},getJSON(e){const t=this.get(e);return t?JSON.parse(t):null},remove(e){sessionStorage.removeItem(e)},clear(){sessionStorage.clear()}},X={set(e,t){localStorage&&e&&t&&localStorage.setItem(e,t)},get(e){return!localStorage||!e?null:localStorage.getItem(e)},setJSON(e,t){t&&this.set(e,JSON.stringify(t))},getJSON(e){const t=this.get(e);return t?JSON.parse(t):null},remove(e){localStorage.removeItem(e)},clear(){localStorage.clear()}};function Q(e,t){if(!e||!t)return;let n=e.className;const r=n.indexOf(t);r===-1?n+=`${t}`:n=n.substring(0,r)+n.substring(r+t.length),e.className=n}function O(e,t){return e.className.match(new RegExp("(?:\\s|^)"+t+"(?:\\s|$)"))}function K(e,t){O(e,t)||(e.className+=` ${t}`)}function ee(e,t){if(O(e,t)){const n=new RegExp("(?:\\s|^)"+t+"(?:\\s|$)");e.className=e.className.replace(n," ")}}function te(e){let t=!1;return function(...n){t||(t=!0,window.requestAnimationFrame(()=>{e.apply(this,n),t=!1}))}}function ne(e){e&&(e.oncontextmenu=()=>!1)}function re(e){return/^(http(s)?:\/\/)/.test(e)}function oe(e){return/^(https?:|mailto:|tel:)/.test(e)}function ie(e){return Object.prototype.toString.call(e)==="[object String]"}function se(e){return/^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(e)}function ce(e){return!Object.keys(e).length}function ae(e){return/^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(e)}function ue(e,t=8){return new RegExp(`^S*(?=S{${t}},})(?=S*d)(?=S*[A-Z])(?=S*[a-z])(?=S*[!@#$%^&*?])S*$`).test(e)}function fe(e){return/^(([^<>()\[\]\\.,;:\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,}))$/.test(e)}function M(e){return/^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/.test(e)}function le(e){return/^0\d{2,3}-?\d{7,8}$/.test(e)}function de(e){return/^1[3-9]\d{9}$/.test(e)}const w=()=>{};function he(e){return new Promise(t=>setTimeout(t,e))}function pe(e,t){return new Promise(n=>{const r=setInterval(()=>{if(e===0)return clearInterval(r),n(!0),!1;t&&t(e),e--},1e3)})}function ge(e,t){const n=e.slice(),r=[];let o=n.length;const i=[];if(t>o)return null;for(;t--;){const s=Math.floor(Math.random()*o);r[t]=n[s in i?i[s]:s],i[s]=--o in i?i[o]:o}return r}function me(e,t){let n=null;return function(...r){n!==null&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r),n=null},t)}}function ve(e){if(!M(e))throw new Error("Please provide a valid ID number!");const t=e.length,n=t===15?e[t-1]:e[t-2];return parseInt(n)%2===1?"1":"2"}function be(e){if(!M(e))throw new Error("Please provide a valid ID number!");return e.substring(6,10)+"-"+e.substring(10,12)+"-"+e.substring(12,14)}const x=(e,t="")=>{t||(t=location.origin);const n=new RegExp(/^http(s)?:\/\//),r=new RegExp(/^((?:[a-z]+:)?\/\/|data:image\/)(.*)/i);return n.test(e)||r.test(e)?e:t+e},_e=(e,t="")=>{typeof e=="string"&&(e=e===""?[]:e.split(","));for(const n in e)e[n]=x(e[n],t);return e};function ye(e){let t=w;return(...n)=>new Promise((r,o)=>{t(),t=()=>{r=o=w},e(...n).then(i=>r(i),i=>o(i))})}function we(e,t){const n=document.createElement("a");n.download=t,n.href=e,n.click()}function D(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}function Ee(e,t,n=!1){let r=Math.round(e/t*1e4)/100;return Number.isNaN(r)&&(r=0),n?Math.floor(r):r}function Oe(e){const t=document.createElement("link");t.rel="stylesheet",t.href=e,t.crossOrigin="anonymous",document.getElementsByTagName("head")[0].appendChild(t)}function Me(e){return new Promise((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=()=>t(),r.onerror=o=>n(o),document.getElementsByTagName("head")[0].appendChild(r)})}const Te=[["date","YYYY-MM-DD"],["daterange","YYYY-MM-DD"],["datetime","YYYY-MM-DD HH:mm:ss"],["datetimerange","YYYY-MM-DD HH:mm:ss"],["month","YYYY-MM"],["monthrange","YYYY-MM"],["year","YYYY"],["yearrange","YYYY"],["time","HH:mm:ss"]],Re={view:"查看",add:"添加",edit:"编辑",delete:"删除",save:"保存",reset:"重置",close:"关闭",confirm:"确定",submit:"提交",cancel:"取消",success:"成功",fail:"失败",open:"启用",disable:"禁用",refresh:"刷新",show:"显示",hide:"隐藏",search:"搜索",expand:"展开",collapse:"收起",upload:"上传",download:"下载",copy:"复制",clear:"清除",fuzzyQuery:"模糊查询",ing:"中",loading:"加载中...",select:"请选择",attachment:"附件",icon:"图标",picture:"图片",start:"开始",end:"结束",range:"范围",date:"日期",month:"月份",year:"年份",time:"时间",yes:"是",no:"否",have:"有",noHave:"无",unfilled:"未填写",selectAll:"全选",all:"全部",export:"导出",import:"导入",defaultErrorCode:"系统未知错误,请反馈给管理员"},Ae={400:"请求失败,请您稍后重试!",401:"认证失败,无法访问系统资源!",403:"当前操作没有权限!",404:"你所访问的资源不存在!",405:"请求错误,禁止访问系统资源!",408:"请求超时,请您稍后重试!",500:"服务异常!",502:"网关错误!",503:"服务不可用!",504:"网关超时!"},Se=new Map(Te),l=Re,xe=Ae,z=["jpg","jpeg","png","bmp","gif"],I=["mp3","mp4","webm","ogg","3gp"],Y=["doc","docx","xls","xlsx","ppt","txt","pdf","zip"],De=[...z,...I,...Y];function ze(e){return xe[e]??l.defaultErrorCode}function Ie(e){return e==null?l.unfilled:(e=typeof e=="number"?`${e}`:e,e==="1"?l.yes:l.no)}function Ye(e){return e==null?l.unfilled:(e=typeof e=="number"?`${e}`:e,e==="1"?l.have:l.noHave)}function Ce(e){return e?e.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2"):""}function Le(e,t,n){if(t??(t=4),n??(n=4),e){const r=e.length;return e.substring(0,t)+"*".repeat(r-t-n)+e.substring(r-n)}return""}function $e(e){return e.replace(/( |^)[a-z]/g,t=>t.toUpperCase())}function Fe(e){return e.replace(/( |^)[A-Z]/g,t=>t.toLowerCase())}function ke(e,t){const n=e.find(r=>r.value===t);return n?n.label:""}function Ne(e,t,n){const r=[],o=t.split(","),i=n.split(",");return Array.from(new Set(o)).forEach(c=>{const a=e.find(u=>u.value===c);a&&i.forEach(u=>{var p;const f=(p=a.children)==null?void 0:p.find(H=>H.value===u);f&&r.push(f)})}),r.map(c=>c.label).join()}function C(e,t,n){var i;if(!t)return"";const r=t.split(","),o=n.find(s=>s.value===r[e]);return o?((i=o.children)!=null&&i.length&&C(e+1,t,o.children),o.label):""}function He(e,t,n){if(!e)return"";const r=e.split(","),o=[],i=r.length-1,s=r.findIndex(c=>c===n);if(s!==-1){const c=r[i]===n;r.splice(c?0:s,c?i:1)}return r.forEach(c=>{const a=t.find(u=>u.value===c);a&&o.push(a)}),o.map(c=>c.label).join()}function Pe(e){let t="";for(const n of Object.keys(e)){const r=e[n],o=`${encodeURIComponent(n)}=`;if(r!==null&&typeof r<"u")if(typeof r=="object"){for(const i of Object.keys(r))if(r[i]!==null&&typeof r[i]<"u"){const s=`${n}[${i}]`,c=`${encodeURIComponent(s)}=`;t+=`${c+encodeURIComponent(r[i])}&`}}else t+=`${o+encodeURIComponent(r)}&`}return t}function Be(e){return e?D(Object.keys(e).map(t=>e[t]===void 0?"":`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&"):""}function Ue(e){const t=decodeURIComponent(e.split("?")[1]).replace(/\+/g," ");if(!t)return{};const n={};return t.split("&").forEach(o=>{const i=o.indexOf("=");if(i!==-1){const s=o.substring(0,i),c=o.substring(i+1,o.length);n[s]=c}}),n}var L=function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,i){return o[0]===n?(r=i,!0):!1}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,i=this.__entries__;o<i.length;o++){var s=i[o];n.call(r,s[1],s[0])}},t}()}(),E=typeof window<"u"&&typeof document<"u"&&window.document===document,v=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),je=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(v):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),qe=2;function Ge(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function s(){je(i)}function c(){var a=Date.now();if(n){if(a-o<qe)return;r=!0}else n=!0,r=!1,setTimeout(s,t);o=a}return c}var Je=20,Ze=["top","right","bottom","left","width","height","size","weight"],We=typeof MutationObserver<"u",Ve=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Ge(this.refresh.bind(this),Je)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!E||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),We?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!E||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=Ze.some(function(i){return!!~r.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),$=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},d=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||v},F=_(0,0,0,0);function b(e){return parseFloat(e)||0}function T(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var i=e["border-"+o+"-width"];return r+b(i)},0)}function Xe(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var i=o[r],s=e["padding-"+i];n[i]=b(s)}return n}function Qe(e){var t=e.getBBox();return _(0,0,t.width,t.height)}function Ke(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return F;var r=d(e).getComputedStyle(e),o=Xe(r),i=o.left+o.right,s=o.top+o.bottom,c=b(r.width),a=b(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+i)!==t&&(c-=T(r,"left","right")+i),Math.round(a+s)!==n&&(a-=T(r,"top","bottom")+s)),!tt(e)){var u=Math.round(c+i)-t,f=Math.round(a+s)-n;Math.abs(u)!==1&&(c-=u),Math.abs(f)!==1&&(a-=f)}return _(o.left,o.top,c,a)}var et=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof d(e).SVGGraphicsElement}:function(e){return e instanceof d(e).SVGElement&&typeof e.getBBox=="function"}}();function tt(e){return e===d(e).document.documentElement}function nt(e){return E?et(e)?Qe(e):Ke(e):F}function rt(e){var t=e.x,n=e.y,r=e.width,o=e.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,s=Object.create(i.prototype);return $(s,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),s}function _(e,t,n,r){return{x:e,y:t,width:n,height:r}}var ot=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=_(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=nt(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),it=function(){function e(t,n){var r=rt(n);$(this,{target:t,contentRect:r})}return e}(),st=function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new L,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof d(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new ot(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof d(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new it(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),k=typeof WeakMap<"u"?new WeakMap:new L,N=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Ve.getInstance(),r=new st(t,n,this);k.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){N.prototype[e]=function(){var t;return(t=k.get(this))[e].apply(t,arguments)}});var ct=function(){return typeof v.ResizeObserver<"u"?v.ResizeObserver:N}();function at(e){for(const t of e){const n=t.target.__resizeListeners__||[];n.length&&n.forEach(r=>r())}}function ut(e,t){typeof window>"u"||(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new ct(at),e.__ro__.observe(e)),e.__resizeListeners__.push(t))}function ft(e,t){!e||!e.__resizeListeners__||(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__.disconnect())}let h=[],lt={consecutiveFrames:0,lastBlinkTime:0},dt={consecutiveFrames:0,lastBlinkTime:0};const ht=new Map([["nod",[Et,30,100]],["shake",[wt,7,100]],["mouth",[yt,.35,100]],["eye",[_t,.3,100]]]),pt=["nod","shake","mouth","eye"],gt={nod:"请点点头",shake:"请摇摇头",mouth:"请张张嘴",eye:"请眨眨眼"};function R(e,t){if(e.length!==t.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");const n=Array.from(e),r=Array.from(t);return Math.sqrt(n.map((o,i)=>o-r[i]).reduce((o,i)=>o+Math.pow(i,2),0))}function*mt(e,t,n=8,r=0){for(let o=n;o>0;o--)yield e(t,.5,r)}function g(e){return[e.x,e.y]}function y(e,t){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function A(e){const t=y(e[1],e[5]),n=y(e[2],e[4]),r=y(e[0],e[3]);return(t+n)/(2*r)}function vt(e){const t=R(g(e[13]),g(e[19])),n=R(g(e[0]),g(e[6]));return t/n}function bt(e){const t=e.positions[30],n=e.positions[36],r=e.positions[45],o=(n.x+r.x)/2;return(t.x-o)/(r.x-n.x)*30}function _t(e,t){const n=Date.now(),r=S(A(e.getLeftEye()),t,lt,n),o=S(A(e.getRightEye()),t,dt,n);return!!(r||o)}function S(e,t,n,r){if(e<t)n.consecutiveFrames++;else if(n.consecutiveFrames>=3&&r-n.lastBlinkTime>500)return n.lastBlinkTime=r,n.consecutiveFrames=0,!0;return!1}function yt(e,t){return vt(e.getMouth())>t}function wt(e,t){const n=bt(e);return Math.abs(n)>t}function Et(e,t){const n=h.length,r=e.positions[33];if(n<5)h.push(r.y);else if(n===5){const o=Math.min(...h);if(Math.max(...h)-o>t)return!0;h=[]}return!1}function Ot(e,t="blob",n=1){return new Promise(r=>{const o=document.createElement("canvas"),i=o.getContext("2d");o.width=e.videoWidth,o.height=e.videoHeight,i==null||i.drawImage(e,0,0,o.width,o.height),t==="blob"?o.toBlob(s=>{const c=new FileReader;c.onload=()=>r(c.result),c.readAsArrayBuffer(s)},"image/png",n):r(o.toDataURL("image/png",n))})}async function Mt(e,t,n,r=5){const[o,i,s]=ht.get(n);if(!o)return!1;const c=[],a=mt(e,t,r,s);for(const u of a){const f=await u;if(!f)continue;const p=o(f.landmarks,i);c.push(p)}return c.includes(!0)}const Tt={DATE_VALUE_FORMAT:Se,COMMON_TEXT:l,IMAGE_TYPE:z,MEDIA_TYPE:I,DOC_TYPE:Y,FILE_TYPE:De},Rt={encodeURIToParams:Pe,paramsToQueryString:Be,queryStringToParams:Ue,errorCodeToString:ze,YNToString:Ie,HNToString:Ye,valueToLabel:ke,chargeToLabel:Ne,cascaderToLabel:C,multipleSelectToLabel:He,phoneToAsterisk:Ce,idNumberToAsterisk:Le,firstLetterToUpperCase:$e,firstLetterToLowerCase:Fe},At={validHttp:re,validExternal:oe,validString:ie,validNumberStr:se,validEmptyObject:ce,validURL:ae,validPassword:ue,validEmail:fe,validIdNumber:M,validPhone:de,validTel:le},St={scrollTo:q,addClass:K,removeClass:ee,hasClass:O,toggleClass:Q,noContextmenu:ne,useRafThrottle:te},xt={parseTime:m,getTimeDistance:Z,getDayRange:W},Dt={local:X,session:V},zt={uuid:J,randomNum:G};exports.CONSTANTS=Tt;exports.NOOP=w;exports.addResizeListener=ut;exports.cacheUtil=Dt;exports.countdownTimer=pe;exports.creatCancelTask=ye;exports.dateUtil=xt;exports.debounce=me;exports.downloadFile=we;exports.elementUtil=St;exports.faceLivingEvent=pt;exports.faceLivingEventHint=gt;exports.getArrayFullUrl=_e;exports.getBirthdayByIdNumber=be;exports.getFaceGestureResult=Mt;exports.getFaceVideoFrame=Ot;exports.getFullUrl=x;exports.getGenderByIdNumber=ve;exports.getPercentage=Ee;exports.getRandomItemInArray=ge;exports.loadCss=Oe;exports.loadJs=Me;exports.randomUtil=zt;exports.removeResizeListener=ft;exports.sleep=he;exports.toUtil=Rt;exports.trimArray=D;exports.validUtil=At;
|
package/lib/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const H = (e, t, n, r) => (e /= r / 2, e < 1 ? n / 2 * e * e + t : (e--, -n / 2 * (e * (e - 2) - 1) + t)), N = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || ((e) => window.setTimeout(e, 16.666666666666668));
|
|
2
|
+
function P(e, t) {
|
|
3
3
|
if (t) {
|
|
4
4
|
document.querySelector(t).scrollTop = e;
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
7
|
document.documentElement.scrollTop = e, document.body.parentNode.scrollTop = e, document.body.scrollTop = e;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function B(e) {
|
|
10
10
|
return e ? document.querySelector(e).scrollTop : document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const { target: t, to: n = 0, duration: r = 500, callback: o } = e ?? {}, i =
|
|
12
|
+
function q(e) {
|
|
13
|
+
const { target: t, to: n = 0, duration: r = 500, callback: o } = e ?? {}, i = B(t), s = n - i, c = 20;
|
|
14
14
|
let a = 0;
|
|
15
15
|
const u = function() {
|
|
16
16
|
a += c;
|
|
17
|
-
const f =
|
|
18
|
-
|
|
17
|
+
const f = H(a, i, s, r);
|
|
18
|
+
P(f, t), a < r ? N(u) : o && o();
|
|
19
19
|
};
|
|
20
20
|
u();
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function j(e, t) {
|
|
23
23
|
switch (arguments.length) {
|
|
24
24
|
case 1:
|
|
25
25
|
return parseInt((Math.random() * e + 1).toString(), 10);
|
|
@@ -29,7 +29,7 @@ function q(e, t) {
|
|
|
29
29
|
return 0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function G() {
|
|
33
33
|
let e = "";
|
|
34
34
|
const t = [];
|
|
35
35
|
for (let n = 0; n <= 15; n++)
|
|
@@ -38,7 +38,7 @@ function j() {
|
|
|
38
38
|
n === 9 || n === 14 || n === 19 || n === 24 ? e += "-" : n === 15 ? e += 4 : n === 20 ? e += t[Math.random() * 4 | 8] : e += t[Math.random() * 16 | 0];
|
|
39
39
|
return e;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function m(e, t) {
|
|
42
42
|
if (!e) return "-";
|
|
43
43
|
e.toString().length === 10 && (e = +e * 1e3), t ?? (t = "YYYY-MM-DD HH:mm:ss");
|
|
44
44
|
const n = new Date(e), r = (s, c, a = " ") => {
|
|
@@ -62,19 +62,19 @@ function g(e, t) {
|
|
|
62
62
|
o = new RegExp("(" + s + ")").exec(t), o && (t = t.replace(o[1], o[1].length == 1 ? i[s] : r(i[s], o[1].length, "0")));
|
|
63
63
|
return t;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function U(e, t) {
|
|
66
66
|
`${e}`.length === 10 ? e = parseInt(e + "") * 1e3 : e = +e;
|
|
67
67
|
const n = new Date(e), o = (Date.now() - Number(n)) / 1e3;
|
|
68
|
-
return o < 30 ? "刚刚" : o < 3600 ? `${Math.ceil(o / 60)}分钟前` : o < 3600 * 24 ? `${Math.ceil(o / 3600)}小时前` : o < 3600 * 24 * 2 ? "1天前" : t ?
|
|
68
|
+
return o < 30 ? "刚刚" : o < 3600 ? `${Math.ceil(o / 60)}分钟前` : o < 3600 * 24 ? `${Math.ceil(o / 3600)}小时前` : o < 3600 * 24 * 2 ? "1天前" : t ? m(e, t) : `${n.getMonth() + 1}月${n.getDate()}日${n.getHours()}时${n.getMinutes()}分`;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function Z(e) {
|
|
71
71
|
const t = e || /* @__PURE__ */ new Date(), n = new Date(t), r = new Date(t);
|
|
72
72
|
return n.setHours(0, 0, 0), r.setHours(23, 59, 59), {
|
|
73
|
-
dateRange: [
|
|
73
|
+
dateRange: [m(n), m(r)],
|
|
74
74
|
timestampRange: [n.getTime(), r.getTime()]
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const J = {
|
|
78
78
|
set(e, t) {
|
|
79
79
|
sessionStorage && e && t && sessionStorage.setItem(e, t);
|
|
80
80
|
},
|
|
@@ -94,7 +94,7 @@ const Z = {
|
|
|
94
94
|
clear() {
|
|
95
95
|
sessionStorage.clear();
|
|
96
96
|
}
|
|
97
|
-
},
|
|
97
|
+
}, W = {
|
|
98
98
|
set(e, t) {
|
|
99
99
|
localStorage && e && t && localStorage.setItem(e, t);
|
|
100
100
|
},
|
|
@@ -115,21 +115,21 @@ const Z = {
|
|
|
115
115
|
localStorage.clear();
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
function
|
|
118
|
+
function V(e, t) {
|
|
119
119
|
if (!e || !t)
|
|
120
120
|
return;
|
|
121
121
|
let n = e.className;
|
|
122
122
|
const r = n.indexOf(t);
|
|
123
123
|
r === -1 ? n += `${t}` : n = n.substring(0, r) + n.substring(r + t.length), e.className = n;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function E(e, t) {
|
|
126
126
|
return e.className.match(new RegExp("(?:\\s|^)" + t + "(?:\\s|$)"));
|
|
127
127
|
}
|
|
128
|
-
function V(e, t) {
|
|
129
|
-
w(e, t) || (e.className += ` ${t}`);
|
|
130
|
-
}
|
|
131
128
|
function X(e, t) {
|
|
132
|
-
|
|
129
|
+
E(e, t) || (e.className += ` ${t}`);
|
|
130
|
+
}
|
|
131
|
+
function Q(e, t) {
|
|
132
|
+
if (E(e, t)) {
|
|
133
133
|
const n = new RegExp("(?:\\s|^)" + t + "(?:\\s|$)");
|
|
134
134
|
e.className = e.className.replace(n, " ");
|
|
135
135
|
}
|
|
@@ -142,48 +142,48 @@ function K(e) {
|
|
|
142
142
|
}));
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function ee(e) {
|
|
146
146
|
e && (e.oncontextmenu = () => !1);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function te(e) {
|
|
149
149
|
return /^(http(s)?:\/\/)/.test(e);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function ne(e) {
|
|
152
152
|
return /^(https?:|mailto:|tel:)/.test(e);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function re(e) {
|
|
155
155
|
return Object.prototype.toString.call(e) === "[object String]";
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function oe(e) {
|
|
158
158
|
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(e);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function ie(e) {
|
|
161
161
|
return !Object.keys(e).length;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function se(e) {
|
|
164
164
|
return /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/.test(e);
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function ce(e, t = 8) {
|
|
167
167
|
return new RegExp(`^S*(?=S{${t}},})(?=S*d)(?=S*[A-Z])(?=S*[a-z])(?=S*[!@#$%^&*?])S*$`).test(e);
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function ae(e) {
|
|
170
170
|
return /^(([^<>()\[\]\\.,;:\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,}))$/.test(e);
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function O(e) {
|
|
173
173
|
return /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/.test(e);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function ue(e) {
|
|
176
176
|
return /^0\d{2,3}-?\d{7,8}$/.test(e);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function fe(e) {
|
|
179
179
|
return /^1[3-9]\d{9}$/.test(e);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const M = () => {
|
|
182
182
|
};
|
|
183
|
-
function
|
|
183
|
+
function ct(e) {
|
|
184
184
|
return new Promise((t) => setTimeout(t, e));
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function at(e, t) {
|
|
187
187
|
return new Promise((n) => {
|
|
188
188
|
const r = setInterval(() => {
|
|
189
189
|
if (e === 0)
|
|
@@ -192,7 +192,7 @@ function st(e, t) {
|
|
|
192
192
|
}, 1e3);
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function ut(e, t) {
|
|
196
196
|
const n = e.slice(), r = [];
|
|
197
197
|
let o = n.length;
|
|
198
198
|
const i = [];
|
|
@@ -203,7 +203,7 @@ function ct(e, t) {
|
|
|
203
203
|
}
|
|
204
204
|
return r;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function ft(e, t) {
|
|
207
207
|
let n = null;
|
|
208
208
|
return function(...r) {
|
|
209
209
|
n !== null && clearTimeout(n), n = setTimeout(() => {
|
|
@@ -211,132 +211,180 @@ function at(e, t) {
|
|
|
211
211
|
}, t);
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
if (!
|
|
214
|
+
function lt(e) {
|
|
215
|
+
if (!O(e))
|
|
216
216
|
throw new Error("Please provide a valid ID number!");
|
|
217
217
|
const t = e.length, n = t === 15 ? e[t - 1] : e[t - 2];
|
|
218
218
|
return parseInt(n) % 2 === 1 ? "1" : "2";
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
if (!
|
|
220
|
+
function dt(e) {
|
|
221
|
+
if (!O(e))
|
|
222
222
|
throw new Error("Please provide a valid ID number!");
|
|
223
223
|
return e.substring(6, 10) + "-" + e.substring(10, 12) + "-" + e.substring(12, 14);
|
|
224
224
|
}
|
|
225
|
-
const
|
|
225
|
+
const le = (e, t = "") => {
|
|
226
226
|
t || (t = location.origin);
|
|
227
227
|
const n = new RegExp(/^http(s)?:\/\//), r = new RegExp(/^((?:[a-z]+:)?\/\/|data:image\/)(.*)/i);
|
|
228
228
|
return n.test(e) || r.test(e) ? e : t + e;
|
|
229
|
-
},
|
|
229
|
+
}, ht = (e, t = "") => {
|
|
230
230
|
typeof e == "string" && (e = e === "" ? [] : e.split(","));
|
|
231
231
|
for (const n in e)
|
|
232
|
-
e[n] =
|
|
232
|
+
e[n] = le(e[n], t);
|
|
233
233
|
return e;
|
|
234
234
|
};
|
|
235
|
-
function
|
|
236
|
-
let t =
|
|
235
|
+
function pt(e) {
|
|
236
|
+
let t = M;
|
|
237
237
|
return (...n) => new Promise((r, o) => {
|
|
238
238
|
t(), t = () => {
|
|
239
|
-
r = o =
|
|
239
|
+
r = o = M;
|
|
240
240
|
}, e(...n).then(
|
|
241
241
|
(i) => r(i),
|
|
242
242
|
(i) => o(i)
|
|
243
243
|
);
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function gt(e, t) {
|
|
247
247
|
const n = document.createElement("a");
|
|
248
248
|
n.download = t, n.href = e, n.click();
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function de(e) {
|
|
251
251
|
const t = [];
|
|
252
252
|
for (let n = 0; n < e.length; n++)
|
|
253
253
|
e[n] && t.push(e[n]);
|
|
254
254
|
return t;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function mt(e, t, n = !1) {
|
|
257
257
|
let r = Math.round(e / t * 1e4) / 100;
|
|
258
258
|
return Number.isNaN(r) && (r = 0), n ? Math.floor(r) : r;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function vt(e) {
|
|
261
261
|
const t = document.createElement("link");
|
|
262
262
|
t.rel = "stylesheet", t.href = e, t.crossOrigin = "anonymous", document.getElementsByTagName("head")[0].appendChild(t);
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function _t(e) {
|
|
265
265
|
return new Promise((t, n) => {
|
|
266
266
|
const r = document.createElement("script");
|
|
267
267
|
r.type = "text/javascript", r.src = e, r.onload = () => t(), r.onerror = (o) => n(o), document.getElementsByTagName("head")[0].appendChild(r);
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
270
|
+
const he = [
|
|
271
|
+
["date", "YYYY-MM-DD"],
|
|
272
|
+
["daterange", "YYYY-MM-DD"],
|
|
273
|
+
["datetime", "YYYY-MM-DD HH:mm:ss"],
|
|
274
|
+
["datetimerange", "YYYY-MM-DD HH:mm:ss"],
|
|
275
|
+
["month", "YYYY-MM"],
|
|
276
|
+
["monthrange", "YYYY-MM"],
|
|
277
|
+
["year", "YYYY"],
|
|
278
|
+
["yearrange", "YYYY"],
|
|
279
|
+
["time", "HH:mm:ss"]
|
|
280
|
+
], pe = {
|
|
281
|
+
view: "查看",
|
|
282
|
+
add: "添加",
|
|
283
|
+
edit: "编辑",
|
|
284
|
+
delete: "删除",
|
|
285
|
+
save: "保存",
|
|
286
|
+
reset: "重置",
|
|
287
|
+
close: "关闭",
|
|
288
|
+
confirm: "确定",
|
|
289
|
+
submit: "提交",
|
|
290
|
+
cancel: "取消",
|
|
291
|
+
success: "成功",
|
|
292
|
+
fail: "失败",
|
|
293
|
+
open: "启用",
|
|
294
|
+
disable: "禁用",
|
|
295
|
+
refresh: "刷新",
|
|
296
|
+
show: "显示",
|
|
297
|
+
hide: "隐藏",
|
|
298
|
+
search: "搜索",
|
|
299
|
+
expand: "展开",
|
|
300
|
+
collapse: "收起",
|
|
301
|
+
upload: "上传",
|
|
302
|
+
download: "下载",
|
|
303
|
+
copy: "复制",
|
|
304
|
+
clear: "清除",
|
|
305
|
+
fuzzyQuery: "模糊查询",
|
|
306
|
+
ing: "中",
|
|
307
|
+
loading: "加载中...",
|
|
308
|
+
select: "请选择",
|
|
309
|
+
attachment: "附件",
|
|
310
|
+
icon: "图标",
|
|
311
|
+
picture: "图片",
|
|
312
|
+
start: "开始",
|
|
313
|
+
end: "结束",
|
|
314
|
+
range: "范围",
|
|
315
|
+
date: "日期",
|
|
316
|
+
month: "月份",
|
|
317
|
+
year: "年份",
|
|
318
|
+
time: "时间",
|
|
319
|
+
yes: "是",
|
|
320
|
+
no: "否",
|
|
321
|
+
have: "有",
|
|
322
|
+
noHave: "无",
|
|
323
|
+
unfilled: "未填写",
|
|
324
|
+
selectAll: "全选",
|
|
325
|
+
all: "全部",
|
|
326
|
+
export: "导出",
|
|
327
|
+
import: "导入",
|
|
328
|
+
defaultErrorCode: "系统未知错误,请反馈给管理员"
|
|
329
|
+
}, ge = {
|
|
330
|
+
400: "请求失败,请您稍后重试!",
|
|
331
|
+
401: "认证失败,无法访问系统资源!",
|
|
332
|
+
403: "当前操作没有权限!",
|
|
333
|
+
404: "你所访问的资源不存在!",
|
|
334
|
+
405: "请求错误,禁止访问系统资源!",
|
|
335
|
+
408: "请求超时,请您稍后重试!",
|
|
336
|
+
500: "服务异常!",
|
|
337
|
+
502: "网关错误!",
|
|
338
|
+
503: "服务不可用!",
|
|
339
|
+
504: "网关超时!"
|
|
340
|
+
}, me = new Map(he), l = pe, ve = ge, x = ["jpg", "jpeg", "png", "bmp", "gif"], D = ["mp3", "mp4", "webm", "ogg", "3gp"], Y = ["doc", "docx", "xls", "xlsx", "ppt", "txt", "pdf", "zip"], _e = [...x, ...D, ...Y];
|
|
341
|
+
function be(e) {
|
|
342
|
+
return ve[e] ?? l.defaultErrorCode;
|
|
343
|
+
}
|
|
344
|
+
function ye(e) {
|
|
345
|
+
return e == null ? l.unfilled : (e = typeof e == "number" ? `${e}` : e, e === "1" ? l.yes : l.no);
|
|
346
|
+
}
|
|
347
|
+
function we(e) {
|
|
348
|
+
return e == null ? l.unfilled : (e = typeof e == "number" ? `${e}` : e, e === "1" ? l.have : l.noHave);
|
|
301
349
|
}
|
|
302
|
-
function
|
|
350
|
+
function Ee(e) {
|
|
303
351
|
return e ? e.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2") : "";
|
|
304
352
|
}
|
|
305
|
-
function
|
|
353
|
+
function Oe(e, t, n) {
|
|
306
354
|
if (t ?? (t = 4), n ?? (n = 4), e) {
|
|
307
355
|
const r = e.length;
|
|
308
356
|
return e.substring(0, t) + "*".repeat(r - t - n) + e.substring(r - n);
|
|
309
357
|
}
|
|
310
358
|
return "";
|
|
311
359
|
}
|
|
312
|
-
function
|
|
360
|
+
function Me(e) {
|
|
313
361
|
return e.replace(/( |^)[a-z]/g, (t) => t.toUpperCase());
|
|
314
362
|
}
|
|
315
|
-
function
|
|
363
|
+
function Te(e) {
|
|
316
364
|
return e.replace(/( |^)[A-Z]/g, (t) => t.toLowerCase());
|
|
317
365
|
}
|
|
318
|
-
function
|
|
366
|
+
function Re(e, t) {
|
|
319
367
|
const n = e.find((r) => r.value === t);
|
|
320
368
|
return n ? n.label : "";
|
|
321
369
|
}
|
|
322
|
-
function
|
|
370
|
+
function Ae(e, t, n) {
|
|
323
371
|
const r = [], o = t.split(","), i = n.split(",");
|
|
324
372
|
return Array.from(new Set(o)).forEach((c) => {
|
|
325
373
|
const a = e.find((u) => u.value === c);
|
|
326
374
|
a && i.forEach((u) => {
|
|
327
|
-
var
|
|
328
|
-
const f = (
|
|
375
|
+
var p;
|
|
376
|
+
const f = (p = a.children) == null ? void 0 : p.find((F) => F.value === u);
|
|
329
377
|
f && r.push(f);
|
|
330
378
|
});
|
|
331
379
|
}), r.map((c) => c.label).join();
|
|
332
380
|
}
|
|
333
|
-
function
|
|
381
|
+
function z(e, t, n) {
|
|
334
382
|
var i;
|
|
335
383
|
if (!t) return "";
|
|
336
384
|
const r = t.split(","), o = n.find((s) => s.value === r[e]);
|
|
337
|
-
return o ? ((i = o.children) != null && i.length &&
|
|
385
|
+
return o ? ((i = o.children) != null && i.length && z(e + 1, t, o.children), o.label) : "";
|
|
338
386
|
}
|
|
339
|
-
function
|
|
387
|
+
function Se(e, t, n) {
|
|
340
388
|
if (!e) return "";
|
|
341
389
|
const r = e.split(","), o = [], i = r.length - 1, s = r.findIndex((c) => c === n);
|
|
342
390
|
if (s !== -1) {
|
|
@@ -348,7 +396,7 @@ function we(e, t, n) {
|
|
|
348
396
|
a && o.push(a);
|
|
349
397
|
}), o.map((c) => c.label).join();
|
|
350
398
|
}
|
|
351
|
-
function
|
|
399
|
+
function xe(e) {
|
|
352
400
|
let t = "";
|
|
353
401
|
for (const n of Object.keys(e)) {
|
|
354
402
|
const r = e[n], o = `${encodeURIComponent(n)}=`;
|
|
@@ -364,12 +412,12 @@ function Ee(e) {
|
|
|
364
412
|
}
|
|
365
413
|
return t;
|
|
366
414
|
}
|
|
367
|
-
function
|
|
368
|
-
return e ?
|
|
415
|
+
function De(e) {
|
|
416
|
+
return e ? de(
|
|
369
417
|
Object.keys(e).map((t) => e[t] === void 0 ? "" : `${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)
|
|
370
418
|
).join("&") : "";
|
|
371
419
|
}
|
|
372
|
-
function
|
|
420
|
+
function Ye(e) {
|
|
373
421
|
const t = decodeURIComponent(e.split("?")[1]).replace(/\+/g, " ");
|
|
374
422
|
if (!t)
|
|
375
423
|
return {};
|
|
@@ -382,33 +430,7 @@ function Me(e) {
|
|
|
382
430
|
}
|
|
383
431
|
}), n;
|
|
384
432
|
}
|
|
385
|
-
|
|
386
|
-
["date", "YYYY-MM-DD"],
|
|
387
|
-
["daterange", "YYYY-MM-DD"],
|
|
388
|
-
["datetime", "YYYY-MM-DD HH:mm:ss"],
|
|
389
|
-
["datetimerange", "YYYY-MM-DD HH:mm:ss"],
|
|
390
|
-
["month", "YYYY-MM"],
|
|
391
|
-
["monthrange", "YYYY-MM"],
|
|
392
|
-
["year", "YYYY"],
|
|
393
|
-
["yearrange", "YYYY"],
|
|
394
|
-
["time", "HH:mm:ss"]
|
|
395
|
-
], Re = {
|
|
396
|
-
view: "查看",
|
|
397
|
-
add: "添加",
|
|
398
|
-
edit: "编辑",
|
|
399
|
-
del: "删除",
|
|
400
|
-
save: "保存",
|
|
401
|
-
reset: "重置",
|
|
402
|
-
close: "关闭",
|
|
403
|
-
confirm: "确定",
|
|
404
|
-
submit: "提交",
|
|
405
|
-
cancel: "取消",
|
|
406
|
-
success: "成功",
|
|
407
|
-
fail: "失败",
|
|
408
|
-
open: "启用",
|
|
409
|
-
disable: "禁用"
|
|
410
|
-
}, Ae = new Map(Te), Se = Re, x = ["jpg", "jpeg", "png", "bmp", "gif"], D = ["mp3", "mp4", "webm", "ogg", "3gp"], Y = ["doc", "docx", "xls", "xlsx", "ppt", "txt", "pdf", "zip"], xe = [...x, ...D, ...Y];
|
|
411
|
-
var z = function() {
|
|
433
|
+
var I = function() {
|
|
412
434
|
if (typeof Map < "u")
|
|
413
435
|
return Map;
|
|
414
436
|
function e(t, n) {
|
|
@@ -454,27 +476,27 @@ var z = function() {
|
|
|
454
476
|
}, t;
|
|
455
477
|
}()
|
|
456
478
|
);
|
|
457
|
-
}(),
|
|
479
|
+
}(), w = typeof window < "u" && typeof document < "u" && window.document === document, v = function() {
|
|
458
480
|
return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
|
|
459
|
-
}(),
|
|
460
|
-
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(
|
|
481
|
+
}(), ze = function() {
|
|
482
|
+
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(v) : function(e) {
|
|
461
483
|
return setTimeout(function() {
|
|
462
484
|
return e(Date.now());
|
|
463
485
|
}, 1e3 / 60);
|
|
464
486
|
};
|
|
465
|
-
}(),
|
|
466
|
-
function
|
|
487
|
+
}(), Ie = 2;
|
|
488
|
+
function Ce(e, t) {
|
|
467
489
|
var n = !1, r = !1, o = 0;
|
|
468
490
|
function i() {
|
|
469
491
|
n && (n = !1, e()), r && c();
|
|
470
492
|
}
|
|
471
493
|
function s() {
|
|
472
|
-
|
|
494
|
+
ze(i);
|
|
473
495
|
}
|
|
474
496
|
function c() {
|
|
475
497
|
var a = Date.now();
|
|
476
498
|
if (n) {
|
|
477
|
-
if (a - o <
|
|
499
|
+
if (a - o < Ie)
|
|
478
500
|
return;
|
|
479
501
|
r = !0;
|
|
480
502
|
} else
|
|
@@ -483,11 +505,11 @@ function ze(e, t) {
|
|
|
483
505
|
}
|
|
484
506
|
return c;
|
|
485
507
|
}
|
|
486
|
-
var
|
|
508
|
+
var $e = 20, Le = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], ke = typeof MutationObserver < "u", Fe = (
|
|
487
509
|
/** @class */
|
|
488
510
|
function() {
|
|
489
511
|
function e() {
|
|
490
|
-
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh =
|
|
512
|
+
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = Ce(this.refresh.bind(this), $e);
|
|
491
513
|
}
|
|
492
514
|
return e.prototype.addObserver = function(t) {
|
|
493
515
|
~this.observers_.indexOf(t) || this.observers_.push(t), this.connected_ || this.connect_();
|
|
@@ -505,16 +527,16 @@ var Ie = 20, Ce = ["top", "right", "bottom", "left", "width", "height", "size",
|
|
|
505
527
|
return n.broadcastActive();
|
|
506
528
|
}), t.length > 0;
|
|
507
529
|
}, e.prototype.connect_ = function() {
|
|
508
|
-
!
|
|
530
|
+
!w || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), ke ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
|
|
509
531
|
attributes: !0,
|
|
510
532
|
childList: !0,
|
|
511
533
|
characterData: !0,
|
|
512
534
|
subtree: !0
|
|
513
535
|
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
|
|
514
536
|
}, e.prototype.disconnect_ = function() {
|
|
515
|
-
!
|
|
537
|
+
!w || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
|
|
516
538
|
}, e.prototype.onTransitionEnd_ = function(t) {
|
|
517
|
-
var n = t.propertyName, r = n === void 0 ? "" : n, o =
|
|
539
|
+
var n = t.propertyName, r = n === void 0 ? "" : n, o = Le.some(function(i) {
|
|
518
540
|
return !!~r.indexOf(i);
|
|
519
541
|
});
|
|
520
542
|
o && this.refresh();
|
|
@@ -522,7 +544,7 @@ var Ie = 20, Ce = ["top", "right", "bottom", "left", "width", "height", "size",
|
|
|
522
544
|
return this.instance_ || (this.instance_ = new e()), this.instance_;
|
|
523
545
|
}, e.instance_ = null, e;
|
|
524
546
|
}()
|
|
525
|
-
),
|
|
547
|
+
), C = function(e, t) {
|
|
526
548
|
for (var n = 0, r = Object.keys(t); n < r.length; n++) {
|
|
527
549
|
var o = r[n];
|
|
528
550
|
Object.defineProperty(e, o, {
|
|
@@ -533,59 +555,59 @@ var Ie = 20, Ce = ["top", "right", "bottom", "left", "width", "height", "size",
|
|
|
533
555
|
});
|
|
534
556
|
}
|
|
535
557
|
return e;
|
|
536
|
-
},
|
|
558
|
+
}, d = function(e) {
|
|
537
559
|
var t = e && e.ownerDocument && e.ownerDocument.defaultView;
|
|
538
|
-
return t ||
|
|
539
|
-
},
|
|
540
|
-
function
|
|
560
|
+
return t || v;
|
|
561
|
+
}, $ = b(0, 0, 0, 0);
|
|
562
|
+
function _(e) {
|
|
541
563
|
return parseFloat(e) || 0;
|
|
542
564
|
}
|
|
543
|
-
function
|
|
565
|
+
function T(e) {
|
|
544
566
|
for (var t = [], n = 1; n < arguments.length; n++)
|
|
545
567
|
t[n - 1] = arguments[n];
|
|
546
568
|
return t.reduce(function(r, o) {
|
|
547
569
|
var i = e["border-" + o + "-width"];
|
|
548
|
-
return r +
|
|
570
|
+
return r + _(i);
|
|
549
571
|
}, 0);
|
|
550
572
|
}
|
|
551
|
-
function
|
|
573
|
+
function He(e) {
|
|
552
574
|
for (var t = ["top", "right", "bottom", "left"], n = {}, r = 0, o = t; r < o.length; r++) {
|
|
553
575
|
var i = o[r], s = e["padding-" + i];
|
|
554
|
-
n[i] =
|
|
576
|
+
n[i] = _(s);
|
|
555
577
|
}
|
|
556
578
|
return n;
|
|
557
579
|
}
|
|
558
|
-
function
|
|
580
|
+
function Ne(e) {
|
|
559
581
|
var t = e.getBBox();
|
|
560
|
-
return
|
|
582
|
+
return b(0, 0, t.width, t.height);
|
|
561
583
|
}
|
|
562
|
-
function
|
|
584
|
+
function Pe(e) {
|
|
563
585
|
var t = e.clientWidth, n = e.clientHeight;
|
|
564
586
|
if (!t && !n)
|
|
565
|
-
return
|
|
566
|
-
var r =
|
|
567
|
-
if (r.boxSizing === "border-box" && (Math.round(c + i) !== t && (c -=
|
|
587
|
+
return $;
|
|
588
|
+
var r = d(e).getComputedStyle(e), o = He(r), i = o.left + o.right, s = o.top + o.bottom, c = _(r.width), a = _(r.height);
|
|
589
|
+
if (r.boxSizing === "border-box" && (Math.round(c + i) !== t && (c -= T(r, "left", "right") + i), Math.round(a + s) !== n && (a -= T(r, "top", "bottom") + s)), !qe(e)) {
|
|
568
590
|
var u = Math.round(c + i) - t, f = Math.round(a + s) - n;
|
|
569
591
|
Math.abs(u) !== 1 && (c -= u), Math.abs(f) !== 1 && (a -= f);
|
|
570
592
|
}
|
|
571
|
-
return
|
|
593
|
+
return b(o.left, o.top, c, a);
|
|
572
594
|
}
|
|
573
|
-
var
|
|
595
|
+
var Be = /* @__PURE__ */ function() {
|
|
574
596
|
return typeof SVGGraphicsElement < "u" ? function(e) {
|
|
575
|
-
return e instanceof
|
|
597
|
+
return e instanceof d(e).SVGGraphicsElement;
|
|
576
598
|
} : function(e) {
|
|
577
|
-
return e instanceof
|
|
599
|
+
return e instanceof d(e).SVGElement && typeof e.getBBox == "function";
|
|
578
600
|
};
|
|
579
601
|
}();
|
|
580
|
-
function
|
|
581
|
-
return e ===
|
|
602
|
+
function qe(e) {
|
|
603
|
+
return e === d(e).document.documentElement;
|
|
582
604
|
}
|
|
583
|
-
function
|
|
584
|
-
return
|
|
605
|
+
function je(e) {
|
|
606
|
+
return w ? Be(e) ? Ne(e) : Pe(e) : $;
|
|
585
607
|
}
|
|
586
|
-
function
|
|
608
|
+
function Ge(e) {
|
|
587
609
|
var t = e.x, n = e.y, r = e.width, o = e.height, i = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, s = Object.create(i.prototype);
|
|
588
|
-
return
|
|
610
|
+
return C(s, {
|
|
589
611
|
x: t,
|
|
590
612
|
y: n,
|
|
591
613
|
width: r,
|
|
@@ -596,37 +618,37 @@ function qe(e) {
|
|
|
596
618
|
left: t
|
|
597
619
|
}), s;
|
|
598
620
|
}
|
|
599
|
-
function
|
|
621
|
+
function b(e, t, n, r) {
|
|
600
622
|
return { x: e, y: t, width: n, height: r };
|
|
601
623
|
}
|
|
602
|
-
var
|
|
624
|
+
var Ue = (
|
|
603
625
|
/** @class */
|
|
604
626
|
function() {
|
|
605
627
|
function e(t) {
|
|
606
|
-
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ =
|
|
628
|
+
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = b(0, 0, 0, 0), this.target = t;
|
|
607
629
|
}
|
|
608
630
|
return e.prototype.isActive = function() {
|
|
609
|
-
var t =
|
|
631
|
+
var t = je(this.target);
|
|
610
632
|
return this.contentRect_ = t, t.width !== this.broadcastWidth || t.height !== this.broadcastHeight;
|
|
611
633
|
}, e.prototype.broadcastRect = function() {
|
|
612
634
|
var t = this.contentRect_;
|
|
613
635
|
return this.broadcastWidth = t.width, this.broadcastHeight = t.height, t;
|
|
614
636
|
}, e;
|
|
615
637
|
}()
|
|
616
|
-
),
|
|
638
|
+
), Ze = (
|
|
617
639
|
/** @class */
|
|
618
640
|
/* @__PURE__ */ function() {
|
|
619
641
|
function e(t, n) {
|
|
620
|
-
var r =
|
|
621
|
-
|
|
642
|
+
var r = Ge(n);
|
|
643
|
+
C(this, { target: t, contentRect: r });
|
|
622
644
|
}
|
|
623
645
|
return e;
|
|
624
646
|
}()
|
|
625
|
-
),
|
|
647
|
+
), Je = (
|
|
626
648
|
/** @class */
|
|
627
649
|
function() {
|
|
628
650
|
function e(t, n, r) {
|
|
629
|
-
if (this.activeObservations_ = [], this.observations_ = new
|
|
651
|
+
if (this.activeObservations_ = [], this.observations_ = new I(), typeof t != "function")
|
|
630
652
|
throw new TypeError("The callback provided as parameter 1 is not a function.");
|
|
631
653
|
this.callback_ = t, this.controller_ = n, this.callbackCtx_ = r;
|
|
632
654
|
}
|
|
@@ -634,16 +656,16 @@ var je = (
|
|
|
634
656
|
if (!arguments.length)
|
|
635
657
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
636
658
|
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
637
|
-
if (!(t instanceof
|
|
659
|
+
if (!(t instanceof d(t).Element))
|
|
638
660
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
639
661
|
var n = this.observations_;
|
|
640
|
-
n.has(t) || (n.set(t, new
|
|
662
|
+
n.has(t) || (n.set(t, new Ue(t)), this.controller_.addObserver(this), this.controller_.refresh());
|
|
641
663
|
}
|
|
642
664
|
}, e.prototype.unobserve = function(t) {
|
|
643
665
|
if (!arguments.length)
|
|
644
666
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
645
667
|
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
646
|
-
if (!(t instanceof
|
|
668
|
+
if (!(t instanceof d(t).Element))
|
|
647
669
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
648
670
|
var n = this.observations_;
|
|
649
671
|
n.has(t) && (n.delete(t), n.size || this.controller_.removeObserver(this));
|
|
@@ -658,7 +680,7 @@ var je = (
|
|
|
658
680
|
}, e.prototype.broadcastActive = function() {
|
|
659
681
|
if (this.hasActive()) {
|
|
660
682
|
var t = this.callbackCtx_, n = this.activeObservations_.map(function(r) {
|
|
661
|
-
return new
|
|
683
|
+
return new Ze(r.target, r.broadcastRect());
|
|
662
684
|
});
|
|
663
685
|
this.callback_.call(t, n, t), this.clearActive();
|
|
664
686
|
}
|
|
@@ -668,7 +690,7 @@ var je = (
|
|
|
668
690
|
return this.activeObservations_.length > 0;
|
|
669
691
|
}, e;
|
|
670
692
|
}()
|
|
671
|
-
),
|
|
693
|
+
), L = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new I(), k = (
|
|
672
694
|
/** @class */
|
|
673
695
|
/* @__PURE__ */ function() {
|
|
674
696
|
function e(t) {
|
|
@@ -676,8 +698,8 @@ var je = (
|
|
|
676
698
|
throw new TypeError("Cannot call a class as a function.");
|
|
677
699
|
if (!arguments.length)
|
|
678
700
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
679
|
-
var n =
|
|
680
|
-
|
|
701
|
+
var n = Fe.getInstance(), r = new Je(t, n, this);
|
|
702
|
+
L.set(this, r);
|
|
681
703
|
}
|
|
682
704
|
return e;
|
|
683
705
|
}()
|
|
@@ -687,99 +709,99 @@ var je = (
|
|
|
687
709
|
"unobserve",
|
|
688
710
|
"disconnect"
|
|
689
711
|
].forEach(function(e) {
|
|
690
|
-
|
|
712
|
+
k.prototype[e] = function() {
|
|
691
713
|
var t;
|
|
692
|
-
return (t =
|
|
714
|
+
return (t = L.get(this))[e].apply(t, arguments);
|
|
693
715
|
};
|
|
694
716
|
});
|
|
695
|
-
var
|
|
696
|
-
return typeof
|
|
717
|
+
var We = function() {
|
|
718
|
+
return typeof v.ResizeObserver < "u" ? v.ResizeObserver : k;
|
|
697
719
|
}();
|
|
698
|
-
function
|
|
720
|
+
function Ve(e) {
|
|
699
721
|
for (const t of e) {
|
|
700
722
|
const n = t.target.__resizeListeners__ || [];
|
|
701
723
|
n.length && n.forEach((r) => r());
|
|
702
724
|
}
|
|
703
725
|
}
|
|
704
|
-
function
|
|
705
|
-
typeof window > "u" || (e.__resizeListeners__ || (e.__resizeListeners__ = [], e.__ro__ = new
|
|
726
|
+
function bt(e, t) {
|
|
727
|
+
typeof window > "u" || (e.__resizeListeners__ || (e.__resizeListeners__ = [], e.__ro__ = new We(Ve), e.__ro__.observe(e)), e.__resizeListeners__.push(t));
|
|
706
728
|
}
|
|
707
|
-
function
|
|
729
|
+
function yt(e, t) {
|
|
708
730
|
!e || !e.__resizeListeners__ || (e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t), 1), e.__resizeListeners__.length || e.__ro__.disconnect());
|
|
709
731
|
}
|
|
710
|
-
let
|
|
711
|
-
const
|
|
712
|
-
["nod", [
|
|
713
|
-
["shake", [
|
|
714
|
-
["mouth", [
|
|
715
|
-
["eye", [
|
|
716
|
-
]),
|
|
732
|
+
let h = [], Xe = { consecutiveFrames: 0, lastBlinkTime: 0 }, Qe = { consecutiveFrames: 0, lastBlinkTime: 0 };
|
|
733
|
+
const Ke = /* @__PURE__ */ new Map([
|
|
734
|
+
["nod", [st, 30, 100]],
|
|
735
|
+
["shake", [it, 7, 100]],
|
|
736
|
+
["mouth", [ot, 0.35, 100]],
|
|
737
|
+
["eye", [rt, 0.3, 100]]
|
|
738
|
+
]), wt = ["nod", "shake", "mouth", "eye"], Et = {
|
|
717
739
|
nod: "请点点头",
|
|
718
740
|
shake: "请摇摇头",
|
|
719
741
|
mouth: "请张张嘴",
|
|
720
742
|
eye: "请眨眨眼"
|
|
721
743
|
};
|
|
722
|
-
function
|
|
744
|
+
function R(e, t) {
|
|
723
745
|
if (e.length !== t.length) throw new Error("euclideanDistance: arr1.length !== arr2.length");
|
|
724
746
|
const n = Array.from(e), r = Array.from(t);
|
|
725
747
|
return Math.sqrt(
|
|
726
748
|
n.map((o, i) => o - r[i]).reduce((o, i) => o + Math.pow(i, 2), 0)
|
|
727
749
|
);
|
|
728
750
|
}
|
|
729
|
-
function*
|
|
751
|
+
function* et(e, t, n = 8, r = 0) {
|
|
730
752
|
for (let o = n; o > 0; o--)
|
|
731
753
|
yield e(t, 0.5, r);
|
|
732
754
|
}
|
|
733
|
-
function
|
|
755
|
+
function g(e) {
|
|
734
756
|
return [e.x, e.y];
|
|
735
757
|
}
|
|
736
|
-
function
|
|
758
|
+
function y(e, t) {
|
|
737
759
|
const n = e.x - t.x, r = e.y - t.y;
|
|
738
760
|
return Math.sqrt(n * n + r * r);
|
|
739
761
|
}
|
|
740
|
-
function
|
|
741
|
-
const t =
|
|
762
|
+
function A(e) {
|
|
763
|
+
const t = y(e[1], e[5]), n = y(e[2], e[4]), r = y(e[0], e[3]);
|
|
742
764
|
return (t + n) / (2 * r);
|
|
743
765
|
}
|
|
744
|
-
function
|
|
745
|
-
const t =
|
|
766
|
+
function tt(e) {
|
|
767
|
+
const t = R(g(e[13]), g(e[19])), n = R(g(e[0]), g(e[6]));
|
|
746
768
|
return t / n;
|
|
747
769
|
}
|
|
748
|
-
function
|
|
770
|
+
function nt(e) {
|
|
749
771
|
const t = e.positions[30], n = e.positions[36], r = e.positions[45], o = (n.x + r.x) / 2;
|
|
750
772
|
return (t.x - o) / (r.x - n.x) * 30;
|
|
751
773
|
}
|
|
752
|
-
function
|
|
753
|
-
const n = Date.now(), r = A(
|
|
774
|
+
function rt(e, t) {
|
|
775
|
+
const n = Date.now(), r = S(A(e.getLeftEye()), t, Xe, n), o = S(A(e.getRightEye()), t, Qe, n);
|
|
754
776
|
return !!(r || o);
|
|
755
777
|
}
|
|
756
|
-
function
|
|
778
|
+
function S(e, t, n, r) {
|
|
757
779
|
if (e < t)
|
|
758
780
|
n.consecutiveFrames++;
|
|
759
781
|
else if (n.consecutiveFrames >= 3 && r - n.lastBlinkTime > 500)
|
|
760
782
|
return n.lastBlinkTime = r, n.consecutiveFrames = 0, !0;
|
|
761
783
|
return !1;
|
|
762
784
|
}
|
|
763
|
-
function
|
|
764
|
-
return
|
|
785
|
+
function ot(e, t) {
|
|
786
|
+
return tt(e.getMouth()) > t;
|
|
765
787
|
}
|
|
766
|
-
function
|
|
767
|
-
const n =
|
|
788
|
+
function it(e, t) {
|
|
789
|
+
const n = nt(e);
|
|
768
790
|
return Math.abs(n) > t;
|
|
769
791
|
}
|
|
770
|
-
function
|
|
771
|
-
const n =
|
|
792
|
+
function st(e, t) {
|
|
793
|
+
const n = h.length, r = e.positions[33];
|
|
772
794
|
if (n < 5)
|
|
773
|
-
|
|
795
|
+
h.push(r.y);
|
|
774
796
|
else if (n === 5) {
|
|
775
|
-
const o = Math.min(...
|
|
776
|
-
if (Math.max(...
|
|
797
|
+
const o = Math.min(...h);
|
|
798
|
+
if (Math.max(...h) - o > t)
|
|
777
799
|
return !0;
|
|
778
|
-
|
|
800
|
+
h = [];
|
|
779
801
|
}
|
|
780
802
|
return !1;
|
|
781
803
|
}
|
|
782
|
-
function
|
|
804
|
+
function Ot(e, t = "blob", n = 1) {
|
|
783
805
|
return new Promise((r) => {
|
|
784
806
|
const o = document.createElement("canvas"), i = o.getContext("2d");
|
|
785
807
|
o.width = e.videoWidth, o.height = e.videoHeight, i == null || i.drawImage(e, 0, 0, o.width, o.height), t === "blob" ? o.toBlob(
|
|
@@ -792,73 +814,73 @@ function wt(e, t = "blob", n = 1) {
|
|
|
792
814
|
) : r(o.toDataURL("image/png", n));
|
|
793
815
|
});
|
|
794
816
|
}
|
|
795
|
-
async function
|
|
796
|
-
const [o, i, s] =
|
|
817
|
+
async function Mt(e, t, n, r = 5) {
|
|
818
|
+
const [o, i, s] = Ke.get(n);
|
|
797
819
|
if (!o) return !1;
|
|
798
|
-
const c = [], a =
|
|
820
|
+
const c = [], a = et(e, t, r, s);
|
|
799
821
|
for (const u of a) {
|
|
800
822
|
const f = await u;
|
|
801
823
|
if (!f) continue;
|
|
802
|
-
const
|
|
803
|
-
c.push(
|
|
824
|
+
const p = o(f.landmarks, i);
|
|
825
|
+
c.push(p);
|
|
804
826
|
}
|
|
805
827
|
return c.includes(!0);
|
|
806
828
|
}
|
|
807
|
-
const
|
|
808
|
-
encodeURIToParams:
|
|
809
|
-
paramsToQueryString:
|
|
810
|
-
queryStringToParams:
|
|
811
|
-
errorCodeToString:
|
|
812
|
-
YNToString:
|
|
813
|
-
HNToString:
|
|
814
|
-
valueToLabel:
|
|
815
|
-
chargeToLabel:
|
|
816
|
-
cascaderToLabel:
|
|
817
|
-
multipleSelectToLabel:
|
|
818
|
-
phoneToAsterisk:
|
|
819
|
-
idNumberToAsterisk:
|
|
820
|
-
firstLetterToUpperCase:
|
|
821
|
-
firstLetterToLowerCase:
|
|
822
|
-
},
|
|
823
|
-
validHttp:
|
|
824
|
-
validExternal:
|
|
825
|
-
validString:
|
|
826
|
-
validNumberStr:
|
|
827
|
-
validEmptyObject:
|
|
828
|
-
validURL:
|
|
829
|
-
validPassword:
|
|
830
|
-
validEmail:
|
|
831
|
-
validIdNumber:
|
|
832
|
-
validPhone:
|
|
833
|
-
validTel:
|
|
834
|
-
},
|
|
829
|
+
const Tt = { DATE_VALUE_FORMAT: me, COMMON_TEXT: l, IMAGE_TYPE: x, MEDIA_TYPE: D, DOC_TYPE: Y, FILE_TYPE: _e }, Rt = {
|
|
830
|
+
encodeURIToParams: xe,
|
|
831
|
+
paramsToQueryString: De,
|
|
832
|
+
queryStringToParams: Ye,
|
|
833
|
+
errorCodeToString: be,
|
|
834
|
+
YNToString: ye,
|
|
835
|
+
HNToString: we,
|
|
836
|
+
valueToLabel: Re,
|
|
837
|
+
chargeToLabel: Ae,
|
|
838
|
+
cascaderToLabel: z,
|
|
839
|
+
multipleSelectToLabel: Se,
|
|
840
|
+
phoneToAsterisk: Ee,
|
|
841
|
+
idNumberToAsterisk: Oe,
|
|
842
|
+
firstLetterToUpperCase: Me,
|
|
843
|
+
firstLetterToLowerCase: Te
|
|
844
|
+
}, At = {
|
|
845
|
+
validHttp: te,
|
|
846
|
+
validExternal: ne,
|
|
847
|
+
validString: re,
|
|
848
|
+
validNumberStr: oe,
|
|
849
|
+
validEmptyObject: ie,
|
|
850
|
+
validURL: se,
|
|
851
|
+
validPassword: ce,
|
|
852
|
+
validEmail: ae,
|
|
853
|
+
validIdNumber: O,
|
|
854
|
+
validPhone: fe,
|
|
855
|
+
validTel: ue
|
|
856
|
+
}, St = { scrollTo: q, addClass: X, removeClass: Q, hasClass: E, toggleClass: V, noContextmenu: ee, useRafThrottle: K }, xt = { parseTime: m, getTimeDistance: U, getDayRange: Z }, Dt = { local: W, session: J }, Yt = { uuid: G, randomNum: j };
|
|
835
857
|
export {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
858
|
+
Tt as CONSTANTS,
|
|
859
|
+
M as NOOP,
|
|
860
|
+
bt as addResizeListener,
|
|
861
|
+
Dt as cacheUtil,
|
|
862
|
+
at as countdownTimer,
|
|
863
|
+
pt as creatCancelTask,
|
|
864
|
+
xt as dateUtil,
|
|
865
|
+
ft as debounce,
|
|
866
|
+
gt as downloadFile,
|
|
867
|
+
St as elementUtil,
|
|
868
|
+
wt as faceLivingEvent,
|
|
869
|
+
Et as faceLivingEventHint,
|
|
870
|
+
ht as getArrayFullUrl,
|
|
871
|
+
dt as getBirthdayByIdNumber,
|
|
872
|
+
Mt as getFaceGestureResult,
|
|
873
|
+
Ot as getFaceVideoFrame,
|
|
874
|
+
le as getFullUrl,
|
|
875
|
+
lt as getGenderByIdNumber,
|
|
876
|
+
mt as getPercentage,
|
|
877
|
+
ut as getRandomItemInArray,
|
|
878
|
+
vt as loadCss,
|
|
879
|
+
_t as loadJs,
|
|
880
|
+
Yt as randomUtil,
|
|
881
|
+
yt as removeResizeListener,
|
|
882
|
+
ct as sleep,
|
|
883
|
+
Rt as toUtil,
|
|
884
|
+
de as trimArray,
|
|
885
|
+
At as validUtil
|
|
864
886
|
};
|
package/lib/utils/to.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyObj, CategoryType } from '../types';
|
|
2
2
|
export declare function errorCodeToString(code: number): string;
|
|
3
|
-
export declare function YNToString(value?: string | number | null): "
|
|
4
|
-
export declare function HNToString(value?: string | number | null): "
|
|
3
|
+
export declare function YNToString(value?: string | number | null): "是" | "否" | "未填写";
|
|
4
|
+
export declare function HNToString(value?: string | number | null): "有" | "无" | "未填写";
|
|
5
5
|
export declare function phoneToAsterisk(phone?: string): string;
|
|
6
6
|
export declare function idNumberToAsterisk(idNumber?: string, startLength?: number, endLength?: number): string;
|
|
7
7
|
export declare function firstLetterToUpperCase(str: string): string;
|