@nano-lib/util 1.0.12 → 1.0.13
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 +16 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +1 -1
- package/lib/index.mjs +109 -94
- package/package.json +1 -1
package/lib/constant/index.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
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 OPERATE_STATE: {
|
|
5
|
+
readonly view: "查看";
|
|
6
|
+
readonly add: "添加";
|
|
7
|
+
readonly edit: "编辑";
|
|
8
|
+
readonly del: "删除";
|
|
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
|
+
};
|
|
4
20
|
export declare const IMAGE_TYPE: string[];
|
|
5
21
|
export declare const MEDIA_TYPE: string[];
|
|
6
22
|
export declare const DOC_TYPE: string[];
|
package/lib/index.d.ts
CHANGED
|
@@ -9,6 +9,22 @@ 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
|
+
OPERATE_STATE: {
|
|
13
|
+
readonly view: "查看";
|
|
14
|
+
readonly add: "添加";
|
|
15
|
+
readonly edit: "编辑";
|
|
16
|
+
readonly del: "删除";
|
|
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
|
+
};
|
|
12
28
|
IMAGE_TYPE: string[];
|
|
13
29
|
MEDIA_TYPE: string[];
|
|
14
30
|
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 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;
|
package/lib/index.mjs
CHANGED
|
@@ -180,10 +180,10 @@ function ue(e) {
|
|
|
180
180
|
}
|
|
181
181
|
const O = () => {
|
|
182
182
|
};
|
|
183
|
-
function
|
|
183
|
+
function it(e) {
|
|
184
184
|
return new Promise((t) => setTimeout(t, e));
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function st(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 ct(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 at(e, t) {
|
|
207
207
|
let n = null;
|
|
208
208
|
return function(...r) {
|
|
209
209
|
n !== null && clearTimeout(n), n = setTimeout(() => {
|
|
@@ -211,13 +211,13 @@ function st(e, t) {
|
|
|
211
211
|
}, t);
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function ut(e) {
|
|
215
215
|
if (!E(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
|
|
220
|
+
function ft(e) {
|
|
221
221
|
if (!E(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);
|
|
@@ -226,13 +226,13 @@ const fe = (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
|
+
}, lt = (e, t = "") => {
|
|
230
230
|
typeof e == "string" && (e = e === "" ? [] : e.split(","));
|
|
231
231
|
for (const n in e)
|
|
232
232
|
e[n] = fe(e[n], t);
|
|
233
233
|
return e;
|
|
234
234
|
};
|
|
235
|
-
function
|
|
235
|
+
function dt(e) {
|
|
236
236
|
let t = O;
|
|
237
237
|
return (...n) => new Promise((r, o) => {
|
|
238
238
|
t(), t = () => {
|
|
@@ -243,7 +243,7 @@ function ft(e) {
|
|
|
243
243
|
);
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function ht(e, t) {
|
|
247
247
|
const n = document.createElement("a");
|
|
248
248
|
n.download = t, n.href = e, n.click();
|
|
249
249
|
}
|
|
@@ -253,15 +253,15 @@ function le(e) {
|
|
|
253
253
|
e[n] && t.push(e[n]);
|
|
254
254
|
return t;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function pt(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 gt(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 mt(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);
|
|
@@ -392,7 +392,22 @@ const Te = [
|
|
|
392
392
|
["year", "YYYY"],
|
|
393
393
|
["yearrange", "YYYY"],
|
|
394
394
|
["time", "HH:mm:ss"]
|
|
395
|
-
], Re =
|
|
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];
|
|
396
411
|
var z = function() {
|
|
397
412
|
if (typeof Map < "u")
|
|
398
413
|
return Map;
|
|
@@ -441,25 +456,25 @@ var z = function() {
|
|
|
441
456
|
);
|
|
442
457
|
}(), y = typeof window < "u" && typeof document < "u" && window.document === document, m = function() {
|
|
443
458
|
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
|
-
}(),
|
|
459
|
+
}(), De = function() {
|
|
445
460
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(m) : function(e) {
|
|
446
461
|
return setTimeout(function() {
|
|
447
462
|
return e(Date.now());
|
|
448
463
|
}, 1e3 / 60);
|
|
449
464
|
};
|
|
450
|
-
}(),
|
|
451
|
-
function
|
|
465
|
+
}(), Ye = 2;
|
|
466
|
+
function ze(e, t) {
|
|
452
467
|
var n = !1, r = !1, o = 0;
|
|
453
468
|
function i() {
|
|
454
469
|
n && (n = !1, e()), r && c();
|
|
455
470
|
}
|
|
456
471
|
function s() {
|
|
457
|
-
|
|
472
|
+
De(i);
|
|
458
473
|
}
|
|
459
474
|
function c() {
|
|
460
475
|
var a = Date.now();
|
|
461
476
|
if (n) {
|
|
462
|
-
if (a - o <
|
|
477
|
+
if (a - o < Ye)
|
|
463
478
|
return;
|
|
464
479
|
r = !0;
|
|
465
480
|
} else
|
|
@@ -468,11 +483,11 @@ function De(e, t) {
|
|
|
468
483
|
}
|
|
469
484
|
return c;
|
|
470
485
|
}
|
|
471
|
-
var
|
|
486
|
+
var Ie = 20, Ce = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], $e = typeof MutationObserver < "u", Le = (
|
|
472
487
|
/** @class */
|
|
473
488
|
function() {
|
|
474
489
|
function e() {
|
|
475
|
-
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh =
|
|
490
|
+
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = ze(this.refresh.bind(this), Ie);
|
|
476
491
|
}
|
|
477
492
|
return e.prototype.addObserver = function(t) {
|
|
478
493
|
~this.observers_.indexOf(t) || this.observers_.push(t), this.connected_ || this.connect_();
|
|
@@ -490,7 +505,7 @@ var Ye = 20, ze = ["top", "right", "bottom", "left", "width", "height", "size",
|
|
|
490
505
|
return n.broadcastActive();
|
|
491
506
|
}), t.length > 0;
|
|
492
507
|
}, e.prototype.connect_ = function() {
|
|
493
|
-
!y || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh),
|
|
508
|
+
!y || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), $e ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
|
|
494
509
|
attributes: !0,
|
|
495
510
|
childList: !0,
|
|
496
511
|
characterData: !0,
|
|
@@ -499,7 +514,7 @@ var Ye = 20, ze = ["top", "right", "bottom", "left", "width", "height", "size",
|
|
|
499
514
|
}, e.prototype.disconnect_ = function() {
|
|
500
515
|
!y || !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
516
|
}, e.prototype.onTransitionEnd_ = function(t) {
|
|
502
|
-
var n = t.propertyName, r = n === void 0 ? "" : n, o =
|
|
517
|
+
var n = t.propertyName, r = n === void 0 ? "" : n, o = Ce.some(function(i) {
|
|
503
518
|
return !!~r.indexOf(i);
|
|
504
519
|
});
|
|
505
520
|
o && this.refresh();
|
|
@@ -533,42 +548,42 @@ function M(e) {
|
|
|
533
548
|
return r + v(i);
|
|
534
549
|
}, 0);
|
|
535
550
|
}
|
|
536
|
-
function
|
|
551
|
+
function ke(e) {
|
|
537
552
|
for (var t = ["top", "right", "bottom", "left"], n = {}, r = 0, o = t; r < o.length; r++) {
|
|
538
553
|
var i = o[r], s = e["padding-" + i];
|
|
539
554
|
n[i] = v(s);
|
|
540
555
|
}
|
|
541
556
|
return n;
|
|
542
557
|
}
|
|
543
|
-
function
|
|
558
|
+
function Fe(e) {
|
|
544
559
|
var t = e.getBBox();
|
|
545
560
|
return _(0, 0, t.width, t.height);
|
|
546
561
|
}
|
|
547
|
-
function
|
|
562
|
+
function He(e) {
|
|
548
563
|
var t = e.clientWidth, n = e.clientHeight;
|
|
549
564
|
if (!t && !n)
|
|
550
565
|
return C;
|
|
551
|
-
var r = l(e).getComputedStyle(e), o =
|
|
552
|
-
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)), !
|
|
566
|
+
var r = l(e).getComputedStyle(e), o = ke(r), i = o.left + o.right, s = o.top + o.bottom, c = v(r.width), a = v(r.height);
|
|
567
|
+
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)), !Pe(e)) {
|
|
553
568
|
var u = Math.round(c + i) - t, f = Math.round(a + s) - n;
|
|
554
569
|
Math.abs(u) !== 1 && (c -= u), Math.abs(f) !== 1 && (a -= f);
|
|
555
570
|
}
|
|
556
571
|
return _(o.left, o.top, c, a);
|
|
557
572
|
}
|
|
558
|
-
var
|
|
573
|
+
var Ne = /* @__PURE__ */ function() {
|
|
559
574
|
return typeof SVGGraphicsElement < "u" ? function(e) {
|
|
560
575
|
return e instanceof l(e).SVGGraphicsElement;
|
|
561
576
|
} : function(e) {
|
|
562
577
|
return e instanceof l(e).SVGElement && typeof e.getBBox == "function";
|
|
563
578
|
};
|
|
564
579
|
}();
|
|
565
|
-
function
|
|
580
|
+
function Pe(e) {
|
|
566
581
|
return e === l(e).document.documentElement;
|
|
567
582
|
}
|
|
568
|
-
function
|
|
569
|
-
return y ?
|
|
583
|
+
function Be(e) {
|
|
584
|
+
return y ? Ne(e) ? Fe(e) : He(e) : C;
|
|
570
585
|
}
|
|
571
|
-
function
|
|
586
|
+
function qe(e) {
|
|
572
587
|
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
588
|
return I(s, {
|
|
574
589
|
x: t,
|
|
@@ -584,30 +599,30 @@ function Pe(e) {
|
|
|
584
599
|
function _(e, t, n, r) {
|
|
585
600
|
return { x: e, y: t, width: n, height: r };
|
|
586
601
|
}
|
|
587
|
-
var
|
|
602
|
+
var je = (
|
|
588
603
|
/** @class */
|
|
589
604
|
function() {
|
|
590
605
|
function e(t) {
|
|
591
606
|
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = _(0, 0, 0, 0), this.target = t;
|
|
592
607
|
}
|
|
593
608
|
return e.prototype.isActive = function() {
|
|
594
|
-
var t =
|
|
609
|
+
var t = Be(this.target);
|
|
595
610
|
return this.contentRect_ = t, t.width !== this.broadcastWidth || t.height !== this.broadcastHeight;
|
|
596
611
|
}, e.prototype.broadcastRect = function() {
|
|
597
612
|
var t = this.contentRect_;
|
|
598
613
|
return this.broadcastWidth = t.width, this.broadcastHeight = t.height, t;
|
|
599
614
|
}, e;
|
|
600
615
|
}()
|
|
601
|
-
),
|
|
616
|
+
), Ge = (
|
|
602
617
|
/** @class */
|
|
603
618
|
/* @__PURE__ */ function() {
|
|
604
619
|
function e(t, n) {
|
|
605
|
-
var r =
|
|
620
|
+
var r = qe(n);
|
|
606
621
|
I(this, { target: t, contentRect: r });
|
|
607
622
|
}
|
|
608
623
|
return e;
|
|
609
624
|
}()
|
|
610
|
-
),
|
|
625
|
+
), Ue = (
|
|
611
626
|
/** @class */
|
|
612
627
|
function() {
|
|
613
628
|
function e(t, n, r) {
|
|
@@ -622,7 +637,7 @@ var Be = (
|
|
|
622
637
|
if (!(t instanceof l(t).Element))
|
|
623
638
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
624
639
|
var n = this.observations_;
|
|
625
|
-
n.has(t) || (n.set(t, new
|
|
640
|
+
n.has(t) || (n.set(t, new je(t)), this.controller_.addObserver(this), this.controller_.refresh());
|
|
626
641
|
}
|
|
627
642
|
}, e.prototype.unobserve = function(t) {
|
|
628
643
|
if (!arguments.length)
|
|
@@ -643,7 +658,7 @@ var Be = (
|
|
|
643
658
|
}, e.prototype.broadcastActive = function() {
|
|
644
659
|
if (this.hasActive()) {
|
|
645
660
|
var t = this.callbackCtx_, n = this.activeObservations_.map(function(r) {
|
|
646
|
-
return new
|
|
661
|
+
return new Ge(r.target, r.broadcastRect());
|
|
647
662
|
});
|
|
648
663
|
this.callback_.call(t, n, t), this.clearActive();
|
|
649
664
|
}
|
|
@@ -661,7 +676,7 @@ var Be = (
|
|
|
661
676
|
throw new TypeError("Cannot call a class as a function.");
|
|
662
677
|
if (!arguments.length)
|
|
663
678
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
664
|
-
var n =
|
|
679
|
+
var n = Le.getInstance(), r = new Ue(t, n, this);
|
|
665
680
|
$.set(this, r);
|
|
666
681
|
}
|
|
667
682
|
return e;
|
|
@@ -677,28 +692,28 @@ var Be = (
|
|
|
677
692
|
return (t = $.get(this))[e].apply(t, arguments);
|
|
678
693
|
};
|
|
679
694
|
});
|
|
680
|
-
var
|
|
695
|
+
var Ze = function() {
|
|
681
696
|
return typeof m.ResizeObserver < "u" ? m.ResizeObserver : L;
|
|
682
697
|
}();
|
|
683
|
-
function
|
|
698
|
+
function Je(e) {
|
|
684
699
|
for (const t of e) {
|
|
685
700
|
const n = t.target.__resizeListeners__ || [];
|
|
686
701
|
n.length && n.forEach((r) => r());
|
|
687
702
|
}
|
|
688
703
|
}
|
|
689
|
-
function
|
|
690
|
-
typeof window > "u" || (e.__resizeListeners__ || (e.__resizeListeners__ = [], e.__ro__ = new
|
|
704
|
+
function vt(e, t) {
|
|
705
|
+
typeof window > "u" || (e.__resizeListeners__ || (e.__resizeListeners__ = [], e.__ro__ = new Ze(Je), e.__ro__.observe(e)), e.__resizeListeners__.push(t));
|
|
691
706
|
}
|
|
692
|
-
function
|
|
707
|
+
function _t(e, t) {
|
|
693
708
|
!e || !e.__resizeListeners__ || (e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t), 1), e.__resizeListeners__.length || e.__ro__.disconnect());
|
|
694
709
|
}
|
|
695
|
-
let d = [],
|
|
696
|
-
const
|
|
697
|
-
["nod", [
|
|
698
|
-
["shake", [
|
|
699
|
-
["mouth", [
|
|
700
|
-
["eye", [
|
|
701
|
-
]),
|
|
710
|
+
let d = [], We = { consecutiveFrames: 0, lastBlinkTime: 0 }, Ve = { consecutiveFrames: 0, lastBlinkTime: 0 };
|
|
711
|
+
const Xe = /* @__PURE__ */ new Map([
|
|
712
|
+
["nod", [ot, 30, 100]],
|
|
713
|
+
["shake", [rt, 7, 100]],
|
|
714
|
+
["mouth", [nt, 0.35, 100]],
|
|
715
|
+
["eye", [tt, 0.3, 100]]
|
|
716
|
+
]), bt = ["nod", "shake", "mouth", "eye"], yt = {
|
|
702
717
|
nod: "请点点头",
|
|
703
718
|
shake: "请摇摇头",
|
|
704
719
|
mouth: "请张张嘴",
|
|
@@ -711,7 +726,7 @@ function T(e, t) {
|
|
|
711
726
|
n.map((o, i) => o - r[i]).reduce((o, i) => o + Math.pow(i, 2), 0)
|
|
712
727
|
);
|
|
713
728
|
}
|
|
714
|
-
function*
|
|
729
|
+
function* Ke(e, t, n = 8, r = 0) {
|
|
715
730
|
for (let o = n; o > 0; o--)
|
|
716
731
|
yield e(t, 0.5, r);
|
|
717
732
|
}
|
|
@@ -726,16 +741,16 @@ function R(e) {
|
|
|
726
741
|
const t = b(e[1], e[5]), n = b(e[2], e[4]), r = b(e[0], e[3]);
|
|
727
742
|
return (t + n) / (2 * r);
|
|
728
743
|
}
|
|
729
|
-
function
|
|
744
|
+
function Qe(e) {
|
|
730
745
|
const t = T(p(e[13]), p(e[19])), n = T(p(e[0]), p(e[6]));
|
|
731
746
|
return t / n;
|
|
732
747
|
}
|
|
733
|
-
function
|
|
748
|
+
function et(e) {
|
|
734
749
|
const t = e.positions[30], n = e.positions[36], r = e.positions[45], o = (n.x + r.x) / 2;
|
|
735
750
|
return (t.x - o) / (r.x - n.x) * 30;
|
|
736
751
|
}
|
|
737
|
-
function
|
|
738
|
-
const n = Date.now(), r = A(R(e.getLeftEye()), t,
|
|
752
|
+
function tt(e, t) {
|
|
753
|
+
const n = Date.now(), r = A(R(e.getLeftEye()), t, We, n), o = A(R(e.getRightEye()), t, Ve, n);
|
|
739
754
|
return !!(r || o);
|
|
740
755
|
}
|
|
741
756
|
function A(e, t, n, r) {
|
|
@@ -745,14 +760,14 @@ function A(e, t, n, r) {
|
|
|
745
760
|
return n.lastBlinkTime = r, n.consecutiveFrames = 0, !0;
|
|
746
761
|
return !1;
|
|
747
762
|
}
|
|
748
|
-
function
|
|
749
|
-
return
|
|
763
|
+
function nt(e, t) {
|
|
764
|
+
return Qe(e.getMouth()) > t;
|
|
750
765
|
}
|
|
751
|
-
function
|
|
752
|
-
const n =
|
|
766
|
+
function rt(e, t) {
|
|
767
|
+
const n = et(e);
|
|
753
768
|
return Math.abs(n) > t;
|
|
754
769
|
}
|
|
755
|
-
function
|
|
770
|
+
function ot(e, t) {
|
|
756
771
|
const n = d.length, r = e.positions[33];
|
|
757
772
|
if (n < 5)
|
|
758
773
|
d.push(r.y);
|
|
@@ -764,7 +779,7 @@ function nt(e, t) {
|
|
|
764
779
|
}
|
|
765
780
|
return !1;
|
|
766
781
|
}
|
|
767
|
-
function
|
|
782
|
+
function wt(e, t = "blob", n = 1) {
|
|
768
783
|
return new Promise((r) => {
|
|
769
784
|
const o = document.createElement("canvas"), i = o.getContext("2d");
|
|
770
785
|
o.width = e.videoWidth, o.height = e.videoHeight, i == null || i.drawImage(e, 0, 0, o.width, o.height), t === "blob" ? o.toBlob(
|
|
@@ -777,10 +792,10 @@ function bt(e, t = "blob", n = 1) {
|
|
|
777
792
|
) : r(o.toDataURL("image/png", n));
|
|
778
793
|
});
|
|
779
794
|
}
|
|
780
|
-
async function
|
|
781
|
-
const [o, i, s] =
|
|
795
|
+
async function Et(e, t, n, r = 5) {
|
|
796
|
+
const [o, i, s] = Xe.get(n);
|
|
782
797
|
if (!o) return !1;
|
|
783
|
-
const c = [], a =
|
|
798
|
+
const c = [], a = Ke(e, t, r, s);
|
|
784
799
|
for (const u of a) {
|
|
785
800
|
const f = await u;
|
|
786
801
|
if (!f) continue;
|
|
@@ -789,7 +804,7 @@ async function yt(e, t, n, r = 5) {
|
|
|
789
804
|
}
|
|
790
805
|
return c.includes(!0);
|
|
791
806
|
}
|
|
792
|
-
const
|
|
807
|
+
const Ot = { DATE_VALUE_FORMAT: Ae, OPERATE_STATE: Se, IMAGE_TYPE: x, MEDIA_TYPE: D, DOC_TYPE: Y, FILE_TYPE: xe }, Mt = {
|
|
793
808
|
encodeURIToParams: Ee,
|
|
794
809
|
paramsToQueryString: Oe,
|
|
795
810
|
queryStringToParams: Me,
|
|
@@ -804,7 +819,7 @@ const wt = { DATE_VALUE_FORMAT: Re, IMAGE_TYPE: x, MEDIA_TYPE: D, DOC_TYPE: Y, F
|
|
|
804
819
|
idNumberToAsterisk: me,
|
|
805
820
|
firstLetterToUpperCase: ve,
|
|
806
821
|
firstLetterToLowerCase: _e
|
|
807
|
-
},
|
|
822
|
+
}, Tt = {
|
|
808
823
|
validHttp: ee,
|
|
809
824
|
validExternal: te,
|
|
810
825
|
validString: ne,
|
|
@@ -816,34 +831,34 @@ const wt = { DATE_VALUE_FORMAT: Re, IMAGE_TYPE: x, MEDIA_TYPE: D, DOC_TYPE: Y, F
|
|
|
816
831
|
validIdNumber: E,
|
|
817
832
|
validPhone: ue,
|
|
818
833
|
validTel: ae
|
|
819
|
-
},
|
|
834
|
+
}, Rt = { scrollTo: B, addClass: V, removeClass: X, hasClass: w, toggleClass: W, noContextmenu: Q, useRafThrottle: K }, At = { parseTime: g, getTimeDistance: G, getDayRange: U }, St = { local: J, session: Z }, xt = { uuid: j, randomNum: q };
|
|
820
835
|
export {
|
|
821
|
-
|
|
836
|
+
Ot as CONSTANTS,
|
|
822
837
|
O as NOOP,
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
838
|
+
vt as addResizeListener,
|
|
839
|
+
St as cacheUtil,
|
|
840
|
+
st as countdownTimer,
|
|
841
|
+
dt as creatCancelTask,
|
|
842
|
+
At as dateUtil,
|
|
843
|
+
at as debounce,
|
|
844
|
+
ht as downloadFile,
|
|
845
|
+
Rt as elementUtil,
|
|
846
|
+
bt as faceLivingEvent,
|
|
847
|
+
yt as faceLivingEventHint,
|
|
848
|
+
lt as getArrayFullUrl,
|
|
849
|
+
ft as getBirthdayByIdNumber,
|
|
850
|
+
Et as getFaceGestureResult,
|
|
851
|
+
wt as getFaceVideoFrame,
|
|
837
852
|
fe as getFullUrl,
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
853
|
+
ut as getGenderByIdNumber,
|
|
854
|
+
pt as getPercentage,
|
|
855
|
+
ct as getRandomItemInArray,
|
|
856
|
+
gt as loadCss,
|
|
857
|
+
mt as loadJs,
|
|
858
|
+
xt as randomUtil,
|
|
859
|
+
_t as removeResizeListener,
|
|
860
|
+
it as sleep,
|
|
861
|
+
Mt as toUtil,
|
|
847
862
|
le as trimArray,
|
|
848
|
-
|
|
863
|
+
Tt as validUtil
|
|
849
864
|
};
|