@nano-lib/util 1.0.12 → 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 +62 -0
- package/lib/index.d.ts +50 -0
- package/lib/index.js +1 -1
- package/lib/index.mjs +301 -264
- package/lib/utils/to.d.ts +2 -2
- package/package.json +1 -1
package/lib/constant/index.d.ts
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
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 COMMON_TEXT: {
|
|
5
|
+
readonly view: "查看";
|
|
6
|
+
readonly add: "添加";
|
|
7
|
+
readonly edit: "编辑";
|
|
8
|
+
readonly delete: "删除";
|
|
9
|
+
readonly save: "保存";
|
|
10
|
+
readonly reset: "重置";
|
|
11
|
+
readonly close: "关闭";
|
|
12
|
+
readonly confirm: "确定";
|
|
13
|
+
readonly submit: "提交";
|
|
14
|
+
readonly cancel: "取消";
|
|
15
|
+
readonly success: "成功";
|
|
16
|
+
readonly fail: "失败";
|
|
17
|
+
readonly open: "启用";
|
|
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: "网关超时!";
|
|
65
|
+
};
|
|
4
66
|
export declare const IMAGE_TYPE: string[];
|
|
5
67
|
export declare const MEDIA_TYPE: string[];
|
|
6
68
|
export declare const DOC_TYPE: string[];
|
package/lib/index.d.ts
CHANGED
|
@@ -9,6 +9,56 @@ 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
|
+
COMMON_TEXT: {
|
|
13
|
+
readonly view: "查看";
|
|
14
|
+
readonly add: "添加";
|
|
15
|
+
readonly edit: "编辑";
|
|
16
|
+
readonly delete: "删除";
|
|
17
|
+
readonly save: "保存";
|
|
18
|
+
readonly reset: "重置";
|
|
19
|
+
readonly close: "关闭";
|
|
20
|
+
readonly confirm: "确定";
|
|
21
|
+
readonly submit: "提交";
|
|
22
|
+
readonly cancel: "取消";
|
|
23
|
+
readonly success: "成功";
|
|
24
|
+
readonly fail: "失败";
|
|
25
|
+
readonly open: "启用";
|
|
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: "系统未知错误,请反馈给管理员";
|
|
61
|
+
};
|
|
12
62
|
IMAGE_TYPE: string[];
|
|
13
63
|
MEDIA_TYPE: string[];
|
|
14
64
|
DOC_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 Me(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 Te(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=new Map(Fe),I=["jpg","jpeg","png","bmp","gif"],Y=["mp3","mp4","webm","ogg","3gp"],z=["doc","docx","xls","xlsx","ppt","txt","pdf","zip"],Ne=[...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")()}(),He=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(m):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),Pe=2;function Be(e,t){var n=!1,r=!1,o=0;function i(){n&&(n=!1,e()),r&&c()}function s(){He(i)}function c(){var a=Date.now();if(n){if(a-o<Pe)return;r=!0}else n=!0,r=!1,setTimeout(s,t);o=a}return c}var Ue=20,je=["top","right","bottom","left","width","height","size","weight"],qe=typeof MutationObserver<"u",Ge=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Be(this.refresh.bind(this),Ue)}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),qe?(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=je.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 M(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 Je(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 Ze(e){var t=e.getBBox();return b(0,0,t.width,t.height)}function We(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return $;var r=l(e).getComputedStyle(e),o=Je(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-=M(r,"left","right")+i),Math.round(a+s)!==n&&(a-=M(r,"top","bottom")+s)),!Xe(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 Ve=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 Xe(e){return e===l(e).document.documentElement}function Ke(e){return w?Ve(e)?Ze(e):We(e):$}function Qe(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 et=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=Ke(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}(),tt=function(){function e(t,n){var r=Qe(n);L(this,{target:t,contentRect:r})}return e}(),nt=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 et(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 tt(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=Ge.getInstance(),r=new nt(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 rt=function(){return typeof m.ResizeObserver<"u"?m.ResizeObserver:k}();function ot(e){for(const t of e){const n=t.target.__resizeListeners__||[];n.length&&n.forEach(r=>r())}}function it(e,t){typeof window>"u"||(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new rt(ot),e.__ro__.observe(e)),e.__resizeListeners__.push(t))}function st(e,t){!e||!e.__resizeListeners__||(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__.disconnect())}let d=[],ct={consecutiveFrames:0,lastBlinkTime:0},at={consecutiveFrames:0,lastBlinkTime:0};const ut=new Map([["nod",[bt,30,100]],["shake",[vt,7,100]],["mouth",[mt,.35,100]],["eye",[gt,.3,100]]]),ft=["nod","shake","mouth","eye"],lt={nod:"请点点头",shake:"请摇摇头",mouth:"请张张嘴",eye:"请眨眨眼"};function T(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*dt(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 ht(e){const t=T(p(e[13]),p(e[19])),n=T(p(e[0]),p(e[6]));return t/n}function pt(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 gt(e,t){const n=Date.now(),r=A(R(e.getLeftEye()),t,ct,n),o=A(R(e.getRightEye()),t,at,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 mt(e,t){return ht(e.getMouth())>t}function vt(e,t){const n=pt(e);return Math.abs(n)>t}function bt(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 _t(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 yt(e,t,n,r=5){const[o,i,s]=ut.get(n);if(!o)return!1;const c=[],a=dt(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 wt={DATE_VALUE_FORMAT:ke,IMAGE_TYPE:I,MEDIA_TYPE:Y,DOC_TYPE:z,FILE_TYPE:Ne},Et={encodeURIToParams:Ce,paramsToQueryString:Le,queryStringToParams:$e,errorCodeToString:Me,YNToString:Te,HNToString:Re,valueToLabel:Ie,chargeToLabel:Ye,cascaderToLabel:D,multipleSelectToLabel:ze,phoneToAsterisk:Ae,idNumberToAsterisk:Se,firstLetterToUpperCase:xe,firstLetterToLowerCase:De},Ot={validHttp:ne,validExternal:re,validString:oe,validNumberStr:ie,validEmptyObject:se,validURL:ce,validPassword:ae,validEmail:ue,validIdNumber:O,validPhone:le,validTel:fe},Mt={scrollTo:j,addClass:K,removeClass:Q,hasClass:E,toggleClass:X,noContextmenu:te,useRafThrottle:ee},Tt={parseTime:g,getTimeDistance:J,getDayRange:Z},Rt={local:V,session:W},At={uuid:G,randomNum:q};exports.CONSTANTS=wt;exports.NOOP=y;exports.addResizeListener=it;exports.cacheUtil=Rt;exports.countdownTimer=he;exports.creatCancelTask=_e;exports.dateUtil=Tt;exports.debounce=ge;exports.downloadFile=ye;exports.elementUtil=Mt;exports.faceLivingEvent=ft;exports.faceLivingEventHint=lt;exports.getArrayFullUrl=be;exports.getBirthdayByIdNumber=ve;exports.getFaceGestureResult=yt;exports.getFaceVideoFrame=_t;exports.getFullUrl=S;exports.getGenderByIdNumber=me;exports.getPercentage=we;exports.getRandomItemInArray=pe;exports.loadCss=Ee;exports.loadJs=Oe;exports.randomUtil=At;exports.removeResizeListener=st;exports.sleep=de;exports.toUtil=Et;exports.trimArray=x;exports.validUtil=Ot;
|
|
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 ot(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 it(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 st(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,18 +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 = new Map(Te), x = ["jpg", "jpeg", "png", "bmp", "gif"], D = ["mp3", "mp4", "webm", "ogg", "3gp"], Y = ["doc", "docx", "xls", "xlsx", "ppt", "txt", "pdf", "zip"], Ae = [...x, ...D, ...Y];
|
|
396
|
-
var z = function() {
|
|
433
|
+
var I = function() {
|
|
397
434
|
if (typeof Map < "u")
|
|
398
435
|
return Map;
|
|
399
436
|
function e(t, n) {
|
|
@@ -439,27 +476,27 @@ var z = function() {
|
|
|
439
476
|
}, t;
|
|
440
477
|
}()
|
|
441
478
|
);
|
|
442
|
-
}(),
|
|
479
|
+
}(), w = typeof window < "u" && typeof document < "u" && window.document === document, v = function() {
|
|
443
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")();
|
|
444
|
-
}(),
|
|
445
|
-
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(
|
|
481
|
+
}(), ze = function() {
|
|
482
|
+
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(v) : function(e) {
|
|
446
483
|
return setTimeout(function() {
|
|
447
484
|
return e(Date.now());
|
|
448
485
|
}, 1e3 / 60);
|
|
449
486
|
};
|
|
450
|
-
}(),
|
|
451
|
-
function
|
|
487
|
+
}(), Ie = 2;
|
|
488
|
+
function Ce(e, t) {
|
|
452
489
|
var n = !1, r = !1, o = 0;
|
|
453
490
|
function i() {
|
|
454
491
|
n && (n = !1, e()), r && c();
|
|
455
492
|
}
|
|
456
493
|
function s() {
|
|
457
|
-
|
|
494
|
+
ze(i);
|
|
458
495
|
}
|
|
459
496
|
function c() {
|
|
460
497
|
var a = Date.now();
|
|
461
498
|
if (n) {
|
|
462
|
-
if (a - o <
|
|
499
|
+
if (a - o < Ie)
|
|
463
500
|
return;
|
|
464
501
|
r = !0;
|
|
465
502
|
} else
|
|
@@ -468,11 +505,11 @@ function De(e, t) {
|
|
|
468
505
|
}
|
|
469
506
|
return c;
|
|
470
507
|
}
|
|
471
|
-
var
|
|
508
|
+
var $e = 20, Le = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], ke = typeof MutationObserver < "u", Fe = (
|
|
472
509
|
/** @class */
|
|
473
510
|
function() {
|
|
474
511
|
function e() {
|
|
475
|
-
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);
|
|
476
513
|
}
|
|
477
514
|
return e.prototype.addObserver = function(t) {
|
|
478
515
|
~this.observers_.indexOf(t) || this.observers_.push(t), this.connected_ || this.connect_();
|
|
@@ -490,16 +527,16 @@ var Ye = 20, ze = ["top", "right", "bottom", "left", "width", "height", "size",
|
|
|
490
527
|
return n.broadcastActive();
|
|
491
528
|
}), t.length > 0;
|
|
492
529
|
}, e.prototype.connect_ = function() {
|
|
493
|
-
!
|
|
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, {
|
|
494
531
|
attributes: !0,
|
|
495
532
|
childList: !0,
|
|
496
533
|
characterData: !0,
|
|
497
534
|
subtree: !0
|
|
498
535
|
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
|
|
499
536
|
}, e.prototype.disconnect_ = function() {
|
|
500
|
-
!
|
|
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);
|
|
501
538
|
}, e.prototype.onTransitionEnd_ = function(t) {
|
|
502
|
-
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) {
|
|
503
540
|
return !!~r.indexOf(i);
|
|
504
541
|
});
|
|
505
542
|
o && this.refresh();
|
|
@@ -507,7 +544,7 @@ var Ye = 20, ze = ["top", "right", "bottom", "left", "width", "height", "size",
|
|
|
507
544
|
return this.instance_ || (this.instance_ = new e()), this.instance_;
|
|
508
545
|
}, e.instance_ = null, e;
|
|
509
546
|
}()
|
|
510
|
-
),
|
|
547
|
+
), C = function(e, t) {
|
|
511
548
|
for (var n = 0, r = Object.keys(t); n < r.length; n++) {
|
|
512
549
|
var o = r[n];
|
|
513
550
|
Object.defineProperty(e, o, {
|
|
@@ -518,59 +555,59 @@ var Ye = 20, ze = ["top", "right", "bottom", "left", "width", "height", "size",
|
|
|
518
555
|
});
|
|
519
556
|
}
|
|
520
557
|
return e;
|
|
521
|
-
},
|
|
558
|
+
}, d = function(e) {
|
|
522
559
|
var t = e && e.ownerDocument && e.ownerDocument.defaultView;
|
|
523
|
-
return t ||
|
|
524
|
-
},
|
|
525
|
-
function
|
|
560
|
+
return t || v;
|
|
561
|
+
}, $ = b(0, 0, 0, 0);
|
|
562
|
+
function _(e) {
|
|
526
563
|
return parseFloat(e) || 0;
|
|
527
564
|
}
|
|
528
|
-
function
|
|
565
|
+
function T(e) {
|
|
529
566
|
for (var t = [], n = 1; n < arguments.length; n++)
|
|
530
567
|
t[n - 1] = arguments[n];
|
|
531
568
|
return t.reduce(function(r, o) {
|
|
532
569
|
var i = e["border-" + o + "-width"];
|
|
533
|
-
return r +
|
|
570
|
+
return r + _(i);
|
|
534
571
|
}, 0);
|
|
535
572
|
}
|
|
536
|
-
function
|
|
573
|
+
function He(e) {
|
|
537
574
|
for (var t = ["top", "right", "bottom", "left"], n = {}, r = 0, o = t; r < o.length; r++) {
|
|
538
575
|
var i = o[r], s = e["padding-" + i];
|
|
539
|
-
n[i] =
|
|
576
|
+
n[i] = _(s);
|
|
540
577
|
}
|
|
541
578
|
return n;
|
|
542
579
|
}
|
|
543
|
-
function
|
|
580
|
+
function Ne(e) {
|
|
544
581
|
var t = e.getBBox();
|
|
545
|
-
return
|
|
582
|
+
return b(0, 0, t.width, t.height);
|
|
546
583
|
}
|
|
547
|
-
function
|
|
584
|
+
function Pe(e) {
|
|
548
585
|
var t = e.clientWidth, n = e.clientHeight;
|
|
549
586
|
if (!t && !n)
|
|
550
|
-
return
|
|
551
|
-
var r =
|
|
552
|
-
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)) {
|
|
553
590
|
var u = Math.round(c + i) - t, f = Math.round(a + s) - n;
|
|
554
591
|
Math.abs(u) !== 1 && (c -= u), Math.abs(f) !== 1 && (a -= f);
|
|
555
592
|
}
|
|
556
|
-
return
|
|
593
|
+
return b(o.left, o.top, c, a);
|
|
557
594
|
}
|
|
558
|
-
var
|
|
595
|
+
var Be = /* @__PURE__ */ function() {
|
|
559
596
|
return typeof SVGGraphicsElement < "u" ? function(e) {
|
|
560
|
-
return e instanceof
|
|
597
|
+
return e instanceof d(e).SVGGraphicsElement;
|
|
561
598
|
} : function(e) {
|
|
562
|
-
return e instanceof
|
|
599
|
+
return e instanceof d(e).SVGElement && typeof e.getBBox == "function";
|
|
563
600
|
};
|
|
564
601
|
}();
|
|
565
|
-
function
|
|
566
|
-
return e ===
|
|
602
|
+
function qe(e) {
|
|
603
|
+
return e === d(e).document.documentElement;
|
|
567
604
|
}
|
|
568
|
-
function
|
|
569
|
-
return
|
|
605
|
+
function je(e) {
|
|
606
|
+
return w ? Be(e) ? Ne(e) : Pe(e) : $;
|
|
570
607
|
}
|
|
571
|
-
function
|
|
608
|
+
function Ge(e) {
|
|
572
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);
|
|
573
|
-
return
|
|
610
|
+
return C(s, {
|
|
574
611
|
x: t,
|
|
575
612
|
y: n,
|
|
576
613
|
width: r,
|
|
@@ -581,37 +618,37 @@ function Pe(e) {
|
|
|
581
618
|
left: t
|
|
582
619
|
}), s;
|
|
583
620
|
}
|
|
584
|
-
function
|
|
621
|
+
function b(e, t, n, r) {
|
|
585
622
|
return { x: e, y: t, width: n, height: r };
|
|
586
623
|
}
|
|
587
|
-
var
|
|
624
|
+
var Ue = (
|
|
588
625
|
/** @class */
|
|
589
626
|
function() {
|
|
590
627
|
function e(t) {
|
|
591
|
-
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;
|
|
592
629
|
}
|
|
593
630
|
return e.prototype.isActive = function() {
|
|
594
|
-
var t =
|
|
631
|
+
var t = je(this.target);
|
|
595
632
|
return this.contentRect_ = t, t.width !== this.broadcastWidth || t.height !== this.broadcastHeight;
|
|
596
633
|
}, e.prototype.broadcastRect = function() {
|
|
597
634
|
var t = this.contentRect_;
|
|
598
635
|
return this.broadcastWidth = t.width, this.broadcastHeight = t.height, t;
|
|
599
636
|
}, e;
|
|
600
637
|
}()
|
|
601
|
-
),
|
|
638
|
+
), Ze = (
|
|
602
639
|
/** @class */
|
|
603
640
|
/* @__PURE__ */ function() {
|
|
604
641
|
function e(t, n) {
|
|
605
|
-
var r =
|
|
606
|
-
|
|
642
|
+
var r = Ge(n);
|
|
643
|
+
C(this, { target: t, contentRect: r });
|
|
607
644
|
}
|
|
608
645
|
return e;
|
|
609
646
|
}()
|
|
610
|
-
),
|
|
647
|
+
), Je = (
|
|
611
648
|
/** @class */
|
|
612
649
|
function() {
|
|
613
650
|
function e(t, n, r) {
|
|
614
|
-
if (this.activeObservations_ = [], this.observations_ = new
|
|
651
|
+
if (this.activeObservations_ = [], this.observations_ = new I(), typeof t != "function")
|
|
615
652
|
throw new TypeError("The callback provided as parameter 1 is not a function.");
|
|
616
653
|
this.callback_ = t, this.controller_ = n, this.callbackCtx_ = r;
|
|
617
654
|
}
|
|
@@ -619,16 +656,16 @@ var Be = (
|
|
|
619
656
|
if (!arguments.length)
|
|
620
657
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
621
658
|
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
622
|
-
if (!(t instanceof
|
|
659
|
+
if (!(t instanceof d(t).Element))
|
|
623
660
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
624
661
|
var n = this.observations_;
|
|
625
|
-
n.has(t) || (n.set(t, new
|
|
662
|
+
n.has(t) || (n.set(t, new Ue(t)), this.controller_.addObserver(this), this.controller_.refresh());
|
|
626
663
|
}
|
|
627
664
|
}, e.prototype.unobserve = function(t) {
|
|
628
665
|
if (!arguments.length)
|
|
629
666
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
630
667
|
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
631
|
-
if (!(t instanceof
|
|
668
|
+
if (!(t instanceof d(t).Element))
|
|
632
669
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
633
670
|
var n = this.observations_;
|
|
634
671
|
n.has(t) && (n.delete(t), n.size || this.controller_.removeObserver(this));
|
|
@@ -643,7 +680,7 @@ var Be = (
|
|
|
643
680
|
}, e.prototype.broadcastActive = function() {
|
|
644
681
|
if (this.hasActive()) {
|
|
645
682
|
var t = this.callbackCtx_, n = this.activeObservations_.map(function(r) {
|
|
646
|
-
return new
|
|
683
|
+
return new Ze(r.target, r.broadcastRect());
|
|
647
684
|
});
|
|
648
685
|
this.callback_.call(t, n, t), this.clearActive();
|
|
649
686
|
}
|
|
@@ -653,7 +690,7 @@ var Be = (
|
|
|
653
690
|
return this.activeObservations_.length > 0;
|
|
654
691
|
}, e;
|
|
655
692
|
}()
|
|
656
|
-
),
|
|
693
|
+
), L = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new I(), k = (
|
|
657
694
|
/** @class */
|
|
658
695
|
/* @__PURE__ */ function() {
|
|
659
696
|
function e(t) {
|
|
@@ -661,8 +698,8 @@ var Be = (
|
|
|
661
698
|
throw new TypeError("Cannot call a class as a function.");
|
|
662
699
|
if (!arguments.length)
|
|
663
700
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
664
|
-
var n =
|
|
665
|
-
|
|
701
|
+
var n = Fe.getInstance(), r = new Je(t, n, this);
|
|
702
|
+
L.set(this, r);
|
|
666
703
|
}
|
|
667
704
|
return e;
|
|
668
705
|
}()
|
|
@@ -672,99 +709,99 @@ var Be = (
|
|
|
672
709
|
"unobserve",
|
|
673
710
|
"disconnect"
|
|
674
711
|
].forEach(function(e) {
|
|
675
|
-
|
|
712
|
+
k.prototype[e] = function() {
|
|
676
713
|
var t;
|
|
677
|
-
return (t =
|
|
714
|
+
return (t = L.get(this))[e].apply(t, arguments);
|
|
678
715
|
};
|
|
679
716
|
});
|
|
680
|
-
var
|
|
681
|
-
return typeof
|
|
717
|
+
var We = function() {
|
|
718
|
+
return typeof v.ResizeObserver < "u" ? v.ResizeObserver : k;
|
|
682
719
|
}();
|
|
683
|
-
function
|
|
720
|
+
function Ve(e) {
|
|
684
721
|
for (const t of e) {
|
|
685
722
|
const n = t.target.__resizeListeners__ || [];
|
|
686
723
|
n.length && n.forEach((r) => r());
|
|
687
724
|
}
|
|
688
725
|
}
|
|
689
|
-
function
|
|
690
|
-
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));
|
|
691
728
|
}
|
|
692
|
-
function
|
|
729
|
+
function yt(e, t) {
|
|
693
730
|
!e || !e.__resizeListeners__ || (e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t), 1), e.__resizeListeners__.length || e.__ro__.disconnect());
|
|
694
731
|
}
|
|
695
|
-
let
|
|
696
|
-
const
|
|
697
|
-
["nod", [
|
|
698
|
-
["shake", [
|
|
699
|
-
["mouth", [
|
|
700
|
-
["eye", [
|
|
701
|
-
]),
|
|
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 = {
|
|
702
739
|
nod: "请点点头",
|
|
703
740
|
shake: "请摇摇头",
|
|
704
741
|
mouth: "请张张嘴",
|
|
705
742
|
eye: "请眨眨眼"
|
|
706
743
|
};
|
|
707
|
-
function
|
|
744
|
+
function R(e, t) {
|
|
708
745
|
if (e.length !== t.length) throw new Error("euclideanDistance: arr1.length !== arr2.length");
|
|
709
746
|
const n = Array.from(e), r = Array.from(t);
|
|
710
747
|
return Math.sqrt(
|
|
711
748
|
n.map((o, i) => o - r[i]).reduce((o, i) => o + Math.pow(i, 2), 0)
|
|
712
749
|
);
|
|
713
750
|
}
|
|
714
|
-
function*
|
|
751
|
+
function* et(e, t, n = 8, r = 0) {
|
|
715
752
|
for (let o = n; o > 0; o--)
|
|
716
753
|
yield e(t, 0.5, r);
|
|
717
754
|
}
|
|
718
|
-
function
|
|
755
|
+
function g(e) {
|
|
719
756
|
return [e.x, e.y];
|
|
720
757
|
}
|
|
721
|
-
function
|
|
758
|
+
function y(e, t) {
|
|
722
759
|
const n = e.x - t.x, r = e.y - t.y;
|
|
723
760
|
return Math.sqrt(n * n + r * r);
|
|
724
761
|
}
|
|
725
|
-
function
|
|
726
|
-
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]);
|
|
727
764
|
return (t + n) / (2 * r);
|
|
728
765
|
}
|
|
729
|
-
function
|
|
730
|
-
const t =
|
|
766
|
+
function tt(e) {
|
|
767
|
+
const t = R(g(e[13]), g(e[19])), n = R(g(e[0]), g(e[6]));
|
|
731
768
|
return t / n;
|
|
732
769
|
}
|
|
733
|
-
function
|
|
770
|
+
function nt(e) {
|
|
734
771
|
const t = e.positions[30], n = e.positions[36], r = e.positions[45], o = (n.x + r.x) / 2;
|
|
735
772
|
return (t.x - o) / (r.x - n.x) * 30;
|
|
736
773
|
}
|
|
737
|
-
function
|
|
738
|
-
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);
|
|
739
776
|
return !!(r || o);
|
|
740
777
|
}
|
|
741
|
-
function
|
|
778
|
+
function S(e, t, n, r) {
|
|
742
779
|
if (e < t)
|
|
743
780
|
n.consecutiveFrames++;
|
|
744
781
|
else if (n.consecutiveFrames >= 3 && r - n.lastBlinkTime > 500)
|
|
745
782
|
return n.lastBlinkTime = r, n.consecutiveFrames = 0, !0;
|
|
746
783
|
return !1;
|
|
747
784
|
}
|
|
748
|
-
function
|
|
749
|
-
return
|
|
785
|
+
function ot(e, t) {
|
|
786
|
+
return tt(e.getMouth()) > t;
|
|
750
787
|
}
|
|
751
|
-
function
|
|
752
|
-
const n =
|
|
788
|
+
function it(e, t) {
|
|
789
|
+
const n = nt(e);
|
|
753
790
|
return Math.abs(n) > t;
|
|
754
791
|
}
|
|
755
|
-
function
|
|
756
|
-
const n =
|
|
792
|
+
function st(e, t) {
|
|
793
|
+
const n = h.length, r = e.positions[33];
|
|
757
794
|
if (n < 5)
|
|
758
|
-
|
|
795
|
+
h.push(r.y);
|
|
759
796
|
else if (n === 5) {
|
|
760
|
-
const o = Math.min(...
|
|
761
|
-
if (Math.max(...
|
|
797
|
+
const o = Math.min(...h);
|
|
798
|
+
if (Math.max(...h) - o > t)
|
|
762
799
|
return !0;
|
|
763
|
-
|
|
800
|
+
h = [];
|
|
764
801
|
}
|
|
765
802
|
return !1;
|
|
766
803
|
}
|
|
767
|
-
function
|
|
804
|
+
function Ot(e, t = "blob", n = 1) {
|
|
768
805
|
return new Promise((r) => {
|
|
769
806
|
const o = document.createElement("canvas"), i = o.getContext("2d");
|
|
770
807
|
o.width = e.videoWidth, o.height = e.videoHeight, i == null || i.drawImage(e, 0, 0, o.width, o.height), t === "blob" ? o.toBlob(
|
|
@@ -777,73 +814,73 @@ function bt(e, t = "blob", n = 1) {
|
|
|
777
814
|
) : r(o.toDataURL("image/png", n));
|
|
778
815
|
});
|
|
779
816
|
}
|
|
780
|
-
async function
|
|
781
|
-
const [o, i, s] =
|
|
817
|
+
async function Mt(e, t, n, r = 5) {
|
|
818
|
+
const [o, i, s] = Ke.get(n);
|
|
782
819
|
if (!o) return !1;
|
|
783
|
-
const c = [], a =
|
|
820
|
+
const c = [], a = et(e, t, r, s);
|
|
784
821
|
for (const u of a) {
|
|
785
822
|
const f = await u;
|
|
786
823
|
if (!f) continue;
|
|
787
|
-
const
|
|
788
|
-
c.push(
|
|
824
|
+
const p = o(f.landmarks, i);
|
|
825
|
+
c.push(p);
|
|
789
826
|
}
|
|
790
827
|
return c.includes(!0);
|
|
791
828
|
}
|
|
792
|
-
const
|
|
793
|
-
encodeURIToParams:
|
|
794
|
-
paramsToQueryString:
|
|
795
|
-
queryStringToParams:
|
|
796
|
-
errorCodeToString:
|
|
797
|
-
YNToString:
|
|
798
|
-
HNToString:
|
|
799
|
-
valueToLabel:
|
|
800
|
-
chargeToLabel:
|
|
801
|
-
cascaderToLabel:
|
|
802
|
-
multipleSelectToLabel:
|
|
803
|
-
phoneToAsterisk:
|
|
804
|
-
idNumberToAsterisk:
|
|
805
|
-
firstLetterToUpperCase:
|
|
806
|
-
firstLetterToLowerCase:
|
|
807
|
-
},
|
|
808
|
-
validHttp:
|
|
809
|
-
validExternal:
|
|
810
|
-
validString:
|
|
811
|
-
validNumberStr:
|
|
812
|
-
validEmptyObject:
|
|
813
|
-
validURL:
|
|
814
|
-
validPassword:
|
|
815
|
-
validEmail:
|
|
816
|
-
validIdNumber:
|
|
817
|
-
validPhone:
|
|
818
|
-
validTel:
|
|
819
|
-
},
|
|
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 };
|
|
820
857
|
export {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
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
|
|
849
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;
|