mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-17 12:52:48 +00:00
2 lines
20 KiB
JavaScript
2 lines
20 KiB
JavaScript
import{Z as P,u as T,cc as ye,e as Ee,ar as Se,av as xe,a0 as V,M as ee,at as q,ag as pe,r as _,af as Te,a as we,au as Fe,ac as Me,$ as te,an as ke}from"./entry.08c6ab45.js";function Re(e){return e==null}class Ae extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function st(e,t){throw new Ae(`[${e}] ${t}`)}function it(e,t){}const ot=({from:e,replacement:t,scope:r,version:n,ref:a,type:s="API"},i)=>{P(()=>T(i),f=>{},{immediate:!0})},re={prefix:Math.floor(Math.random()*1e4),current:0},Ie=Symbol("elIdInjection"),He=()=>Se()?xe(Ie,re):re,ft=e=>{const t=He(),r=ye();return Ee(()=>T(e)||`${r.value}-id-${t.prefix}-${t.current++}`)};let x=[];const ne=e=>{const t=e;t.key===pe.esc&&x.forEach(r=>r(t))},Pe=e=>{V(()=>{x.length===0&&document.addEventListener("keydown",ne),ee&&x.push(e)}),q(()=>{x=x.filter(t=>t!==e),x.length===0&&ee&&document.removeEventListener("keydown",ne)})},ut=Symbol("formContextKey"),ct=Symbol("formItemContextKey"),B="focus-trap.focus-after-trapped",D="focus-trap.focus-after-released",_e="focus-trap.focusout-prevented",ae={cancelable:!0,bubbles:!1},Ne={cancelable:!0,bubbles:!1},se="focusAfterTrapped",ie="focusAfterReleased",Oe=Symbol("elFocusTrap"),G=_(),N=_(0),J=_(0);let k=0;const ge=e=>{const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0||n===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t},oe=(e,t)=>{for(const r of e)if(!Ce(r,t))return r},Ce=(e,t)=>{if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1},Le=e=>{const t=ge(e),r=oe(t,e),n=oe(t.reverse(),e);return[r,n]},Ue=e=>e instanceof HTMLInputElement&&"select"in e,y=(e,t)=>{if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),J.value=window.performance.now(),e!==r&&Ue(e)&&t&&e.select()}};function fe(e,t){const r=[...e],n=e.indexOf(t);return n!==-1&&r.splice(n,1),r}const Be=()=>{let e=[];return{push:n=>{const a=e[0];a&&n!==a&&a.pause(),e=fe(e,n),e.unshift(n)},remove:n=>{var a,s;e=fe(e,n),(s=(a=e[0])==null?void 0:a.resume)==null||s.call(a)}}},De=(e,t=!1)=>{const r=document.activeElement;for(const n of e)if(y(n,t),document.activeElement!==r)return},ue=Be(),Ke=()=>N.value>J.value,R=()=>{G.value="pointer",N.value=window.performance.now()},ce=()=>{G.value="keyboard",N.value=window.performance.now()},je=()=>(V(()=>{k===0&&(document.addEventListener("mousedown",R),document.addEventListener("touchstart",R),document.addEventListener("keydown",ce)),k++}),q(()=>{k--,k<=0&&(document.removeEventListener("mousedown",R),document.removeEventListener("touchstart",R),document.removeEventListener("keydown",ce))}),{focusReason:G,lastUserFocusTimestamp:N,lastAutomatedFocusTimestamp:J}),A=e=>new CustomEvent(_e,{...Ne,detail:e}),$e=we({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[se,ie,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const r=_();let n,a;const{focusReason:s}=je();Pe(o=>{e.trapped&&!i.paused&&t("release-requested",o)});const i={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},f=o=>{if(!e.loop&&!e.trapped||i.paused)return;const{key:u,altKey:l,ctrlKey:v,metaKey:p,currentTarget:z,shiftKey:Q}=o,{loop:X}=e,me=u===pe.tab&&!l&&!v&&!p,M=document.activeElement;if(me&&M){const C=z,[L,U]=Le(C);if(L&&U){if(!Q&&M===U){const m=A({focusReason:s.value});t("focusout-prevented",m),m.defaultPrevented||(o.preventDefault(),X&&y(L,!0))}else if(Q&&[L,C].includes(M)){const m=A({focusReason:s.value});t("focusout-prevented",m),m.defaultPrevented||(o.preventDefault(),X&&y(U,!0))}}else if(M===C){const m=A({focusReason:s.value});t("focusout-prevented",m),m.defaultPrevented||o.preventDefault()}}};Fe(Oe,{focusTrapRef:r,onKeydown:f}),P(()=>e.focusTrapEl,o=>{o&&(r.value=o)},{immediate:!0}),P([r],([o],[u])=>{o&&(o.addEventListener("keydown",f),o.addEventListener("focusin",w),o.addEventListener("focusout",F)),u&&(u.removeEventListener("keydown",f),u.removeEventListener("focusin",w),u.removeEventListener("focusout",F))});const d=o=>{t(se,o)},O=o=>t(ie,o),w=o=>{const u=T(r);if(!u)return;const l=o.target,v=o.relatedTarget,p=l&&u.contains(l);e.trapped||v&&u.contains(v)||(n=v),p&&t("focusin",o),!i.paused&&e.trapped&&(p?a=l:y(a,!0))},F=o=>{const u=T(r);if(!(i.paused||!u))if(e.trapped){const l=o.relatedTarget;!Re(l)&&!u.contains(l)&&setTimeout(()=>{if(!i.paused&&e.trapped){const v=A({focusReason:s.value});t("focusout-prevented",v),v.defaultPrevented||y(a,!0)}},0)}else{const l=o.target;l&&u.contains(l)||t("focusout",o)}};async function Y(){await te();const o=T(r);if(o){ue.push(i);const u=o.contains(document.activeElement)?n:document.activeElement;if(n=u,!o.contains(u)){const v=new Event(B,ae);o.addEventListener(B,d),o.dispatchEvent(v),v.defaultPrevented||te(()=>{let p=e.focusStartEl;ke(p)||(y(p),document.activeElement!==p&&(p="first")),p==="first"&&De(ge(o),!0),(document.activeElement===u||p==="container")&&y(o)})}}}function Z(){const o=T(r);if(o){o.removeEventListener(B,d);const u=new CustomEvent(D,{...ae,detail:{focusReason:s.value}});o.addEventListener(D,O),o.dispatchEvent(u),!u.defaultPrevented&&(s.value=="keyboard"||!Ke()||o.contains(document.activeElement))&&y(n??document.body),o.removeEventListener(D,d),ue.remove(i)}}return V(()=>{e.trapped&&Y(),P(()=>e.trapped,o=>{o?Y():Z()})}),q(()=>{e.trapped&&Z()}),{onKeydown:f}}});function We(e,t,r,n,a,s){return Me(e.$slots,"default",{handleKeydown:e.onKeydown})}var dt=Te($e,[["render",We],["__file","/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);function c(e,t){Ve(e)&&(e="100%");var r=qe(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function I(e){return Math.min(1,Math.max(0,e))}function Ve(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function qe(e){return typeof e=="string"&&e.indexOf("%")!==-1}function be(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function H(e){return e<=1?"".concat(Number(e)*100,"%"):e}function S(e){return e.length===1?"0"+e:String(e)}function Ge(e,t,r){return{r:c(e,255)*255,g:c(t,255)*255,b:c(r,255)*255}}function de(e,t,r){e=c(e,255),t=c(t,255),r=c(r,255);var n=Math.max(e,t,r),a=Math.min(e,t,r),s=0,i=0,f=(n+a)/2;if(n===a)i=0,s=0;else{var d=n-a;switch(i=f>.5?d/(2-n-a):d/(n+a),n){case e:s=(t-r)/d+(t<r?6:0);break;case t:s=(r-e)/d+2;break;case r:s=(e-t)/d+4;break}s/=6}return{h:s,s:i,l:f}}function K(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*(6*r):r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function Je(e,t,r){var n,a,s;if(e=c(e,360),t=c(t,100),r=c(r,100),t===0)a=r,s=r,n=r;else{var i=r<.5?r*(1+t):r+t-r*t,f=2*r-i;n=K(f,i,e+1/3),a=K(f,i,e),s=K(f,i,e-1/3)}return{r:n*255,g:a*255,b:s*255}}function he(e,t,r){e=c(e,255),t=c(t,255),r=c(r,255);var n=Math.max(e,t,r),a=Math.min(e,t,r),s=0,i=n,f=n-a,d=n===0?0:f/n;if(n===a)s=0;else{switch(n){case e:s=(t-r)/f+(t<r?6:0);break;case t:s=(r-e)/f+2;break;case r:s=(e-t)/f+4;break}s/=6}return{h:s,s:d,v:i}}function Ye(e,t,r){e=c(e,360)*6,t=c(t,100),r=c(r,100);var n=Math.floor(e),a=e-n,s=r*(1-t),i=r*(1-a*t),f=r*(1-(1-a)*t),d=n%6,O=[r,i,s,s,f,r][d],w=[f,r,r,i,s,s][d],F=[s,s,f,r,r,i][d];return{r:O*255,g:w*255,b:F*255}}function le(e,t,r,n){var a=[S(Math.round(e).toString(16)),S(Math.round(t).toString(16)),S(Math.round(r).toString(16))];return n&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function Ze(e,t,r,n,a){var s=[S(Math.round(e).toString(16)),S(Math.round(t).toString(16)),S(Math.round(r).toString(16)),S(ze(n))];return a&&s[0].startsWith(s[0].charAt(1))&&s[1].startsWith(s[1].charAt(1))&&s[2].startsWith(s[2].charAt(1))&&s[3].startsWith(s[3].charAt(1))?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function ze(e){return Math.round(parseFloat(e)*255).toString(16)}function ve(e){return h(e)/255}function h(e){return parseInt(e,16)}function Qe(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var W={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",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:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",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:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",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:"#ff0000",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:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Xe(e){var t={r:0,g:0,b:0},r=1,n=null,a=null,s=null,i=!1,f=!1;return typeof e=="string"&&(e=rt(e)),typeof e=="object"&&(b(e.r)&&b(e.g)&&b(e.b)?(t=Ge(e.r,e.g,e.b),i=!0,f=String(e.r).substr(-1)==="%"?"prgb":"rgb"):b(e.h)&&b(e.s)&&b(e.v)?(n=H(e.s),a=H(e.v),t=Ye(e.h,n,a),i=!0,f="hsv"):b(e.h)&&b(e.s)&&b(e.l)&&(n=H(e.s),s=H(e.l),t=Je(e.h,n,s),i=!0,f="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(r=e.a)),r=be(r),{ok:i,format:e.format||f,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}var et="[-\\+]?\\d+%?",tt="[-\\+]?\\d*\\.\\d+%?",E="(?:".concat(tt,")|(?:").concat(et,")"),j="[\\s|\\(]+(".concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")\\s*\\)?"),$="[\\s|\\(]+(".concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")\\s*\\)?"),g={CSS_UNIT:new RegExp(E),rgb:new RegExp("rgb"+j),rgba:new RegExp("rgba"+$),hsl:new RegExp("hsl"+j),hsla:new RegExp("hsla"+$),hsv:new RegExp("hsv"+j),hsva:new RegExp("hsva"+$),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function rt(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(W[e])e=W[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r=g.rgb.exec(e);return r?{r:r[1],g:r[2],b:r[3]}:(r=g.rgba.exec(e),r?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=g.hsl.exec(e),r?{h:r[1],s:r[2],l:r[3]}:(r=g.hsla.exec(e),r?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=g.hsv.exec(e),r?{h:r[1],s:r[2],v:r[3]}:(r=g.hsva.exec(e),r?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=g.hex8.exec(e),r?{r:h(r[1]),g:h(r[2]),b:h(r[3]),a:ve(r[4]),format:t?"name":"hex8"}:(r=g.hex6.exec(e),r?{r:h(r[1]),g:h(r[2]),b:h(r[3]),format:t?"name":"hex"}:(r=g.hex4.exec(e),r?{r:h(r[1]+r[1]),g:h(r[2]+r[2]),b:h(r[3]+r[3]),a:ve(r[4]+r[4]),format:t?"name":"hex8"}:(r=g.hex3.exec(e),r?{r:h(r[1]+r[1]),g:h(r[2]+r[2]),b:h(r[3]+r[3]),format:t?"name":"hex"}:!1)))))))))}function b(e){return!!g.CSS_UNIT.exec(String(e))}var ht=function(){function e(t,r){t===void 0&&(t=""),r===void 0&&(r={});var n;if(t instanceof e)return t;typeof t=="number"&&(t=Qe(t)),this.originalInput=t;var a=Xe(t);this.originalInput=t,this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a,this.roundA=Math.round(100*this.a)/100,this.format=(n=r.format)!==null&&n!==void 0?n:a.format,this.gradientType=r.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=a.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},e.prototype.getLuminance=function(){var t=this.toRgb(),r,n,a,s=t.r/255,i=t.g/255,f=t.b/255;return s<=.03928?r=s/12.92:r=Math.pow((s+.055)/1.055,2.4),i<=.03928?n=i/12.92:n=Math.pow((i+.055)/1.055,2.4),f<=.03928?a=f/12.92:a=Math.pow((f+.055)/1.055,2.4),.2126*r+.7152*n+.0722*a},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(t){return this.a=be(t),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var t=this.toHsl().s;return t===0},e.prototype.toHsv=function(){var t=he(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}},e.prototype.toHsvString=function(){var t=he(this.r,this.g,this.b),r=Math.round(t.h*360),n=Math.round(t.s*100),a=Math.round(t.v*100);return this.a===1?"hsv(".concat(r,", ").concat(n,"%, ").concat(a,"%)"):"hsva(".concat(r,", ").concat(n,"%, ").concat(a,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var t=de(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}},e.prototype.toHslString=function(){var t=de(this.r,this.g,this.b),r=Math.round(t.h*360),n=Math.round(t.s*100),a=Math.round(t.l*100);return this.a===1?"hsl(".concat(r,", ").concat(n,"%, ").concat(a,"%)"):"hsla(".concat(r,", ").concat(n,"%, ").concat(a,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(t){return t===void 0&&(t=!1),le(this.r,this.g,this.b,t)},e.prototype.toHexString=function(t){return t===void 0&&(t=!1),"#"+this.toHex(t)},e.prototype.toHex8=function(t){return t===void 0&&(t=!1),Ze(this.r,this.g,this.b,this.a,t)},e.prototype.toHex8String=function(t){return t===void 0&&(t=!1),"#"+this.toHex8(t)},e.prototype.toHexShortString=function(t){return t===void 0&&(t=!1),this.a===1?this.toHexString(t):this.toHex8String(t)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var t=Math.round(this.r),r=Math.round(this.g),n=Math.round(this.b);return this.a===1?"rgb(".concat(t,", ").concat(r,", ").concat(n,")"):"rgba(".concat(t,", ").concat(r,", ").concat(n,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var t=function(r){return"".concat(Math.round(c(r,255)*100),"%")};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var t=function(r){return Math.round(c(r,255)*100)};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return!1;for(var t="#"+le(this.r,this.g,this.b,!1),r=0,n=Object.entries(W);r<n.length;r++){var a=n[r],s=a[0],i=a[1];if(t===i)return s}return!1},e.prototype.toString=function(t){var r=!!t;t=t??this.format;var n=!1,a=this.a<1&&this.a>=0,s=!r&&a&&(t.startsWith("hex")||t==="name");return s?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(n=this.toRgbString()),t==="prgb"&&(n=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(n=this.toHexString()),t==="hex3"&&(n=this.toHexString(!0)),t==="hex4"&&(n=this.toHex8String(!0)),t==="hex8"&&(n=this.toHex8String()),t==="name"&&(n=this.toName()),t==="hsl"&&(n=this.toHslString()),t==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.l+=t/100,r.l=I(r.l),new e(r)},e.prototype.brighten=function(t){t===void 0&&(t=10);var r=this.toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),new e(r)},e.prototype.darken=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.l-=t/100,r.l=I(r.l),new e(r)},e.prototype.tint=function(t){return t===void 0&&(t=10),this.mix("white",t)},e.prototype.shade=function(t){return t===void 0&&(t=10),this.mix("black",t)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.s-=t/100,r.s=I(r.s),new e(r)},e.prototype.saturate=function(t){t===void 0&&(t=10);var r=this.toHsl();return r.s+=t/100,r.s=I(r.s),new e(r)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var r=this.toHsl(),n=(r.h+t)%360;return r.h=n<0?360+n:n,new e(r)},e.prototype.mix=function(t,r){r===void 0&&(r=50);var n=this.toRgb(),a=new e(t).toRgb(),s=r/100,i={r:(a.r-n.r)*s+n.r,g:(a.g-n.g)*s+n.g,b:(a.b-n.b)*s+n.b,a:(a.a-n.a)*s+n.a};return new e(i)},e.prototype.analogous=function(t,r){t===void 0&&(t=6),r===void 0&&(r=30);var n=this.toHsl(),a=360/r,s=[this];for(n.h=(n.h-(a*t>>1)+720)%360;--t;)n.h=(n.h+a)%360,s.push(new e(n));return s},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var r=this.toHsv(),n=r.h,a=r.s,s=r.v,i=[],f=1/t;t--;)i.push(new e({h:n,s:a,v:s})),s=(s+f)%1;return i},e.prototype.splitcomplement=function(){var t=this.toHsl(),r=t.h;return[this,new e({h:(r+72)%360,s:t.s,l:t.l}),new e({h:(r+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var r=this.toRgb(),n=new e(t).toRgb(),a=r.a+n.a*(1-r.a);return new e({r:(r.r*r.a+n.r*n.a*(1-r.a))/a,g:(r.g*r.a+n.g*n.a*(1-r.a))/a,b:(r.b*r.a+n.b*n.a*(1-r.a))/a,a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var r=this.toHsl(),n=r.h,a=[this],s=360/t,i=1;i<t;i++)a.push(new e({h:(n+i*s)%360,s:r.s,l:r.l}));return a},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();export{dt as E,Oe as F,ht as T,ct as a,ot as b,He as c,it as d,ut as f,Re as i,st as t,ft as u};
|