toolset.io
Version:
3 lines (2 loc) • 41.7 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).toolset={})}(this,(function(t){"use strict";const e="undefined"!=typeof window,n=e&&window?.navigator?.userAgent&&/iP(ad|hone|od)/.test(window.navigator.userAgent),r=Object.prototype.toString,o=Object.prototype.hasOwnProperty;function a(t,e){return r.call(t)===`[object ${e}]`}function i(t){return null!=t}function s(t){return null==t}function c(t){return Number.isNaN(t)}function u(t){return"string"==typeof t}function f(t){return a(t,"Object")}function l(t){return"function"==typeof t}function d(t){return i(t)&&"function"==typeof t[Symbol.iterator]}function h(){}function g(){return!0}function p(t){return Object.prototype.toString.call(t).slice(8,-1)}class m{static set(t,e,n){const r=b(e);let o=y(t);return o||(o=Object.create(null)),!!f(o)&&(r.length>0&&(o=w(r,o,n),v(t,o)))}static get(t,e){const n=b(e),r=y(t);return n.length>0?n.reduce(((t,e)=>{if(t&&"object"==typeof t)return t[e]}),r):u(t)?r:void 0}static delete(t,e){const n=b(e),r=y(t),o=M(n,r);m.set(t,e,o)}static clear(t){return v(t,{})}}const b=t=>{if("string"!=typeof t)return[];const e=t.match(/^\{(.+)\}$/);return e?e[1].split("."):[]},y=t=>{if("string"==typeof t)return(t=>{if("string"==typeof t)try{return JSON.parse(t)}catch(t){return}})(localStorage.getItem(t))},v=(t,e)=>{if("string"!=typeof t)return!1;if(f(e))try{return localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){return!1}return localStorage.setItem(t,String(e)),!0},w=(t,e,n)=>{if(0===t.length)return e;const[r,...o]=t,a={...e};return 0===o.length?a[r]=n:a[r]=w(o,a[r]||{},n),a},M=(t,e)=>{if(0===t.length)return e;const[n,...r]=t,o={...e};return 0===r.length?delete o[n]:void 0!==o[n]&&(o[n]=M(r,o[n])),o};const S="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",A=`[\\s|\\(]+(${S})[,|\\s]+(${S})[,|\\s]+(${S})[,|\\s]+(${S})\\s*\\)?`,k=new RegExp(`rgb${`[\\s|\\(]+(${S})[,|\\s]+(${S})[,|\\s]+(${S})\\s*\\)?`}`),$=new RegExp(`rgba${A}`),E=new RegExp(`hsl${A}`),C=new RegExp(`hsla${A}`),x=new RegExp(`hsv${A}`),O=new RegExp(`hsva${A}`),F=/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,T=/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,D=/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,N=/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,I=Object.freeze({aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"}),R=Object.freeze(new Set(Object.keys(I)));function j(t){if("transparent"===(t=t.toString().trim().toLowerCase()))return{r:0,g:0,b:0,a:0,format:"name",toString:rt};let e,n=!1;if(I[t]&&(t=I[t],n=!0),e=k.exec(t)){const{r:t,g:n,b:r}=H(e[1],e[2],e[3]);return{r:255*t,g:255*n,b:255*r,format:"rgb",toString:rt}}if(e=$.exec(t)){const{r:t,g:n,b:r}=H(e[1],e[2],e[3]);return{r:255*t,g:255*n,b:255*r,a:L(e[4]),format:"rgba",toString:rt}}if(e=E.exec(t)){const{h:t,s:n,l:r}=Y(e[0],e[1],e[3]);return{h:360*t,s:n,l:r,format:"hsl",toString:ot}}if(e=C.exec(t)){const{h:t,s:n,l:r}=Y(e[0],e[1],e[3]);return{h:360*t,s:n,l:r,a:L(e[4]),format:"hsla",toString:ot}}if(e=x.exec(t)){const{h:t,s:n,v:r}=B(e[0],e[1],e[3]);return{h:360*t,s:n,v:r,format:"hsv",toString:at}}if(e=O.exec(t)){const{h:t,s:n,v:r}=B(e[0],e[1],e[3]);return{h:360*t,s:n,v:r,a:L(e[4]),format:"hsva",toString:at}}return(e=F.exec(t))?{r:parseInt(`${e[1]}${e[1]}`,16),g:parseInt(`${e[2]}${e[2]}`,16),b:parseInt(`${e[3]}${e[3]}`,16),format:n?"name":"hex3",toString:rt}:(e=T.exec(t))?{r:parseInt(`${e[1]}${e[1]}`,16),g:parseInt(`${e[2]}${e[2]}`,16),b:parseInt(`${e[3]}${e[3]}`,16),a:J(`${e[4]}${e[4]}`),format:n?"name":"hex4",toString:rt}:(e=D.exec(t))?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16),format:n?"name":"hex6",toString:rt}:(e=N.exec(t))?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16),a:J(e[4]),format:n?"name":"hex8",toString:rt}:null}function P(t){let e,n={r:0,g:0,b:0},r=1;return e="string"==typeof t?j(t):t,null!==e&&"object"==typeof e&&("l"in e?n=z(e.h,e.s,e.l):"v"in e&&(n=U(e.h,e.s,e.v)),"a"in e&&(r=L(e.a??1),Number.isNaN(r)&&(r=1)),n=e),{...n,a:r,format:"rgba",toString:rt}}function Y(t,e,n){return{h:Q(t,0,360)/360,s:Q(et(e)?nt(e):e,0,1),l:Q(et(n)?nt(n):n,0,1)}}function H(t,e,n){return{r:Q(t,0,255)/255,g:Q(e,0,255)/255,b:Q(n,0,255)/255}}function B(t,e,n){return{h:Q(t,0,360)/360,s:Q(et(e)?nt(e):e,0,1),v:Q(et(n)?nt(n):n,0,1)}}function L(t){return Q(et(t)?nt(t):t,0,1)}function z(t,e,n){let r,o,a;if(({h:t,s:e,l:n}=Y(t,e,n)),0===e)r=o=a=n;else{const i=n<.5?1*(1+e):n+e-n*e,s=2*n-i;r=tt(s,i,t+1/3),o=tt(s,i,t),a=tt(s,i,t-1/3)}return r*=255,o*=255,a*=255,{r:r,g:o,b:a,toString:rt}}function _(t,e,n){({r:t,g:e,b:n}=H(t,e,n));const r=Math.max(t,e,n),o=Math.min(t,e,n);let a,i;const s=(r+o)/2;if(r===o)a=i=0;else{const c=r-o;switch(i=s>.5?c/(2-r-o):c/(r+o),r){case t:a=(e-n)/c+(e<n?6:0);break;case e:a=(n-t)/c+2;break;case n:a=(t-e)/c+4;break;default:a=0}a*=60}return{h:a,s:i,l:s,toString:ot}}function G(t,e,n){({h:t,s:e,l:n}=Y(t,e,n));const r=.5*(2*n+e*(1-Math.abs(2*n-1)));return{h:360*t,s:e=2*(r-n)/r,v:r,toString:at}}function U(t,e,n){({h:t,s:e,v:n}=B(t,e,n)),t*=6;const r=Math.floor(t),o=t-r,a=n*(1-e),i=n*(1-o*e),s=n*(1-(1-o)*e),c=r%6;let u=[n,i,a,a,s,n][c],f=[s,n,n,i,a,a][c],l=[a,a,s,n,n,i][c];return u*=255,f*=255,l*=255,{r:u,g:f,b:l,toString:rt}}function W(t,e,n){({r:t,g:e,b:n}=H(t,e,n));const r=Math.max(t,e,n),o=Math.min(t,e,n);let a;const i=r,s=r-o,c=0===r?0:s/r;if(r===o)a=0;else{switch(r){case t:a=(e-n)/s+(e<n?6:0);break;case e:a=(n-t)/s+2;break;case n:a=(t-e)/s+4;break;default:a=0}a*=60}return{h:a,s:c,v:i,toString:at}}function q(t,e,n,r=!1){({r:t,g:e,b:n}=H(t,e,n));const o=[X(Math.round(255*t).toString(16)),X(Math.round(255*e).toString(16)),X(Math.round(255*n).toString(16))];return r&&Z(o[0])&&Z(o[1])&&Z(o[2])?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):"#"+o.join("")}function V(t,e,n,r,o=!1){({r:t,g:e,b:n}=H(t,e,n));const a=[X(Math.round(255*t).toString(16)),X(Math.round(255*e).toString(16)),X(Math.round(255*n).toString(16)),X((i=L(r),Math.round(255*parseFloat(i)).toString(16)))];var i;return o&&Z(a[0])&&Z(a[1])&&Z(a[2])&&Z(a[3])?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):"#"+a.join("")}function K(t,e=!1,n="hex"){const r=Math.round(360*Math.random()),o=Math.round("hard"===t?80+20*Math.random():20+70*Math.random())/100,a=Math.round("hard"===t?40+20*Math.random():80+15*Math.random())/100;if("hsl"===n)return ot.bind({h:r,s:o,l:a})();let i;if("hex"===n||"rgb"===n){if(i=z(r,o,a),"hex"===n){const{r:t,g:n,b:r}=i;return e?V(t,n,r,Math.random()):q(t,n,r)}}else"hsv"===n&&(i=G(r,o,a));return e&&(i.a=Math.random()),i.toString()}function X(t){return 1===t.length?`0${t}`:t.toString()}function Z(t){return t.charAt(0)===t.charAt(1)}function J(t){return parseInt(t,16)/255}function Q(t,e,n){return Math.max(e,Math.min(n,parseFloat(t)))}function tt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function et(t){return String(t).trim().includes("%")}function nt(t){const e=parseFloat(t)/100;return Number.isNaN(e)?0:e}function rt(){return i(this.a)&&this.a>=0&&this.a<1?`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`:`rgb(${this.r}, ${this.g}, ${this.b})`}function ot(){const t=100*this.s+"%",e=100*this.l+"%";return i(this.a)&&this.a>=0&&this.a<1?`hsla(${this.h}, ${t}, ${e}, ${this.a})`:`hsl(${this.h}, ${t}, ${e})`}function at(){const t=100*this.s+"%",e=100*this.v+"%";return i(this.a)&&this.a>=0&&this.a<1?`hsva(${this.h}, ${t}, ${e}, ${this.a})`:`hsv(${this.h}, ${t}, ${e})`}function it(t){return(.2126*t.r+.7152*t.g+.0722*t.b)/255}let st=0;function ct(t){return t&-t}class ut{date;constructor(t){if(void 0===t)this.date=new Date;else if(t instanceof Date)this.date=new Date(t.getTime());else{if("string"!=typeof t&&"number"!=typeof t)throw new Error("Invalid date input");this.date=new Date(t)}if(isNaN(this.date.getTime()))throw new Error("Invalid Date")}static create(t){return new ut(t)}day(){const t=this.date.getDay();return 0===t?7:t}format(t="YYYY-MM-DD HH:mm:ss"){const e=(t,e=2)=>t.toString().padStart(e,"0"),n={YYYY:e(this.date.getFullYear(),4),YY:e(this.date.getFullYear()%100),MM:e(this.date.getMonth()+1),DD:e(this.date.getDate()),HH:e(this.date.getHours()),mm:e(this.date.getMinutes()),ss:e(this.date.getSeconds()),SSS:e(this.date.getMilliseconds(),3)};return t.replace(/YYYY|YY|MM|DD|HH|mm|ss|SSS/g,(t=>n[t]??t))}add(t,e){const n=new Date(this.date.getTime());switch(e){case"year":n.setFullYear(n.getFullYear()+t);break;case"month":const e=n.getDate();n.setMonth(n.getMonth()+t),n.getDate()!==e&&n.setDate(0);break;case"week":n.setDate(n.getDate()+7*t);break;case"day":n.setDate(n.getDate()+t);break;case"hour":n.setHours(n.getHours()+t);break;case"minute":n.setMinutes(n.getMinutes()+t);break;case"second":n.setSeconds(n.getSeconds()+t);break;case"millisecond":n.setMilliseconds(n.getMilliseconds()+t)}return new ut(n)}subtract(t,e){return this.add(-t,e)}startOf(t){const e=new Date(this.date.getTime());switch(t){case"year":e.setMonth(0);case"month":e.setDate(1);case"day":case"week":if("week"===t){const t=this.day();e.setDate(e.getDate()-(t-1))}e.setHours(0);case"hour":e.setMinutes(0);case"minute":e.setSeconds(0);case"second":e.setMilliseconds(0)}return new ut(e)}endOf(t){const e=new Date(this.date.getTime());switch(t){case"year":e.setMonth(11);case"month":e.setDate(this.daysInMonth());case"day":case"week":if("week"===t){const t=this.day();e.setDate(e.getDate()+(7-t))}e.setHours(23);case"hour":e.setMinutes(59);case"minute":e.setSeconds(59);case"second":e.setMilliseconds(999)}return new ut(e)}diff(t,e="millisecond"){const n=t instanceof ut?t.date:new Date(t),r=this.date.getTime()-n.getTime();switch(e){case"year":return this.date.getFullYear()-n.getFullYear();case"month":return 12*(this.date.getFullYear()-n.getFullYear())+(this.date.getMonth()-n.getMonth());case"week":return Math.floor(r/6048e5);case"day":return Math.floor(r/864e5);case"hour":return Math.floor(r/36e5);case"minute":return Math.floor(r/6e4);case"second":return Math.floor(r/1e3);default:return r}}getWeekRange(t=0,e=1){if(e<1||e>7)throw new Error("weekStartsOn must be between 1 and 7");let n=this.add(7*t,"day"),r=(n.day()-e+7)%7;const o=n.subtract(r,"day").startOf("day"),a=o.add(6,"day").endOf("day");return[o,a]}getMonthRange(t=0){const e=this.add(t,"month");return[e.startOf("month"),e.endOf("month")]}getQuarterRange(t=0){const e=this.add(3*t,"month"),n=3*Math.floor(e.toDate().getMonth()/3),r=new ut(new Date(e.toDate().getFullYear(),n,1)).startOf("month"),o=r.add(2,"month").endOf("month");return[r,o]}getYearRange(t=0){const e=this.add(t,"year");return[e.startOf("year"),e.endOf("year")]}isWeekday(){return this.day()<=5}isWeekend(){return!this.isWeekday()}isSame(t,e="millisecond"){const n=t instanceof ut?t:ut.create(t);return this.startOf(e).valueOf()===n.startOf(e).valueOf()}isBefore(t){return this.date.getTime()<ut.create(t).valueOf()}isAfter(t){return this.date.getTime()>ut.create(t).valueOf()}isValid(){return!isNaN(this.date.getTime())}toDate(){return new Date(this.date.getTime())}valueOf(){return this.date.getTime()}toString(){return this.date.toISOString()}daysInMonth(){return new Date(this.date.getFullYear(),this.date.getMonth()+1,0).getDate()}}function ft(t,e={}){if(null==t||"object"!=typeof t)return t;const{cloneObject:n=h}=e,r={},o=[{parent:r,prop:"root",data:t}],a=new WeakMap,i=[],s=[];for(;o.length;){const{parent:t,prop:e,data:r}=o.pop();if(!t)continue;const c=p(r);if("Date"===c){t[e]=new Date(r);continue}if("Array"!==c){const o=n(c,r);if(null!=o){t[e]=o;continue}}const u=t[e]="Array"===c||"Set"===c||"Map"===c?[]:{};if("Set"===c||"Map"===c){let n=0;if("Set"===c){for(const t of r)a.has(t)?u[n]=a.get(t):null!==t&&"object"==typeof t?o.push({parent:u,prop:n,data:t}):u[n]=t,++n;i.push({parent:t,prop:e})}else{for(const t of r){const e=[];n=0;for(const r of t)a.has(r)?e[n]=a.get(r):null!==r&&"object"==typeof r?o.push({parent:e,prop:n,data:r}):e[n]=r,++n;u.push(e)}s.push({parent:t,prop:e})}}else for(const t of Object.keys(r)){const e=r[t];a.has(e)?u[t]=a.get(e):null!==e&&"object"==typeof e?o.push({parent:u,prop:t,data:e}):u[t]=e}a.set(r,u)}for(const{parent:t,prop:e}of i)t[e]=new Set(t[e]);for(const{parent:t,prop:e}of s)t[e]=new Map(t[e]);return r.root}Date.prototype.isBefore=function(t){return this.getTime()<t.getTime()},Date.prototype.isAfter=function(t){return this.getTime()>t.getTime()};const lt=()=>!0;const dt=e&&("ontouchstart"in window||("undefined"!=typeof navigator&&(navigator.maxTouchPoints||navigator.msMaxTouchPoints)||0)>0),ht=dt?"pointerdown":"click";const gt=/^\s*[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?\s*$/;function pt(t,e=!1){return"number"==typeof t?!Number.isNaN(t):e?gt.test(String(t)):!Number.isNaN(parseFloat(t))||!Number.isNaN(Number(t))}function mt(t){let e=parseFloat(t);return Number.isNaN(e)&&(e=Number(t)),Number.isNaN(e)?0:e}function bt(t,e){return e<=0?t.toString():`${t<0?"-":""}${String(Math.abs(Math.round(t))).padStart(e,"0")}`}function yt(t){const e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-+(e[1]||0);return n>0?n:0}function vt(t,e){if(0===e)return Math.round(t);let n=t.toFixed(yt(t));const r=n.indexOf(".");if(-1===r)return t;const o=r+e;return n.replace(".","").split("")[o]?(n="5"===n.charAt(o+1)?n.substring(0,o+1)+"6":n.substring(0,o+2),parseFloat(Number(n).toFixed(e))):t}const wt=Object.freeze(["B","KB","MB","GB","TB","AUTO"]);function Mt(t,e=15){return+parseFloat(Number(t).toPrecision(e))}function St(t){const e=String(t);if(!e.includes("e"))return Number(e.replace(".",""));const n=yt(t);return n>0?Mt(Number(t)*10**n):Number(t)}function At(t){return(...e)=>{let n=e[0];for(let r=1,o=e.length;r<o;++r)n=t(n,e[r]);return n}}const kt=At(((t,e)=>St(t)*St(e)/10**(yt(t)+yt(e)))),$t=At(((t,e)=>{const n=10**Math.max(yt(t),yt(e));return(kt(t,n)+kt(e,n))/n})),Et=At(((t,e)=>{const n=10**Math.max(yt(t),yt(e));return(kt(t,n)-kt(e,n))/n})),Ct=At(((t,e)=>{const n=St(t),r=St(e);return kt(n/r,Mt(10**(yt(e)-yt(t))))})),xt=["button","[href]:not(.disabled)","input","select","textarea","[tabindex]","[contenteditable]"].map((t=>`${t}:not(:disabled):not([disabled])`)).join(", ");function Ot(t){return!!t&&1===t.nodeType}function Ft(t,n){return e&&t?Array.from((r=n,Ot(r)?r:document.body).querySelectorAll(t)):[];var r}function Tt(t,e){if(!t||!e)return!1;const n=e.__transferElement;return e.contains(t)||!!n&&(n===t||n.contains(t))}function Dt(t){if(!(e&&Ot(t)&&t.parentNode&&Tt(t,document.body)))return!0;if("none"===t.style.display)return!0;const n=t.getBoundingClientRect();return!(n&&n.width>0&&n.height>0)}function Nt(t){return!Dt(t)}function It(t){return!Ot(t)||t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")||t.disabled}function Rt(t){if(!e||!t)return 0;const n=getComputedStyle(t);return parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)||0}const jt=/["'&<>]/;class Pt{events=new Map;static instance=new Pt;static getEvents(){return Pt.getInstance().events}static getEventsSize(){return Pt.getInstance().events.size}static getEvent(t){return Pt.getInstance().events.get(t)}static hasEvent(t){return Pt.getInstance().events.has(t)}static deleteEvent(t){return Pt.getInstance().events.delete(t)}static setEvent(t,e){return Pt.hasEvent(t)&&console.warn(`Event "${t}" is already registered. Overwriting...`),Pt.getInstance().events.set(t,e)}static on(t,e){return Pt.isFunction(e)||console.warn("The second argument to the on method must be a function"),Pt.setEvent(t,e)}static emit(t,...e){const n=Pt.getEvent(t);if(Pt.isFunction(n))return n(...e);console.error(`EventBus Error: Event "${t}" is not registered. Use "EventBus.on('${t}', callback)" to bind it.`)}static once(t,...e){const n=Pt.emit(t,...e);return Pt.off(t),n}static off(t){return Array.isArray(t)?t.every((t=>Pt.off(t))):Pt.getInstance().events.delete(t)}static getInstance(){return Pt.instance}static isFunction(t){return"function"==typeof t}}class Yt{static normalizeKey(t){return"number"==typeof t?`Key${String.fromCharCode(t)}`:t.toString().toLowerCase()}static isComboMatch(t,e){return(Array.isArray(e)?e:[e]).every((e=>{const n=Yt.normalizeKey(e);return t.key.toLowerCase()===n||t.code.toLowerCase()===n||t.keyCode===("number"==typeof e?e:0)}))}static on(t,e,n={}){const{preventDefault:r=!1,stopPropagation:o=!1,target:a=document,event:i="keydown"}=n,s=n=>{const a=n;Yt.isComboMatch(a,t)&&(r&&a.preventDefault(),o&&a.stopPropagation(),e(a))};return a.addEventListener(i,s),{unsubscribe:()=>{a.removeEventListener(i,s)}}}static once(t,e,n={}){let r=null;return r=this.on(t,(t=>{e(t),r?.unsubscribe()}),n),r}static longPress(t,e,n={}){const{threshold:r=500,interval:o=100,...a}=n;let i=null,s=null;const c=this.on(t,(t=>{i=setTimeout((()=>{e(t),s=setInterval((()=>e(t)),o)}),r)}),{...a,event:"keydown"}),u=this.on(t,(()=>{i&&clearTimeout(i),s&&clearInterval(s),i=null,s=null}),{...a,event:"keyup"});return{unsubscribe:()=>{c.unsubscribe(),u.unsubscribe(),i&&clearTimeout(i),s&&clearInterval(s)}}}}class Ht{static isButtonMatch(t,e){if("number"==typeof e)return t.button===e;return t.button==={left:0,middle:1,right:2}[e]}static on(t,e,n={}){const{preventDefault:r=!1,stopPropagation:o=!1,target:a=document,event:i="mousedown"}=n,s=n=>{const a=n;Ht.isButtonMatch(a,t)&&(r&&a.preventDefault(),o&&a.stopPropagation(),e(a))};return a.addEventListener(i,s),{unsubscribe:()=>{a.removeEventListener(i,s)}}}static once(t,e,n={}){let r=null;return r=this.on(t,(t=>{e(t),r?.unsubscribe()}),n),r}static longPress(t,e,n={}){const{threshold:r=500,interval:o=100,...a}=n;let i=null,s=null;const c=this.on(t,(t=>{i=setTimeout((()=>{e(t),s=setInterval((()=>e(t)),o)}),r)}),{...a,event:"mousedown"}),u=this.on(t,(()=>{i&&clearTimeout(i),s&&clearInterval(s),i=null,s=null}),{...a,event:"mouseup"});return{unsubscribe:()=>{c.unsubscribe(),u.unsubscribe(),i&&clearTimeout(i),s&&clearInterval(s)}}}static onClickOutside(t,e,n={}){const{preventDefault:r=!1,stopPropagation:o=!1}=n,a=n=>{const a=n;t.contains(a.target)||(r&&a.preventDefault(),o&&a.stopPropagation(),e(a))};return document.addEventListener("click",a),{unsubscribe:()=>{document.removeEventListener("click",a)}}}}function Bt(t,e,n){t&&!e.has(t)&&(n(t),e.add(t))}const Lt=new Set;const zt=new Set;const _t=new Set;const Gt=e?requestAnimationFrame:t=>{setTimeout(t,16)};function Ut(t,e={}){if("function"!=typeof t)return t;const{leading:n=!1,trailing:r=!0}=e;let o,a,i=!1,s=!1;return function(...e){if(o=e,i)s=r;else{if(i=!0,n){const e=t(...o);a=Promise.resolve(e)}else a=Promise.resolve();a=a.then((()=>r&&s?(s=!1,t(...o)):a)).finally((()=>{i=!1,a=void 0}))}return a}}const Wt=new Set,qt=new WeakMap;function Vt(){Wt.forEach((t=>{t(...qt.get(t))})),Wt.clear()}const Kt=new Set,Xt=new WeakMap;function Zt(){Kt.forEach((t=>{t(...Xt.get(t))})),Kt.clear()}let Jt=null;let Qt=null;function te(t,e,n=t=>t,r=!1){const o=r?new Map:{};if(!i(e))return o;const a=r?(t,e)=>o.set(t,e):(t,e)=>o[t]=e,s=l(e)?e:t=>t[e];return t.forEach((t=>{const e=s(t);i(e)&&a(e,n(t))})),o}function ee(t,e={}){const{keyField:n="id",childField:r="children",parentField:o="parent",rootId:a=null}=e,s=i(a)&&""!==a,c=[],u=new Map;for(let e=0,f=t.length;e<f;++e){const f=t[e],l=f[n];if(s?l!==a:i(l))if(u.has(l)?f[r]=u.get(l):(f[r]=[],u.set(l,f[r])),!f[o]||s&&f[o]===a)c.push(f);else{const t=f[o];u.has(t)||u.set(t,[]),u.get(t).push(f)}}return c}const ne=(t,e)=>Number.isNaN(Number(t)-Number(e))?String(t).localeCompare(e):t-e;const re=/\B([A-Z])(?=[^A-Z_-])/g;function oe(t){return((t=(t=t.trim().replace(/\s+/g,"-")).replace(/-+(\w)/g,((t,e)=>e?e.toUpperCase():""))).charAt(0).toLocaleUpperCase()+t.slice(1)).replace(/[^\w]/g,"")}function ae(t){let e,n,r=t.length;const o=globalThis.crypto||globalThis.msCrypto,a=t=>{if(o?.getRandomValues){const e=new Uint32Array(1);return o.getRandomValues(e),e[0]/4294967296*t}return Math.random()*t};for(;0!==r;)n=Math.floor(a(r)),r--,e=t[r],t[r]=t[n],t[n]=e;return t}t.CLICK_TYPE=ht,t.COLOR_NAMES=R,t.DateTime=ut,t.EventBus=Pt,t.HEX_REG_3=F,t.HEX_REG_4=T,t.HEX_REG_6=D,t.HEX_REG_8=N,t.HSLA_REG=C,t.HSL_REG=E,t.HSVA_REG=O,t.HSV_REG=x,t.KeyboardListener=Yt,t.MouseListener=Ht,t.NAMED_COLORS=I,t.ObjectLocalStorage=m,t.RGBA_REG=$,t.RGB_REG=k,t.USE_TOUCH=dt,t.adjustAlpha=function(t,e){const n=P(t);return n.a=L(e),n},t.base64Decode=function(t){return decodeURIComponent(atob(t))},t.base64Encode=function(t){return btoa(encodeURIComponent(t))},t.boundRange=function(t,e,n){return Math.max(e,Math.min(n,parseFloat(t)))},t.buildTree=ee,t.caesarCipher=function(t,e){return t.split("").map((t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?String.fromCharCode((n-65+e+26)%26+65):n>=97&&n<=122?String.fromCharCode((n-97+e+26)%26+97):n>=48&&n<=57?String.fromCharCode((n-48+e+10)%10+48):t})).join("")},t.callIfFunc=function(t,...e){return l(t)?t(...e):t},t.cloneDeep=function t(e,n=new WeakMap){if(null===e||"object"!=typeof e)return e;if(n.has(e))return n.get(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const t=e.flags||(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"");return new RegExp(e.source,t)}if(e instanceof Map){const r=new Map;return n.set(e,r),e.forEach(((e,o)=>{r.set(t(o,n),t(e,n))})),r}if(e instanceof Set){const r=new Set;return n.set(e,r),e.forEach((e=>{r.add(t(e,n))})),r}if(e instanceof ArrayBuffer)return e.slice(0);if(ArrayBuffer.isView(e)){const r=e,o=t(r.buffer,n);return new e.constructor(o,r.byteOffset,r.length)}const r=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));n.set(e,r);const o=Object.getOwnPropertySymbols(e);for(const a of[...Object.keys(e),...o])r[a]=t(e[a],n);return r},t.contains=Tt,t.createBITree=function(t,e=0){const n=new Array(t+1).fill(0);function r(r=t){if(r<=0)return 0;r>t&&(r=t);let o=r*e;for(;r>0;)o+=n[r],r-=ct(r);return o}return{tree:n,add:function(e,r){if(r&&!(e>=t))for(e+=1;e<=t;)n[e]+=r,e+=ct(e)},sum:r,get:function(t){return r(t+1)-r(t)},boundIndex:function(e){let n=0,o=t;for(;o>n;){const t=Math.floor((n+o)/2),a=r(t);if(a>e)o=t;else{if(!(a<e))return t;if(n===t)return r(n+1)<=e?n+1:n;n=t}}return n}}},t.createCounter=function(t=0){return{getCount:()=>t++,setCount:e=>{t=e}}},t.createEventEmitter=function(){const t=new Map;return{on(e,n){const r=t.get(e),o=r?.add(n);o||t.set(e,new Set([n]))},off(e,n){const r=t.get(e);r&&r.delete(n)},clear(e){const n=t.get(e);n&&n.clear()},clearAll(){t.clear()},emit(e,...n){const r=t.get(e);r&&r.forEach((t=>{t(...n)}))}}},t.debounce=function(t,e=100){if("function"!=typeof t)return h;const{leading:n=!1,trailing:r=!0,delay:o=("number"==typeof e?e:e.delay||100)}="object"==typeof e?e:{delay:e};if(o<=0)return Ut(t);let a=null,i=null,s=!1;const c=(...e)=>{t(...e)};return function(...t){i=t,a?(clearTimeout(a),s=!0):(n&&c(...t),s=!1),a=setTimeout((()=>{a=null,r&&s&&c(...i)}),o)}},t.debounceFrame=function(t,e={}){if("function"!=typeof t)return t;const{leading:n=!1,trailing:r=!0}=e;let o,a,i=!1,s=!1;return function(...e){if(o=e,i)s=r;else{if(i=!0,n){const e=t(...o);a=Promise.resolve(e)}else a=new Promise((e=>{Gt((()=>{r&&s?(s=!1,e(t(...o))):e(void 0)}))}));a=a.finally((()=>{i=!1,a=void 0}))}return a}},t.debounceMinor=Ut,t.decide=async function(t,e={}){if(t.length)for(const[n,r]of t)if("function"==typeof n?n():n)return"function"==typeof e.beforeMatchAny&&await e.beforeMatchAny(),await r(),"function"==typeof e.afterMatchAny&&await e.afterMatchAny(),!0;return!1},t.decimalLength=yt,t.deepClone=ft,t.destroyObject=function(t,e="This object was destroyed, do not use it anywhere"){const n=()=>{throw new Error(e)};Object.keys(t).forEach((e=>{"function"==typeof t[e]?t[e]=n.bind(t):t[e]=null})),Object.getOwnPropertyNames(t.constructor.prototype).forEach((e=>{"constructor"!==e&&"function"==typeof t[e]&&(t[e]=n.bind(t))})),t.isDestroyed=lt},t.digitLength=function(t){return yt(t)},t.dispatchEvent=function(t,e,n=window.Event){const{type:r,bubbles:o=!1,cancelable:a=!1,...s}=e;if(!i(r)||""===r)return!1;let c;return i(n)?c=new n(r,{bubbles:o,cancelable:a}):(c=document.createEvent("HTMLEvents"),c.initEvent(r,o,a)),Object.assign(c,s),t.dispatchEvent(c)},t.divide=Ct,t.doubleDigits=function(t){return bt(t,2)},t.ensureArray=function(t){return Array.isArray(t)?t:[t]},t.errorOnce=function(t,e=console.warn){Bt(t,_t,e)},t.escapeHtml=function(t){const e=""+t,n=jt.exec(e);if(!n)return e;let r,o,a="",i=0;for(o=n.index;o<e.length;o++){switch(e.charCodeAt(o)){case 34:r=""";break;case 38:r="&";break;case 39:r="'";break;case 60:r="<";break;case 62:r=">";break;default:continue}i!==o&&(a+=e.substring(i,o)),i=o+1,a+=r}return i!==o?a+e.substring(i,o):a},t.filterTree=function(t,e,n={}){const{childField:r="children",leafOnly:o=!1,isLeaf:a=t=>!d(t[r])}=n,i=(t,n,s)=>t.map((t=>({...t}))).filter((t=>{const c=t[r],u=a(t),f=d(c)&&Array.from(c);if(o&&!u){if(f&&f.length){const e=i(f,n+1,t);return t[r]=e,!!e.length}return!1}const l=e(t,n,s);if(u)return l;if(!o&&l)return!0;if(f&&f.length){const e=i(f,n+1,t);return t[r]=e,!!e.length}return l}));return i(t,0,null)},t.flatTree=function(t,e={}){const{keyField:n="id",childField:r="children",parentField:o="parent",rootId:a=null,depthFirst:s=!1,injectId:c=!0,buildId:u=t=>t,filter:f=g,cascaded:l=!1,forceInject:d=!1}=e;let h=1;const p=i(a)&&""!==a,m=[],b=[...t];for(;b.length;){const t=b.shift(),e=t[r],i=Array.isArray(e)&&e.length?e:[];!c||!d&&t[n]||(t[n]=u(h++));const g=t[n];c&&o&&(p?t[o]===a:!t[o])&&(t[o]=a);const y=f(t);if(y&&m.push(t),y||!l){for(let t=0,e=i.length;t<e;++t){const e=i[t];c&&o&&(e[o]=g),!s&&b.push(e)}s&&b.unshift(...i)}}return m},t.formatByteSize=function(t,e="AUTO",n=!1,r){void 0===r&&("number"==typeof n?(r=n,n=!1):r=2);let o,a,i=e.toUpperCase();switch(i=wt.includes(i)?i:"AUTO",i){case"AUTO":o=0;break;case"KB":o=1;break;case"MB":o=2;break;case"GB":o=3;break;case"TB":o=4;break;default:return t}if(o)a=t/1024**o;else for(a=t;a>1024&&!(o>4);++o)a/=1024;return a=vt(a,r),n?`${a}${"AUTO"===i?wt[Math.min(o,4)]:i}`:a},t.formatDate=function(t,e="YYYY-MM-DD HH:mm:ss"){return ut.create(t).format(e)},t.getCurrentMonth=function(t){const[e,n]=ut.create().getMonthRange();return t?[e.format(t),n.format(t)]:[e.toString(),n.toString()]},t.getCurrentWeek=function(t){const[e,n]=ut.create().getWeekRange();return t?[e.format(t),n.format(t)]:[e.toString(),n.toString()]},t.getDateRange=function(t,e,n="YYYY-MM-DD"){const r=ut.create(t).startOf("day"),o=ut.create(e).startOf("day").diff(r,"day");return Array.from({length:o+1},((t,e)=>r.add(e,"day").format(n)))},t.getGlobalCount=function(){return st++},t.getLast=function(t){return t[t.length-1]},t.getRangeWidth=function(t){if(!e||!t)return 0;const n=document.createRange();return n.setStart(t,0),n.setEnd(t,t.childNodes.length),n.getBoundingClientRect().width+Rt(t)},t.getType=p,t.getXBorder=function(t){if(!e||!t)return 0;const n=getComputedStyle(t);return parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth)||0},t.getXMargin=function(t){if(!e||!t)return 0;const n=getComputedStyle(t);return parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0},t.getXPadding=Rt,t.getYBorder=function(t){if(!e||!t)return 0;const n=getComputedStyle(t);return parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth)||0},t.getYMargin=function(t){if(!e||!t)return 0;const n=getComputedStyle(t);return parseFloat(n.marginTop)+parseFloat(n.marginBottom)||0},t.getYPadding=function(t){if(!e||!t)return 0;const n=getComputedStyle(t);return parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)||0},t.groupByProps=function(t,e=[]){"string"!=typeof e&&"function"!=typeof e||(e=[e]);const n=e.length,r={};for(const o of t){let t;for(let a=0;a<n;++a){const i=a===n-1,s=e[a],c="function"==typeof s?s(o):o[s];t?(t[c]||(t[c]=i?[]:{}),t=t[c]):(r[c]||(r[c]=i?[]:{}),t=r[c])}t.push(o)}return r},t.has=function(t,e){return o.call(t,e)},t.hslToHsv=G,t.hslToRgb=z,t.hsvToHsl=function(t,e,n){({h:t,s:e,v:n}=B(t,e,n));const r=.5*n*(2-e);return{h:360*t,s:e=n*e/(1-Math.abs(2*r-1)),l:r,toString:ot}},t.hsvToRgb=U,t.humanizeDiff=function(t,e=new Date){const n=ut.create(e).diff(t,"second");if(n<60)return`${n}秒`;if(n<3600)return`${Math.floor(n/60)}分钟`;if(n<86400)return`${Math.floor(n/3600)}小时`;const r=Math.floor(n/86400);return r>=0?`${r}天`:`${Math.abs(r)}天后`},t.infoOnce=function(t,e=console.info){Bt(t,Lt,e)},t.is=a,t.isArray=function(t){return Array.isArray(t)},t.isBigInt=function(t){return"bigint"==typeof t},t.isBoolean=function(t){return"boolean"==typeof t},t.isClass=function(t){if("function"!=typeof t)return!1;const e=t.toString();return void 0!==t.prototype&&(t.prototype.constructor===t&&("class "===e.slice(0,6)||(Object.getOwnPropertyNames(t.prototype).length>=2||(/^function\s+\(|^function\s+anonymous\(/.test(e),!1))))},t.isClient=e,t.isColor=function(t){return!!(t=String(t).trim().toLowerCase())&&(!("transparent"!==t&&!I[t])||("transparent"===t||R.has(t)||k.test(t)||$.test(t)||E.test(t)||C.test(t)||x.test(t)||O.test(t)||F.test(t)||T.test(t)||D.test(t)||N.test(t)))},t.isDate=function(t){return a(t,"Date")},t.isDefined=i,t.isDisabled=It,t.isElement=function(t,n=!1){return!(!n&&!e)&&!(!t||!("nodeType"in t))},t.isEmail=function(t){return!!u(t)&&/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(t)},t.isEmpty=function(t){return Array.isArray(t)||"string"==typeof t?0===t.length:t instanceof Map||t instanceof Set?0===t.size:f(t)?0===Object.keys(t).length:"number"==typeof t?c(t):s(t)},t.isEmptyObject=function(t){return f(t)&&0===Object.keys(t).length},t.isExist=function(t){return t||0===t},t.isFalse=function(t){return!1===t},t.isFocusIn=function(t){if(!e)return!1;const n=document.activeElement;return!(!Ot(t)||!n)&&(t===n||Tt(n,t))},t.isFunction=l,t.isHex=function(t){return/^#[a-fA-F0-9]{3}$|#[a-fA-F0-9]{6}$/.test(t)},t.isHidden=Dt,t.isIOS=n,t.isIterable=d,t.isMap=function(t){return a(t,"Map")},t.isNaN=c,t.isNull=s,t.isNumber=function(t){return"number"==typeof t},t.isObject=f,t.isPhone=function(t){return!!u(t)&&/^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(t)},t.isPromise=function(t){return!!t&&"function"==typeof t.then&&"function"==typeof t.catch},t.isRegExp=function(t){return a(t,"RegExp")},t.isRgb=function(t){return/^rgb\((\s*\d+\s*,?){3}\)$/.test(t)},t.isRgba=function(t){return/^rgba\((\s*\d+\s*,\s*){3}\s*\d(\.\d+)?\s*\)$/.test(t)},t.isSet=function(t){return a(t,"Set")},t.isString=u,t.isSymbol=function(t){return"symbol"==typeof t},t.isTrue=function(t){return!0===t},t.isUndefined=function(t){return void 0===t},t.isValidNumber=pt,t.isVisible=Nt,t.isWindow=function(t){return t===window},t.leaveNumber=function(t,e,n=0){if(t<=0||e<=1)return[t];n<1&&(n=1/0);const r=[];let o=0;for(;t>=e&&o<n;)r.push(t%e),t=Math.floor(t/e),++o;return r.push(t),r.reverse()},t.listToMap=te,t.mapTree=function(t,e,n={}){const{childField:r="children",depthFirst:o=!1,clearChildren:a=!0}=n,i=[],s=[...t.map((t=>({item:t,depth:0,parent:null,result:i})))];for(;s.length;){const{item:t,depth:n,parent:i,result:c}=s.shift(),u=t[r],f=e(t,n,i)??{};if(a&&(f[r]=[]),c.push(f),d(u)){Array.from(u).length&&(f[r]=[],s[o?"unshift":"push"](...Array.from(u).map((e=>({item:e,depth:n+1,parent:t,result:f[r]})))))}}return i},t.mergeObjects=function(t,e,n=!0){const r=[{source:t=n?ft(t):t,target:e}];for(;r.length;){const{source:t,target:e}=r.pop();Object.keys(e).forEach((n=>{f(e[n])?(f(t[n])||(t[n]={}),r.push({source:t[n],target:e[n]})):Array.isArray(e[n])?(Array.isArray(t[n])||(t[n]=[]),r.push({source:t[n],target:e[n]})):t[n]=e[n]}))}return t},t.minus=Et,t.mixColor=function(t,e,n=.5){if(!t&&!e)return{r:0,g:0,b:0,a:1};if(!t)return P(e);if(!e)return P(t);const r=P(t),o=P(e),a=Q(n,0,1),i=2*a-1,s=r.a-o.a,c=((i*s==-1?i:(i+s)/(1+i*s))+1)/2,u=1-c;return{r:Math.round(r.r*c+o.r*u),g:Math.round(r.g*c+o.g*u),b:Math.round(r.b*c+o.b*u),a:Math.round(r.a*a+o.a*(1-a)),format:"rgba",toString:rt}},t.multipleFixed=function(t,e,n){return vt(t*e,n)},t.nextFrameOnce=function(t,...e){if("function"!=typeof t)return t;Xt.set(t,e),Kt.has(t)||(Kt.add(t),1===Kt.size&&Gt(Zt))},t.nextTickOnce=function(t,...e){if("function"!=typeof t)return t;qt.set(t,e),Wt.has(t)||(Wt.add(t),1===Wt.size&&Promise.resolve().then(Vt))},t.noop=h,t.normalizeAlpha=L,t.normalizeHsl=Y,t.normalizeHsv=B,t.normalizePath=function(t){return t.replace(/[\\/]+/g,"/")},t.normalizeRgb=H,t.numberRE=gt,t.ordinalNumber=function(t){if(t<0)return`${t}th`;const e=["th","st","nd","rd"];return`${t}${e[t%100]||e[t%10]||e[0]}`},t.padStartZeros=bt,t.parseColor=function(t){const{a:e,...n}=P(t);delete n.format;const r=_(n.r,n.g,n.b),o=W(n.r,n.g,n.b),a=q(n.r,n.g,n.b),i=V(n.r,n.g,n.b,e);return{rgb:n,hsl:r,hsv:o,hex:a,alpha:e,rgba:{...n,a:e,format:"rgba"},hsla:{...r,a:e,format:"hsla"},hsva:{...o,a:e,format:"hsva"},hex8:i,gray:it(n),origin:t}},t.parseColorToRgba=P,t.parseStringColor=j,t.plus=$t,t.queryAll=Ft,t.queryTabables=function(t,e=!1){const n=e?()=>!1:It;return Ft(xt,t).filter((t=>Nt(t)&&t.tabIndex>-1&&!n(t)))},t.raf=Gt,t.random=function(t,e=0){return e===t?e:(e>t&&([e,t]=[t,e]),Math.random()*(t-e)+e)},t.randomColor=function(t=!1,e="hex"){const n=Math.round(255*Math.random()),r=Math.round(255*Math.random()),o=Math.round(255*Math.random());if("hex"===e)return t?V(n,r,o,Math.random()):q(n,r,o);let a;return a="hsl"===e?_(n,r,o):"hsv"===e?W(n,r,o):Object.create({r:n,g:r,b:o,toString:rt}),t&&(a.a=Math.random()),a.toString()},t.randomHardColor=function(t=!1,e="hex"){return K("hard",t,e)},t.randomPreferColor=K,t.randomSoftColor=function(t=!1,e="hex"){return K("soft",t,e)},t.randomString=function(t=16){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";let n="";for(;t--;)n+=e.charAt(Math.floor(62*Math.random()));return n},t.range=function(t,e=1,n=1){const r=[];for(let o=0;o<t;++o)r.push(e+o*n);return r},t.readClipboard=async function(){if(!e)return null;try{return await navigator.clipboard.readText()}catch(t){return console.error("Modern clipboard API failed:",t),function(){try{const t=document.createElement("textarea"),e=document.activeElement;t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt",document.body.appendChild(t),t.focus();let n=!1;try{n=document.execCommand("paste")}catch(t){console.error("Fallback paste failed:",t)}const r=n?t.value:null;return document.body.removeChild(t),e?.focus(),r}catch(t){return console.error("Unexpected error in fallback paste:",t),null}}()}},t.removeArrayItem=function(t,e,n=!1){let r=-1;return r=n||"function"!=typeof e?t.findIndex((t=>t===e)):t.findIndex(e),~r?t.splice(r,1)[0]:null},t.rgbToHex=q,t.rgbToHsl=_,t.rgbToHsv=W,t.rgbaToHex=V,t.round=function(t,e){if(e<0||e>1)return Math.round(t);const n=Math.ceil(t);return t+1-e>=n?n:Math.floor(t)},t.runParallel=async function(t,e,n){const r=[],o=[];for(const a of e){const i=Promise.resolve().then((()=>n(a,e)));if(r.push(i),t<=e.length){const e=i.then((()=>o.splice(o.indexOf(e),1)));o.push(e),o.length>=t&&await Promise.race(o)}}return Promise.all(r)},t.runQueueFrame=function(t){t=Array.from(t);let e=!1;const n=()=>{e||(t.shift()?.(),t.length&&Gt(n))};return n(),()=>e=!0},t.segmentNumber=function(t,e=3,n=","){if("number"!=typeof t&&(t=parseFloat(t)),Number.isNaN(t))return"0";let[r,o]=String(t).split(".");const a=new RegExp(`(\\d+)(\\d{${e}})`);for(;a.test(r);)r=r.replace(a,`$1${n}$2`);return o=o?`.${o}`:"",`${r}${o}`},t.setGlobalCount=function(t){st=Math.round(t)},t.shuffle=ae,t.shuffled=function(t){return ae([...t])},t.sortByProps=function(t,e){if(!t.sort||f(e)&&!e.key||!e.length)return t;const n=Array.from(t);Array.isArray(e)||(e=[e]);const r=e.map((t=>"string"==typeof t?{key:t,method:ne,type:"asc"}:t)).map((t=>("function"!=typeof t.accessor&&(t.accessor=e=>e[t.key]),"function"!=typeof t.method&&(t.method=ne),t.params=Array.isArray(t.params)?t.params:[],t)));return n.sort(((t,e)=>{let n=0;for(const o of r){const{method:r,type:a,accessor:i,params:s}=o,c="desc"===a,u=r(i(t,...s),i(e,...s));if(n=c?-u:u,n)break}return n})),n},t.supportFlexGap=function(){if(!e)return!0;if(null===Jt){const t=document.createElement("div");t.style.display="flex",t.style.flexDirection="column",t.style.rowGap="1px",t.appendChild(document.createElement("div")),t.appendChild(document.createElement("div")),document.body.appendChild(t),Jt=1===t.scrollHeight,document.body.removeChild(t)}return Jt},t.supportImgLoading=function(){return!!e&&(null===Qt&&(Qt="loading"in document.createElement("img")),Qt)},t.throttle=function(t,e=16){if("function"!=typeof t)return h;const{leading:n=!0,trailing:r=!0,interval:o=("number"==typeof e?e:e.interval||16)}="object"==typeof e?e:{interval:e};if(o<=0)return Ut(t);let a=0,i=null,s=null;const c=(...e)=>{a=Date.now(),t(...e)};return function(...t){const e=Date.now(),u=e-a;s=t,i&&(clearTimeout(i),i=null),u>=o&&(n&&c(...t),a=e),r&&(!n||u<o)&&(i=setTimeout((()=>{i=null,r&&s&&c(...s)}),Math.max(0,o-u)))}},t.timeAgo=function(t){if(!Number.isInteger(t))return"Invalid timestamp";const e=Date.now()-t,n=Math.floor(e/1e3),r=Math.floor(n/60),o=Math.floor(r/60),a=Math.floor(o/24),i=Math.floor(a/30),s=Math.floor(i/12);return s>0?`${s}年前`:i>0?`${i}个月前`:a>0?`${a}天前`:o>0?`${o}小时前`:r>0?`${r}分钟前`:n>30?`${n}秒前`:"刚刚"},t.times=kt,t.toAttrValue=function(t){return i(t)&&!1!==t?String(t):void 0},t.toCamelCase=function(t){const e=oe(t);return function(t){const e=t.match(/[A-Z]+/);return e&&e[0]===t}(e)?e.toLocaleLowerCase():e.charAt(0).toLowerCase()+e.slice(1)},t.toCapitalCase=oe,t.toCssSize=function(t){return pt(t,!0)?`${mt(t)}px`:String(t).trim()},t.toFalse=function(){return!1},t.toFixed=vt,t.toGrayScale=function(t){return it(P(t))},t.toKebabCase=function(t){return t.replace(re,"-$1").toLowerCase()},t.toNumber=mt,t.toPrecision=Mt,t.toTrue=g,t.transformListToMap=te,t.transformTree=ee,t.walkTree=function(t,e,n={}){const{childField:r="children",depthFirst:o=!1}=n,a=[...t.map((t=>({item:t,depth:0,parent:null})))];for(;a.length;){const{item:t,depth:n,parent:i}=a.shift(),s=t[r];e(t,n,i),d(s)&&a[o?"unshift":"push"](...Array.from(s).map((e=>({item:e,depth:n+1,parent:t}))))}},t.warnOnce=function(t,e=console.warn){Bt(t,zt,e)},t.writeClipboard=async function(t){if(!e)return!1;if(!t)return!1;try{return await navigator.clipboard.writeText(t),!0}catch(e){return console.error("Modern clipboard API failed:",e),function(t){try{const e=document.createElement("textarea"),n=document.activeElement,r=document.getSelection(),o=r?.rangeCount?r.getRangeAt(0):null;e.value=t,e.setAttribute("readonly",""),e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="12pt",document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let a=!1;try{a=document.execCommand("copy")}catch(t){console.error("Fallback copy failed:",t)}return document.body.removeChild(e),o&&r&&(r.removeAllRanges(),r.addRange(o)),n?.focus(),a}catch(t){return console.error("Unexpected error in fallback copy:",t),!1}}(t)}},t.xorCipher=function(t,e){return t.split("").map(((t,n)=>String.fromCharCode(t.charCodeAt(0)^e.charCodeAt(n%e.length)))).join("")},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=toolset.io.js.map