nhanh-pure-function 2.0.3 → 2.0.4

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.
@@ -269,12 +269,7 @@ export declare class _KeyedWindowManager {
269
269
  * @param windowFeatures 新窗口的特性
270
270
  * @returns 返回已打开或新打开的窗口
271
271
  */
272
- static open(key: string, url?: string, target?: WindowTarget, windowFeatures?: string): Window | undefined;
273
- /**
274
- * 关闭与指定键关联的窗口
275
- * @param key 窗口的唯一键
276
- */
277
- static close(key: string): void;
272
+ static open(key: string, url?: string | URL, target?: WindowTarget, windowFeatures?: string): Window | undefined;
278
273
  /**
279
274
  * 检查指定键的窗口是否打开
280
275
  * @param key 窗口的唯一键
@@ -287,6 +282,11 @@ export declare class _KeyedWindowManager {
287
282
  * @returns 返回对应的窗口,如果窗口已关闭则返回undefined
288
283
  */
289
284
  static getWindow(key: string): Window | undefined;
285
+ /**
286
+ * 关闭与指定键关联的窗口
287
+ * @param key 窗口的唯一键
288
+ */
289
+ static close(key: string): void;
290
290
  /**
291
291
  * 关闭所有打开的窗口并清空Map
292
292
  */
package/dist/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".nhanh-pure-function{--nhanh: 2233}.no-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}")),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
2
- "use strict";var oe=Object.defineProperty;var G=n=>{throw TypeError(n)};var re=(n,t,e)=>t in n?oe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var y=(n,t,e)=>re(n,typeof t!="symbol"?t+"":t,e),V=(n,t,e)=>t.has(n)||G("Cannot "+e);var c=(n,t,e)=>(V(n,t,"read from private field"),e?e.call(n):t.get(n)),d=(n,t,e)=>t.has(n)?G("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),l=(n,t,e,o)=>(V(n,t,"write to private field"),o?o.call(n,e):t.set(n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie={".mp3":"audio/mpeg",".mp4":"video/mp4",".m4a":"audio/mp4",".aac":"audio/aac",".ogg":"audio/ogg",".wav":"audio/wav",".flac":"audio/flac",".opus":"audio/opus",".webm":"video/webm",".avi":"video/x-msvideo",".mov":"video/quicktime",".wmv":"video/x-ms-wmv",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".bmp":"image/bmp",".tiff":"image/tiff",".ico":"image/vnd.microsoft.icon",".svg":"image/svg+xml",".webp":"image/webp",".heif":"image/heif",".heic":"image/heic",".json":"application/json",".xml":"application/xml",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".ts":"application/typescript",".csv":"text/csv",".tsv":"text/tab-separated-values",".txt":"text/plain",".md":"text/markdown",".rtf":"application/rtf",".pdf":"application/pdf",".zip":"application/zip",".rar":"application/x-rar-compressed",".tar":"application/x-tar",".gz":"application/gzip",".7z":"application/x-7z-compressed",".exe":"application/x-msdownload",".apk":"application/vnd.android.package-archive",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".odt":"application/vnd.oasis.opendocument.text",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odp":"application/vnd.oasis.opendocument.presentation",".jsonld":"application/ld+json",".yaml":"application/x-yaml",".yml":"application/x-yaml",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".map":"application/json"},Y={image:[".jpg",".jpeg",".png",".gif",".bmp",".webp",".tiff",".svg",".heif",".heic",".ico",".raw",".jfif",".avif",".png8",".indd",".eps",".ai"],ppt:[".ppt",".pptx",".odp"],word:[".doc",".docx",".odt",".rtf"],excel:[".xls",".xlsx",".ods",".csv",".tsv"],pdf:[".pdf"],text:[".txt",".csv",".md",".json",".yaml",".yml",".log",".ini",".rtf"],audio:[".mp3",".wav",".ogg",".flac",".aac",".wma",".m4a",".alac",".ape",".opus",".amr",".ra",".mid",".midi",".aiff",".pcm",".au",".wavpack",".spx"],video:[".mp4",".avi",".mkv",".mov",".wmv",".flv",".webm",".mpg",".mpeg",".3gp",".vob",".ogv",".m4v",".ts",".rm",".rmvb",".m2ts",".divx",".xvid",".swf",".f4v"],archive:[".zip",".rar",".tar",".gz",".bz2",".xz",".7z",".tar.gz",".tar.bz2",".tar.xz",".tar.lz",".tar.lzma",".cab",".iso",".dmg",".tgz",".apk",".gz2",".tar.zst"],code:[".js",".ts",".py",".java",".cpp",".c",".html",".css",".scss",".less",".sass",".php",".rb",".go",".swift",".rs",".kt",".scala",".lua",".pl",".m",".h",".xml",".json",".yaml",".yml",".toml",".vue",".ejs",".handlebars",".jinja",".dart"],font:[".woff",".woff2",".ttf",".otf",".eot",".svg",".ttc",".fnt",".fon",".otc"],database:[".sql",".sqlite",".db",".mdb",".accdb",".jsonld",".xml",".csv"],markup:[".html",".htm",".xhtml",".xml",".json",".yaml",".yml"],configuration:[".ini",".conf",".cfg",".env",".properties",".json",".toml"],logs:[".log",".err",".trace",".out"],script:[".bash",".sh",".zsh",".bat",".ps1",".vbs",".cmd",".sed",".awk",".php"]},Z=["","万","亿","兆","京","垓","秭","穰","沟","涧","正","载","极"];function se(n){return n!=null}function ce(n){return!(n===null||typeof n!="object"||Array.isArray(n))}function ae(n){if(typeof n!="function")return console.error("非函数:",n);const t=function(e){e.didTimeout||e.timeRemaining()<=0?requestIdleCallback(t):n()};requestIdleCallback(t)}function le(n,t){const e=+new Date;return new Promise((o,r)=>{const i=()=>{if(+new Date-e>=t)return r("超时");if(n())return o("完成");requestIdleCallback(i)};i()})}function ue(n,t,e=","){const o=new RegExp(`(^|${e})${t}(${e}|$)`,"g");return n.replace(o,function(r,i,s){return i===s?e:""})}function me(n){return n.charAt(0).toUpperCase()+n.slice(1)}function A(n,t,e=[],o=+new Date){if(o<+new Date-50){console.error("_MergeObjects 合并异常:疑似死循环");return}const r=W(n),i=W(t);if(r!=i)return t;if(r=="object"||r=="array"){if(e.some(([s,a])=>s==n&&a==t))return n;if(e.push([n,t]),r=="object"){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const a=t[s],m=n[s],u=A(m,a,e,o);n[s]=u}return n}else if(r=="array")return t.forEach((s,a)=>{const m=s,u=n[a],f=A(u,m,e,o);n[a]=f}),n}else return t}function de(n,t="YYYY-MM-DD hh:mm:ss",e=!0){const o=new Date(n);if(isNaN(o.getTime()))return console.error("Invalid date"),"";const r={YYYY:i=>i.getFullYear(),MM:i=>i.getMonth()+1,DD:i=>i.getDate(),hh:i=>i.getHours(),mm:i=>i.getMinutes(),ss:i=>i.getSeconds(),ms:i=>i.getMilliseconds()};return t.replace(/YYYY|MM|DD|hh|mm|ss|ms/g,i=>{const s=r[i](o);return e?String(s).padStart(2,"0"):String(s)})}function fe(n){return new Promise((t,e)=>{fetch(n).then(o=>t(o.text())).catch(o=>{console.error("Error fetching :",o),e(o)})})}function q(n,t="file"){if(!n||(n=String(n).trim(),n===""))return t;const e=n.split("/");return e[e.length-1].split("?")[0]}function he(n,t){return new Promise((e,o)=>{try{t=t||q(n,"downloaded_file"),fetch(n).then(r=>(r.ok||o(`文件下载失败,状态码: ${r.status}`),r.blob())).then(r=>{const i=URL.createObjectURL(r),s=document.createElement("a");s.href=i,s.download=decodeURIComponent(t),document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i),e(r)}).catch(o)}catch(r){o(r)}})}function pe(n,t=10){let e=0,o=t;function r(){if(o>0)o--,requestAnimationFrame(r);else{const s=(+new Date-e)/t,a=1e3/s;n(Number(a.toFixed(2)),Number(s.toFixed(2)))}}requestAnimationFrame(()=>{e=+new Date,r()})}function ge(n,t){return n=n.replace(/([^a-zA-Z][a-z])/g,e=>e.toUpperCase()),t?n.replace(/[^a-zA-Z]+/g,""):n}function we(n,t,e){if(!e){let s=t.replace(/^[^.]+./,"");s=s==t?"text/plain":"application/"+s,e={type:s}}const o=new Blob(n,e),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function ve(n=""){return n+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function J(n,t){let e;return function(...o){clearTimeout(e),e=setTimeout(()=>{n(...o),e=void 0},t)}}function xe(n,t){let e=-1/0;return function(...o){const r=performance.now();if(r-e>t){e=r;try{n(...o)}catch(i){console.error("Throttled function execution failed:",i)}}}}function W(n){return Array.isArray(n)?"array":n===null?"null":typeof n}function be(n){const t=()=>Promise.resolve(),e=a=>(console.error(a),Promise.reject(a));function o(){return navigator.clipboard.writeText(n).then(t).catch(e)}function r(){const a=document.createElement("div");a.innerText=n,document.body.appendChild(a);const m=document.createRange();m.selectNodeContents(a);const u=window.getSelection();let f=!1;return u&&(u.removeAllRanges(),u.addRange(m),f=document.execCommand("copy")),document.body.removeChild(a),f?Promise.resolve():Promise.reject()}function i(){const a=document.createElement("textarea");a.value=n,document.body.appendChild(a),a.select(),a.setSelectionRange(0,n.length);let m=!1;return document.activeElement===a&&(m=document.execCommand("Copy",!0)),document.body.removeChild(a),m?Promise.resolve():Promise.reject()}function s(){return r().then(t).catch(()=>{i().then(t).catch(()=>e("复制方式尽皆失效"))})}return navigator.clipboard?o().catch(s):s()}function ye(n,t){const e=t.split(".");return e.reduce((o,r,i)=>(r in o||(i===e.length-1?o[r]=void 0:o[r]={}),o[r]),n)}function Ce(n,t){const e=t.split(".");return e.reduce((o,r,i)=>o.hasOwnProperty(r)?o[r]:o[r]=i==e.length-1?void 0:{},n)}function _e(n,t,e){const o=t.split(".");return o.reduce((r,i,s)=>(s===o.length-1&&(r[i]=e),r[i]),n)}function Ee(n){return new Promise((t,e)=>{if(typeof n!="string"||n.trim()===""||!n.includes("://")){e(new Error("Invalid URL: Must be a non-empty string"));return}try{new XMLHttpRequest().open("HEAD",n,!0)}catch(i){e(new Error(`Invalid URL format: ${i.message}`));return}const o=new XMLHttpRequest;o.open("HEAD",n,!0);const r=i=>{e(new Error(`Request failed: ${i.type}`))};o.onreadystatechange=function(){o.readyState===XMLHttpRequest.DONE&&(o.status===0?e(new Error("Network error or CORS blocked")):o.status>=200&&o.status<300?t(!0):e(new Error(`HTTP Error: ${o.status}`)))},o.onerror=r,o.onabort=r,o.ontimeout=r;try{o.send()}catch(i){e(new Error(`Request send failed: ${i.message}`))}})}function Fe(n){return["https:","wss:","ftps:","sftp:","smpts:","smtp+tls:","imap+tls:","pop3+tls:","rdp:","vpn:"].some(e=>n.startsWith(e))}const E=class E{constructor(){if(new.target===E)throw new Error("请直接使用静态方法,而不是实例化此类")}static check(t,e){if(!t||typeof t!="string")return console.error("Invalid URL provided"),e?!1:"unknown";const o=q(t).toLowerCase();if(e){if(!Y.hasOwnProperty(e))return console.error(`Unknown file type: ${e}`),"unknown";const r=Y[e];return E._checkExtension(o,r)}return E._detectFileType(o)}static parseAddresses(t){return!t||typeof t!="string"?(console.error("Invalid URL provided"),[]):t.split(",").map(e=>{const o=q(e),r=this.check(e);return{url:e,name:o,type:r}})}static matchesMimeType(t,e){if(!e)return!0;if(typeof t!="string"||typeof e!="string")return!1;const o=E._normalizeType(t),r=e.split(",").map(a=>E._normalizeType(a.trim())),[i,s="*"]=o.split("/");return r.some(a=>{const[m,u="*"]=a.split("/");return(m==="*"||i==="*"||m===i)&&(u==="*"||s==="*"||u===s)})}static _normalizeType(t){return t.startsWith(".")&&!t.includes("/")?ie[t.toLowerCase()]||t:t.includes("/")?t:`${t}/*`}static _checkExtension(t,e){return e.some(o=>t.endsWith(o))}static _detectFileType(t){for(const[e,o]of E.cachedEntries)if(o.some(r=>t.endsWith(r)))return e;return"unknown"}};y(E,"cachedEntries",Object.entries(Y));let H=E;function Te(n){return n.map((t,e)=>n.slice(e).concat(n.slice(0,e)))}function Le(n){const t=window.structuredClone,e=o=>o===null||typeof o!="object"?o:A(Array.isArray(o)?[]:{},o);try{return t?t(n):e(n)}catch(o){return console.error("structuredClone error:",o),t&&e(n)}}const B=class B{constructor(){if(new.target===B)throw new Error("请直接使用静态方法,而不是实例化此类")}static open(t,e,o,r){const i=this.keys.get(t);if(i&&!i.closed)return i.focus(),i;{const s=window.open(e,o,r);if(s)return this.keys.set(t,s),s.addEventListener("unload",()=>this.keys.delete(t)),s;console.error("window.open failed: 可能是浏览器阻止了弹出窗口"),this.keys.delete(t)}}static close(t){const e=this.keys.get(t);e&&!e.closed&&(e.close(),this.keys.delete(t))}static isOpen(t){const e=this.keys.get(t);return!!e&&!e.closed}static getWindow(t){const e=this.keys.get(t);if(e&&!e.closed)return e}static closeAll(){this.keys.forEach((t,e)=>{t.closed||t.close(),this.keys.delete(e)})}};y(B,"keys",new Map);let X=B;function Me(n,t="image/png"){try{let e,o=t;if(n instanceof File)return URL.createObjectURL(n);if(typeof n=="string"){let i=n;const s=i.match(/^data:([^;]*)(;base64)?,(.*)$/i);if(s){if(!s[2])throw new Error("无效的数据 URL:缺少 base64 编码声明");if(o=s[1]||o,i=s[3],!i)throw new Error("数据 URL 包含空有效负载")}i=i.replace(/[^A-Za-z0-9+/=]/g,"");const a=atob(i);e=new Uint8Array(a.length);for(let m=0;m<a.length;m++)e[m]=a.charCodeAt(m)}else if(n instanceof ArrayBuffer)e=new Uint8Array(n);else if(n instanceof Uint8Array)e=n;else throw new Error("不支持的数据类型。应为 Base64 字符串、ArrayBuffer 或 Uint8Array");const r=new Blob([e],{type:o});return URL.createObjectURL(r)}catch(e){return console.error("数据到 ImageURL 的转换失败:",e.message,e.stack||"没有可用的堆栈跟踪"),null}}function je(n){const t=J(n,100);let e=0,o=0;return function(r){const i=r.target;if(!i||!(i instanceof HTMLElement))return;const{scrollTop:s,scrollHeight:a,clientHeight:m,scrollLeft:u,scrollWidth:f,clientWidth:g}=i;function N(){if(e==s)return;const $=e>s;if(e=s,$)return;a-s-m<=1&&t("vertical")}function te(){if(o==u)return;const $=o>u;if(o=u,$)return;f-u-g<=1&&t("horizontal")}N(),te()}}function Re(n,t,e){const{isClickAllowed:o,uiLibrary:r=["naiveUI","ElementPlus","Element"]}=e||{},i=function(m){const u=[];for(const f in m)Object.hasOwnProperty.call(m,f)&&r.includes(f)&&u.push(...m[f]);return u}({naiveUI:[".v-binder-follower-container",".n-image-preview-container",".n-modal-container"],ElementPlus:[".el-popper"],Element:[".el-popper"]});function s(){t(),document.removeEventListener("mousedown",a)}function a(m){if(o){const g=o(m);if(g)return;if(g===!1)return s()}const u=m.target;if(!(u instanceof HTMLElement)||!(u!=null&&u.closest("body")))return;n.concat(i).some(g=>!!(u!=null&&u.closest(g)))||s()}requestAnimationFrame(()=>document.addEventListener("mousedown",a))}var w,T,L,k,U,C,_,F,I;class Pe{constructor(){d(this,w);d(this,T,!1);d(this,L,{});d(this,k,0);d(this,U,0);d(this,C,0);d(this,_,0);d(this,F);d(this,I)}init(t,e){l(this,w,t),l(this,F,e==null?void 0:e.limit),l(this,I,e==null?void 0:e.dragDom),l(this,L,{mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this)}),this.bindOrUnbindEvent("bind")}finish(){this.bindOrUnbindEvent("unbind")}bindOrUnbindEvent(t){const e=t==="bind"?"addEventListener":"removeEventListener";if(!c(this,w))return console.error("No DOM");c(this,w)[e]("mousedown",c(this,L).mousedown),document[e]("mousemove",c(this,L).mousemove),document[e]("mouseup",c(this,L).mouseup)}alterLocation(){if(!c(this,w))return console.error("No DOM");c(this,F)&&(l(this,C,Math.min(c(this,C),c(this,F).max.top)),l(this,C,Math.max(c(this,C),c(this,F).min.top)),l(this,_,Math.min(c(this,_),c(this,F).max.left)),l(this,_,Math.max(c(this,_),c(this,F).min.left))),c(this,w).style.setProperty("--top",c(this,C)+"px"),c(this,w).style.setProperty("--left",c(this,_)+"px")}mousedown(t){if(!c(this,w))return console.error("No DOM");if(c(this,I)&&t.target!=c(this,I))return;document.body.classList.add("no-select"),l(this,T,!0);const e=c(this,w).getBoundingClientRect(),{pageX:o,pageY:r}=t;l(this,k,o),l(this,U,r),l(this,C,e.y),l(this,_,e.x)}mousemove(t){const{pageX:e,pageY:o}=t;c(this,T)&&(l(this,C,c(this,C)+(o-c(this,U))),l(this,_,c(this,_)+(e-c(this,k))),l(this,k,e),l(this,U,o),this.alterLocation())}mouseup(){c(this,T)&&(l(this,T,!1),document.body.classList.remove("no-select"))}}w=new WeakMap,T=new WeakMap,L=new WeakMap,k=new WeakMap,U=new WeakMap,C=new WeakMap,_=new WeakMap,F=new WeakMap,I=new WeakMap;var v,M,j,D,S,x,b,p,O,z;class ke{constructor(){d(this,v);d(this,M,!1);d(this,j,{});d(this,D,0);d(this,S,0);d(this,x,0);d(this,b,0);d(this,p);d(this,O);d(this,z)}init(t,e={}){l(this,v,t),l(this,p,e.limit),l(this,O,e.update_move),l(this,z,e.update_up),l(this,j,{mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this)}),this.bindOrUnbindEvent("bind")}finish(){this.bindOrUnbindEvent("unbind")}bindOrUnbindEvent(t){const e=t==="bind"?"addEventListener":"removeEventListener";if(!c(this,v))return console.error("No DOM");c(this,v)[e]("mousedown",c(this,j).mousedown),document[e]("mousemove",c(this,j).mousemove),document[e]("mouseup",c(this,j).mouseup)}updateValue(){const t={top:c(this,x),left:c(this,b),percentage:{top:0,left:0}};if(c(this,p)){const e=o=>c(this,p)?(t[o]-c(this,p).min[o])/(c(this,p).max[o]-c(this,p).min[o]):0;t.percentage={top:e("top")||0,left:e("left")||0}}return t}alterLocation(){if(!c(this,v))return console.error("No DOM");c(this,p)&&(l(this,x,Math.min(c(this,x),c(this,p).max.top)),l(this,x,Math.max(c(this,x),c(this,p).min.top)),l(this,b,Math.min(c(this,b),c(this,p).max.left)),l(this,b,Math.max(c(this,b),c(this,p).min.left))),c(this,O)&&c(this,O).call(this,this.updateValue()),c(this,v).style.setProperty("--top",c(this,x)+"px"),c(this,v).style.setProperty("--left",c(this,b)+"px")}mousedown(t){if(!c(this,v))return console.error("No DOM");document.body.classList.add("no-select"),l(this,M,!0);const e=c(this,v).getBoundingClientRect();l(this,S,e.y),l(this,D,e.x);const{pageX:o,pageY:r}=t;l(this,x,r-c(this,S)),l(this,b,o-c(this,D)),this.alterLocation()}mousemove(t){const{pageX:e,pageY:o}=t;c(this,M)&&(l(this,x,o-c(this,S)),l(this,b,e-c(this,D)),this.alterLocation())}mouseup(){c(this,M)&&(l(this,M,!1),document.body.classList.remove("no-select"),c(this,z)&&c(this,z).call(this,this.updateValue()))}}v=new WeakMap,M=new WeakMap,j=new WeakMap,D=new WeakMap,S=new WeakMap,x=new WeakMap,b=new WeakMap,p=new WeakMap,O=new WeakMap,z=new WeakMap;function K(n){const t=n;if(n){if(n.requestFullscreen)return n.requestFullscreen();if(t.mozRequestFullScreen)return t.mozRequestFullScreen();if(t.webkitRequestFullscreen)return t.webkitRequestFullscreen();if(t.msRequestFullscreen)return t.msRequestFullscreen()}else return Promise.reject("No DOM");return Promise.reject("No Fullscreen API")}function Q(){const n=document;return document.exitFullscreen?document.exitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.webkitExitFullscreen?n.webkitExitFullscreen():n.msExitFullscreen?n.msExitFullscreen():Promise.reject("No ExitFullscreen API")}function ee(){const n=document;return document.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement}function Ue(n){return function(){ee()?Q():K(n)}}function Ie(n,t){if(typeof n=="number")return n;if(/px/.test(n))return Number(n.replace(/px/,""))||0;const e=document.createElement("div");e.style.width=n,t=t||document.body,t.appendChild(e);const o=e.getBoundingClientRect().width;return t.removeChild(e),o}function De(n,t){if(!n)return;let e,o;if(typeof t=="string"){const i=document.querySelector(t);if(!i)return;const s=i.getBoundingClientRect();e=s.width,o=s.height}else if(Array.isArray(t))e=t[0],o=t[1];else{const i=t.getBoundingClientRect();e=i.width,o=i.height}const r=e/o;return r>n?[n*o,o]:r<n?[e,e/n]:[e,o]}function Se(n,t=5e3){return new Promise((e,o)=>{const r=new Image;r.src=n;const i=setTimeout(()=>{o(new Error("图片加载超时")),r.onload=null,r.onerror=null},t);r.onload=()=>{clearTimeout(i);const s=r.naturalWidth,a=r.naturalHeight,m=s/a;e([r,m])},r.onerror=()=>{clearTimeout(i),o(new Error("图片加载失败"))},r.crossOrigin="Anonymous"})}function Oe(n,t,e=2){return!Number.isFinite(n)||!Number.isFinite(t)||!Number.isFinite(e)?(console.error("所有参数必须是有限的数字"),""):t===0?(console.error("分母不能为零"),""):e<0?(console.error("小数位数不能为负数"),""):(n/t*100).toFixed(e)+"%"}function ze(n,t,e){return Math.abs(n-t)<=e}function Ne(n,t=500){let e;function o(r){e||(e=r);let i=Math.min((r-e)/t,1);n(i),r-e<t&&requestAnimationFrame(o)}requestAnimationFrame(o)}function Ae(n){return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function qe(n,t){const e={join:!0,suffix:"",decimalPlaces:2},{join:o,suffix:r,decimalPlaces:i}={...e,...t||{}},s=Number(n);if(isNaN(s))return o?`0${r}`:[0,r];const a=Math.abs(s),m=s>=0,u=Math.max(0,Math.floor(Math.log10(a)/4)),f=Math.pow(1e4,u),g=a/f,N=(m?1:-1)*parseFloat(g.toFixed(Math.max(0,i)));return o?`${N}${Z[u]}${r}`:[N,Z[u]+r]}function Be(n,t){let e=!1;const{x:o,y:r}=n,i=t.length;for(let s=0,a=i-1;s<i;a=s++){const m=t[s].x,u=t[s].y,f=t[a].x,g=t[a].y;u>r!=g>r&&o<(f-m)*(r-u)/(g-u)+m&&(e=!e)}return e}function $e(n){const t=["B","KB","MB","GB","TB","PB"];let e=0;for(;n>1024;)n/=1024,e++;return`${Math.round(n*100)/100} ${t[e]}`}class P{constructor(t,e){y(this,"resolve");y(this,"reject");this.resolve=t,this.reject=e}run(t){var e,o;return t instanceof Promise?t.then(r=>{var i;return(i=this.resolve)==null||i.call(this),r}).catch(r=>{var i;return(i=this.reject)==null||i.call(this),Promise.reject(r)}):t?(e=this.resolve)==null||e.call(this):(o=this.reject)==null||o.call(this),t}}class Ye extends P{constructor(t){super(),this.resolve=t}warning(...t){const e=()=>{var o,r;return(r=(o=R.tips).warning)==null?void 0:r.call(o,...t)};return new P(this.resolve,e)}error(...t){const e=()=>{var o,r;return(r=(o=R.tips).error)==null?void 0:r.call(o,...t)};return new P(this.resolve,e)}}class We extends P{constructor(t){super(),this.reject=t}info(...t){const e=()=>{var o,r;return(r=(o=R.tips).info)==null?void 0:r.call(o,...t)};return new P(e,this.reject)}success(...t){const e=()=>{var o,r;return(r=(o=R.tips).success)==null?void 0:r.call(o,...t)};return new P(e,this.reject)}}const h=class h{constructor(){if(new.target===h)throw new Error("请直接使用静态方法,而不是实例化此类")}static register(t,e){if(typeof e!="function")return console.error("TipHandler must be a function");h.tips[t]=e}static resolveTip(t){return function(...e){const o=()=>{var r,i;return(i=(r=h.tips)[t])==null?void 0:i.call(r,...e)};return new Ye(o)}}static rejectTip(t){return function(...e){const o=()=>{var r,i;return(i=(r=h.tips)[t])==null?void 0:i.call(r,...e)};return new We(o)}}};y(h,"tips",{info:void 0,success:void 0,warning:void 0,error:void 0}),y(h,"info",h.resolveTip("info")),y(h,"success",h.resolveTip("success")),y(h,"warning",h.rejectTip("warning")),y(h,"error",h.rejectTip("error"));let R=h;exports._CalculateCanvasSize=De;exports._CapitalizeFirstLetter=me;exports._CheckConnectionWithXHR=Ee;exports._Clone=Le;exports._CloseOnOutsideClick=Re;exports._ConvertToCamelCase=ge;exports._ConvertToPercentage=Oe;exports._CopyToClipboard=be;exports._CreateAndDownloadFile=we;exports._Danger_ConvertDataToImageUrl=Me;exports._DataType=W;exports._Debounce=J;exports._DownloadFile=he;exports._Drag=Pe;exports._EnterFullscreen=K;exports._ExcludeSubstring=ue;exports._ExecuteWhenIdle=ae;exports._ExitFullscreen=Q;exports._FileTypeChecker=H;exports._FormatFileSize=$e;exports._FormatNumber=Ae;exports._FormatNumberWithUnit=qe;exports._Fullscreen=Ue;exports._GenerateUUID=ve;exports._GetFrameRate=pe;exports._GetHrefName=q;exports._GetOtherSizeInPixels=Ie;exports._GetTargetByPath=Ce;exports._InitTargetByPath=ye;exports._IsFullscreen=ee;exports._IsObject=ce;exports._IsPointInPolygon=Be;exports._IsSecureContext=Fe;exports._IsWithinErrorMargin=ze;exports._KeyedWindowManager=X;exports._LoadImage=Se;exports._LocalDrag=ke;exports._MergeObjects=A;exports._NotNull=se;exports._ReadFile=fe;exports._RotateList=Te;exports._Schedule=Ne;exports._ScrollEndListener=je;exports._Throttle=xe;exports._TimeTransition=de;exports._Tip=R;exports._UpdateTargetByPath=_e;exports._WaitForCondition=le;
2
+ "use strict";var oe=Object.defineProperty;var G=n=>{throw TypeError(n)};var re=(n,t,e)=>t in n?oe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var y=(n,t,e)=>re(n,typeof t!="symbol"?t+"":t,e),V=(n,t,e)=>t.has(n)||G("Cannot "+e);var s=(n,t,e)=>(V(n,t,"read from private field"),e?e.call(n):t.get(n)),d=(n,t,e)=>t.has(n)?G("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),l=(n,t,e,o)=>(V(n,t,"write to private field"),o?o.call(n,e):t.set(n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie={".mp3":"audio/mpeg",".mp4":"video/mp4",".m4a":"audio/mp4",".aac":"audio/aac",".ogg":"audio/ogg",".wav":"audio/wav",".flac":"audio/flac",".opus":"audio/opus",".webm":"video/webm",".avi":"video/x-msvideo",".mov":"video/quicktime",".wmv":"video/x-ms-wmv",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".bmp":"image/bmp",".tiff":"image/tiff",".ico":"image/vnd.microsoft.icon",".svg":"image/svg+xml",".webp":"image/webp",".heif":"image/heif",".heic":"image/heic",".json":"application/json",".xml":"application/xml",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".ts":"application/typescript",".csv":"text/csv",".tsv":"text/tab-separated-values",".txt":"text/plain",".md":"text/markdown",".rtf":"application/rtf",".pdf":"application/pdf",".zip":"application/zip",".rar":"application/x-rar-compressed",".tar":"application/x-tar",".gz":"application/gzip",".7z":"application/x-7z-compressed",".exe":"application/x-msdownload",".apk":"application/vnd.android.package-archive",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".odt":"application/vnd.oasis.opendocument.text",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odp":"application/vnd.oasis.opendocument.presentation",".jsonld":"application/ld+json",".yaml":"application/x-yaml",".yml":"application/x-yaml",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".map":"application/json"},Y={image:[".jpg",".jpeg",".png",".gif",".bmp",".webp",".tiff",".svg",".heif",".heic",".ico",".raw",".jfif",".avif",".png8",".indd",".eps",".ai"],ppt:[".ppt",".pptx",".odp"],word:[".doc",".docx",".odt",".rtf"],excel:[".xls",".xlsx",".ods",".csv",".tsv"],pdf:[".pdf"],text:[".txt",".csv",".md",".json",".yaml",".yml",".log",".ini",".rtf"],audio:[".mp3",".wav",".ogg",".flac",".aac",".wma",".m4a",".alac",".ape",".opus",".amr",".ra",".mid",".midi",".aiff",".pcm",".au",".wavpack",".spx"],video:[".mp4",".avi",".mkv",".mov",".wmv",".flv",".webm",".mpg",".mpeg",".3gp",".vob",".ogv",".m4v",".ts",".rm",".rmvb",".m2ts",".divx",".xvid",".swf",".f4v"],archive:[".zip",".rar",".tar",".gz",".bz2",".xz",".7z",".tar.gz",".tar.bz2",".tar.xz",".tar.lz",".tar.lzma",".cab",".iso",".dmg",".tgz",".apk",".gz2",".tar.zst"],code:[".js",".ts",".py",".java",".cpp",".c",".html",".css",".scss",".less",".sass",".php",".rb",".go",".swift",".rs",".kt",".scala",".lua",".pl",".m",".h",".xml",".json",".yaml",".yml",".toml",".vue",".ejs",".handlebars",".jinja",".dart"],font:[".woff",".woff2",".ttf",".otf",".eot",".svg",".ttc",".fnt",".fon",".otc"],database:[".sql",".sqlite",".db",".mdb",".accdb",".jsonld",".xml",".csv"],markup:[".html",".htm",".xhtml",".xml",".json",".yaml",".yml"],configuration:[".ini",".conf",".cfg",".env",".properties",".json",".toml"],logs:[".log",".err",".trace",".out"],script:[".bash",".sh",".zsh",".bat",".ps1",".vbs",".cmd",".sed",".awk",".php"]},Z=["","万","亿","兆","京","垓","秭","穰","沟","涧","正","载","极"];function se(n){return n!=null}function ce(n){return!(n===null||typeof n!="object"||Array.isArray(n))}function ae(n){if(typeof n!="function")return console.error("非函数:",n);const t=function(e){e.didTimeout||e.timeRemaining()<=0?requestIdleCallback(t):n()};requestIdleCallback(t)}function le(n,t){const e=+new Date;return new Promise((o,r)=>{const i=()=>{if(+new Date-e>=t)return r("超时");if(n())return o("完成");requestIdleCallback(i)};i()})}function ue(n,t,e=","){const o=new RegExp(`(^|${e})${t}(${e}|$)`,"g");return n.replace(o,function(r,i,c){return i===c?e:""})}function me(n){return n.charAt(0).toUpperCase()+n.slice(1)}function A(n,t,e=[],o=+new Date){if(o<+new Date-50){console.error("_MergeObjects 合并异常:疑似死循环");return}const r=W(n),i=W(t);if(r!=i)return t;if(r=="object"||r=="array"){if(e.some(([c,a])=>c==n&&a==t))return n;if(e.push([n,t]),r=="object"){for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)){const a=t[c],m=n[c],u=A(m,a,e,o);n[c]=u}return n}else if(r=="array")return t.forEach((c,a)=>{const m=c,u=n[a],f=A(u,m,e,o);n[a]=f}),n}else return t}function de(n,t="YYYY-MM-DD hh:mm:ss",e=!0){const o=new Date(n);if(isNaN(o.getTime()))return console.error("Invalid date"),"";const r={YYYY:i=>i.getFullYear(),MM:i=>i.getMonth()+1,DD:i=>i.getDate(),hh:i=>i.getHours(),mm:i=>i.getMinutes(),ss:i=>i.getSeconds(),ms:i=>i.getMilliseconds()};return t.replace(/YYYY|MM|DD|hh|mm|ss|ms/g,i=>{const c=r[i](o);return e?String(c).padStart(2,"0"):String(c)})}function fe(n){return new Promise((t,e)=>{fetch(n).then(o=>t(o.text())).catch(o=>{console.error("Error fetching :",o),e(o)})})}function q(n,t="file"){if(!n||(n=String(n).trim(),n===""))return t;const e=n.split("/");return e[e.length-1].split("?")[0]}function he(n,t){return new Promise((e,o)=>{try{t=t||q(n,"downloaded_file"),fetch(n).then(r=>(r.ok||o(`文件下载失败,状态码: ${r.status}`),r.blob())).then(r=>{const i=URL.createObjectURL(r),c=document.createElement("a");c.href=i,c.download=decodeURIComponent(t),document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(i),e(r)}).catch(o)}catch(r){o(r)}})}function pe(n,t=10){let e=0,o=t;function r(){if(o>0)o--,requestAnimationFrame(r);else{const c=(+new Date-e)/t,a=1e3/c;n(Number(a.toFixed(2)),Number(c.toFixed(2)))}}requestAnimationFrame(()=>{e=+new Date,r()})}function ge(n,t){return n=n.replace(/([^a-zA-Z][a-z])/g,e=>e.toUpperCase()),t?n.replace(/[^a-zA-Z]+/g,""):n}function we(n,t,e){if(!e){let c=t.replace(/^[^.]+./,"");c=c==t?"text/plain":"application/"+c,e={type:c}}const o=new Blob(n,e),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function xe(n=""){return n+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function J(n,t){let e;return function(...o){clearTimeout(e),e=setTimeout(()=>{n(...o),e=void 0},t)}}function ve(n,t){let e=-1/0;return function(...o){const r=performance.now();if(r-e>t){e=r;try{n(...o)}catch(i){console.error("Throttled function execution failed:",i)}}}}function W(n){return Array.isArray(n)?"array":n===null?"null":typeof n}function be(n){const t=()=>Promise.resolve(),e=a=>(console.error(a),Promise.reject(a));function o(){return navigator.clipboard.writeText(n).then(t).catch(e)}function r(){const a=document.createElement("div");a.innerText=n,document.body.appendChild(a);const m=document.createRange();m.selectNodeContents(a);const u=window.getSelection();let f=!1;return u&&(u.removeAllRanges(),u.addRange(m),f=document.execCommand("copy")),document.body.removeChild(a),f?Promise.resolve():Promise.reject()}function i(){const a=document.createElement("textarea");a.value=n,document.body.appendChild(a),a.select(),a.setSelectionRange(0,n.length);let m=!1;return document.activeElement===a&&(m=document.execCommand("Copy",!0)),document.body.removeChild(a),m?Promise.resolve():Promise.reject()}function c(){return r().then(t).catch(()=>{i().then(t).catch(()=>e("复制方式尽皆失效"))})}return navigator.clipboard?o().catch(c):c()}function ye(n,t){const e=t.split(".");return e.reduce((o,r,i)=>(r in o||(i===e.length-1?o[r]=void 0:o[r]={}),o[r]),n)}function _e(n,t){const e=t.split(".");return e.reduce((o,r,i)=>o.hasOwnProperty(r)?o[r]:o[r]=i==e.length-1?void 0:{},n)}function Ce(n,t,e){const o=t.split(".");return o.reduce((r,i,c)=>(c===o.length-1&&(r[i]=e),r[i]),n)}function Ee(n){return new Promise((t,e)=>{if(typeof n!="string"||n.trim()===""||!n.includes("://")){e(new Error("Invalid URL: Must be a non-empty string"));return}try{new XMLHttpRequest().open("HEAD",n,!0)}catch(i){e(new Error(`Invalid URL format: ${i.message}`));return}const o=new XMLHttpRequest;o.open("HEAD",n,!0);const r=i=>{e(new Error(`Request failed: ${i.type}`))};o.onreadystatechange=function(){o.readyState===XMLHttpRequest.DONE&&(o.status===0?e(new Error("Network error or CORS blocked")):o.status>=200&&o.status<300?t(!0):e(new Error(`HTTP Error: ${o.status}`)))},o.onerror=r,o.onabort=r,o.ontimeout=r;try{o.send()}catch(i){e(new Error(`Request send failed: ${i.message}`))}})}function Fe(n){return["https:","wss:","ftps:","sftp:","smpts:","smtp+tls:","imap+tls:","pop3+tls:","rdp:","vpn:"].some(e=>n.startsWith(e))}const E=class E{constructor(){if(new.target===E)throw new Error("请直接使用静态方法,而不是实例化此类")}static check(t,e){if(!t||typeof t!="string")return console.error("Invalid URL provided"),e?!1:"unknown";const o=q(t).toLowerCase();if(e){if(!Y.hasOwnProperty(e))return console.error(`Unknown file type: ${e}`),"unknown";const r=Y[e];return E._checkExtension(o,r)}return E._detectFileType(o)}static parseAddresses(t){return!t||typeof t!="string"?(console.error("Invalid URL provided"),[]):t.split(",").map(e=>{const o=q(e),r=this.check(e);return{url:e,name:o,type:r}})}static matchesMimeType(t,e){if(!e)return!0;if(typeof t!="string"||typeof e!="string")return!1;const o=E._normalizeType(t),r=e.split(",").map(a=>E._normalizeType(a.trim())),[i,c="*"]=o.split("/");return r.some(a=>{const[m,u="*"]=a.split("/");return(m==="*"||i==="*"||m===i)&&(u==="*"||c==="*"||u===c)})}static _normalizeType(t){return t.startsWith(".")&&!t.includes("/")?ie[t.toLowerCase()]||t:t.includes("/")?t:`${t}/*`}static _checkExtension(t,e){return e.some(o=>t.endsWith(o))}static _detectFileType(t){for(const[e,o]of E.cachedEntries)if(o.some(r=>t.endsWith(r)))return e;return"unknown"}};y(E,"cachedEntries",Object.entries(Y));let H=E;function Te(n){return n.map((t,e)=>n.slice(e).concat(n.slice(0,e)))}function Le(n){const t=window.structuredClone,e=o=>o===null||typeof o!="object"?o:A(Array.isArray(o)?[]:{},o);try{return t?t(n):e(n)}catch(o){return console.error("structuredClone error:",o),t&&e(n)}}const B=class B{constructor(){if(new.target===B)throw new Error("请直接使用静态方法,而不是实例化此类")}static open(t,e,o,r){const i=this.keys.get(t);if(i&&!i.closed)return i.focus(),i;{const c=window.open(e,o,r);if(c)return this.keys.set(t,c),c;console.error("window.open failed: 可能是浏览器阻止了弹出窗口"),this.keys.delete(t)}}static isOpen(t){const e=this.keys.get(t);return e!=null&&e.closed&&this.keys.delete(t),this.keys.has(t)}static getWindow(t){if(this.isOpen(t))return this.keys.get(t)}static close(t){const e=this.keys.get(t);e&&(e.close(),this.keys.delete(t))}static closeAll(){this.keys.forEach((t,e)=>t.close()),this.keys.clear()}};y(B,"keys",new Map);let X=B;function Me(n,t="image/png"){try{let e,o=t;if(n instanceof File)return URL.createObjectURL(n);if(typeof n=="string"){let i=n;const c=i.match(/^data:([^;]*)(;base64)?,(.*)$/i);if(c){if(!c[2])throw new Error("无效的数据 URL:缺少 base64 编码声明");if(o=c[1]||o,i=c[3],!i)throw new Error("数据 URL 包含空有效负载")}i=i.replace(/[^A-Za-z0-9+/=]/g,"");const a=atob(i);e=new Uint8Array(a.length);for(let m=0;m<a.length;m++)e[m]=a.charCodeAt(m)}else if(n instanceof ArrayBuffer)e=new Uint8Array(n);else if(n instanceof Uint8Array)e=n;else throw new Error("不支持的数据类型。应为 Base64 字符串、ArrayBuffer 或 Uint8Array");const r=new Blob([e],{type:o});return URL.createObjectURL(r)}catch(e){return console.error("数据到 ImageURL 的转换失败:",e.message,e.stack||"没有可用的堆栈跟踪"),null}}function je(n){const t=J(n,100);let e=0,o=0;return function(r){const i=r.target;if(!i||!(i instanceof HTMLElement))return;const{scrollTop:c,scrollHeight:a,clientHeight:m,scrollLeft:u,scrollWidth:f,clientWidth:g}=i;function N(){if(e==c)return;const $=e>c;if(e=c,$)return;a-c-m<=1&&t("vertical")}function te(){if(o==u)return;const $=o>u;if(o=u,$)return;f-u-g<=1&&t("horizontal")}N(),te()}}function Re(n,t,e){const{isClickAllowed:o,uiLibrary:r=["naiveUI","ElementPlus","Element"]}=e||{},i=function(m){const u=[];for(const f in m)Object.hasOwnProperty.call(m,f)&&r.includes(f)&&u.push(...m[f]);return u}({naiveUI:[".v-binder-follower-container",".n-image-preview-container",".n-modal-container"],ElementPlus:[".el-popper"],Element:[".el-popper"]});function c(){t(),document.removeEventListener("mousedown",a)}function a(m){if(o){const g=o(m);if(g)return;if(g===!1)return c()}const u=m.target;if(!(u instanceof HTMLElement)||!(u!=null&&u.closest("body")))return;n.concat(i).some(g=>!!(u!=null&&u.closest(g)))||c()}requestAnimationFrame(()=>document.addEventListener("mousedown",a))}var w,T,L,k,U,_,C,F,I;class Pe{constructor(){d(this,w);d(this,T,!1);d(this,L,{});d(this,k,0);d(this,U,0);d(this,_,0);d(this,C,0);d(this,F);d(this,I)}init(t,e){l(this,w,t),l(this,F,e==null?void 0:e.limit),l(this,I,e==null?void 0:e.dragDom),l(this,L,{mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this)}),this.bindOrUnbindEvent("bind")}finish(){this.bindOrUnbindEvent("unbind")}bindOrUnbindEvent(t){const e=t==="bind"?"addEventListener":"removeEventListener";if(!s(this,w))return console.error("No DOM");s(this,w)[e]("mousedown",s(this,L).mousedown),document[e]("mousemove",s(this,L).mousemove),document[e]("mouseup",s(this,L).mouseup)}alterLocation(){if(!s(this,w))return console.error("No DOM");s(this,F)&&(l(this,_,Math.min(s(this,_),s(this,F).max.top)),l(this,_,Math.max(s(this,_),s(this,F).min.top)),l(this,C,Math.min(s(this,C),s(this,F).max.left)),l(this,C,Math.max(s(this,C),s(this,F).min.left))),s(this,w).style.setProperty("--top",s(this,_)+"px"),s(this,w).style.setProperty("--left",s(this,C)+"px")}mousedown(t){if(!s(this,w))return console.error("No DOM");if(s(this,I)&&t.target!=s(this,I))return;document.body.classList.add("no-select"),l(this,T,!0);const e=s(this,w).getBoundingClientRect(),{pageX:o,pageY:r}=t;l(this,k,o),l(this,U,r),l(this,_,e.y),l(this,C,e.x)}mousemove(t){const{pageX:e,pageY:o}=t;s(this,T)&&(l(this,_,s(this,_)+(o-s(this,U))),l(this,C,s(this,C)+(e-s(this,k))),l(this,k,e),l(this,U,o),this.alterLocation())}mouseup(){s(this,T)&&(l(this,T,!1),document.body.classList.remove("no-select"))}}w=new WeakMap,T=new WeakMap,L=new WeakMap,k=new WeakMap,U=new WeakMap,_=new WeakMap,C=new WeakMap,F=new WeakMap,I=new WeakMap;var x,M,j,D,O,v,b,p,S,z;class ke{constructor(){d(this,x);d(this,M,!1);d(this,j,{});d(this,D,0);d(this,O,0);d(this,v,0);d(this,b,0);d(this,p);d(this,S);d(this,z)}init(t,e={}){l(this,x,t),l(this,p,e.limit),l(this,S,e.update_move),l(this,z,e.update_up),l(this,j,{mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this)}),this.bindOrUnbindEvent("bind")}finish(){this.bindOrUnbindEvent("unbind")}bindOrUnbindEvent(t){const e=t==="bind"?"addEventListener":"removeEventListener";if(!s(this,x))return console.error("No DOM");s(this,x)[e]("mousedown",s(this,j).mousedown),document[e]("mousemove",s(this,j).mousemove),document[e]("mouseup",s(this,j).mouseup)}updateValue(){const t={top:s(this,v),left:s(this,b),percentage:{top:0,left:0}};if(s(this,p)){const e=o=>s(this,p)?(t[o]-s(this,p).min[o])/(s(this,p).max[o]-s(this,p).min[o]):0;t.percentage={top:e("top")||0,left:e("left")||0}}return t}alterLocation(){if(!s(this,x))return console.error("No DOM");s(this,p)&&(l(this,v,Math.min(s(this,v),s(this,p).max.top)),l(this,v,Math.max(s(this,v),s(this,p).min.top)),l(this,b,Math.min(s(this,b),s(this,p).max.left)),l(this,b,Math.max(s(this,b),s(this,p).min.left))),s(this,S)&&s(this,S).call(this,this.updateValue()),s(this,x).style.setProperty("--top",s(this,v)+"px"),s(this,x).style.setProperty("--left",s(this,b)+"px")}mousedown(t){if(!s(this,x))return console.error("No DOM");document.body.classList.add("no-select"),l(this,M,!0);const e=s(this,x).getBoundingClientRect();l(this,O,e.y),l(this,D,e.x);const{pageX:o,pageY:r}=t;l(this,v,r-s(this,O)),l(this,b,o-s(this,D)),this.alterLocation()}mousemove(t){const{pageX:e,pageY:o}=t;s(this,M)&&(l(this,v,o-s(this,O)),l(this,b,e-s(this,D)),this.alterLocation())}mouseup(){s(this,M)&&(l(this,M,!1),document.body.classList.remove("no-select"),s(this,z)&&s(this,z).call(this,this.updateValue()))}}x=new WeakMap,M=new WeakMap,j=new WeakMap,D=new WeakMap,O=new WeakMap,v=new WeakMap,b=new WeakMap,p=new WeakMap,S=new WeakMap,z=new WeakMap;function K(n){const t=n;if(n){if(n.requestFullscreen)return n.requestFullscreen();if(t.mozRequestFullScreen)return t.mozRequestFullScreen();if(t.webkitRequestFullscreen)return t.webkitRequestFullscreen();if(t.msRequestFullscreen)return t.msRequestFullscreen()}else return Promise.reject("No DOM");return Promise.reject("No Fullscreen API")}function Q(){const n=document;return document.exitFullscreen?document.exitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.webkitExitFullscreen?n.webkitExitFullscreen():n.msExitFullscreen?n.msExitFullscreen():Promise.reject("No ExitFullscreen API")}function ee(){const n=document;return document.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement}function Ue(n){return function(){ee()?Q():K(n)}}function Ie(n,t){if(typeof n=="number")return n;if(/px/.test(n))return Number(n.replace(/px/,""))||0;const e=document.createElement("div");e.style.width=n,t=t||document.body,t.appendChild(e);const o=e.getBoundingClientRect().width;return t.removeChild(e),o}function De(n,t){if(!n)return;let e,o;if(typeof t=="string"){const i=document.querySelector(t);if(!i)return;const c=i.getBoundingClientRect();e=c.width,o=c.height}else if(Array.isArray(t))e=t[0],o=t[1];else{const i=t.getBoundingClientRect();e=i.width,o=i.height}const r=e/o;return r>n?[n*o,o]:r<n?[e,e/n]:[e,o]}function Oe(n,t=5e3){return new Promise((e,o)=>{const r=new Image;r.src=n;const i=setTimeout(()=>{o(new Error("图片加载超时")),r.onload=null,r.onerror=null},t);r.onload=()=>{clearTimeout(i);const c=r.naturalWidth,a=r.naturalHeight,m=c/a;e([r,m])},r.onerror=()=>{clearTimeout(i),o(new Error("图片加载失败"))},r.crossOrigin="Anonymous"})}function Se(n,t,e=2){return!Number.isFinite(n)||!Number.isFinite(t)||!Number.isFinite(e)?(console.error("所有参数必须是有限的数字"),""):t===0?(console.error("分母不能为零"),""):e<0?(console.error("小数位数不能为负数"),""):(n/t*100).toFixed(e)+"%"}function ze(n,t,e){return Math.abs(n-t)<=e}function Ne(n,t=500){let e;function o(r){e||(e=r);let i=Math.min((r-e)/t,1);n(i),r-e<t&&requestAnimationFrame(o)}requestAnimationFrame(o)}function Ae(n){return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function qe(n,t){const e={join:!0,suffix:"",decimalPlaces:2},{join:o,suffix:r,decimalPlaces:i}={...e,...t||{}},c=Number(n);if(isNaN(c))return o?`0${r}`:[0,r];const a=Math.abs(c),m=c>=0,u=Math.max(0,Math.floor(Math.log10(a)/4)),f=Math.pow(1e4,u),g=a/f,N=(m?1:-1)*parseFloat(g.toFixed(Math.max(0,i)));return o?`${N}${Z[u]}${r}`:[N,Z[u]+r]}function Be(n,t){let e=!1;const{x:o,y:r}=n,i=t.length;for(let c=0,a=i-1;c<i;a=c++){const m=t[c].x,u=t[c].y,f=t[a].x,g=t[a].y;u>r!=g>r&&o<(f-m)*(r-u)/(g-u)+m&&(e=!e)}return e}function $e(n){const t=["B","KB","MB","GB","TB","PB"];let e=0;for(;n>1024;)n/=1024,e++;return`${Math.round(n*100)/100} ${t[e]}`}class P{constructor(t,e){y(this,"resolve");y(this,"reject");this.resolve=t,this.reject=e}run(t){var e,o;return t instanceof Promise?t.then(r=>{var i;return(i=this.resolve)==null||i.call(this),r}).catch(r=>{var i;return(i=this.reject)==null||i.call(this),Promise.reject(r)}):t?(e=this.resolve)==null||e.call(this):(o=this.reject)==null||o.call(this),t}}class Ye extends P{constructor(t){super(),this.resolve=t}warning(...t){const e=()=>{var o,r;return(r=(o=R.tips).warning)==null?void 0:r.call(o,...t)};return new P(this.resolve,e)}error(...t){const e=()=>{var o,r;return(r=(o=R.tips).error)==null?void 0:r.call(o,...t)};return new P(this.resolve,e)}}class We extends P{constructor(t){super(),this.reject=t}info(...t){const e=()=>{var o,r;return(r=(o=R.tips).info)==null?void 0:r.call(o,...t)};return new P(e,this.reject)}success(...t){const e=()=>{var o,r;return(r=(o=R.tips).success)==null?void 0:r.call(o,...t)};return new P(e,this.reject)}}const h=class h{constructor(){if(new.target===h)throw new Error("请直接使用静态方法,而不是实例化此类")}static register(t,e){if(typeof e!="function")return console.error("TipHandler must be a function");h.tips[t]=e}static resolveTip(t){return function(...e){const o=()=>{var r,i;return(i=(r=h.tips)[t])==null?void 0:i.call(r,...e)};return new Ye(o)}}static rejectTip(t){return function(...e){const o=()=>{var r,i;return(i=(r=h.tips)[t])==null?void 0:i.call(r,...e)};return new We(o)}}};y(h,"tips",{info:void 0,success:void 0,warning:void 0,error:void 0}),y(h,"info",h.resolveTip("info")),y(h,"success",h.resolveTip("success")),y(h,"warning",h.rejectTip("warning")),y(h,"error",h.rejectTip("error"));let R=h;exports._CalculateCanvasSize=De;exports._CapitalizeFirstLetter=me;exports._CheckConnectionWithXHR=Ee;exports._Clone=Le;exports._CloseOnOutsideClick=Re;exports._ConvertToCamelCase=ge;exports._ConvertToPercentage=Se;exports._CopyToClipboard=be;exports._CreateAndDownloadFile=we;exports._Danger_ConvertDataToImageUrl=Me;exports._DataType=W;exports._Debounce=J;exports._DownloadFile=he;exports._Drag=Pe;exports._EnterFullscreen=K;exports._ExcludeSubstring=ue;exports._ExecuteWhenIdle=ae;exports._ExitFullscreen=Q;exports._FileTypeChecker=H;exports._FormatFileSize=$e;exports._FormatNumber=Ae;exports._FormatNumberWithUnit=qe;exports._Fullscreen=Ue;exports._GenerateUUID=xe;exports._GetFrameRate=pe;exports._GetHrefName=q;exports._GetOtherSizeInPixels=Ie;exports._GetTargetByPath=_e;exports._InitTargetByPath=ye;exports._IsFullscreen=ee;exports._IsObject=ce;exports._IsPointInPolygon=Be;exports._IsSecureContext=Fe;exports._IsWithinErrorMargin=ze;exports._KeyedWindowManager=X;exports._LoadImage=Oe;exports._LocalDrag=ke;exports._MergeObjects=A;exports._NotNull=se;exports._ReadFile=fe;exports._RotateList=Te;exports._Schedule=Ne;exports._ScrollEndListener=je;exports._Throttle=ve;exports._TimeTransition=de;exports._Tip=R;exports._UpdateTargetByPath=Ce;exports._WaitForCondition=le;
package/dist/index.es.js CHANGED
@@ -5,7 +5,7 @@ var H = (n) => {
5
5
  };
6
6
  var ee = (n, t, e) => t in n ? K(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
7
7
  var y = (n, t, e) => ee(n, typeof t != "symbol" ? t + "" : t, e), X = (n, t, e) => t.has(n) || H("Cannot " + e);
8
- var c = (n, t, e) => (X(n, t, "read from private field"), e ? e.call(n) : t.get(n)), d = (n, t, e) => t.has(n) ? H("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), l = (n, t, e, o) => (X(n, t, "write to private field"), o ? o.call(n, e) : t.set(n, e), e);
8
+ var s = (n, t, e) => (X(n, t, "read from private field"), e ? e.call(n) : t.get(n)), d = (n, t, e) => t.has(n) ? H("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), l = (n, t, e, o) => (X(n, t, "write to private field"), o ? o.call(n, e) : t.set(n, e), e);
9
9
  const te = {
10
10
  /* 常见扩展名映射 */
11
11
  ".mp3": "audio/mpeg",
@@ -295,8 +295,8 @@ function fe(n, t, e = ",") {
295
295
  `(^|${e})${t}(${e}|$)`,
296
296
  "g"
297
297
  );
298
- return n.replace(o, function(r, i, s) {
299
- return i === s ? e : "";
298
+ return n.replace(o, function(r, i, c) {
299
+ return i === c ? e : "";
300
300
  });
301
301
  }
302
302
  function he(n) {
@@ -310,17 +310,17 @@ function Y(n, t, e = [], o = +/* @__PURE__ */ new Date()) {
310
310
  const r = G(n), i = G(t);
311
311
  if (r != i) return t;
312
312
  if (r == "object" || r == "array") {
313
- if (e.some(([s, a]) => s == n && a == t)) return n;
313
+ if (e.some(([c, a]) => c == n && a == t)) return n;
314
314
  if (e.push([n, t]), r == "object") {
315
- for (const s in t)
316
- if (Object.prototype.hasOwnProperty.call(t, s)) {
317
- const a = t[s], m = n[s], u = Y(m, a, e, o);
318
- n[s] = u;
315
+ for (const c in t)
316
+ if (Object.prototype.hasOwnProperty.call(t, c)) {
317
+ const a = t[c], m = n[c], u = Y(m, a, e, o);
318
+ n[c] = u;
319
319
  }
320
320
  return n;
321
321
  } else if (r == "array")
322
- return t.forEach((s, a) => {
323
- const m = s, u = n[a], f = Y(u, m, e, o);
322
+ return t.forEach((c, a) => {
323
+ const m = c, u = n[a], f = Y(u, m, e, o);
324
324
  n[a] = f;
325
325
  }), n;
326
326
  } else return t;
@@ -340,8 +340,8 @@ function pe(n, t = "YYYY-MM-DD hh:mm:ss", e = !0) {
340
340
  ms: (i) => i.getMilliseconds()
341
341
  };
342
342
  return t.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (i) => {
343
- const s = r[i](o);
344
- return e ? String(s).padStart(2, "0") : String(s);
343
+ const c = r[i](o);
344
+ return e ? String(c).padStart(2, "0") : String(c);
345
345
  });
346
346
  }
347
347
  function ge(n) {
@@ -360,8 +360,8 @@ function we(n, t) {
360
360
  return new Promise((e, o) => {
361
361
  try {
362
362
  t = t || B(n, "downloaded_file"), fetch(n).then((r) => (r.ok || o(`文件下载失败,状态码: ${r.status}`), r.blob())).then((r) => {
363
- const i = URL.createObjectURL(r), s = document.createElement("a");
364
- s.href = i, s.download = decodeURIComponent(t), document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(i), e(r);
363
+ const i = URL.createObjectURL(r), c = document.createElement("a");
364
+ c.href = i, c.download = decodeURIComponent(t), document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(i), e(r);
365
365
  }).catch(o);
366
366
  } catch (r) {
367
367
  o(r);
@@ -374,8 +374,8 @@ function xe(n, t = 10) {
374
374
  if (o > 0)
375
375
  o--, requestAnimationFrame(r);
376
376
  else {
377
- const s = (+/* @__PURE__ */ new Date() - e) / t, a = 1e3 / s;
378
- n(Number(a.toFixed(2)), Number(s.toFixed(2)));
377
+ const c = (+/* @__PURE__ */ new Date() - e) / t, a = 1e3 / c;
378
+ n(Number(a.toFixed(2)), Number(c.toFixed(2)));
379
379
  }
380
380
  }
381
381
  requestAnimationFrame(() => {
@@ -387,8 +387,8 @@ function ve(n, t) {
387
387
  }
388
388
  function be(n, t, e) {
389
389
  if (!e) {
390
- let s = t.replace(/^[^.]+./, "");
391
- s = s == t ? "text/plain" : "application/" + s, e = { type: s };
390
+ let c = t.replace(/^[^.]+./, "");
391
+ c = c == t ? "text/plain" : "application/" + c, e = { type: c };
392
392
  }
393
393
  const o = new Blob(n, e), r = URL.createObjectURL(o), i = document.createElement("a");
394
394
  i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
@@ -444,12 +444,12 @@ function Ce(n) {
444
444
  let m = !1;
445
445
  return document.activeElement === a && (m = document.execCommand("Copy", !0)), document.body.removeChild(a), m ? Promise.resolve() : Promise.reject();
446
446
  }
447
- function s() {
447
+ function c() {
448
448
  return r().then(t).catch(() => {
449
449
  i().then(t).catch(() => e("复制方式尽皆失效"));
450
450
  });
451
451
  }
452
- return navigator.clipboard ? o().catch(s) : s();
452
+ return navigator.clipboard ? o().catch(c) : c();
453
453
  }
454
454
  function Fe(n, t) {
455
455
  const e = t.split(".");
@@ -461,7 +461,7 @@ function Le(n, t) {
461
461
  }
462
462
  function je(n, t, e) {
463
463
  const o = t.split(".");
464
- return o.reduce((r, i, s) => (s === o.length - 1 && (r[i] = e), r[i]), n);
464
+ return o.reduce((r, i, c) => (c === o.length - 1 && (r[i] = e), r[i]), n);
465
465
  }
466
466
  function Me(n) {
467
467
  return new Promise((t, e) => {
@@ -554,10 +554,10 @@ const F = class F {
554
554
  static matchesMimeType(t, e) {
555
555
  if (!e) return !0;
556
556
  if (typeof t != "string" || typeof e != "string") return !1;
557
- const o = F._normalizeType(t), r = e.split(",").map((a) => F._normalizeType(a.trim())), [i, s = "*"] = o.split("/");
557
+ const o = F._normalizeType(t), r = e.split(",").map((a) => F._normalizeType(a.trim())), [i, c = "*"] = o.split("/");
558
558
  return r.some((a) => {
559
559
  const [m, u = "*"] = a.split("/");
560
- return (m === "*" || i === "*" || m === i) && (u === "*" || s === "*" || u === s);
560
+ return (m === "*" || i === "*" || m === i) && (u === "*" || c === "*" || u === c);
561
561
  });
562
562
  }
563
563
  /**
@@ -628,20 +628,12 @@ const N = class N {
628
628
  if (i && !i.closed)
629
629
  return i.focus(), i;
630
630
  {
631
- const s = window.open(e, o, r);
632
- if (s)
633
- return this.keys.set(t, s), s.addEventListener("unload", () => this.keys.delete(t)), s;
631
+ const c = window.open(e, o, r);
632
+ if (c)
633
+ return this.keys.set(t, c), c;
634
634
  console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(t);
635
635
  }
636
636
  }
637
- /**
638
- * 关闭与指定键关联的窗口
639
- * @param key 窗口的唯一键
640
- */
641
- static close(t) {
642
- const e = this.keys.get(t);
643
- e && !e.closed && (e.close(), this.keys.delete(t));
644
- }
645
637
  /**
646
638
  * 检查指定键的窗口是否打开
647
639
  * @param key 窗口的唯一键
@@ -649,7 +641,7 @@ const N = class N {
649
641
  */
650
642
  static isOpen(t) {
651
643
  const e = this.keys.get(t);
652
- return !!e && !e.closed;
644
+ return e != null && e.closed && this.keys.delete(t), this.keys.has(t);
653
645
  }
654
646
  /**
655
647
  * 获取与指定键关联的窗口
@@ -657,16 +649,21 @@ const N = class N {
657
649
  * @returns 返回对应的窗口,如果窗口已关闭则返回undefined
658
650
  */
659
651
  static getWindow(t) {
652
+ if (this.isOpen(t)) return this.keys.get(t);
653
+ }
654
+ /**
655
+ * 关闭与指定键关联的窗口
656
+ * @param key 窗口的唯一键
657
+ */
658
+ static close(t) {
660
659
  const e = this.keys.get(t);
661
- if (e && !e.closed) return e;
660
+ e && (e.close(), this.keys.delete(t));
662
661
  }
663
662
  /**
664
663
  * 关闭所有打开的窗口并清空Map
665
664
  */
666
665
  static closeAll() {
667
- this.keys.forEach((t, e) => {
668
- t.closed || t.close(), this.keys.delete(e);
669
- });
666
+ this.keys.forEach((t, e) => t.close()), this.keys.clear();
670
667
  }
671
668
  };
672
669
  // 存储键与对应窗口的Map
@@ -679,11 +676,11 @@ function Ue(n, t = "image/png") {
679
676
  return URL.createObjectURL(n);
680
677
  if (typeof n == "string") {
681
678
  let i = n;
682
- const s = i.match(/^data:([^;]*)(;base64)?,(.*)$/i);
683
- if (s) {
684
- if (!s[2])
679
+ const c = i.match(/^data:([^;]*)(;base64)?,(.*)$/i);
680
+ if (c) {
681
+ if (!c[2])
685
682
  throw new Error("无效的数据 URL:缺少 base64 编码声明");
686
- if (o = s[1] || o, i = s[3], !i)
683
+ if (o = c[1] || o, i = c[3], !i)
687
684
  throw new Error("数据 URL 包含空有效负载");
688
685
  }
689
686
  i = i.replace(/[^A-Za-z0-9+/=]/g, "");
@@ -716,7 +713,7 @@ function Pe(n) {
716
713
  const i = r.target;
717
714
  if (!i || !(i instanceof HTMLElement)) return;
718
715
  const {
719
- scrollTop: s,
716
+ scrollTop: c,
720
717
  scrollHeight: a,
721
718
  clientHeight: m,
722
719
  scrollLeft: u,
@@ -724,10 +721,10 @@ function Pe(n) {
724
721
  clientWidth: g
725
722
  } = i;
726
723
  function A() {
727
- if (e == s) return;
728
- const q = e > s;
729
- if (e = s, q) return;
730
- a - s - m <= 1 && t("vertical");
724
+ if (e == c) return;
725
+ const q = e > c;
726
+ if (e = c, q) return;
727
+ a - c - m <= 1 && t("vertical");
731
728
  }
732
729
  function J() {
733
730
  if (o == u) return;
@@ -753,18 +750,18 @@ function ze(n, t, e) {
753
750
  ElementPlus: [".el-popper"],
754
751
  Element: [".el-popper"]
755
752
  });
756
- function s() {
753
+ function c() {
757
754
  t(), document.removeEventListener("mousedown", a);
758
755
  }
759
756
  function a(m) {
760
757
  if (o) {
761
758
  const g = o(m);
762
759
  if (g) return;
763
- if (g === !1) return s();
760
+ if (g === !1) return c();
764
761
  }
765
762
  const u = m.target;
766
763
  if (!(u instanceof HTMLElement) || !(u != null && u.closest("body"))) return;
767
- n.concat(i).some((g) => !!(u != null && u.closest(g))) || s();
764
+ n.concat(i).some((g) => !!(u != null && u.closest(g))) || c();
768
765
  }
769
766
  requestAnimationFrame(
770
767
  () => document.addEventListener("mousedown", a)
@@ -795,26 +792,26 @@ class De {
795
792
  }
796
793
  bindOrUnbindEvent(t) {
797
794
  const e = t === "bind" ? "addEventListener" : "removeEventListener";
798
- if (!c(this, w)) return console.error("No DOM");
799
- c(this, w)[e]("mousedown", c(this, M).mousedown), document[e]("mousemove", c(this, M).mousemove), document[e]("mouseup", c(this, M).mouseup);
795
+ if (!s(this, w)) return console.error("No DOM");
796
+ s(this, w)[e]("mousedown", s(this, M).mousedown), document[e]("mousemove", s(this, M).mousemove), document[e]("mouseup", s(this, M).mouseup);
800
797
  }
801
798
  alterLocation() {
802
- if (!c(this, w)) return console.error("No DOM");
803
- c(this, L) && (l(this, E, Math.min(c(this, E), c(this, L).max.top)), l(this, E, Math.max(c(this, E), c(this, L).min.top)), l(this, C, Math.min(c(this, C), c(this, L).max.left)), l(this, C, Math.max(c(this, C), c(this, L).min.left))), c(this, w).style.setProperty("--top", c(this, E) + "px"), c(this, w).style.setProperty("--left", c(this, C) + "px");
799
+ if (!s(this, w)) return console.error("No DOM");
800
+ s(this, L) && (l(this, E, Math.min(s(this, E), s(this, L).max.top)), l(this, E, Math.max(s(this, E), s(this, L).min.top)), l(this, C, Math.min(s(this, C), s(this, L).max.left)), l(this, C, Math.max(s(this, C), s(this, L).min.left))), s(this, w).style.setProperty("--top", s(this, E) + "px"), s(this, w).style.setProperty("--left", s(this, C) + "px");
804
801
  }
805
802
  mousedown(t) {
806
- if (!c(this, w)) return console.error("No DOM");
807
- if (c(this, z) && t.target != c(this, z)) return;
803
+ if (!s(this, w)) return console.error("No DOM");
804
+ if (s(this, z) && t.target != s(this, z)) return;
808
805
  document.body.classList.add("no-select"), l(this, j, !0);
809
- const e = c(this, w).getBoundingClientRect(), { pageX: o, pageY: r } = t;
806
+ const e = s(this, w).getBoundingClientRect(), { pageX: o, pageY: r } = t;
810
807
  l(this, U, o), l(this, P, r), l(this, E, e.y), l(this, C, e.x);
811
808
  }
812
809
  mousemove(t) {
813
810
  const { pageX: e, pageY: o } = t;
814
- c(this, j) && (l(this, E, c(this, E) + (o - c(this, P))), l(this, C, c(this, C) + (e - c(this, U))), l(this, U, e), l(this, P, o), this.alterLocation());
811
+ s(this, j) && (l(this, E, s(this, E) + (o - s(this, P))), l(this, C, s(this, C) + (e - s(this, U))), l(this, U, e), l(this, P, o), this.alterLocation());
815
812
  }
816
813
  mouseup() {
817
- c(this, j) && (l(this, j, !1), document.body.classList.remove("no-select"));
814
+ s(this, j) && (l(this, j, !1), document.body.classList.remove("no-select"));
818
815
  }
819
816
  }
820
817
  w = new WeakMap(), j = new WeakMap(), M = new WeakMap(), U = new WeakMap(), P = new WeakMap(), E = new WeakMap(), C = new WeakMap(), L = new WeakMap(), z = new WeakMap();
@@ -844,17 +841,17 @@ class Ie {
844
841
  }
845
842
  bindOrUnbindEvent(t) {
846
843
  const e = t === "bind" ? "addEventListener" : "removeEventListener";
847
- if (!c(this, x)) return console.error("No DOM");
848
- c(this, x)[e]("mousedown", c(this, T).mousedown), document[e]("mousemove", c(this, T).mousemove), document[e]("mouseup", c(this, T).mouseup);
844
+ if (!s(this, x)) return console.error("No DOM");
845
+ s(this, x)[e]("mousedown", s(this, T).mousedown), document[e]("mousemove", s(this, T).mousemove), document[e]("mouseup", s(this, T).mouseup);
849
846
  }
850
847
  updateValue() {
851
848
  const t = {
852
- top: c(this, v),
853
- left: c(this, b),
849
+ top: s(this, v),
850
+ left: s(this, b),
854
851
  percentage: { top: 0, left: 0 }
855
852
  };
856
- if (c(this, p)) {
857
- const e = (o) => c(this, p) ? (t[o] - c(this, p).min[o]) / (c(this, p).max[o] - c(this, p).min[o]) : 0;
853
+ if (s(this, p)) {
854
+ const e = (o) => s(this, p) ? (t[o] - s(this, p).min[o]) / (s(this, p).max[o] - s(this, p).min[o]) : 0;
858
855
  t.percentage = {
859
856
  top: e("top") || 0,
860
857
  left: e("left") || 0
@@ -863,23 +860,23 @@ class Ie {
863
860
  return t;
864
861
  }
865
862
  alterLocation() {
866
- if (!c(this, x)) return console.error("No DOM");
867
- c(this, p) && (l(this, v, Math.min(c(this, v), c(this, p).max.top)), l(this, v, Math.max(c(this, v), c(this, p).min.top)), l(this, b, Math.min(c(this, b), c(this, p).max.left)), l(this, b, Math.max(c(this, b), c(this, p).min.left))), c(this, O) && c(this, O).call(this, this.updateValue()), c(this, x).style.setProperty("--top", c(this, v) + "px"), c(this, x).style.setProperty("--left", c(this, b) + "px");
863
+ if (!s(this, x)) return console.error("No DOM");
864
+ s(this, p) && (l(this, v, Math.min(s(this, v), s(this, p).max.top)), l(this, v, Math.max(s(this, v), s(this, p).min.top)), l(this, b, Math.min(s(this, b), s(this, p).max.left)), l(this, b, Math.max(s(this, b), s(this, p).min.left))), s(this, O) && s(this, O).call(this, this.updateValue()), s(this, x).style.setProperty("--top", s(this, v) + "px"), s(this, x).style.setProperty("--left", s(this, b) + "px");
868
865
  }
869
866
  mousedown(t) {
870
- if (!c(this, x)) return console.error("No DOM");
867
+ if (!s(this, x)) return console.error("No DOM");
871
868
  document.body.classList.add("no-select"), l(this, R, !0);
872
- const e = c(this, x).getBoundingClientRect();
869
+ const e = s(this, x).getBoundingClientRect();
873
870
  l(this, I, e.y), l(this, D, e.x);
874
871
  const { pageX: o, pageY: r } = t;
875
- l(this, v, r - c(this, I)), l(this, b, o - c(this, D)), this.alterLocation();
872
+ l(this, v, r - s(this, I)), l(this, b, o - s(this, D)), this.alterLocation();
876
873
  }
877
874
  mousemove(t) {
878
875
  const { pageX: e, pageY: o } = t;
879
- c(this, R) && (l(this, v, o - c(this, I)), l(this, b, e - c(this, D)), this.alterLocation());
876
+ s(this, R) && (l(this, v, o - s(this, I)), l(this, b, e - s(this, D)), this.alterLocation());
880
877
  }
881
878
  mouseup() {
882
- c(this, R) && (l(this, R, !1), document.body.classList.remove("no-select"), c(this, _) && c(this, _).call(this, this.updateValue()));
879
+ s(this, R) && (l(this, R, !1), document.body.classList.remove("no-select"), s(this, _) && s(this, _).call(this, this.updateValue()));
883
880
  }
884
881
  }
885
882
  x = new WeakMap(), R = new WeakMap(), T = new WeakMap(), D = new WeakMap(), I = new WeakMap(), v = new WeakMap(), b = new WeakMap(), p = new WeakMap(), O = new WeakMap(), _ = new WeakMap();
@@ -924,8 +921,8 @@ function Se(n, t) {
924
921
  if (typeof t == "string") {
925
922
  const i = document.querySelector(t);
926
923
  if (!i) return;
927
- const s = i.getBoundingClientRect();
928
- e = s.width, o = s.height;
924
+ const c = i.getBoundingClientRect();
925
+ e = c.width, o = c.height;
929
926
  } else if (Array.isArray(t))
930
927
  e = t[0], o = t[1];
931
928
  else {
@@ -944,7 +941,7 @@ function Ae(n, t = 5e3) {
944
941
  }, t);
945
942
  r.onload = () => {
946
943
  clearTimeout(i);
947
- const s = r.naturalWidth, a = r.naturalHeight, m = s / a;
944
+ const c = r.naturalWidth, a = r.naturalHeight, m = c / a;
948
945
  e([r, m]);
949
946
  }, r.onerror = () => {
950
947
  clearTimeout(i), o(new Error("图片加载失败"));
@@ -977,16 +974,16 @@ function Be(n, t) {
977
974
  }, { join: o, suffix: r, decimalPlaces: i } = {
978
975
  ...e,
979
976
  ...t || {}
980
- }, s = Number(n);
981
- if (isNaN(s)) return o ? `0${r}` : [0, r];
982
- const a = Math.abs(s), m = s >= 0, u = Math.max(0, Math.floor(Math.log10(a) / 4)), f = Math.pow(1e4, u), g = a / f, A = (m ? 1 : -1) * parseFloat(g.toFixed(Math.max(0, i)));
977
+ }, c = Number(n);
978
+ if (isNaN(c)) return o ? `0${r}` : [0, r];
979
+ const a = Math.abs(c), m = c >= 0, u = Math.max(0, Math.floor(Math.log10(a) / 4)), f = Math.pow(1e4, u), g = a / f, A = (m ? 1 : -1) * parseFloat(g.toFixed(Math.max(0, i)));
983
980
  return o ? `${A}${W[u]}${r}` : [A, W[u] + r];
984
981
  }
985
982
  function He(n, t) {
986
983
  let e = !1;
987
984
  const { x: o, y: r } = n, i = t.length;
988
- for (let s = 0, a = i - 1; s < i; a = s++) {
989
- const m = t[s].x, u = t[s].y, f = t[a].x, g = t[a].y;
985
+ for (let c = 0, a = i - 1; c < i; a = c++) {
986
+ const m = t[c].x, u = t[c].y, f = t[a].x, g = t[a].y;
990
987
  u > r != g > r && o < (f - m) * (r - u) / (g - u) + m && (e = !e);
991
988
  }
992
989
  return e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhanh-pure-function",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "纯函数工具",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",