hdr-color-input 0.2.5 → 0.3.1

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.
@@ -1,3 +1,3 @@
1
1
  /* color-input web component - https://github.com/pops/css-color-component */
2
- var ColorInput=function(e){"use strict";var t,r,n,a,o,i,s,l,c,h,u,p,d,f,g,m,b,v,y,w,M,k,x,C,S,$,L,A,B,E,R,N,z,P,H,W,_,q,I,j,O,T=Object.defineProperty,G=e=>{throw TypeError(e)},D=(e,t,r)=>((e,t,r)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),F=(e,t,r)=>t.has(e)||G("Cannot "+r),Z=(e,t,r)=>(F(e,t,"read from private field"),r?r.call(e):t.get(e)),X=(e,t,r)=>t.has(e)?G("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Y=(e,t,r,n)=>(F(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),J=(e,t,r)=>(F(e,t,"access private method"),r),U=Symbol.for("preact-signals");function V(){if(te>1)te--;else{for(var e,t=!1;void 0!==ee;){var r=ee;for(ee=void 0,re++;void 0!==r;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&se(r))try{r.c()}catch(a){t||(e=a,t=!0)}r=n}}if(re=0,te--,t)throw e}}var Q=void 0;function K(e){var t=Q;Q=void 0;try{return e()}finally{Q=t}}var ee=void 0,te=0,re=0,ne=0;function ae(e){if(void 0!==Q){var t=e.n;if(void 0===t||t.t!==Q)return t={i:0,S:e,p:Q.s,n:void 0,t:Q,e:void 0,x:void 0,r:t},void 0!==Q.s&&(Q.s.n=t),Q.s=t,e.n=t,32&Q.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Q.s,t.n=void 0,Q.s.n=t,Q.s=t),t}}function oe(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function ie(e,t){return new oe(e,t)}function se(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function le(e){for(var t=e.s;void 0!==t;t=t.n){var r=t.S.n;if(void 0!==r&&(t.r=r),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function ce(e){for(var t=e.s,r=void 0;void 0!==t;){var n=t.p;-1===t.i?(t.S.U(t),void 0!==n&&(n.n=t.n),void 0!==t.n&&(t.n.p=n)):r=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=n}e.s=r}function he(e,t){oe.call(this,void 0),this.x=e,this.s=void 0,this.g=ne-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function ue(e,t){return new he(e,t)}function pe(e){var t=e.u;if(e.u=void 0,"function"==typeof t){te++;var r=Q;Q=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,de(e),n}finally{Q=r,V()}}}function de(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,pe(e)}function fe(e){if(Q!==this)throw new Error("Out-of-order effect");ce(this),Q=e,this.f&=-2,8&this.f&&de(this),V()}function ge(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function me(e,t){var r=new ge(e,t);try{r.c()}catch(a){throw r.d(),a}var n=r.d.bind(r);return n[Symbol.dispose]=n,n}function be(e,t){let r=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map(e=>[e]));let n=t[0].length,a=t[0].map((e,r)=>t.map(e=>e[r])),o=e.map(e=>a.map(t=>{let r=0;if(!Array.isArray(e)){for(let n of t)r+=e*n;return r}for(let n=0;n<e.length;n++)r+=e[n]*(t[n]||0);return r}));return 1===r&&(o=o[0]),1===n?o.map(e=>e[0]):o}function ve(e){return"string"===ye(e)}function ye(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function we(e,{precision:t,unit:r}){return Me(e)?"none":xe(e,t)+(null!=r?r:"")}function Me(e){return Number.isNaN(e)||e instanceof Number&&(null==e?void 0:e.none)}function ke(e){return Me(e)?0:e}function xe(e,t){if(0===e)return 0;let r=~~e,n=0;r&&t&&(n=1+~~Math.log10(Math.abs(r)));const a=10**(t-n);return Math.floor(e*a+.5)/a}oe.prototype.brand=U,oe.prototype.h=function(){return!0},oe.prototype.S=function(e){var t=this,r=this.t;r!==e&&void 0===e.e&&(e.x=r,this.t=e,void 0!==r?r.e=e:K(function(){var e;null==(e=t.W)||e.call(t)}))},oe.prototype.U=function(e){var t=this;if(void 0!==this.t){var r=e.e,n=e.x;void 0!==r&&(r.x=n,e.e=void 0),void 0!==n&&(n.e=r,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&K(function(){var e;null==(e=t.Z)||e.call(t)}))}},oe.prototype.subscribe=function(e){var t=this;return me(function(){var r=t.value,n=Q;Q=void 0;try{e(r)}finally{Q=n}},{name:"sub"})},oe.prototype.valueOf=function(){return this.value},oe.prototype.toString=function(){return this.value+""},oe.prototype.toJSON=function(){return this.value},oe.prototype.peek=function(){var e=Q;Q=void 0;try{return this.value}finally{Q=e}},Object.defineProperty(oe.prototype,"value",{get:function(){var e=ae(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(re>100)throw new Error("Cycle detected");this.v=e,this.i++,ne++,te++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{V()}}}}),he.prototype=new oe,he.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===ne)return!0;if(this.g=ne,this.f|=1,this.i>0&&!se(this))return this.f&=-2,!0;var e=Q;try{le(this),Q=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return Q=e,ce(this),this.f&=-2,!0},he.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}oe.prototype.S.call(this,e)},he.prototype.U=function(e){if(void 0!==this.t&&(oe.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},he.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(he.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ae(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),ge.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},ge.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,pe(this),le(this),te++;var e=Q;return Q=this,fe.bind(this,e)},ge.prototype.N=function(){2&this.f||(this.f|=2,this.o=ee,ee=this)},ge.prototype.d=function(){this.f|=8,1&this.f||de(this)},ge.prototype.dispose=function(){this.d()};const Ce={deg:1,grad:.9,rad:180/Math.PI,turn:360};function Se(e){if(!e)return;e=e.trim();const t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,n=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let a=e.match(/^([a-z]+)\((.+?)\)$/i);if(a){let e=[];return a[2].replace(n,(n,a)=>{let o=a.match(r),i=a;if(o){let e=o[0],t=i.slice(0,-e.length);"%"===e?(i=new Number(t/100),i.type="<percentage>"):(i=new Number(t*Ce[e]),i.type="<angle>",i.unit=e)}else t.test(i)?(i=new Number(i),i.type="<number>"):"none"===i&&(i=new Number(NaN),i.none=!0);n.startsWith("/")&&(i=i instanceof Number?i:new Number(i),i.alpha=!0),"object"==typeof i&&i instanceof Number&&(i.raw=a),e.push(i)}),{name:a[1].toLowerCase(),rawName:a[1],rawArgs:a[2],args:e}}}function $e(e){return e[e.length-1]}function Le(e,t,r){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*r}function Ae(e,t,r){return(r-e)/(t-e)}function Be(e,t,r){return Le(t[0],t[1],Ae(e[0],e[1],r))}function Ee(e){return e.map(e=>e.split("|").map(e=>{let t=(e=e.trim()).match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(t){let e=new String(t[1]);return e.range=[+t[2],+t[3]],e}return e}))}function Re(e,t,r){return Math.max(Math.min(r,t),e)}function Ne(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function ze(e,t){return Ne(Math.abs(e)**t,e)}function Pe(e,t){return 0===t?0:e/t}function He(e,t,r=0,n=e.length){for(;r<n;){const a=r+n>>1;e[a]<t?r=a+1:n=a}return r}var We=Object.freeze({__proto__:null,bisectLeft:He,clamp:Re,copySign:Ne,interpolate:Le,interpolateInv:Ae,isNone:Me,isString:ve,last:$e,mapRange:Be,multiplyMatrices:be,parseCoordGrammar:Ee,parseFunction:Se,serializeNumber:we,skipNone:ke,spow:ze,toPrecision:xe,type:ye,zdiv:Pe});const _e=new class{add(e,t,r){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}};var qe={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==(null==(n=null==(r=null==(t=null==globalThis?void 0:globalThis.process)?void 0:t.env)?void 0:r.NODE_ENV)?void 0:n.toLowerCase()),warn:function(e){var t,r;this.verbose&&(null==(r=null==(t=null==globalThis?void 0:globalThis.console)?void 0:t.warn)||r.call(t,e))}};const Ie={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function je(e){return Array.isArray(e)?e:Ie[e]}function Oe(e,t,r,n={}){if(e=je(e),t=je(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return r;let a={W1:e,W2:t,XYZ:r,options:n};if(_e.run("chromatic-adaptation-start",a),a.M||(a.W1===Ie.D65&&a.W2===Ie.D50?a.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:a.W1===Ie.D50&&a.W2===Ie.D65&&(a.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),_e.run("chromatic-adaptation-end",a),a.M)return be(a.M,a.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Te=new Set(["<number>","<percentage>","<angle>"]);function Ge(e,t,r,n){return Object.entries(e.coords).map(([e,a],o)=>{let i,s=t.coordGrammar[o],l=n[o],c=null==l?void 0:l.type;if(i=l.none?s.find(e=>Te.has(e)):s.find(e=>e==c),!i){let t=a.name||e;throw new TypeError(`${null!=c?c:l.raw} not allowed for ${t} in ${r}()`)}let h=i.range;"<percentage>"===c&&(h||(h=[0,1]));let u=a.range||a.refRange;return h&&u&&(n[o]=Be(h,u,n[o])),i})}function De(e,{meta:t}={}){var r,n,a,o;let i={str:null==(r=String(e))?void 0:r.trim()};if(_e.run("parse-start",i),i.color)return i.color;if(i.parsed=Se(i.str),i.parsed){let e=i.parsed.name;if("color"===e){let e=i.parsed.args.shift(),r=e.startsWith("--")?e.substring(2):`--${e}`,s=[e,r],l=i.parsed.rawArgs.indexOf("/")>0?i.parsed.args.pop():1;for(let a of Xe.all){let r=a.getFormat("color");if(r&&(s.includes(r.id)||(null==(n=r.ids)?void 0:n.filter(e=>s.includes(e)).length))){const n=Object.keys(a.coords).map((e,t)=>i.parsed.args[t]||0);let o;return r.coordGrammar&&(o=Ge(a,r,"color",n)),t&&Object.assign(t,{formatId:"color",types:o}),r.id.startsWith("--")&&!e.startsWith("--")&&qe.warn(`${a.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${r.id}) instead of color(${e}).`),e.startsWith("--")&&!r.id.startsWith("--")&&qe.warn(`${a.name} is a standard space and supported in the CSS spec. Use color(${r.id}) instead of prefixed color(${e}).`),{spaceId:a.id,coords:n,alpha:l}}}let c="",h=e in Xe.registry?e:r;if(h in Xe.registry){let e=null==(o=null==(a=Xe.registry[h].formats)?void 0:a.color)?void 0:o.id;e&&(c=`Did you mean color(${e})?`)}throw new TypeError(`Cannot parse color(${e}). `+(c||"Missing a plugin?"))}for(let r of Xe.all){let n=r.getFormat(e);if(n&&"function"===n.type){let a=1;(n.lastAlpha||$e(i.parsed.args).alpha)&&(a=i.parsed.args.pop());let o,s=i.parsed.args;return n.coordGrammar&&(o=Ge(r,n,e,s)),t&&Object.assign(t,{formatId:n.name,types:o}),{spaceId:r.id,coords:s,alpha:a}}}}else for(let s of Xe.all)for(let e in s.formats){let r=s.formats[e];if("custom"!==r.type)continue;if(r.test&&!r.test(i.str))continue;let n=r.parse(i.str);if(n)return null!=n.alpha||(n.alpha=1),t&&(t.formatId=e),n}throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`)}function Fe(e){if(Array.isArray(e))return e.map(Fe);if(!e)throw new TypeError("Empty color reference");ve(e)&&(e=De(e));let t=e.space||e.spaceId;return t instanceof Xe||(e.space=Xe.get(t)),void 0===e.alpha&&(e.alpha=1),e}const Ze=class e{constructor(t){var r,n,a,o,i,s;this.id=t.id,this.name=t.name,this.base=t.base?e.get(t.base):null,this.aliases=t.aliases,this.base&&(this.fromBase=t.fromBase,this.toBase=t.toBase);let l=null!=(r=t.coords)?r:this.base.coords;for(let e in l)"name"in l[e]||(l[e].name=e);this.coords=l;let c=null!=(a=null!=(n=t.white)?n:this.base.white)?a:"D65";this.white=je(c),this.formats=null!=(o=t.formats)?o:{};for(let e in this.formats){let t=this.formats[e];t.type||(t.type="function"),t.name||(t.name=e)}(null==(i=this.formats.color)?void 0:i.id)||(this.formats.color={...null!=(s=this.formats.color)?s:{},id:t.cssId||this.id}),t.gamutSpace?this.gamutSpace="self"===t.gamutSpace?this:e.get(t.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=t.referred,Object.defineProperty(this,"path",{value:Ye(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),_e.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=75e-6}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every((e,n)=>{let a=r[n];if("angle"!==a.type&&a.range){if(Number.isNaN(e))return!0;let[r,n]=a.range;return(void 0===r||e>=r-t)&&(void 0===n||e<=n+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return(null==(t=null==(e=this.formats)?void 0:e.color)?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if("object"==typeof e)return Je(e,this);let t;return t="default"===e?Object.values(this.formats)[0]:this.formats[e],t?(t=Je(t,this),t):null}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(t,r){if(1===arguments.length){const e=Fe(t);[t,r]=[e.space,e.coords]}if(t=e.get(t),this.equals(t))return r;r=r.map(e=>Number.isNaN(e)?0:e);let n,a,o=this.path,i=t.path;for(let e=0;e<o.length&&o[e].equals(i[e]);e++)n=o[e],a=e;if(!n)throw new Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);for(let e=o.length-1;e>a;e--)r=o[e].toBase(r);for(let e=a+1;e<i.length;e++)r=i[e].fromBase(r);return r}from(t,r){if(1===arguments.length){const e=Fe(t);[t,r]=[e.space,e.coords]}return(t=e.get(t)).to(this,r)}toString(){return`${this.name} (${this.id})`}getMinCoords(){var e;let t=[];for(let r in this.coords){let n=this.coords[r],a=n.range||n.refRange;t.push(null!=(e=null==a?void 0:a.min)?e:0)}return t}static get all(){return[...new Set(Object.values(e.registry))]}static register(e,t){if(1===arguments.length&&(e=(t=arguments[0]).id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,1===arguments.length&&t.aliases)for(let r of t.aliases)this.register(r,t);return t}static get(t,...r){if(!t||t instanceof e)return t;if("string"===ye(t)){let r=e.registry[t.toLowerCase()];if(!r)throw new TypeError(`No color space found with id = "${t}"`);return r}if(r.length)return e.get(...r);throw new TypeError(`${t} is not a valid color space`)}static resolveCoord(t,r){var n;let a,o,i=ye(t);if("string"===i?t.includes(".")?[a,o]=t.split("."):[a,o]=[,t]:Array.isArray(t)?[a,o]=t:(a=t.space,o=t.coordId),a=e.get(a),a||(a=r),!a)throw new TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);if(i=ye(o),"number"===i||"string"===i&&o>=0){let e=Object.entries(a.coords)[o];if(e)return{space:a,id:e[0],index:o,...e[1]}}a=e.get(a);let s=o.toLowerCase(),l=0;for(let e in a.coords){let t=a.coords[e];if(e.toLowerCase()===s||(null==(n=t.name)?void 0:n.toLowerCase())===s)return{space:a,id:e,index:l,...t};l++}throw new TypeError(`No "${o}" coordinate found in ${a.name}. Its coordinates are: ${Object.keys(a.coords).join(", ")}`)}};D(Ze,"registry",{}),D(Ze,"DEFAULT_FORMAT",{type:"functions",name:"color"});let Xe=Ze;function Ye(e){let t=[e];for(let r=e;r=r.base;)t.push(r);return t}function Je(e,{coords:t}={}){if(e.coords&&!e.coordGrammar){e.type||(e.type="function"),e.name||(e.name="color"),e.coordGrammar=Ee(e.coords);let r=Object.entries(t).map(([t,r],n)=>{let a=e.coordGrammar[n][0],o=r.range||r.refRange,i=a.range,s="";return"<percentage>"==a?(i=[0,100],s="%"):"<angle>"==a&&(s="deg"),{fromRange:o,toRange:i,suffix:s}});e.serializeCoords=(e,t)=>e.map((e,n)=>{let{fromRange:a,toRange:o,suffix:i}=r[n];return a&&o&&(e=Be(a,o,e)),we(e,{precision:t,unit:i})})}return e}var Ue=new Xe({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class Ve extends Xe{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Ue),e.toXYZ_M&&e.fromXYZ_M&&(null!=e.toBase||(e.toBase=t=>{let r=be(e.toXYZ_M,t);return this.white!==this.base.white&&(r=Oe(this.white,this.base.white,r)),r}),null!=e.fromBase||(e.fromBase=t=>(t=Oe(this.base.white,this.white,t),be(e.fromXYZ_M,t)))),null!=e.referred||(e.referred="display"),super(e)}}function Qe(e,t){return e=Fe(e),!t||e.space.equals(t)?e.coords.slice():(t=Xe.get(t)).from(e)}function Ke(e,t){e=Fe(e);let{space:r,index:n}=Xe.resolveCoord(t,e.space);return Qe(e,r)[n]}function et(e,t,r){return e=Fe(e),t=Xe.get(t),e.coords=t.to(e.space,r),e}function tt(e,t,r){if(e=Fe(e),2===arguments.length&&"object"===ye(arguments[1])){let t=arguments[1];for(let r in t)tt(e,r,t[r])}else{"function"==typeof r&&(r=r(Ke(e,t)));let{space:n,index:a}=Xe.resolveCoord(t,e.space),o=Qe(e,n);o[a]=r,et(e,n,o)}return e}et.returns="color",tt.returns="color";var rt=new Xe({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Ue,fromBase:e=>Oe(Ue.white,"D50",e),toBase:e=>Oe("D50",Ue.white,e)});const nt=216/24389,at=24/116,ot=24389/27;let it=Ie.D50;var st=new Xe({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:it,base:rt,fromBase(e){let t=e.map((e,t)=>e/it[t]).map(e=>e>nt?Math.cbrt(e):(ot*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>at?Math.pow(t[0],3):(116*t[0]-16)/ot,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/ot,t[2]>at?Math.pow(t[2],3):(116*t[2]-16)/ot].map((e,t)=>e*it[t])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function lt(e){return(e%360+360)%360}var ct=new Xe({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:st,fromBase(e){let t,[r,n,a]=e;return t=Math.abs(n)<.02&&Math.abs(a)<.02?NaN:180*Math.atan2(a,n)/Math.PI,[r,Math.sqrt(n**2+a**2),lt(t)]},toBase(e){let[t,r,n]=e;return r<0&&(r=0),isNaN(n)&&(n=0),[t,r*Math.cos(n*Math.PI/180),r*Math.sin(n*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const ht=25**7,ut=Math.PI,pt=180/ut,dt=ut/180;function ft(e){const t=e*e;return t*t*t*e}function gt(e,t,{kL:r=1,kC:n=1,kH:a=1}={}){[e,t]=Fe([e,t]);let[o,i,s]=st.from(e),l=ct.from(st,[o,i,s])[1],[c,h,u]=st.from(t),p=ct.from(st,[c,h,u])[1];l<0&&(l=0),p<0&&(p=0);let d=ft((l+p)/2),f=.5*(1-Math.sqrt(d/(d+ht))),g=(1+f)*i,m=(1+f)*h,b=Math.sqrt(g**2+s**2),v=Math.sqrt(m**2+u**2),y=0===g&&0===s?0:Math.atan2(s,g),w=0===m&&0===u?0:Math.atan2(u,m);y<0&&(y+=2*ut),w<0&&(w+=2*ut),y*=pt,w*=pt;let M,k=c-o,x=v-b,C=w-y,S=y+w,$=Math.abs(C);b*v===0?M=0:$<=180?M=C:C>180?M=C-360:C<-180?M=C+360:qe.warn("the unthinkable has happened");let L,A=2*Math.sqrt(v*b)*Math.sin(M*dt/2),B=(o+c)/2,E=(b+v)/2,R=ft(E);L=b*v===0?S:$<=180?S/2:S<360?(S+360)/2:(S-360)/2;let N=(B-50)**2,z=1+.015*N/Math.sqrt(20+N),P=1+.045*E,H=1;H-=.17*Math.cos((L-30)*dt),H+=.24*Math.cos(2*L*dt),H+=.32*Math.cos((3*L+6)*dt),H-=.2*Math.cos((4*L-63)*dt);let W=1+.015*E*H,_=30*Math.exp(-1*((L-275)/25)**2),q=2*Math.sqrt(R/(R+ht)),I=(k/(r*z))**2;return I+=(x/(n*P))**2,I+=(A/(a*W))**2,I+=-1*Math.sin(2*_*dt)*q*(x/(n*P))*(A/(a*W)),Math.sqrt(I)}const mt=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],bt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],vt=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],yt=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var wt=new Xe({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Ue,fromBase(e){let t=be(mt,e).map(e=>Math.cbrt(e));return be(vt,t)},toBase(e){let t=be(yt,e).map(e=>e**3);return be(bt,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Mt(e,t){[e,t]=Fe([e,t]);let[r,n,a]=wt.from(e),[o,i,s]=wt.from(t),l=r-o,c=n-i,h=a-s;return Math.sqrt(l**2+c**2+h**2)}function kt(e,t,{epsilon:r=75e-6}={}){e=Fe(e),t||(t=e.space),t=Xe.get(t);let n=e.coords;return t!==e.space&&(n=t.from(e)),t.inGamut(n,{epsilon:r})}function xt(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}function Ct(e,t,r="lab"){let n=(r=Xe.get(r)).from(e),a=r.from(t);return Math.sqrt(n.reduce((e,t,r)=>{let n=a[r];return isNaN(t)||isNaN(n)?e:e+(n-t)**2},0))}const St=Math.PI/180;var $t=new Xe({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Ue,fromBase:e=>e.map(e=>Math.max(203*e,0)),toBase:e=>e.map(e=>Math.max(e/203,0))});const Lt=1.15,At=.66,Bt=2610/16384,Et=16384/2610,Rt=.8359375,Nt=2413/128,zt=18.6875,Pt=1.7*2523/32,Ht=32/(1.7*2523),Wt=-.56,_t=16295499532821565e-27,qt=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],It=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],jt=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],Ot=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var Tt=new Xe({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:$t,fromBase(e){let[t,r,n]=e,a=be(qt,[Lt*t-(Lt-1)*n,At*r-(At-1)*t,n]).map(function(e){return((Rt+Nt*(e/1e4)**Bt)/(1+zt*(e/1e4)**Bt))**Pt}),[o,i,s]=be(jt,a);return[(1+Wt)*o/(1+Wt*o)-_t,i,s]},toBase(e){let[t,r,n]=e,a=be(Ot,[(t+_t)/(1+Wt-Wt*(t+_t)),r,n]).map(function(e){return 1e4*((Rt-e**Ht)/(zt*e**Ht-Nt))**Et}),[o,i,s]=be(It,a),l=(o+(Lt-1)*s)/Lt;return[l,(i+(At-1)*l)/At,s]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),Gt=new Xe({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:Tt,fromBase(e){let t,[r,n,a]=e;const o=2e-4;return t=Math.abs(n)<o&&Math.abs(a)<o?NaN:180*Math.atan2(a,n)/Math.PI,[r,Math.sqrt(n**2+a**2),lt(t)]},toBase:e=>[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]});const Dt=.8359375,Ft=2413/128,Zt=18.6875,Xt=2610/16384,Yt=16384/2610,Jt=32/2523,Ut=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],Vt=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],Qt=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],Kt=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var er=new Xe({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:$t,fromBase:e=>function(e){let t=e.map(function(e){return((Dt+Ft*(e/1e4)**Xt)/(1+Zt*(e/1e4)**Xt))**78.84375});return be(Vt,t)}(be(Ut,e)),toBase(e){let t=function(e){return be(Qt,e).map(function(e){return 1e4*(Math.max(e**Jt-Dt,0)/(Ft-Zt*e**Jt))**Yt})}(e);return be(Kt,t)}});const tr=Ie.D65,rr=1/.42,nr=2*Math.PI,ar=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],or=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],ir=[[460,451,288],[460,-891,-261],[460,-220,-6300]],sr={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},lr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},cr=180/Math.PI,hr=Math.PI/180;function ur(e,t){return e.map(e=>{const r=ze(t*Math.abs(e)*.01,.42);return 400*Ne(r,e)/(r+27.13)})}function pr(e,t,r,n,a){const o={};o.discounting=a,o.refWhite=e,o.surround=n;const i=e.map(e=>100*e);o.la=t,o.yb=r;const s=i[1],l=be(ar,i),c=(n=sr[o.surround])[0];o.c=n[1],o.nc=n[2];const h=(1/(5*o.la+1))**4;o.fl=h*o.la+.1*(1-h)*(1-h)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/s,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const u=Math.max(Math.min(c*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=l.map(e=>Le(1,s/e,u)),o.dRgbInv=o.dRgb.map(e=>1/e);const p=ur(l.map((e,t)=>e*o.dRgb[t]),o.fl);return o.aW=o.nbb*(2*p[0]+p[1]+.05*p[2]),o}const dr=pr(tr,64/Math.PI*.2,20,"average",!1);function fr(e,t){if(!(void 0!==e.J^void 0!==e.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==e.C^void 0!==e.M^void 0!==e.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==e.h^void 0!==e.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===e.J||0===e.Q)return[0,0,0];let r=0;r=void 0!==e.h?lt(e.h)*hr:function(e){let t=(e%400+400)%400;const r=Math.floor(.01*t);t%=100;const[n,a]=lr.h.slice(r,r+2),[o,i]=lr.e.slice(r,r+2);return lt((t*(i*n-o*a)-100*n*i)/(t*(i-o)-100*i))}(e.H)*hr;const n=Math.cos(r),a=Math.sin(r);let o=0;void 0!==e.J?o=.1*ze(e.J,.5):void 0!==e.Q&&(o=.25*t.c*e.Q/((t.aW+4)*t.flRoot));let i=0;void 0!==e.C?i=e.C/o:void 0!==e.M?i=e.M/t.flRoot/o:void 0!==e.s&&(i=4e-4*e.s**2*(t.aW+4)/t.c);const s=ze(i*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),l=.25*(Math.cos(r+2)+3.8),c=t.aW*ze(o,2/t.c/t.z),h=5e4/13*t.nc*t.ncb*l,u=c/t.nbb,p=23*(u+.305)*Pe(s,23*h+s*(11*n+108*a)),d=function(e,t){const r=100/t*2588.068098016295;return e.map(e=>{const t=Math.abs(e);return Ne(r*ze(t/(400-t),rr),e)})}(be(ir,[u,p*n,p*a]).map(e=>1*e/1403),t.fl);return be(or,d.map((e,r)=>e*t.dRgbInv[r])).map(e=>e/100)}function gr(e,t){const r=e.map(e=>100*e),n=ur(be(ar,r).map((e,r)=>e*t.dRgb[r]),t.fl),a=n[0]+(-12*n[1]+n[2])/11,o=(n[0]+n[1]-2*n[2])/9,i=(Math.atan2(o,a)%nr+nr)%nr,s=.25*(Math.cos(i+2)+3.8),l=ze(5e4/13*t.nc*t.ncb*Pe(s*Math.sqrt(a**2+o**2),n[0]+n[1]+1.05*n[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),c=ze(t.nbb*(2*n[0]+n[1]+.05*n[2])/t.aW,.5*t.c*t.z),h=100*ze(c,2),u=4/t.c*c*(t.aW+4)*t.flRoot,p=l*c,d=p*t.flRoot,f=lt(i*cr),g=function(e){let t=lt(e);t<=lr.h[0]&&(t+=360);const r=He(lr.h,t)-1,[n,a]=lr.h.slice(r,r+2),[o,i]=lr.e.slice(r,r+2),s=(t-n)/o;return lr.H[r]+100*s/(s+(a-t)/i)}(f);return{J:h,C:p,h:f,s:50*ze(t.c*l/(t.aW+4),.5),Q:u,M:d,H:g}}var mr=new Xe({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Ue,fromBase(e){const t=gr(e,dr);return[t.J,t.M,t.h]},toBase:e=>fr({J:e[0],M:e[1],h:e[2]},dr)});const br=Ie.D65,vr=216/24389,yr=24389/27;function wr(e){return e>8?Math.pow((e+16)/116,3):e/yr}const Mr=pr(br,200/Math.PI*wr(50),100*wr(50),"average",!1);var kr=new Xe({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Ue,fromBase:e=>function(e){const t=116*((r=e[1])>vr?Math.cbrt(r):(yr*r+16)/116)-16;var r;if(0===t)return[0,0,0];const n=gr(e,Mr);return[lt(n.h),n.C,t]}(e),toBase:e=>function(e,t){let[r,n,a]=e,o=[],i=0;if(0===a)return[0,0,0];let s=wr(a);i=a>0?.00379058511492914*a**2+.608983189401032*a+.9155088574762233:9514440756550361e-21*a**2+.08693057439788597*a-21.928975842194614;let l=0,c=1/0;for(;l<=15;){o=fr({J:i,C:n,h:r},t);const e=Math.abs(o[1]-s);if(e<c){if(e<=2e-12)return o;c=e}i-=(o[1]-s)*i/(2*o[1]),l+=1}return fr({J:i,C:n,h:r},t)}(e,Mr),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const xr=Math.PI/180,Cr=[1,.007,.0228];function Sr(e){e[1]<0&&(e=kr.fromBase(kr.toBase(e)));const t=Math.log(Math.max(1+Cr[2]*e[1]*Mr.flRoot,1))/Cr[2],r=e[0]*xr,n=t*Math.cos(r),a=t*Math.sin(r);return[e[2],n,a]}var $r={deltaE76:function(e,t){return Ct(e,t,"lab")},deltaECMC:function(e,t,{l:r=2,c:n=1}={}){[e,t]=Fe([e,t]);let[a,o,i]=st.from(e),[,s,l]=ct.from(st,[a,o,i]),[c,h,u]=st.from(t),p=ct.from(st,[c,h,u])[1];s<0&&(s=0),p<0&&(p=0);let d=a-c,f=s-p,g=(o-h)**2+(i-u)**2-f**2,m=.511;a>=16&&(m=.040975*a/(1+.01765*a));let b,v=.0638*s/(1+.0131*s)+.638;Number.isNaN(l)&&(l=0),b=l>=164&&l<=345?.56+Math.abs(.2*Math.cos((l+168)*St)):.36+Math.abs(.4*Math.cos((l+35)*St));let y=Math.pow(s,4),w=Math.sqrt(y/(y+1900)),M=(d/(r*m))**2;return M+=(f/(n*v))**2,M+=g/(v*(w*b+1-w))**2,Math.sqrt(M)},deltaE2000:gt,deltaEJz:function(e,t){[e,t]=Fe([e,t]);let[r,n,a]=Gt.from(e),[o,i,s]=Gt.from(t),l=r-o,c=n-i;Number.isNaN(a)&&Number.isNaN(s)?(a=0,s=0):Number.isNaN(a)?a=s:Number.isNaN(s)&&(s=a);let h=a-s,u=2*Math.sqrt(n*i)*Math.sin(h/2*(Math.PI/180));return Math.sqrt(l**2+c**2+u**2)},deltaEITP:function(e,t){[e,t]=Fe([e,t]);let[r,n,a]=er.from(e),[o,i,s]=er.from(t);return 720*Math.sqrt((r-o)**2+.25*(n-i)**2+(a-s)**2)},deltaEOK:Mt,deltaEHCT:function(e,t){[e,t]=Fe([e,t]);let[r,n,a]=Sr(kr.from(e)),[o,i,s]=Sr(kr.from(t));return Math.sqrt((r-o)**2+(n-i)**2+(a-s)**2)}};const Lr={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Ar(e,{method:t=qe.gamut_mapping,space:r,deltaEMethod:n="",jnd:a=2,blackWhiteClamp:o={}}={}){if(e=Fe(e),ve(arguments[1])?r=arguments[1]:r||(r=e.space),kt(e,r=Xe.get(r),{epsilon:0}))return e;let i;if("css"===t)i=function(e,{space:t}={}){const r=.02,n=1e-4;e=Fe(e),t||(t=e.space),t=Xe.get(t);const a=Xe.get("oklch");if(t.isUnbounded)return Er(e,t);const o=Er(e,a);let i=o.coords[0];if(i>=1){const r=Er(Br.WHITE,t);return r.alpha=e.alpha,Er(r,t)}if(i<=0){const r=Er(Br.BLACK,t);return r.alpha=e.alpha,Er(r,t)}if(kt(o,t,{epsilon:0}))return Er(o,t);function s(e){const r=Er(e,t),n=Object.values(t.coords);return r.coords=r.coords.map((e,t)=>{if("range"in n[t]){const[r,a]=n[t].range;return Re(r,e,a)}return e}),r}let l=0,c=o.coords[1],h=!0,u=xt(o),p=s(u),d=Mt(p,u);if(d<r)return p;for(;c-l>n;){const e=(l+c)/2;if(u.coords[1]=e,h&&kt(u,t,{epsilon:0}))l=e;else if(p=s(u),d=Mt(p,u),d<r){if(r-d<n)break;h=!1,l=e}else c=e}return p}(e,{space:r});else{if("clip"===t||kt(e,r))i=Er(e,r);else{Object.prototype.hasOwnProperty.call(Lr,t)&&({method:t,jnd:a,deltaEMethod:n,blackWhiteClamp:o}=Lr[t]);let s=gt;if(""!==n)for(let e in $r)if("deltae"+n.toLowerCase()===e.toLowerCase()){s=$r[e];break}let l=Ar(Er(e,r),{method:"clip",space:r});if(s(e,l)>a){if(3===Object.keys(o).length){let t=Xe.resolveCoord(o.channel),r=Ke(Er(e,t.space),t.id);if(Me(r)&&(r=0),r>=o.max)return Er({space:"xyz-d65",coords:Ie.D65},e.space);if(r<=o.min)return Er({space:"xyz-d65",coords:[0,0,0]},e.space)}let n=Xe.resolveCoord(t),l=n.space,c=n.id,h=Er(e,l);h.coords.forEach((e,t)=>{Me(e)&&(h.coords[t]=0)});let u=(n.range||n.refRange)[0],p=function(e){const t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat("1e"+(t-2)),1e-6)}(a),d=u,f=Ke(h,c);for(;f-d>p;){let e=xt(h);e=Ar(e,{space:r,method:"clip"}),s(h,e)-a<p?d=Ke(h,c):f=Ke(h,c),tt(h,c,(d+f)/2)}i=Er(h,r)}else i=l}if("clip"===t||!kt(i,r,{epsilon:0})){let e=Object.values(r.coords).map(e=>e.range||[]);i.coords=i.coords.map((t,r)=>{let[n,a]=e[r];return void 0!==n&&(t=Math.max(n,t)),void 0!==a&&(t=Math.min(t,a)),t})}}return r!==e.space&&(i=Er(i,e.space)),e.coords=i.coords,e}Ar.returns="color";const Br={WHITE:{space:wt,coords:[1,0,0]},BLACK:{space:wt,coords:[0,0,0]}};function Er(e,t,{inGamut:r}={}){e=Fe(e);let n=(t=Xe.get(t)).from(e),a={space:t,coords:n,alpha:e.alpha};return r&&(a=Ar(a,!0===r?void 0:r)),a}function Rr(e,{precision:t=qe.precision,format:r="default",inGamut:n=!0,...a}={}){var o,i,s;let l,c=r;r=null!=(i=null!=(o=(e=Fe(e)).space.getFormat(r))?o:e.space.getFormat("default"))?i:Xe.DEFAULT_FORMAT;let h=e.coords.slice();if(n||(n=r.toGamut),n&&!kt(e)&&(h=Ar(xt(e),!0===n?void 0:n).coords),"custom"===r.type){if(a.precision=t,!r.serialize)throw new TypeError(`format ${c} can only be used to parse colors, not for serialization`);l=r.serialize(h,e.alpha,a)}else{let n=r.name||"color";r.serializeCoords?h=r.serializeCoords(h,t):null!==t&&(h=h.map(e=>we(e,{precision:t})));let a=[...h];if("color"===n){let t=r.id||(null==(s=r.ids)?void 0:s[0])||e.space.id;a.unshift(t)}let o=e.alpha;null!==t&&(o=we(o,{precision:t}));let i=e.alpha>=1||r.noAlpha?"":`${r.commas?",":" /"} ${o}`;l=`${n}(${a.join(r.commas?", ":" ")}${i})`}return l}Er.returns="color";var Nr=new Ve({id:"rec2020-linear",cssId:"--rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],fromXYZ_M:[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]]});const zr=1.09929682680944,Pr=.018053968510807;var Hr=new Ve({id:"rec2020",name:"REC.2020",base:Nr,toBase:e=>e.map(function(e){return e<4.5*Pr?e/4.5:Math.pow((e+zr-1)/zr,1/.45)}),fromBase:e=>e.map(function(e){return e>=Pr?zr*Math.pow(e,.45)-(zr-1):4.5*e})}),Wr=new Ve({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ_M:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]});const _r=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]];var qr=new Ve({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ_M:_r}),Ir={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[.4,.2,.6],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let jr=Array(3).fill("<percentage> | <number>[0, 255]"),Or=Array(3).fill("<number>[0, 255]");var Tr=new Ve({id:"srgb",name:"sRGB",base:qr,fromBase:e=>e.map(e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e}),toBase:e=>e.map(e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4}),formats:{rgb:{coords:jr},rgb_number:{name:"rgb",commas:!0,coords:Or,noAlpha:!0},color:{},rgba:{coords:jr,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Or},hex:{type:"custom",toGamut:!0,test:e=>/^#([a-f0-9]{3,4}){1,2}$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,e=>{t.push(parseInt(e,16)/255)}),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:r=!0}={})=>{t<1&&e.push(t),e=e.map(e=>Math.round(255*e));let n=r&&e.every(e=>e%17==0);return"#"+e.map(e=>n?(e/17).toString(16):e.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){let t={spaceId:"srgb",coords:null,alpha:1};if("transparent"===(e=e.toLowerCase())?(t.coords=Ir.black,t.alpha=0):t.coords=Ir[e],t.coords)return t}}}}),Gr=new Ve({id:"p3",cssId:"display-p3",name:"P3",base:Wr,fromBase:Tr.fromBase,toBase:Tr.toBase});let Dr;if(qe.display_space=Tr,"undefined"!=typeof CSS&&CSS.supports)for(let Na of[st,Hr,Gr]){let e=Na.getMinCoords(),t=Rr({space:Na,coords:e,alpha:1});if(CSS.supports("color",t)){qe.display_space=Na;break}}function Fr(e){return Ke(e,[Ue,"y"])}function Zr(e,t){tt(e,[Ue,"y"],t)}var Xr=Object.freeze({__proto__:null,getLuminance:Fr,register:function(e){Object.defineProperty(e.prototype,"luminance",{get(){return Fr(this)},set(e){Zr(this,e)}})},setLuminance:Zr});function Yr(e){return e>=.022?e:e+(.022-e)**1.414}function Jr(e){let t=e<0?-1:1,r=Math.abs(e);return t*Math.pow(r,2.4)}const Ur=216/24389,Vr=24/116,Qr=24389/27;let Kr=Ie.D65;var en=new Xe({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Kr,base:Ue,fromBase(e){let t=e.map((e,t)=>e/Kr[t]).map(e=>e>Ur?Math.cbrt(e):(Qr*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>Vr?Math.pow(t[0],3):(116*t[0]-16)/Qr,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/Qr,t[2]>Vr?Math.pow(t[2],3):(116*t[2]-16)/Qr].map((e,t)=>e*Kr[t])},formats:{"lab-d65":{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});const tn=.5*Math.pow(5,.5)+.5;var rn=Object.freeze({__proto__:null,contrastAPCA:function(e,t){let r,n,a,o,i,s;t=Fe(t),e=Fe(e),t=Er(t,"srgb"),[o,i,s]=t.coords;let l=.2126729*Jr(o)+.7151522*Jr(i)+.072175*Jr(s);e=Er(e,"srgb"),[o,i,s]=e.coords;let c=.2126729*Jr(o)+.7151522*Jr(i)+.072175*Jr(s),h=Yr(l),u=Yr(c),p=u>h;return Math.abs(u-h)<5e-4?n=0:p?(r=u**.56-h**.57,n=1.14*r):(r=u**.65-h**.62,n=1.14*r),a=Math.abs(n)<.1?0:n>0?n-.027:n+.027,100*a},contrastDeltaPhi:function(e,t){e=Fe(e),t=Fe(t);let r=Ke(e,[en,"l"]),n=Ke(t,[en,"l"]),a=Math.abs(Math.pow(r,tn)-Math.pow(n,tn)),o=Math.pow(a,1/tn)*Math.SQRT2-40;return o<7.5?0:o},contrastLstar:function(e,t){e=Fe(e),t=Fe(t);let r=Ke(e,[st,"l"]),n=Ke(t,[st,"l"]);return Math.abs(r-n)},contrastMichelson:function(e,t){e=Fe(e),t=Fe(t);let r=Math.max(Fr(e),0),n=Math.max(Fr(t),0);n>r&&([r,n]=[n,r]);let a=r+n;return 0===a?0:(r-n)/a},contrastWCAG21:function(e,t){e=Fe(e),t=Fe(t);let r=Math.max(Fr(e),0),n=Math.max(Fr(t),0);return n>r&&([r,n]=[n,r]),(r+.05)/(n+.05)},contrastWeber:function(e,t){e=Fe(e),t=Fe(t);let r=Math.max(Fr(e),0),n=Math.max(Fr(t),0);return n>r&&([r,n]=[n,r]),0===n?5e4:(r-n)/n}});function nn(e){let[t,r,n]=Qe(e,Ue),a=t+15*r+3*n;return[4*t/a,9*r/a]}function an(e){let[t,r,n]=Qe(e,Ue),a=t+r+n;return[t/a,r/a]}var on=Object.freeze({__proto__:null,register:function(e){Object.defineProperty(e.prototype,"uv",{get(){return nn(this)}}),Object.defineProperty(e.prototype,"xy",{get(){return an(this)}})},uv:nn,xy:an});function sn(e,t,r={}){ve(r)&&(r={method:r});let{method:n=qe.deltaE,...a}=r;for(let o in $r)if("deltae"+n.toLowerCase()===o.toLowerCase())return $r[o](e,t,a);throw new TypeError(`Unknown deltaE method: ${n}`)}var ln=Object.freeze({__proto__:null,darken:function(e,t=.25){return tt(e,[Xe.get("oklch","lch"),"l"],e=>e*(1-t))},lighten:function(e,t=.25){return tt(e,[Xe.get("oklch","lch"),"l"],e=>e*(1+t))}});function cn(e,t,r=.5,n={}){return[e,t]=[Fe(e),Fe(t)],"object"===ye(r)&&([r,n]=[.5,r]),un(e,t,n)(r)}function hn(e,t,r={}){let n;pn(e)&&([n,r]=[e,t],[e,t]=n.rangeArgs.colors);let{maxDeltaE:a,deltaEMethod:o,steps:i=2,maxSteps:s=1e3,...l}=r;n||([e,t]=[Fe(e),Fe(t)],n=un(e,t,l));let c=sn(e,t),h=a>0?Math.max(i,Math.ceil(c/a)+1):i,u=[];if(void 0!==s&&(h=Math.min(h,s)),1===h)u=[{p:.5,color:n(.5)}];else{let e=1/(h-1);u=Array.from({length:h},(t,r)=>{let a=r*e;return{p:a,color:n(a)}})}if(a>0){let e=u.reduce((e,t,r)=>{if(0===r)return 0;let n=sn(t.color,u[r-1].color,o);return Math.max(e,n)},0);for(;e>a;){e=0;for(let t=1;t<u.length&&u.length<s;t++){let r=u[t-1],a=u[t],o=(a.p+r.p)/2,i=n(o);e=Math.max(e,sn(i,r.color),sn(i,a.color)),u.splice(t,0,{p:o,color:n(o)}),t++}}}return u=u.map(e=>e.color),u}function un(e,t,r={}){if(pn(e)){let[r,n]=[e,t];return un(...r.rangeArgs.colors,{...r.rangeArgs.options,...n})}let{space:n,outputSpace:a,progression:o,premultiplied:i}=r;e=Fe(e),t=Fe(t),e=xt(e),t=xt(t);let s={colors:[e,t],options:r};if(n=n?Xe.get(n):Xe.registry[qe.interpolationSpace]||e.space,a=a?Xe.get(a):n,e=Er(e,n),t=Er(t,n),e=Ar(e),t=Ar(t),n.coords.h&&"angle"===n.coords.h.type){let a=r.hue=r.hue||"shorter",o=[n,"h"],[i,s]=[Ke(e,o),Ke(t,o)];isNaN(i)&&!isNaN(s)?i=s:isNaN(s)&&!isNaN(i)&&(s=i),[i,s]=function(e,t){if("raw"===e)return t;let[r,n]=t.map(lt),a=n-r;return"increasing"===e?a<0&&(n+=360):"decreasing"===e?a>0&&(r+=360):"longer"===e?-180<a&&a<180&&(a>0?r+=360:n+=360):"shorter"===e&&(a>180?r+=360:a<-180&&(n+=360)),[r,n]}(a,[i,s]),tt(e,o,i),tt(t,o,s)}return i&&(e.coords=e.coords.map(t=>t*e.alpha),t.coords=t.coords.map(e=>e*t.alpha)),Object.assign(r=>{r=o?o(r):r;let s=e.coords.map((e,n)=>Le(e,t.coords[n],r)),l=Le(e.alpha,t.alpha,r),c={space:n,coords:s,alpha:l};return i&&(c.coords=c.coords.map(e=>e/l)),a!==n&&(c=Er(c,a)),c},{rangeArgs:s})}function pn(e){return"function"===ye(e)&&!!e.rangeArgs}qe.interpolationSpace="lab";var dn=Object.freeze({__proto__:null,isRange:pn,mix:cn,range:un,register:function(e){e.defineFunction("mix",cn,{returns:"color"}),e.defineFunction("range",un,{returns:"function<color>"}),e.defineFunction("steps",hn,{returns:"array<color>"})},steps:hn}),fn=new Xe({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Tr,fromBase:e=>{let t=Math.max(...e),r=Math.min(...e),[n,a,o]=e,[i,s,l]=[NaN,0,(r+t)/2],c=t-r;if(0!==c){switch(s=0===l||1===l?0:(t-l)/Math.min(l,1-l),t){case n:i=(a-o)/c+(a<o?6:0);break;case a:i=(o-n)/c+2;break;case o:i=(n-a)/c+4}i*=60}return s<0&&(i+=180,s=Math.abs(s)),i>=360&&(i-=360),[i,100*s,100*l]},toBase:e=>{let[t,r,n]=e;function a(e){let a=(e+t/30)%12,o=r*Math.min(n,1-n);return n-o*Math.max(-1,Math.min(a-3,9-a,1))}return t%=360,t<0&&(t+=360),r/=100,n/=100,[a(0),a(8),a(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),gn=new Xe({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:fn,fromBase(e){let[t,r,n]=e;r/=100,n/=100;let a=n+r*Math.min(n,1-n);return[t,0===a?0:200*(1-n/a),100*a]},toBase(e){let[t,r,n]=e;r/=100,n/=100;let a=n*(1-r/2);return[t,0===a||1===a?0:(n-a)/Math.min(a,1-a)*100,100*a]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),mn=new Xe({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:gn,fromBase(e){let[t,r,n]=e;return[t,n*(100-r)/100,100-n]},toBase(e){let[t,r,n]=e;r/=100,n/=100;let a=r+n;if(a>=1)return[t,0,r/a*100];let o=1-n;return[t,100*(0===o?0:1-r/o),100*o]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),bn=new Ve({id:"a98rgb-linear",cssId:"--a98-rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],fromXYZ_M:[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]]}),vn=new Ve({id:"a98rgb",cssId:"a98-rgb",name:"Adobe® 98 RGB compatible",base:bn,toBase:e=>e.map(e=>Math.pow(Math.abs(e),563/256)*Math.sign(e)),fromBase:e=>e.map(e=>Math.pow(Math.abs(e),256/563)*Math.sign(e))}),yn=new Ve({id:"prophoto-linear",cssId:"--prophoto-rgb-linear",name:"Linear ProPhoto",white:"D50",base:rt,toXYZ_M:[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],fromXYZ_M:[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]]});const wn=1/512;var Mn=new Ve({id:"prophoto",cssId:"prophoto-rgb",name:"ProPhoto",base:yn,toBase:e=>e.map(e=>e<.03125?e/16:e**1.8),fromBase:e=>e.map(e=>e>=wn?e**(1/1.8):16*e)}),kn=new Xe({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:wt,fromBase(e){let t,[r,n,a]=e;const o=2e-4;return t=Math.abs(n)<o&&Math.abs(a)<o?NaN:180*Math.atan2(a,n)/Math.PI,[r,Math.sqrt(n**2+a**2),lt(t)]},toBase(e){let t,r,[n,a,o]=e;return isNaN(o)?(t=0,r=0):(t=a*Math.cos(o*Math.PI/180),r=a*Math.sin(o*Math.PI/180)),[n,t,r]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}});let xn=Ie.D65;const Cn=216/24389,Sn=24389/27,[$n,Ln]=nn({space:Ue,coords:xn});var An=new Xe({id:"luv",name:"Luv",coords:{l:{refRange:[0,100],name:"Lightness"},u:{refRange:[-215,215]},v:{refRange:[-215,215]}},white:xn,base:Ue,fromBase(e){let t=[ke(e[0]),ke(e[1]),ke(e[2])],r=t[1],[n,a]=nn({space:Ue,coords:t});if(!Number.isFinite(n)||!Number.isFinite(a))return[0,0,0];let o=r<=Cn?Sn*r:116*Math.cbrt(r)-16;return[o,13*o*(n-$n),13*o*(a-Ln)]},toBase(e){let[t,r,n]=e;if(0===t||Me(t))return[0,0,0];r=ke(r),n=ke(n);let a=r/(13*t)+$n,o=n/(13*t)+Ln,i=t<=8?t/Sn:Math.pow((t+16)/116,3);return[i*(9*a/(4*o)),i,i*((12-3*a-20*o)/(4*o))]},formats:{color:{id:"--luv",coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),Bn=new Xe({id:"lchuv",name:"LChuv",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,220],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:An,fromBase(e){let t,[r,n,a]=e;return t=Math.abs(n)<.02&&Math.abs(a)<.02?NaN:180*Math.atan2(a,n)/Math.PI,[r,Math.sqrt(n**2+a**2),lt(t)]},toBase(e){let[t,r,n]=e;return r<0&&(r=0),isNaN(n)&&(n=0),[t,r*Math.cos(n*Math.PI/180),r*Math.sin(n*Math.PI/180)]},formats:{color:{id:"--lchuv",coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const En=216/24389,Rn=24389/27,Nn=_r[0][0],zn=_r[0][1],Pn=_r[0][2],Hn=_r[1][0],Wn=_r[1][1],_n=_r[1][2],qn=_r[2][0],In=_r[2][1],jn=_r[2][2];function On(e,t,r){const n=t/(Math.sin(r)-e*Math.cos(r));return n<0?1/0:n}function Tn(e){const t=Math.pow(e+16,3)/1560896,r=t>En?t:e/Rn,n=r*(284517*Nn-94839*Pn),a=r*(838422*Pn+769860*zn+731718*Nn),o=r*(632260*Pn-126452*zn),i=r*(284517*Hn-94839*_n),s=r*(838422*_n+769860*Wn+731718*Hn),l=r*(632260*_n-126452*Wn),c=r*(284517*qn-94839*jn),h=r*(838422*jn+769860*In+731718*qn),u=r*(632260*jn-126452*In);return{r0s:n/o,r0i:a*e/o,r1s:n/(o+126452),r1i:(a-769860)*e/(o+126452),g0s:i/l,g0i:s*e/l,g1s:i/(l+126452),g1i:(s-769860)*e/(l+126452),b0s:c/u,b0i:h*e/u,b1s:c/(u+126452),b1i:(h-769860)*e/(u+126452)}}function Gn(e,t){const r=t/360*Math.PI*2,n=On(e.r0s,e.r0i,r),a=On(e.r1s,e.r1i,r),o=On(e.g0s,e.g0i,r),i=On(e.g1s,e.g1i,r),s=On(e.b0s,e.b0i,r),l=On(e.b1s,e.b1i,r);return Math.min(n,a,o,i,s,l)}var Dn=new Xe({id:"hsluv",name:"HSLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Bn,gamutSpace:Tr,fromBase(e){let t,[r,n,a]=[ke(e[0]),ke(e[1]),ke(e[2])];return r>99.9999999?(t=0,r=100):r<1e-8?(t=0,r=0):t=n/Gn(Tn(r),a)*100,[a,t,r]},toBase(e){let t,[r,n,a]=[ke(e[0]),ke(e[1]),ke(e[2])];return a>99.9999999?(a=100,t=0):a<1e-8?(a=0,t=0):t=Gn(Tn(a),r)/100*n,[a,t,r]},formats:{color:{id:"--hsluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});function Fn(e,t){return Math.abs(t)/Math.sqrt(Math.pow(e,2)+1)}function Zn(e){let t=Fn(e.r0s,e.r0i),r=Fn(e.r1s,e.r1i),n=Fn(e.g0s,e.g0i),a=Fn(e.g1s,e.g1i),o=Fn(e.b0s,e.b0i),i=Fn(e.b1s,e.b1i);return Math.min(t,r,n,a,o,i)}_r[0][0],_r[0][1],_r[0][2],_r[1][0],_r[1][1],_r[1][2],_r[2][0],_r[2][1],_r[2][2];var Xn=new Xe({id:"hpluv",name:"HPLuv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Bn,gamutSpace:"self",fromBase(e){let t,[r,n,a]=[ke(e[0]),ke(e[1]),ke(e[2])];return r>99.9999999?(t=0,r=100):r<1e-8?(t=0,r=0):t=n/Zn(Tn(r))*100,[a,t,r]},toBase(e){let t,[r,n,a]=[ke(e[0]),ke(e[1]),ke(e[2])];return a>99.9999999?(a=100,t=0):a<1e-8?(a=0,t=0):t=Zn(Tn(a))/100*n,[a,t,r]},formats:{color:{id:"--hpluv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const Yn=2610/16384,Jn=16384/2610,Un=32/2523,Vn=.8359375,Qn=2413/128,Kn=18.6875;var ea=new Ve({id:"rec2100pq",cssId:"rec2100-pq",name:"REC.2100-PQ",base:Nr,toBase:e=>e.map(function(e){return 1e4*(Math.max(e**Un-Vn,0)/(Qn-Kn*e**Un))**Jn/203}),fromBase:e=>e.map(function(e){let t=Math.max(203*e/1e4,0);return((Vn+Qn*t**Yn)/(1+Kn*t**Yn))**78.84375})});const ta=.17883277,ra=.28466892,na=.55991073,aa=3.7743;var oa=new Ve({id:"rec2100hlg",cssId:"rec2100-hlg",name:"REC.2100-HLG",referred:"scene",base:Nr,toBase:e=>e.map(function(e){return e<=.5?e**2/3*aa:(Math.exp((e-na)/ta)+ra)/12*aa}),fromBase:e=>e.map(function(e){return(e/=aa)<=1/12?Math.sqrt(3*e):ta*Math.log(12*e-ra)+na})});const ia={};function sa({id:e,toCone_M:t,fromCone_M:r}){ia[e]=arguments[0]}function la(e,t,r="Bradford"){let n=ia[r],[a,o,i]=be(n.toCone_M,e),[s,l,c]=be(n.toCone_M,t),h=be([[s/a,0,0],[0,l/o,0],[0,0,c/i]],n.toCone_M);return be(n.fromCone_M,h)}_e.add("chromatic-adaptation-start",e=>{e.options.method&&(e.M=la(e.W1,e.W2,e.options.method))}),_e.add("chromatic-adaptation-end",e=>{e.M||(e.M=la(e.W1,e.W2,e.options.method))}),sa({id:"von Kries",toCone_M:[[.40024,.7076,-.08081],[-.2263,1.16532,.0457],[0,0,.91822]],fromCone_M:[[1.8599363874558397,-1.1293816185800916,.21989740959619328],[.3611914362417676,.6388124632850422,-6370596838649899e-21],[0,0,1.0890636230968613]]}),sa({id:"Bradford",toCone_M:[[.8951,.2664,-.1614],[-.7502,1.7135,.0367],[.0389,-.0685,1.0296]],fromCone_M:[[.9869929054667121,-.14705425642099013,.15996265166373122],[.4323052697233945,.5183602715367774,.049291228212855594],[-.00852866457517732,.04004282165408486,.96848669578755]]}),sa({id:"CAT02",toCone_M:[[.7328,.4296,-.1624],[-.7036,1.6975,.0061],[.003,.0136,.9834]],fromCone_M:[[1.0961238208355142,-.27886900021828726,.18274517938277307],[.4543690419753592,.4735331543074117,.07209780371722911],[-.009627608738429355,-.00569803121611342,1.0153256399545427]]}),sa({id:"CAT16",toCone_M:[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],fromCone_M:[[1.862067855087233,-1.0112546305316845,.14918677544445172],[.3875265432361372,.6214474419314753,-.008973985167612521],[-.01584149884933386,-.03412293802851557,1.0499644368778496]]}),Object.assign(Ie,{A:[1.0985,1,.35585],C:[.98074,1,1.18232],D55:[.95682,1,.92149],D75:[.94972,1,1.22638],E:[1,1,1],F2:[.99186,1,.67393],F7:[.95041,1,1.08747],F11:[1.00962,1,.6435]}),Ie.ACES=[.32168/.33767,1,.34065/.33767];var ca=new Ve({id:"acescg",cssId:"--acescg",name:"ACEScg",coords:{r:{range:[0,65504],name:"Red"},g:{range:[0,65504],name:"Green"},b:{range:[0,65504],name:"Blue"}},referred:"scene",white:Ie.ACES,toXYZ_M:[[.6624541811085053,.13400420645643313,.1561876870049078],[.27222871678091454,.6740817658111484,.05368951740793705],[-.005574649490394108,.004060733528982826,1.0103391003129971]],fromXYZ_M:[[1.6410233796943257,-.32480329418479,-.23642469523761225],[-.6636628587229829,1.6153315916573379,.016756347685530137],[.011721894328375376,-.008284441996237409,.9883948585390215]]});const ha=2**-16,ua=-.35828683,pa=(Math.log2(65504)+9.72)/17.52;var da=new Ve({id:"acescc",cssId:"--acescc",name:"ACEScc",coords:{r:{range:[ua,pa],name:"Red"},g:{range:[ua,pa],name:"Green"},b:{range:[ua,pa],name:"Blue"}},referred:"scene",base:ca,toBase:e=>e.map(function(e){return e<=-.3013698630136986?2*(2**(17.52*e-9.72)-ha):e<pa?2**(17.52*e-9.72):65504}),fromBase:e=>e.map(function(e){return e<=0?(Math.log2(ha)+9.72)/17.52:e<ha?(Math.log2(ha+.5*e)+9.72)/17.52:(Math.log2(e)+9.72)/17.52})}),fa=Object.freeze({__proto__:null,A98RGB:vn,A98RGB_Linear:bn,ACEScc:da,ACEScg:ca,CAM16_JMh:mr,HCT:kr,HPLuv:Xn,HSL:fn,HSLuv:Dn,HSV:gn,HWB:mn,ICTCP:er,JzCzHz:Gt,Jzazbz:Tt,LCH:ct,LCHuv:Bn,Lab:st,Lab_D65:en,Luv:An,OKLCH:kn,OKLab:wt,P3:Gr,P3_Linear:Wr,ProPhoto:Mn,ProPhoto_Linear:yn,REC_2020:Hr,REC_2020_Linear:Nr,REC_2100_HLG:oa,REC_2100_PQ:ea,XYZ_ABS_D65:$t,XYZ_D50:rt,XYZ_D65:Ue,sRGB:Tr,sRGB_Linear:qr});class ga{constructor(...e){let t,r,n,a;1===e.length&&(t=Fe(e[0])),t?(r=t.space||t.spaceId,n=t.coords,a=t.alpha):[r,n,a]=e,Object.defineProperty(this,"space",{value:Xe.get(r),writable:!1,enumerable:!0,configurable:!0}),this.coords=n?n.slice():[0,0,0],this.alpha=a>1||void 0===a?1:a<0?0:a;for(let o=0;o<this.coords.length;o++)"NaN"===this.coords[o]&&(this.coords[o]=NaN);for(let o in this.space.coords)Object.defineProperty(this,o,{get:()=>this.get(o),set:e=>this.set(o,e)})}get spaceId(){return this.space.id}clone(){return new ga(this.space,this.coords,this.alpha)}toJSON(){return{spaceId:this.spaceId,coords:this.coords,alpha:this.alpha}}display(...e){let t=function(e,{space:t=qe.display_space,...r}={}){let n=Rr(e,r);if("undefined"==typeof CSS||CSS.supports("color",n)||!qe.display_space)n=new String(n),n.color=e;else{let a=e;if((e.coords.some(Me)||Me(e.alpha))&&!(null!=Dr?Dr:Dr=CSS.supports("color","hsl(none 50% 50%)"))&&(a=xt(e),a.coords=a.coords.map(ke),a.alpha=ke(a.alpha),n=Rr(a,r),CSS.supports("color",n)))return n=new String(n),n.color=a,n;a=Er(a,t),n=new String(Rr(a,r)),n.color=a}return n}(this,...e);return t.color=new ga(t.color),t}static get(e,...t){return e instanceof ga?e:new ga(e,...t)}static defineFunction(e,t,r=t){let{instance:n=!0,returns:a}=r,o=function(...e){let r=t(...e);if("color"===a)r=ga.get(r);else if("function<color>"===a){let e=r;r=function(...t){let r=e(...t);return ga.get(r)},Object.assign(r,e)}else"array<color>"===a&&(r=r.map(e=>ga.get(e)));return r};e in ga||(ga[e]=o),n&&(ga.prototype[e]=function(...e){return o(this,...e)})}static defineFunctions(e){for(let t in e)ga.defineFunction(t,e[t],e[t])}static extend(e){if(e.register)e.register(ga);else for(let t in e)ga.defineFunction(t,e[t])}}ga.defineFunctions({get:Ke,getAll:Qe,set:tt,setAll:et,to:Er,equals:function(e,t){return e=Fe(e),t=Fe(t),e.space===t.space&&e.alpha===t.alpha&&e.coords.every((e,r)=>e===t.coords[r])},inGamut:kt,toGamut:Ar,distance:Ct,toString:Rr}),Object.assign(ga,{util:We,hooks:_e,WHITES:Ie,Space:Xe,spaces:Xe.registry,parse:De,defaults:qe});for(let Na of Object.keys(fa))Xe.register(fa[Na]);for(let Na in Xe.registry)ma(Na,Xe.registry[Na]);function ma(e,t){let r=e.replace(/-/g,"_");Object.defineProperty(ga.prototype,r,{get(){let r=this.getAll(e);return"undefined"==typeof Proxy?r:new Proxy(r,{has:(e,r)=>{try{return Xe.resolveCoord([t,r]),!0}catch(n){}return Reflect.has(e,r)},get:(e,r,n)=>{if(r&&"symbol"!=typeof r&&!(r in e)){let{index:n}=Xe.resolveCoord([t,r]);if(n>=0)return e[n]}return Reflect.get(e,r,n)},set:(r,n,a,o)=>{if(n&&"symbol"!=typeof n&&!(n in r)||n>=0){let{index:o}=Xe.resolveCoord([t,n]);if(o>=0)return r[o]=a,this.setAll(e,r),!0}return Reflect.set(r,n,a,o)}})},set(t){this.setAll(e,t)},configurable:!0,enumerable:!0})}function ba(e){return"display-p3"===e?"p3":"a98-rgb"===e?"a98rgb":e}function va(e){return"p3"===e?"display-p3":"a98rgb"===e?"a98-rgb":e}function ya(e){return"100"===e||100===e?"":` / ${e}%`}function wa(e){return["srgb-linear","display-p3","rec2020","a98-rgb","prophoto","xyz","xyz-d50","xyz-d65"].includes(e)}function Ma(e,t=0){return Number(e.toFixed(t)).toString()}function ka(e,t){var r,n,a,o,i,s,l,c,h,u;const p=null!=(r=t.L)?r:50,d=null!=(n=t.A)?n:0,f=null!=(a=t.B)?a:0,g=null!=(o=t.C)?o:0,m=null!=(i=t.H)?i:0,b=null!=(s=t.S)?s:0,v=null!=(l=t.W)?l:0,y=null!=(c=t.R)?c:0,w=null!=(h=t.G)?h:0,M=null!=(u=t.ALP)?u:100;switch(e){case"oklab":return`oklab(${p}% ${d} ${f}${ya(M)})`;case"oklch":return`oklch(${p}% ${g}% ${m}${ya(M)})`;case"lab":return`lab(${p}% ${d} ${f}${ya(M)})`;case"lch":return`lch(${p}% ${g}% ${m}${ya(M)})`;case"hsl":return`hsl(${m} ${b}% ${p}%${ya(M)})`;case"hwb":return`hwb(${m} ${v}% ${f}%${ya(M)})`;case"srgb":return`rgb(${y}% ${w}% ${f}%${ya(M)})`;case"hex":{const e=Math.round(2.55*Number(y)),t=Math.round(2.55*Number(w)),r=Math.round(2.55*Number(f)),n=Number(M),a=e.toString(16).padStart(2,"0"),o=t.toString(16).padStart(2,"0"),i=r.toString(16).padStart(2,"0"),s=a[0]===a[1]&&o[0]===o[1]&&i[0]===i[1];if(n<100){const e=Math.round(n/100*255).toString(16).padStart(2,"0");return s&&e[0]===e[1]?`#${a[0]}${o[0]}${i[0]}${e[0]}`:`#${a}${o}${i}${e}`}return s?`#${a[0]}${o[0]}${i[0]}`:`#${a}${o}${i}`}default:return wa(e)?function(e,t,r,n,a){return`color(${"prophoto"===e?"prophoto-rgb":e} ${t}% ${r}% ${n}%${ya(a)})`}(e,y,w,f,M):"oklch(75% 75% 180)"}}function xa(e,t){let r=new ga(t);const n=ba("hex"===e?"srgb":e);r.space.id!==n&&(r=r.to(n));const a=va(r.space.id),o="rgb"===a?"srgb":a,i={};if("oklab"===o){const[e,t,n]=r.coords;i.L=Ma(100*e),i.A=Ma(t,2),i.B=Ma(n,2),i.ALP=Ma(100*r.alpha)}else if("oklch"===o){const[e,t,n]=r.coords;i.L=Ma(100*e),i.C=Ma(Math.min(100,100*t),0),i.H=isNaN(n)?"0":Ma(n),i.ALP=Ma(100*r.alpha)}else if("lab"===o){const[e,t,n]=r.coords;i.L=Ma(e),i.A=Ma(t),i.B=Ma(n),i.ALP=Ma(100*r.alpha)}else if("lch"===o){const[e,t,n]=r.coords;i.L=Ma(e),i.C=Ma(Math.min(100,t/1.5),0),i.H=Ma(n),i.ALP=Ma(100*r.alpha)}else if("hsl"===o){const[e,t,n]=r.coords;i.H=Ma(e),i.S=Ma(t>1?t:100*t),i.L=Ma(n>1?n:100*n),i.ALP=Ma(100*r.alpha)}else if("hwb"===o){const[e,t,n]=r.coords;i.H=Ma(e),i.W=Ma(t>1?t:100*t),i.B=Ma(n>1?n:100*n),i.ALP=Ma(100*r.alpha)}else if("srgb"===o||"hex"===o){const[e,t,n]=r.toGamut({space:"srgb",method:"clip"}).coords;i.R=Ma(100*e),i.G=Ma(100*t),i.B=Ma(100*n),i.ALP=Ma(100*r.alpha)}else if(wa(o)){const[e,t,n]=r.coords;i.R=Ma(100*Number(e)),i.G=Ma(100*Number(t)),i.B=Ma(100*Number(n)),i.ALP=Ma(100*r.alpha)}return{space:o,ch:i}}_e.add("colorspace-init-end",e=>{var t;ma(e.id,e),null==(t=e.aliases)||t.forEach(t=>{ma(t,e)})}),ga.extend($r),ga.extend({deltaE:sn}),Object.assign(ga,{deltaEMethods:$r}),ga.extend(ln),ga.extend({contrast:function(e,t,r={}){ve(r)&&(r={algorithm:r});let{algorithm:n,...a}=r;if(!n){let e=Object.keys(rn).map(e=>e.replace(/^contrast/,"")).join(", ");throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${e}`)}e=Fe(e),t=Fe(t);for(let o in rn)if("contrast"+n.toLowerCase()===o.toLowerCase())return rn[o](e,t,a);throw new TypeError(`Unknown contrast algorithm: ${n}`)}}),ga.extend(on),ga.extend(Xr),ga.extend(dn),ga.extend(rn);let Ca=null;function Sa(e,t){return e.left>=t.left&&e.top>=t.top&&e.right<=t.right&&e.bottom<=t.bottom}function $a(e,t){const r=Math.max(e.left,t.left),n=Math.max(e.top,t.top),a=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return a<=r||o<=n?0:(a-r)*(o-n)}const La=':root{--radius-round: 1e5px;--radius-2: 5px;--radius-3: 1rem}:host{--canvas: Canvas;--canvas-text: CanvasText;--radius-2: .5rem;--radius-3: .75rem;--radius-round: 1e4px;--shadow-elev: #0305081f 0px -1px 2px 0px, #03050821 0px 2px 1px -2px, #03050821 0px 5px 5px -2px, #03050824 0px 10px 10px -2px, #03050826 0px 20px 20px -2px, #0305082b 0px 40px 40px -2px;--shadow-inner: inset 0 0 0 1px color-mix(in oklab, var(--canvas-text), transparent 94%);--checker: repeating-conic-gradient(color-mix(in oklab, var(--canvas-text), transparent 90%) 0% 25%, transparent 0% 50%) 50%/1rem 1rem;color-scheme:light dark;display:flex;align-items:center;gap:10px;position:relative;@media (width < 350px){overflow:hidden}}:host([hidden]){display:none}button{border:1px solid color-mix(in oklab,var(--canvas-text),var(--canvas) 80%);outline-offset:2px;&.trigger{flex-shrink:0;background:none;padding:0;border:none;display:inline-flex;place-content:center;border-radius:var(--radius-round);.chip{display:inline-block;inline-size:1.25rem;block-size:1.25rem;border-radius:var(--radius-round);box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--canvas-text),transparent 92%);background:linear-gradient(var(--value) 0 0),var(--checker);forced-color-adjust:none}}}.input-wrapper{position:relative;display:flex;flex-direction:column;flex:1;min-width:0}.text-input{field-sizing:content;font-family:inherit;padding:1ch 1.5ch;border:1px solid color-mix(in oklab,var(--canvas-text),var(--canvas) 80%);border-radius:var(--radius-2);background:color-mix(in oklab,var(--canvas-text),var(--canvas) 92%);color:var(--canvas-text);box-shadow:var(--shadow-inner);outline-offset:2px;&[aria-invalid=true]{outline-color:red}}.error-message{position:absolute;bottom:-1.5rem;left:0;font-size:12px;color:#ef4444;font-weight:500;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s ease}.error-message:not(:empty){opacity:1}.panel{margin:0;max-inline-size:min(92vw,560px);background:var(--canvas);color:var(--canvas-text);box-shadow:var(--shadow-elev);border-radius:var(--radius-3);padding:0;border:1px solid #0000;overflow:hidden}.preview{position:relative;aspect-ratio:16 / 9;min-inline-size:28ch;display:grid;align-content:end;justify-items:start;padding:.75rem;gap:10px;box-shadow:var(--shadow-inner);background:linear-gradient(var(--value) 0 0),var(--checker);forced-color-adjust:none;&:hover .copy-btn,&:focus-within .copy-btn{opacity:1}>*:not(:hover){opacity:.9}.copy-wrap{position:absolute;top:.5rem;right:.5rem;display:flex;flex-direction:column;align-items:flex-end;gap:.25rem}.copy-btn{color:var(--contrast);background:none;border:1px solid #0000;border-radius:0;padding:0;cursor:pointer;opacity:0;transition:opacity .2s ease;display:inline-flex;align-items:center}.copy-btn svg{display:block}.copy-message{color:var(--contrast);font-size:.8rem;font-weight:500;opacity:0;pointer-events:none;transition:opacity .2s ease;white-space:nowrap}.copy-message.show{opacity:1}.visually-hidden:not(:focus):not(:active){clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}}.space{-webkit-appearance:base-select;-moz-appearance:base-select;appearance:base-select;min-block-size:1lh;line-height:1.1;font-weight:700;margin:0;padding:0;color:var(--contrast);background:transparent;border-radius:0;border:none;&::picker-icon{content:"›";-webkit-appearance:none;transform:rotate(90deg) scale(1.5)}}@supports not selector(::picker-icon){.space{background-image:url(https://api.iconify.design/basil:caret-down-solid.svg);background-size:1rem;background-position:right .5rem center;background-repeat:no-repeat}}.gamut,.info{line-height:1.1;text-box:cap alphabetic;display:block;color:var(--contrast);background:transparent}.gamut{font-size:1rem;text-box:ex alphabetic}.info{font-size:1.25rem}.controls{display:grid;gap:.5rem;padding:.75rem;border-radius:0 0 var(--radius-3) var(--radius-3);.control{display:grid;grid-template-columns:min-content 1fr 4ch;align-items:center;gap:.5rem}.control .num-wrapper{position:relative;display:flex;align-items:center}.control .num-wrapper sup{opacity:.5;font-size:.5em;place-self:start}.control label{font:500 12px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.control input[type=number]{text-align:end;font-size:12px;padding:0;background:none;border:1px solid var(--canvas);border-radius:.25rem;-moz-appearance:textfield;font-variant:tabular-nums;font-family:monospace;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}}.control input[type=range]{width:100%;height:1rem;border-radius:999px;border:1px solid var(--canvas);background:var(--canvas);box-shadow:var(--shadow-inner);-webkit-appearance:none;-moz-appearance:none;appearance:none;forced-color-adjust:none}.control input[type=range].alpha{background:linear-gradient(to right,#0000,#000),var(--checker)}.control input[type=range]::-webkit-slider-thumb{cursor:grab;-webkit-appearance:none;appearance:none;border:4px solid white;height:calc(1rem + 8px);aspect-ratio:1;border-radius:var(--radius-round);box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026}.control input[type=range]:active::-webkit-slider-thumb{cursor:grabbing}.control input[type=range]::-moz-range-thumb{cursor:grab;-moz-appearance:none;appearance:none;border:4px solid white;height:calc(1rem + 8px);aspect-ratio:1;border-radius:var(--radius-round);box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026;width:calc(8px + 1rem);background:none;box-sizing:border-box}.control input[type=range]:active::-moz-range-thumb{cursor:grabbing}}',Aa="oklch(75% 75% 180)",Ba="oklch",Ea=new CSSStyleSheet;"function"==typeof Ea.replaceSync&&Ea.replaceSync(La);class Ra extends HTMLElement{constructor(){if(super(),X(this,A),X(this,a,ie(Aa)),X(this,o,ie(Ba)),X(this,i,ie("auto")),X(this,s,ie(!1)),X(this,l,ie(null)),X(this,c,ie(null)),X(this,h,ie(!1)),X(this,u,ue(()=>function(e){var t,r;try{const n=new ga(e);let a,o;try{a=null!=(t=n.contrast("white","WCAG21"))?t:n.contrastLstar("white"),o=null!=(r=n.contrast("black","WCAG21"))?r:n.contrastLstar("black")}catch{a=n.contrastLstar("white"),o=n.contrastLstar("black")}return a>o?"white":"black"}catch{return"black"}}(Z(this,a).value))),X(this,p,ue(()=>function(e){let t="srgb";if(!e||e.startsWith("#"))return t;try{const r=new ga(e),n=new ga("srgb",r.to("srgb").coords),a=new ga("p3",r.to("p3").coords),o=new ga("rec2020",r.to("rec2020").coords);new ga("xyz",r.to("xyz").coords).inGamut()&&(t="xyz"),o.inGamut()&&(t="rec2020"),a.inGamut()&&(t="p3"),n.inGamut()&&(t="srgb")}catch{}return t}(Z(this,a).value))),X(this,d,null),X(this,f,null),X(this,g,null),X(this,m,null),X(this,b,!1),X(this,v),X(this,y),X(this,w),X(this,M),X(this,k),X(this,x),X(this,C),X(this,S),X(this,$),X(this,L,null),X(this,R,null),X(this,N,null),X(this,z,[]),X(this,P,null),Y(this,v,this.attachShadow({mode:"open",delegatesFocus:!0})),"adoptedStyleSheets"in Z(this,v)&&"function"==typeof Ea.replaceSync)Z(this,v).adoptedStyleSheets=[Ea];else{const e=document.createElement("style");e.textContent=La,Z(this,v).appendChild(e)}const e=function(){const e=document.createElement("template");return e.innerHTML='\n <button class="trigger" part="trigger" aria-haspopup="dialog" aria-label="Open color picker" title="Open color picker">\n <span class="chip" part="chip"></span>\n </button>\n <div class="input-wrapper">\n <span class="error-message" part="error" role="alert" aria-live="polite"></span>\n <input type="text" class="text-input" part="input" aria-label="Color value" title="Color value" aria-invalid="false" spellcheck="false" />\n </div>\n <div class="panel" popover="auto" part="panel">\n <div class="preview">\n <div class="copy-wrap">\n <button class="copy-btn">\n <span class="visually-hidden">Copy color</span>\n <svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><title>Copy color</title><path fill="currentColor" d="M5 22q-.825 0-1.413-.588T3 20V6h2v14h11v2H5Zm4-4q-.825 0-1.413-.588T7 16V4q0-.825.588-1.413T9 2h9q.825 0 1.413.588T20 4v12q0 .825-.588 1.413T18 18H9Z"/></svg>\n </button>\n <span class="copy-message" aria-hidden="true">Copied!</span>\n <span class="copy-message-live-region visually-hidden" role="status"></span>\n </div>\n <select class="space" title="Colorspace"></select>\n <output class="info" part="output"></output>\n <span class="gamut" title="Color\'s gamut" part="gamut"></span>\n </div>\n <div class="controls" part="controls"></div>\n </div>\n ',e}();Z(this,v).appendChild(e.content.cloneNode(!0))}static get observedAttributes(){return["value","colorspace","theme","no-alpha"]}get value(){return Z(this,a).value}set value(e){if("string"==typeof e&&e)try{const t=va(new ga(e).space.id),r="string"==typeof e&&e.trim().startsWith("#");Z(this,o).value=r?"hex":"rgb"===t?"srgb":t,Z(this,a).value=e,Y(this,b,!0),this.setAttribute("value",e),this.setAttribute("colorspace",Z(this,o).value),Y(this,b,!1),J(this,A,B).call(this)}catch{}}get colorspace(){return Z(this,o).value}set colorspace(e){const t=e||Ba;Z(this,o).value=t,Y(this,b,!0),this.setAttribute("colorspace",t);try{const e=new ga(Z(this,a).value),r="hex"===t?"srgb":t,n=ka(t,xa(t,e.to(ba(r)).toGamut().toString({precision:12})).ch);Z(this,a).value=n,this.setAttribute("value",n),J(this,A,B).call(this)}catch{}Y(this,b,!1),Z(this,w)&&J(this,A,O).call(this)}get theme(){return Z(this,i).value}set theme(e){const t="light"===e||"dark"===e?e:"auto";Z(this,i).value=t,"auto"===t?this.removeAttribute("theme"):this.setAttribute("theme",t)}get noAlpha(){return Z(this,h).value}set noAlpha(e){Z(this,h).value=!!e,e?this.setAttribute("no-alpha",""):this.removeAttribute("no-alpha")}get gamut(){return Z(this,p).value}get contrastColor(){return Z(this,u).value}show(e){var t,r;e&&(Z(this,l).value=e),null==(r=null==(t=Z(this,y))?void 0:t.showPopover)||r.call(t),J(this,A,H).call(this)}close(){var e,t;null==(t=null==(e=Z(this,y))?void 0:e.hidePopover)||t.call(e),J(this,A,W).call(this)}showPicker(){this.show()}setAnchor(e){Z(this,l).value=e}set setColor(e){this.value=e}set setAnchorElement(e){this.setAnchor(e)}connectedCallback(){var e;const t=Z(this,v).querySelector("button.trigger");Y(this,C,null!=t?t:void 0),Y(this,y,Z(this,v).querySelector(".panel")),Y(this,w,Z(this,v).querySelector(".controls")),Y(this,M,Z(this,v).querySelector(".space")),Y(this,k,Z(this,v).querySelector("output.info")),Y(this,x,Z(this,v).querySelector(".chip")),Y(this,S,Z(this,v).querySelector(".text-input")),Y(this,$,Z(this,v).querySelector(".error-message"));const r=Z(this,v).querySelector("button.copy-btn"),n=Z(this,v).querySelector(".copy-message"),l=Z(this,v).querySelector(".copy-message-live-region");if(r&&n&&l){let e=null;r.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(Z(this,a).value),n.classList.add("show"),l.innerText=n.innerText,null!==e&&clearTimeout(e),e=window.setTimeout(()=>{n.classList.remove("show"),l.innerText="",e=null},3e3)}catch{}})}Z(this,M).innerHTML='\n <optgroup label="Standard">\n <option value="hex">hex</option>\n <option value="srgb">rgb</option>\n <option value="srgb-linear">srgb-linear</option>\n <option value="hsl">hsl</option>\n <option value="hwb">hwb</option>\n </optgroup>\n <optgroup label="HDR">\n <option value="display-p3">display-p3</option>\n <option value="a98-rgb">a98-rgb</option>\n </optgroup>\n <optgroup label="Ultra HDR">\n <option value="lab">lab</option>\n <option value="lch">lch</option>\n <option value="oklch">oklch</option>\n <option value="oklab">oklab</option>\n <option value="rec2020">rec2020</option>\n <option value="prophoto">prophoto</option>\n <option value="xyz">xyz</option>\n <option value="xyz-d50">xyz-d50</option>\n <option value="xyz-d65">xyz-d65</option>\n </optgroup>\n ',t&&t.addEventListener("click",()=>this.show(t)),Z(this,S)&&(Z(this,S).value=Z(this,a).value,Z(this,S).addEventListener("input",e=>{const t=e.target.value;J(this,A,E).call(this,t)}),Z(this,S).addEventListener("paste",e=>{})),this.addEventListener("command",e=>{const t=e.command;if(!t)return;const r=e.source||e.invoker||(document.activeElement instanceof HTMLElement?document.activeElement:null);r&&(Y(this,L,r),this.setAnchor(r)),"show-popover"===t||"show"===t?this.show(Z(this,L)):"hide-popover"===t||"close"===t?this.close():"toggle-popover"!==t&&"toggle"!==t||(Z(this,s).value?this.close():this.show(Z(this,L)))}),null==(e=Z(this,y))||e.addEventListener("toggle",()=>{var e;const t=Z(this,y);let r=!t.hasAttribute("hidden");try{r=null!=(e=t.matches(":popover-open"))&&e}catch{}Z(this,s).value=r,r?J(this,A,H).call(this):J(this,A,W).call(this),this.dispatchEvent(new CustomEvent(r?"open":"close",{bubbles:!0}))}),Z(this,M).addEventListener("change",()=>{this.colorspace=Z(this,M).value,J(this,A,O).call(this)}),Y(this,d,me(()=>{const e=Z(this,a).value,t=Z(this,p).value,r=Z(this,u).value;Z(this,k)&&(Z(this,k).value=e),Z(this,x)&&Z(this,x).style.setProperty("--value",e),Z(this,S)&&Z(this,S).value!==e&&(Z(this,S).value=e),this.style.setProperty("--contrast",r),this.style.setProperty("--counter","white"===r?"black":"white");const n=Z(this,v).querySelector(".gamut");n&&(n.textContent=t);const o=Z(this,v).querySelector(".preview");o&&o.style.setProperty("--value",e)})),Y(this,g,me(()=>{const e=Z(this,c).value;e?(this.setAttribute("data-error",""),Z(this,$)&&(Z(this,$).textContent=e),Z(this,S)&&Z(this,S).setAttribute("aria-invalid","true")):(this.removeAttribute("data-error"),Z(this,$)&&(Z(this,$).textContent=""),Z(this,S)&&Z(this,S).setAttribute("aria-invalid","false"))})),Y(this,f,me(()=>{const e=Z(this,i).value,t="auto"===e?"light dark":e;this.style.setProperty("color-scheme",t)})),this.hasAttribute("value")||this.setAttribute("value",Aa),this.hasAttribute("colorspace")||this.setAttribute("colorspace",Z(this,o).value),Z(this,M).value=Z(this,o).value,J(this,A,O).call(this)}disconnectedCallback(){Z(this,f)&&Z(this,f).call(this),Z(this,d)&&Z(this,d).call(this),Z(this,g)&&Z(this,g).call(this)}attributeChangedCallback(e,t,r){if(r!==t&&!Z(this,b)){if("value"===e&&"string"==typeof r)try{const e=va(new ga(r).space.id),t="string"==typeof r&&r.trim().startsWith("#");Z(this,a).value=r,Z(this,o).value=t?"hex":"rgb"===e?"srgb":e,Z(this,M)&&(Z(this,M).value=Z(this,o).value)}catch{}"colorspace"===e&&r&&(Z(this,o).value=r,Z(this,M)&&(Z(this,M).value=r)),"theme"===e&&(Z(this,i).value=r||"auto"),"no-alpha"===e&&(Z(this,h).value=null!==r,Z(this,w)&&J(this,A,O).call(this))}}}return a=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap,l=new WeakMap,c=new WeakMap,h=new WeakMap,u=new WeakMap,p=new WeakMap,d=new WeakMap,f=new WeakMap,g=new WeakMap,m=new WeakMap,b=new WeakMap,v=new WeakMap,y=new WeakMap,w=new WeakMap,M=new WeakMap,k=new WeakMap,x=new WeakMap,C=new WeakMap,S=new WeakMap,$=new WeakMap,L=new WeakMap,A=new WeakSet,B=function(){const e={value:Z(this,a).value,colorspace:Z(this,o).value,gamut:Z(this,p).value};this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0}))},E=function(e){if(e&&e.trim())try{const t=va(new ga(e).space.id),r="string"==typeof e&&e.trim().startsWith("#");Z(this,c).value=null,Z(this,o).value=r?"hex":"rgb"===t?"srgb":t,Z(this,a).value=e,this.setAttribute("value",e),this.setAttribute("colorspace",Z(this,o).value),Z(this,M)&&(Z(this,M).value=Z(this,o).value),J(this,A,B).call(this)}catch(t){Z(this,c).value="Invalid color format"}else Z(this,c).value="Invalid color format"},R=new WeakMap,N=new WeakMap,z=new WeakMap,P=new WeakMap,H=function(){var e,t;if(Z(this,z).length)return;J(this,A,_).call(this);const r=null!=(t=null!=(e=Z(this,l).value)?e:Z(this,L))?t:Z(this,C);if(r&&Z(this,y)){if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>J(this,A,_).call(this));e.observe(r),e.observe(Z(this,y)),e.observe(document.documentElement),Z(this,z).push(()=>e.disconnect())}else{const e=()=>J(this,A,_).call(this);window.addEventListener("resize",e),Z(this,z).push(()=>window.removeEventListener("resize",e))}if(window.visualViewport){const e=()=>J(this,A,_).call(this);window.visualViewport.addEventListener("resize",e),window.visualViewport.addEventListener("scroll",e),Z(this,z).push(()=>{var t,r;null==(t=window.visualViewport)||t.removeEventListener("resize",e),null==(r=window.visualViewport)||r.removeEventListener("scroll",e)})}if(function(e){const t=[];let r=e.parentElement;for(;r&&r!==document.documentElement;){const e=getComputedStyle(r),n=e.overflowY,a=e.overflowX;"auto"!==n&&"scroll"!==n&&"auto"!==a&&"scroll"!==a||!(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)||t.push(r),r=r.parentElement}return document.scrollingElement&&t.push(document.scrollingElement),t}(r).forEach(e=>{const t=()=>J(this,A,_).call(this);e.addEventListener("scroll",t,{passive:!0}),Z(this,z).push(()=>e.removeEventListener("scroll",t))}),"undefined"!=typeof IntersectionObserver){const e=new IntersectionObserver(()=>J(this,A,_).call(this),{threshold:0});e.observe(r),Z(this,z).push(()=>e.disconnect())}}},W=function(){Z(this,z).forEach(e=>e()),Y(this,z,[]),null!==Z(this,P)&&(cancelAnimationFrame(Z(this,P)),Y(this,P,null))},_=function(){null===Z(this,P)&&Y(this,P,requestAnimationFrame(()=>{Y(this,P,null),J(this,A,q).call(this)}))},q=function(){if(!Z(this,y))return;const e=Z(this,y),t=J(this,A,I).call(this),r=function(){if(Ca)return Ca;const e=document.createElement("div");e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.paddingTop="env(safe-area-inset-top)",e.style.paddingRight="env(safe-area-inset-right)",e.style.paddingBottom="env(safe-area-inset-bottom)",e.style.paddingLeft="env(safe-area-inset-left)",document.documentElement.appendChild(e);const t=getComputedStyle(e),r=parseFloat(t.paddingTop)||0,n=parseFloat(t.paddingRight)||0,a=parseFloat(t.paddingBottom)||0,o=parseFloat(t.paddingLeft)||0;return document.documentElement.removeChild(e),Ca={top:r,right:n,bottom:a,left:o},Ca}(),n=function(e){var t,r,n,a;const o=null!=(r=null==(t=window.visualViewport)?void 0:t.width)?r:window.innerWidth,i=null!=(a=null==(n=window.visualViewport)?void 0:n.height)?a:window.innerHeight,s=window.pageXOffset||document.documentElement.scrollLeft,l=window.pageYOffset||document.documentElement.scrollTop,c=e.left+8+s,h=e.top+8+l,u=o-e.right-8+s,p=i-e.bottom-8+l;return{left:c,top:h,right:u,bottom:p,width:u-c,height:p-h}}(r),a=J(this,A,j).call(this,e),o=function(e,t){const{width:r,height:n}=t,a=[{placement:"bottom-center",left:e.left+e.width/2-r/2,top:e.bottom+8,right:0,bottom:0},{placement:"top-center",left:e.left+e.width/2-r/2,top:e.top-8-n,right:0,bottom:0},{placement:"right-start",left:e.right+8,top:e.top,right:0,bottom:0},{placement:"left-start",left:e.left-8-r,top:e.top,right:0,bottom:0},{placement:"bottom-left",left:e.left,top:e.bottom+8,right:0,bottom:0},{placement:"bottom-right",left:e.right-r,top:e.bottom+8,right:0,bottom:0},{placement:"top-left",left:e.left,top:e.top-8-n,right:0,bottom:0},{placement:"top-right",left:e.right-r,top:e.top-8-n,right:0,bottom:0}];return a.forEach(e=>{e.right=e.left+r,e.bottom=e.top+n}),a}(t,a),i=function(e,t,r){if(r){const n=e.find(e=>e.placement===r);if(n&&Sa(n,t))return n}for(const o of e)if(Sa(o,t))return o;let n=e[0],a=$a(n,t);for(let o=1;o<e.length;o++){const r=$a(e[o],t);r>a&&(a=r,n=e[o])}return n}(o,n,Z(this,R));Y(this,R,i.placement);const s=Math.round(Math.min(Math.max(i.left,n.left),n.right-a.width)),l=Math.round(Math.min(Math.max(i.top,n.top),n.bottom-a.height)),c=n.bottom-n.top;a.height>c?(e.style.maxHeight=`${c}px`,e.style.overflow="auto"):e.style.maxHeight&&(e.style.maxHeight="",e.style.overflow=""),e.style.position="absolute",e.style.left=`${s}px`,e.style.top=`${l}px`,e.style.setProperty("--ci-panel-placement",i.placement),e.dataset.placement=i.placement},I=function(){var e,t,r,n,a,o,i;const s=null!=(r=null!=(t=null!=(e=Z(this,l).value)?e:Z(this,L))?t:Z(this,C))?r:this,c=window.pageXOffset||document.documentElement.scrollLeft,h=window.pageYOffset||document.documentElement.scrollTop;if(!s.isConnected){const e=(null!=(a=null==(n=window.visualViewport)?void 0:n.width)?a:window.innerWidth)/2+c,t=(null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:window.innerHeight)/2+h;return{left:e,top:t,right:e,bottom:t,width:0,height:0}}const u=s.getBoundingClientRect();return{left:u.left+c,top:u.top+h,right:u.right+c,bottom:u.bottom+h,width:u.width,height:u.height}},j=function(e){var t;const r=e.getBoundingClientRect();if(r.width>0&&r.height>0)return Y(this,N,{width:r.width,height:r.height}),Z(this,N);const n={display:e.style.display,position:e.style.position,left:e.style.left,top:e.style.top,visibility:e.style.visibility,maxHeight:e.style.maxHeight};e.style.display="block",e.style.position="absolute",e.style.left="-99999px",e.style.top="0",e.style.visibility="hidden",e.style.maxHeight="none";const a=e.getBoundingClientRect();return e.style.display=n.display,e.style.position=n.position,e.style.left=n.left,e.style.top=n.top,e.style.visibility=n.visibility,e.style.maxHeight=n.maxHeight,a.width>0&&a.height>0?(Y(this,N,{width:a.width,height:a.height}),Z(this,N)):null!=(t=Z(this,N))?t:{width:560,height:400}},O=function(){var e,t,r,n,i,s,l,c,u,p,d,f,g,b,v,y;Z(this,m)&&Z(this,m).call(this);const M=Z(this,o).value;if(!Z(this,w))return;const k=xa(M,Z(this,a).value).ch,x={};Object.keys(k).forEach(e=>{x[e]=ie(String(k[e]))});const C=(e,t,r,n,o=1,i,s)=>{var l,c;const h="H"===t,u=["L","S","C","W","B","R","G","ALP"].includes(t),p="H"===t,d=document.createElement("div");d.className="control";const f=document.createElement("label");f.textContent=e;const g={L:"Lightness",C:"Chroma",H:"Hue",S:"Saturation",A:"A (green-red axis)",W:"Whiteness",R:"Red",G:"Green",ALP:"Alpha"};"B"===t?f.title="oklab"===M||"lab"===M?"B (blue-yellow axis)":"hwb"===M?"Blackness":"Blue":g[t]&&(f.title=g[t]);const m=document.createElement("input");if(m.type="range",m.min=String(r),m.max=String(n),m.step=String(o),m.classList.add(`ch-${t.toLowerCase()}`),i&&(m.style.backgroundImage=i),s&&(m.style.backgroundColor=s),m.value=String(null!=(l=k[t])?l:0),"ALP"===t){m.classList.add("alpha");try{const e=ka(M,{...k,ALP:"0"}),t=ka(M,{...k,ALP:"100"}),r="hsl"===M?"hsl":"lch"===M?"lch":"oklch"===M?"oklch":"oklab";m.style.background=`linear-gradient(to right in ${r}, ${e}, ${t}), var(--checker)`}catch{}}const b=document.createElement("input");b.type="number",b.min=String(r),b.max=String(n),b.step=String(o),b.classList.add(`ch-${t.toLowerCase()}`),b.value=String(null!=(c=k[t])?c:0);const v=document.createElement("div");if(v.className="num-wrapper",v.appendChild(b),u||p){const e=document.createElement("sup");e.textContent=p?"°":"%",v.appendChild(e)}const y=()=>{const e=ka(M,k);Z(this,a).value=e,this.setAttribute("value",e),J(this,A,B).call(this)},w=e=>{const a=e.target;let o=Number(a.value);if(!Number.isFinite(o))return;o=h?(o%360+360)%360:Math.max(r,Math.min(n,o));const i=function(e,t,r){const n=(e,t=0)=>Number(e.toFixed(t));if("oklab"===e){if("L"===t)return String(n(r,0));if("A"===t||"B"===t)return String(n(r,2))}else if("oklch"===e){if("L"===t)return String(n(r,0));if("C"===t)return String(n(r,0));if("H"===t)return String(n(r,0))}else if("lab"===e){if("L"===t)return String(n(r,0));if("A"===t||"B"===t)return String(n(r,0))}else if("lch"===e){if("L"===t||"C"===t||"H"===t)return String(n(r,0))}else if("hsl"===e||"hwb"===e){if("H"===t)return String(n(r,0));if("S"===t||"L"===t||"W"===t||"B"===t)return String(n(r,0))}else if("srgb"===e||"hex"===e){if("R"===t||"G"===t||"B"===t)return String(n(r,0))}else if(["srgb-linear","display-p3","rec2020","a98-rgb","prophoto","xyz","xyz-d50","xyz-d65"].includes(e)&&("R"===t||"G"===t||"B"===t))return String(n(r,0));return String(n(r,"ALP"===t?0:2))}(M,t,o);k[t]=i,x[t].value=i,m.value=String(k[t]),b.value=String(k[t]),y()};return m.addEventListener("input",w),b.addEventListener("input",w),d.append(f,m,v),d};if(Z(this,w).innerHTML="","oklab"===M){const e=C("A","ALP",0,100,1);Z(this,h).value&&(e.style.display="none"),Z(this,w).append(C("L","L",0,100,1,"linear-gradient(in oklab to right, black, white)"),C("A","A",-.5,.5,.01,"linear-gradient(to right in oklab, oklab(65% -.5 .5), oklab(65% .5 .5))"),C("B","B",-.5,.5,.01,"linear-gradient(to right in oklab, oklab(47% -.03 -.32), oklab(96% 0 .25))"),e);const t=Z(this,w).querySelector('input[type="range"].ch-alp');Y(this,m,me(()=>{const e=x.L.value||"50",r=x.A.value||"0",n=x.B.value||"0";t&&(t.style.background=`linear-gradient(to right in oklab, oklab(${e}% ${r} ${n} / 0%), oklab(${e}% ${r} ${n} / 100%)), var(--checker)`)}))}else if("oklch"===M){const a=C("A","ALP",0,100,1);Z(this,h).value&&(a.style.display="none"),Z(this,w).append(C("L","L",0,100,1,"linear-gradient(in oklab to right, black, white)"),C("C","C",0,100,1,`linear-gradient(in oklch to right, oklch(${null!=(e=k.L)?e:0}% 1% ${null!=(t=k.H)?t:0}), oklch(${null!=(r=k.L)?r:0}% 100% ${null!=(n=k.H)?n:0}))`),C("H","H",0,359,1,"linear-gradient(to right in oklch longer hue, oklch(90% 75% 0), oklch(90% 75% 0))"),a);const o=Z(this,w).querySelector('input[type="range"].ch-c'),i=Z(this,w).querySelector('input[type="range"].ch-alp');Y(this,m,me(()=>{const e=x.L.value||"0",t=x.C.value||"0",r=x.H.value||"0";o&&(o.style.backgroundImage=`linear-gradient(in oklch to right, oklch(${e}% 1% ${r}deg), oklch(${e}% 100% ${r}deg))`),i&&(i.style.background=`linear-gradient(to right in oklch, oklch(${e}% ${t}% ${r} / 0%), oklch(${e}% ${t}% ${r} / 100%)), var(--checker)`)}))}else if("lab"===M){const e=C("A","ALP",0,100,1);Z(this,h).value&&(e.style.display="none"),Z(this,w).append(C("L","L",0,100,1,"linear-gradient(in lab to right, black, white)"),C("A","A",-160,160,1,"linear-gradient(to right in oklab, lab(85% -100 100), lab(55% 100 100))"),C("B","B",-160,160,1,"linear-gradient(to right in oklab, lab(31% 70 -120), lab(96% 0 120))"),e);const t=Z(this,w).querySelector('input[type="range"].ch-alp');Y(this,m,me(()=>{const e=x.L.value||"50",r=x.A.value||"0",n=x.B.value||"0";t&&(t.style.background=`linear-gradient(to right in lab, lab(${e}% ${r} ${n} / 0%), lab(${e}% ${r} ${n} / 100%)), var(--checker)`)}))}else if("lch"===M){const e=C("A","ALP",0,100,1);Z(this,h).value&&(e.style.display="none"),Z(this,w).append(C("L","L",0,100,1,"linear-gradient(in lab to right, black, white)"),C("C","C",0,100,1,`linear-gradient(in lch to right, lch(${null!=(i=k.L)?i:0}% 1% ${null!=(s=k.H)?s:0}), lch(${null!=(l=k.L)?l:0}% 100% ${null!=(c=k.H)?c:0}))`),C("H","H",0,359,1,"linear-gradient(to right in lch longer hue, lch(90% 75% 0), lch(90% 75% 0))"),e);const t=Z(this,w).querySelector('input[type="range"].ch-c'),r=Z(this,w).querySelector('input[type="range"].ch-alp');Y(this,m,me(()=>{const e=x.L.value||"50",n=x.C.value||"0",a=x.H.value||"0";t&&(t.style.backgroundImage=`linear-gradient(in lch to right, lch(${e}% 1% ${a}), lch(${e}% 100% ${a}))`),r&&(r.style.background=`linear-gradient(to right in lch, lch(${e}% ${n}% ${a} / 0%), lch(${e}% ${n}% ${a} / 100%)), var(--checker)`)}))}else if("hsl"===M){const e=C("A","ALP",0,100,1);Z(this,h).value&&(e.style.display="none"),Z(this,w).append(C("H","H",0,359,1,"linear-gradient(to right in hsl longer hue, hsl(0 100% 50%), hsl(360 100% 50%))"),C("S","S",0,100,1,`linear-gradient(in hsl to right, hsl(${null!=(u=k.H)?u:0} 0% ${null!=(p=k.L)?p:50}% / 100%), hsl(${null!=(d=k.H)?d:0} 100% ${null!=(f=k.L)?f:50}% / 100%))`),C("L","L",0,100,1,`linear-gradient(in oklab to right, hsl(${null!=(g=k.H)?g:0} ${null!=(b=k.S)?b:100}% 0%), hsl(${null!=(v=k.H)?v:0} ${null!=(y=k.S)?y:100}% 100%))`),e);const t=Z(this,w).querySelector('input[type="range"].ch-s'),r=Z(this,w).querySelector('input[type="range"].ch-l'),n=Z(this,w).querySelector('input[type="range"].ch-alp');Y(this,m,me(()=>{const e=x.H.value||"0",a=x.S.value||"100",o=x.L.value||"50";t&&(t.style.backgroundImage=`linear-gradient(in hsl to right, hsl(${e} 0% ${o}% / 100%), hsl(${e} 100% ${o}% / 100%))`),r&&(r.style.backgroundImage=`linear-gradient(in oklab to right, hsl(${e} ${a}% 0%), hsl(${e} ${a}% 100%))`),n&&(n.style.background=`linear-gradient(to right in hsl, hsl(${e} ${a}% ${o}% / 0%), hsl(${e} ${a}% ${o}% / 100%)), var(--checker)`)}))}else if("hwb"===M){const e=C("A","ALP",0,100,1);Z(this,h).value&&(e.style.display="none"),Z(this,w).append(C("H","H",0,359,1,"linear-gradient(to right in hsl longer hue, hsl(0 100% 50%), hsl(360 100% 50%))"),C("W","W",0,100,1,"linear-gradient(to right in oklab, #fff0, #fff)","black"),C("B","B",0,100,1,"linear-gradient(to right in oklab, #0000, #000)","white"),e);const t=Z(this,w).querySelector('input[type="range"].ch-alp');Y(this,m,me(()=>{const e=x.H.value||"0",r=x.W.value||"0",n=x.B.value||"0";t&&(t.style.background=`linear-gradient(to right in hwb, hwb(${e} ${r}% ${n}% / 0%), hwb(${e} ${r}% ${n}% / 100%)), var(--checker)`)}))}else if("srgb"===M||"hex"===M){const e=C("A","ALP",0,100,1);Z(this,h).value&&(e.style.display="none"),Z(this,w).append(C("R","R",0,100,1,"linear-gradient(to right in oklab, #f000, #f00)","black"),C("G","G",0,100,1,"linear-gradient(to right in oklab, #0f00, #0f0)","black"),C("B","B",0,100,1,"linear-gradient(to right in oklab, #00f0, #00f)","black"),e);const t=Z(this,w).querySelector('input[type="range"].ch-alp');Y(this,m,me(()=>{const e=x.R.value||"0",r=x.G.value||"0",n=x.B.value||"0";t&&(t.style.background=`linear-gradient(to right in srgb, rgb(${e}% ${r}% ${n}% / 0%), rgb(${e}% ${r}% ${n}% / 100%)), var(--checker)`)}))}else if(wa(M)){const e=C("A","ALP",0,100,1);Z(this,h).value&&(e.style.display="none"),Z(this,w).append(C("R","R",0,100,1,"linear-gradient(to right in oklab, #f000, #f00)","black"),C("G","G",0,100,1,"linear-gradient(to right in oklab, #0f00, #0f0)","black"),C("B","B",0,100,1,"linear-gradient(to right in oklab, #00f0, #00f)","black"),e);const t=Z(this,w).querySelector('input[type="range"].ch-alp');Y(this,m,me(()=>{const e=x.R.value||"0",r=x.G.value||"0",n=x.B.value||"0";if(t){const a=ka(M,{...k,R:e,G:r,B:n,ALP:"0"}),o=ka(M,{...k,R:e,G:r,B:n,ALP:"100"});t.style.background=`linear-gradient(to right, ${a}, ${o}), var(--checker)`}}))}},customElements.define("color-input",Ra),e.ColorInput=Ra,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
2
+ var ColorInput=function(e){"use strict";var t,n,r,a,o,i,s,l,c,h,u,p,d,g,f,m,b,v,y,w,x,M,k,$,S,C,L,A,E,B,R,z,I,W,H,q,P,j,T,O,N,D,G,F,X,Z,_,Y,V=Object.defineProperty,J=e=>{throw TypeError(e)},U=(e,t,n)=>((e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Q=(e,t,n)=>t.has(e)||J("Cannot "+n),K=(e,t,n)=>(Q(e,t,"read from private field"),n?n.call(e):t.get(e)),ee=(e,t,n)=>t.has(e)?J("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),te=(e,t,n,r)=>(Q(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ne=(e,t,n)=>(Q(e,t,"access private method"),n),re=Symbol.for("preact-signals");function ae(){if(le>1)le--;else{for(var e,t=!1;void 0!==se;){var n=se;for(se=void 0,ce++;void 0!==n;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&ge(n))try{n.c()}catch(a){t||(e=a,t=!0)}n=r}}if(ce=0,le--,t)throw e}}var oe=void 0;function ie(e){var t=oe;oe=void 0;try{return e()}finally{oe=t}}var se=void 0,le=0,ce=0,he=0;function ue(e){if(void 0!==oe){var t=e.n;if(void 0===t||t.t!==oe)return t={i:0,S:e,p:oe.s,n:void 0,t:oe,e:void 0,x:void 0,r:t},void 0!==oe.s&&(oe.s.n=t),oe.s=t,e.n=t,32&oe.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=oe.s,t.n=void 0,oe.s.n=t,oe.s=t),t}}function pe(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function de(e,t){return new pe(e,t)}function ge(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function fe(e){for(var t=e.s;void 0!==t;t=t.n){var n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function me(e){for(var t=e.s,n=void 0;void 0!==t;){var r=t.p;-1===t.i?(t.S.U(t),void 0!==r&&(r.n=t.n),void 0!==t.n&&(t.n.p=r)):n=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=r}e.s=n}function be(e,t){pe.call(this,void 0),this.x=e,this.s=void 0,this.g=he-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function ve(e,t){return new be(e,t)}function ye(e){var t=e.u;if(e.u=void 0,"function"==typeof t){le++;var n=oe;oe=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,we(e),r}finally{oe=n,ae()}}}function we(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ye(e)}function xe(e){if(oe!==this)throw new Error("Out-of-order effect");me(this),oe=e,this.f&=-2,8&this.f&&we(this),ae()}function Me(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function ke(e,t){var n=new Me(e,t);try{n.c()}catch(a){throw n.d(),a}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}function $e(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Se(e,t,n=[0,0,0]){const r=$e(e,t[0]),a=$e(e,t[1]),o=$e(e,t[2]);return n[0]=r,n[1]=a,n[2]=o,n}function Ce(e){return"string"===Le(e)}function Le(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Ae(e,{precision:t=16,unit:n}){return Ee(e)?"none":(e=+Be(e,t))+(null!=n?n:"")}function Ee(e){return null===e}function Be(e,t){if(0===e)return 0;let n=~~e,r=0;n&&t&&(r=1+~~Math.log10(Math.abs(n)));const a=10**(t-r);return Math.floor(e*a+.5)/a}function Re(e,t,n){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*n}function ze(e,t,n){return!e||!t||e===t||e[0]===t[0]&&e[1]===t[1]||isNaN(n)||null===n?n:Re(t[0],t[1],function(e,t,n){return(n-e)/(t-e)}(e[0],e[1],n))}function Ie(e,t,n){return Math.max(Math.min(n,t),e)}function We(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function He(e,t){return We(Math.abs(e)**t,e)}function qe(e,t){return 0===t?0:e/t}function Pe(e,t){var n;if(e instanceof t)return!0;const r=t.name;for(;e;){const t=Object.getPrototypeOf(e),a=null==(n=null==t?void 0:t.constructor)?void 0:n.name;if(a===r)return!0;if(!a||"Object"===a)return!1;e=t}return!1}pe.prototype.brand=re,pe.prototype.h=function(){return!0},pe.prototype.S=function(e){var t=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:ie(function(){var e;null==(e=t.W)||e.call(t)}))},pe.prototype.U=function(e){var t=this;if(void 0!==this.t){var n=e.e,r=e.x;void 0!==n&&(n.x=r,e.e=void 0),void 0!==r&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&ie(function(){var e;null==(e=t.Z)||e.call(t)}))}},pe.prototype.subscribe=function(e){var t=this;return ke(function(){var n=t.value,r=oe;oe=void 0;try{e(n)}finally{oe=r}},{name:"sub"})},pe.prototype.valueOf=function(){return this.value},pe.prototype.toString=function(){return this.value+""},pe.prototype.toJSON=function(){return this.value},pe.prototype.peek=function(){var e=oe;oe=void 0;try{return this.value}finally{oe=e}},Object.defineProperty(pe.prototype,"value",{get:function(){var e=ue(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ce>100)throw new Error("Cycle detected");this.v=e,this.i++,he++,le++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{ae()}}}}),be.prototype=new pe,be.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===he)return!0;if(this.g=he,this.f|=1,this.i>0&&!ge(this))return this.f&=-2,!0;var e=oe;try{fe(this),oe=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return oe=e,me(this),this.f&=-2,!0},be.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}pe.prototype.S.call(this,e)},be.prototype.U=function(e){if(void 0!==this.t&&(pe.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},be.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(be.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ue(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Me.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},Me.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ye(this),fe(this),le++;var e=oe;return oe=this,xe.bind(this,e)},Me.prototype.N=function(){2&this.f||(this.f|=2,this.o=se,se=this)},Me.prototype.d=function(){this.f|=8,1&this.f||we(this)},Me.prototype.dispose=function(){this.d()};class je{constructor(e,t){var n;if(U(this,"type"),U(this,"coordMeta"),U(this,"coordRange"),U(this,"range"),"object"==typeof e&&(this.coordMeta=e),t&&(this.coordMeta=t,this.coordRange=null!=(n=t.range)?n:t.refRange),"string"==typeof e){let t=e.trim().match(/^(?<type><[a-z]+>)(\[(?<min>-?[.\d]+),\s*(?<max>-?[.\d]+)\])?$/);if(!t)throw new TypeError(`Cannot parse ${e} as a type definition.`);this.type=t.groups.type;let{min:n,max:r}=t.groups;(n||r)&&(this.range=[+n,+r])}}get computedRange(){return this.range?this.range:"<percentage>"===this.type?this.percentageRange():"<angle>"===this.type?[0,360]:null}get unit(){return"<percentage>"===this.type?"%":"<angle>"===this.type?"deg":""}resolve(e){if("<angle>"===this.type)return e;let t=this.computedRange,n=this.coordRange;return"<percentage>"===this.type&&(null!=n||(n=this.percentageRange())),ze(t,n,e)}serialize(e,t){let n="<percentage>"===this.type?this.percentageRange(100):this.computedRange,r=this.unit;return Ae(e=ze(this.coordRange,n,e),{unit:r,precision:t})}toString(){let e=this.type;if(this.range){let[t="",n=""]=this.range;e+=`[${t},${n}]`}return e}percentageRange(e=1){let t;return t=this.coordMeta&&this.coordMeta.range||this.coordRange&&this.coordRange[0]>=0?[0,1]:[-1,1],[t[0]*e,t[1]*e]}static get(e,t){return Pe(e,this)?e:new this(e,t)}}const Te=Symbol("instance");class Oe{constructor(e,t=e.space){U(this,"type"),U(this,"name"),U(this,"spaceCoords"),U(this,"coords"),U(this,"id"),U(this,"alpha"),e[Te]=this,this.type="function",this.name="color",Object.assign(this,e),this.space=t,"custom"!==this.type&&(this.spaceCoords=Object.values(t.coords),this.coords||(this.coords=this.spaceCoords.map(e=>{let t=["<number>","<percentage>"];return"angle"===e.type&&t.push("<angle>"),t})),this.coords=this.coords.map((e,t)=>{let n=this.spaceCoords[t];return"string"==typeof e&&(e=e.trim().split(/\s*\|\s*/)),e.map(e=>je.get(e,n))}))}serializeCoords(e,t,n){return n=e.map((e,t)=>{var r;return je.get(null!=(r=null==n?void 0:n[t])?r:this.coords[t][0],this.spaceCoords[t])}),e.map((e,r)=>n[r].serialize(e,t))}coerceCoords(e,t){return Object.entries(this.space.coords).map(([n,r],a)=>{var o;let i=e[a];if(Ee(i)||isNaN(i))return i;let s=t[a],l=this.coords[a].find(e=>e.type==s);if(!l){let e=r.name||n;throw new TypeError(`${null!=(o=null!=s?s:null==i?void 0:i.raw)?o:i} not allowed for ${e} in ${this.name}()`)}return i=l.resolve(i),l.range&&(t[a]=l.toString()),i})}canSerialize(){return"function"===this.type||this.serialize}parse(e){return null}static get(e,...t){return!e||Pe(e,this)?e:e[Te]?e[Te]:new Oe(e,...t)}}const Ne=new class{add(e,t,n){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)},this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},De={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function Ge(e){return Array.isArray(e)?e:De[e]}function Fe(e,t,n,r={}){if(e=Ge(e),t=Ge(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return n;let a={W1:e,W2:t,XYZ:n,options:r};if(Ne.run("chromatic-adaptation-start",a),a.M||(a.W1===De.D65&&a.W2===De.D50?a.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:a.W1===De.D50&&a.W2===De.D65&&(a.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),Ne.run("chromatic-adaptation-end",a),a.M)return Se(a.XYZ,a.M);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Xe={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==(null==(r=null==(n=null==(t=null==globalThis?void 0:globalThis.process)?void 0:t.env)?void 0:n.NODE_ENV)?void 0:r.toLowerCase()),warn:function(e){var t,n;this.verbose&&(null==(n=null==(t=null==globalThis?void 0:globalThis.console)?void 0:t.warn)||n.call(t,e))}};function Ze(e,t){var n,r,a,o;let i,s={str:null==(n=String(e))?void 0:n.trim(),options:t};if(Ne.run("parse-start",s),s.color)return s.color;s.parsed=function(e){if(!e)return;let t=(e=e.trim()).match(Ye.function);if(t){let e=[],n=[],r=!1,a=t[1].toLowerCase(),o=t[2].replace(Ye.singleArgument,(t,o)=>{let{value:i,meta:s}=function(e){var t;let n={},r=null==(t=e.match(Ye.unitValue))?void 0:t[0],a=n.raw=e;return r?(n.type="%"===r?"<percentage>":"<angle>",n.unit=r,n.unitless=Number(a.slice(0,-r.length)),a=n.unitless*_e[r]):Ye.number.test(a)?(a=Number(a),n.type="<number>"):"none"===a?a=null:"NaN"===a||"calc(NaN)"===a?(a=NaN,n.type="<number>"):n.type="<ident>",{value:a,meta:n}}(o);return(t.startsWith("/")||"color"!==a&&3===e.length)&&(r=!0),e.push(i),n.push(s),""});return{name:a,args:e,argMeta:n,lastAlpha:r,commas:o.includes(","),rawName:t[1],rawArgs:t[2]}}}(s.str);let l=s.options?null!=(r=s.options.parseMeta)?r:s.options.meta:null;if(s.parsed){let t,n,r=s.parsed.name,c=s.parsed.args,h=c.map((e,t)=>{var n;return null==(n=s.parsed.argMeta[t])?void 0:n.type});if("color"===r){let i=c.shift();h.shift();let l=i.startsWith("--")?i.substring(2):`--${i}`,u=[i,l];if(t=Ue.findFormat({name:r,id:u,type:"function"}),!t){let t,n=i in Ue.registry?i:l;if(n in Ue.registry){let r=null==(o=null==(a=Ue.registry[n].formats)?void 0:a.color)?void 0:o.id;r&&(t=`Did you mean ${e.replace("color("+i,"color("+r)}?`)}throw new TypeError(`Cannot parse ${s.str}. `+(null!=t?t:"Missing a plugin?"))}n=t.space,t.id.startsWith("--")&&!i.startsWith("--")&&Xe.warn(`${n.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${t.id}) instead of color(${i}).`),i.startsWith("--")&&!t.id.startsWith("--")&&Xe.warn(`${n.name} is a standard space and supported in the CSS spec. Use color(${t.id}) instead of prefixed color(${i}).`)}else t=Ue.findFormat({name:r,type:"function"}),n=t.space;l&&Object.assign(l,{format:t,formatId:t.name,types:h,commas:s.parsed.commas});let u=1;s.parsed.lastAlpha&&(u=s.parsed.args.pop(),l&&(l.alphaType=h.pop()));let p=t.coords.length;if(c.length!==p)throw new TypeError(`Expected ${p} coordinates for ${n.id} in ${s.str}), got ${c.length}`);c=t.coerceCoords(c,h),i={spaceId:n.id,coords:c,alpha:u}}else e:for(let c of Ue.all)for(let e in c.formats){let t=c.formats[e];if("custom"!==t.type)continue;if(t.test&&!t.test(s.str))continue;let n=c.getFormat(t),r=n.parse(s.str);if(r){l&&Object.assign(l,{format:n,formatId:e}),i=r;break e}}if(!i)throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`);return i.alpha=Ee(i.alpha)?i.alpha:void 0===i.alpha?1:Ie(0,i.alpha,1),i}const _e={"%":.01,deg:1,grad:.9,rad:180/Math.PI,turn:360},Ye={function:/^([a-z]+)\(((?:calc\(NaN\)|.)+?)\)$/i,number:/^([-+]?(?:[0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?)$/i,unitValue:RegExp(`(${Object.keys(_e).join("|")})$`),singleArgument:/\/?\s*(none|NaN|calc\(NaN\)|[-+\w.]+(?:%|deg|g?rad|turn)?)/g};function Ve(e,t){if(Array.isArray(e))return e.map(e=>Ve(e,t));if(!e)throw new TypeError("Empty color reference");Ce(e)&&(e=Ze(e,t));let n=e.space||e.spaceId;return"string"==typeof n&&(e.space=Ue.get(n)),void 0===e.alpha&&(e.alpha=1),e}const Je=class e{constructor(t){var n,r,a,o,i,s;this.id=t.id,this.name=t.name,this.base=t.base?e.get(t.base):null,this.aliases=t.aliases,this.base&&(this.fromBase=t.fromBase,this.toBase=t.toBase);let l=null!=(n=t.coords)?n:this.base.coords;for(let e in l)"name"in l[e]||(l[e].name=e);this.coords=l;let c=null!=(a=null!=(r=t.white)?r:this.base.white)?a:"D65";this.white=Ge(c),this.formats=null!=(o=t.formats)?o:{};for(let e in this.formats){let t=this.formats[e];t.type||(t.type="function"),t.name||(t.name=e)}(null==(i=this.formats.color)?void 0:i.id)||(this.formats.color={...null!=(s=this.formats.color)?s:{},id:t.cssId||this.id}),t.gamutSpace?this.gamutSpace="self"===t.gamutSpace?this:e.get(t.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=t.referred,Object.defineProperty(this,"path",{value:Qe(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),Ne.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=75e-6}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let n=Object.values(this.coords);return e.every((e,r)=>{let a=n[r];if("angle"!==a.type&&a.range){if(Ee(e))return!0;let[n,r]=a.range;return(void 0===n||e>=n-t)&&(void 0===r||e<=r+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return(null==(t=null==(e=this.formats)?void 0:e.color)?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if(!e)return null;"default"===e?e=Object.values(this.formats)[0]:"string"==typeof e&&(e=this.formats[e]);let t=Oe.get(e,this);return t!==e&&e.name in this.formats&&(this.formats[e.name]=t),t}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(t,n){if(1===arguments.length){const e=Ve(t);[t,n]=[e.space,e.coords]}if(t=e.get(t),this.equals(t))return n;n=n.map(e=>Ee(e)?0:e);let r,a,o=this.path,i=t.path;for(let e=0;e<o.length&&o[e].equals(i[e]);e++)r=o[e],a=e;if(!r)throw new Error(`Cannot convert between color spaces ${this} and ${t}: no connection space was found`);for(let e=o.length-1;e>a;e--)n=o[e].toBase(n);for(let e=a+1;e<i.length;e++)n=i[e].fromBase(n);return n}from(t,n){if(1===arguments.length){const e=Ve(t);[t,n]=[e.space,e.coords]}return(t=e.get(t)).to(this,n)}toString(){return`${this.name} (${this.id})`}getMinCoords(){var e;let t=[];for(let n in this.coords){let r=this.coords[n],a=r.range||r.refRange;t.push(null!=(e=null==a?void 0:a.min)?e:0)}return t}static get all(){return[...new Set(Object.values(e.registry))]}static register(e,t){if(1===arguments.length&&(e=(t=arguments[0]).id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,1===arguments.length&&t.aliases)for(let n of t.aliases)this.register(n,t);return t}static get(t,...n){if(!t||Pe(t,this))return t;if("string"===Le(t)){let n=e.registry[t.toLowerCase()];if(!n)throw new TypeError(`No color space found with id = "${t}"`);return n}if(n.length)return e.get(...n);throw new TypeError(`${t} is not a valid color space`)}static findFormat(t,n=e.all){if(!t)return null;"string"==typeof t&&(t={name:t});for(let e of n)for(let[n,r]of Object.entries(e.formats)){null!=r.name||(r.name=n),null!=r.type||(r.type="function");let a=!(t.name&&r.name!==t.name||t.type&&r.type!==t.type);if(t.id){let e=r.ids||[r.id],n=Array.isArray(t.id)?t.id:[t.id];a&&(a=n.some(t=>e.includes(t)))}if(a){let t=Oe.get(r,e);return t!==r&&(e.formats[r.name]=t),t}}return null}static resolveCoord(t,n){var r;let a,o,i=Le(t);if("string"===i?t.includes(".")?[a,o]=t.split("."):[a,o]=[,t]:Array.isArray(t)?[a,o]=t:(a=t.space,o=t.coordId),a=e.get(a),a||(a=n),!a)throw new TypeError(`Cannot resolve coordinate reference ${t}: No color space specified and relative references are not allowed here`);if(i=Le(o),"number"===i||"string"===i&&o>=0){let e=Object.entries(a.coords)[o];if(e)return{space:a,id:e[0],index:o,...e[1]}}a=e.get(a);let s=o.toLowerCase(),l=0;for(let e in a.coords){let t=a.coords[e];if(e.toLowerCase()===s||(null==(r=t.name)?void 0:r.toLowerCase())===s)return{space:a,id:e,index:l,...t};l++}throw new TypeError(`No "${o}" coordinate found in ${a.name}. Its coordinates are: ${Object.keys(a.coords).join(", ")}`)}};U(Je,"registry",{}),U(Je,"DEFAULT_FORMAT",{type:"functions",name:"color"});let Ue=Je;function Qe(e){let t=[e];for(let n=e;n=n.base;)t.push(n);return t}const Ke=new Ue({id:"xyz-d65",name:"XYZ D65",coords:{x:{refRange:[0,1],name:"X"},y:{refRange:[0,1],name:"Y"},z:{refRange:[0,1],name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class et extends Ue{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Ke),e.toXYZ_M&&e.fromXYZ_M&&(null!=e.toBase||(e.toBase=t=>{let n=Se(t,e.toXYZ_M);return this.white!==this.base.white&&(n=Fe(this.white,this.base.white,n)),n}),null!=e.fromBase||(e.fromBase=t=>Se(t=Fe(this.base.white,this.white,t),e.fromXYZ_M))),null!=e.referred||(e.referred="display"),super(e)}}function tt(e,t){e=Ve(e);let n,r=Ue.get(t,null==t?void 0:t.space),a=null==t?void 0:t.precision;return n=!r||e.space.equals(r)?e.coords.slice():r.from(e),void 0===a?n:n.map(e=>Be(e,a))}function nt(e,t){var n;if(e=Ve(e),"alpha"===t)return null!=(n=e.alpha)?n:1;let{space:r,index:a}=Ue.resolveCoord(t,e.space);return tt(e,r)[a]}function rt(e,t,n,r){return e=Ve(e),Array.isArray(t)&&([t,n,r]=[e.space,t,n]),t=Ue.get(t),e.coords=t===e.space?n.slice():t.to(e.space,n),void 0!==r&&(e.alpha=r),e}function at(e,t,n){if(e=Ve(e),2===arguments.length&&"object"===Le(arguments[1])){let t=arguments[1];for(let n in t)at(e,n,t[n])}else if("function"==typeof n&&(n=n(nt(e,t))),"alpha"===t)e.alpha=n;else{let{space:r,index:a}=Ue.resolveCoord(t,e.space),o=tt(e,r);o[a]=n,rt(e,r,o)}return e}rt.returns="color",at.returns="color";const ot=new Ue({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Ke,fromBase:e=>Fe(Ke.white,"D50",e),toBase:e=>Fe("D50",Ke.white,e)}),it=216/24389,st=24/116,lt=24389/27;let ct=De.D50;const ht=new Ue({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ct,base:ot,fromBase(e){let t=e.map((e,t)=>e/ct[t]).map(e=>e>it?Math.cbrt(e):(lt*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let[t,n,r]=e,a=[];return a[1]=(t+16)/116,a[0]=n/500+a[1],a[2]=a[1]-r/200,[a[0]>st?Math.pow(a[0],3):(116*a[0]-16)/lt,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/lt,a[2]>st?Math.pow(a[2],3):(116*a[2]-16)/lt].map((e,t)=>e*ct[t])},formats:{lab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function ut(e){return"number"!=typeof e?e:(e%360+360)%360}const pt=new Ue({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:ht,fromBase(e){if(void 0===this.ε){let e=Object.values(this.base.coords)[1].refRange,t=e[1]-e[0];this.ε=t/1e5}let[t,n,r]=e,a=Math.abs(n)<this.ε&&Math.abs(r)<this.ε,o=a?null:ut(180*Math.atan2(r,n)/Math.PI);return[t,a?0:Math.sqrt(n**2+r**2),o]},toBase(e){let[t,n,r]=e,a=null,o=null;return Ee(r)||(n=n<0?0:n,a=n*Math.cos(r*Math.PI/180),o=n*Math.sin(r*Math.PI/180)),[t,a,o]},formats:{lch:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),dt=25**7,gt=Math.PI,ft=180/gt,mt=gt/180;function bt(e){const t=e*e;return t*t*t*e}function vt(e,t,{kL:n=1,kC:r=1,kH:a=1}={}){[e,t]=Ve([e,t]);let[o,i,s]=ht.from(e),l=pt.from(ht,[o,i,s])[1],[c,h,u]=ht.from(t),p=pt.from(ht,[c,h,u])[1];l<0&&(l=0),p<0&&(p=0);let d=bt((l+p)/2),g=.5*(1-Math.sqrt(d/(d+dt))),f=(1+g)*i,m=(1+g)*h,b=Math.sqrt(f**2+s**2),v=Math.sqrt(m**2+u**2),y=0===f&&0===s?0:Math.atan2(s,f),w=0===m&&0===u?0:Math.atan2(u,m);y<0&&(y+=2*gt),w<0&&(w+=2*gt),y*=ft,w*=ft;let x,M=c-o,k=v-b,$=w-y,S=y+w,C=Math.abs($);b*v===0?x=0:C<=180?x=$:$>180?x=$-360:$<-180?x=$+360:Xe.warn("the unthinkable has happened");let L,A=2*Math.sqrt(v*b)*Math.sin(x*mt/2),E=(o+c)/2,B=(b+v)/2,R=bt(B);L=b*v===0?S:C<=180?S/2:S<360?(S+360)/2:(S-360)/2;let z=(E-50)**2,I=1+.015*z/Math.sqrt(20+z),W=1+.045*B,H=1;H-=.17*Math.cos((L-30)*mt),H+=.24*Math.cos(2*L*mt),H+=.32*Math.cos((3*L+6)*mt),H-=.2*Math.cos((4*L-63)*mt);let q=1+.015*B*H,P=30*Math.exp(-1*((L-275)/25)**2),j=2*Math.sqrt(R/(R+dt)),T=(M/(n*I))**2;return T+=(k/(r*W))**2,T+=(A/(a*q))**2,T+=-1*Math.sin(2*P*mt)*j*(k/(r*W))*(A/(a*q)),Math.sqrt(T)}const yt=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],wt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],xt=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Mt=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],kt=new Ue({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Ke,fromBase(e){let t=Se(e,yt);return t[0]=Math.cbrt(t[0]),t[1]=Math.cbrt(t[1]),t[2]=Math.cbrt(t[2]),Se(t,xt,t)},toBase(e){let t=Se(e,Mt);return t[0]=t[0]**3,t[1]=t[1]**3,t[2]=t[2]**3,Se(t,wt,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}});function $t(e,t){[e,t]=Ve([e,t]);let[n,r,a]=kt.from(e),[o,i,s]=kt.from(t),l=n-o,c=r-i,h=a-s;return Math.sqrt(l**2+c**2+h**2)}function St(e,t,{epsilon:n=75e-6}={}){e=Ve(e),t||(t=e.space),t=Ue.get(t);let r=e.coords;return t!==e.space&&(r=t.from(e)),t.inGamut(r,{epsilon:n})}function Ct(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}const Lt=Math.PI/180,At=new Ue({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Ke,fromBase:e=>e.map(e=>203*e),toBase:e=>e.map(e=>e/203)}),Et=1.15,Bt=.66,Rt=2610/16384,zt=16384/2610,It=.8359375,Wt=2413/128,Ht=18.6875,qt=1.7*2523/32,Pt=32/(1.7*2523),jt=-.56,Tt=16295499532821565e-27,Ot=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],Nt=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],Dt=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],Gt=[[1,.13860504327153927,.05804731615611883],[1,-.1386050432715393,-.058047316156118904],[1,-.09601924202631895,-.811891896056039]],Ft=new Ue({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.21,.21]},bz:{refRange:[-.21,.21]}},base:At,fromBase(e){let[t,n,r]=e,a=Se([Et*t-(Et-1)*r,Bt*n-(Bt-1)*t,r],Ot).map(function(e){let t=It+Wt*He(e/1e4,Rt),n=1+Ht*He(e/1e4,Rt);return He(t/n,qt)}),[o,i,s]=Se(a,Dt);return[(1+jt)*o/(1+jt*o)-Tt,i,s]},toBase(e){let[t,n,r]=e,a=Se([(t+Tt)/(1+jt-jt*(t+Tt)),n,r],Gt).map(function(e){let t=It-He(e,Pt),n=Ht*He(e,Pt)-Wt;return 1e4*He(t/n,zt)}),[o,i,s]=Se(a,Nt),l=(o+(Et-1)*s)/Et;return[l,(i+(Bt-1)*l)/Bt,s]},formats:{jzazbz:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}}),Xt=new Ue({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,.26],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:Ft,fromBase:pt.fromBase,toBase:pt.toBase,formats:{jzczhz:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),Zt=.8359375,_t=2413/128,Yt=18.6875,Vt=2610/16384,Jt=16384/2610,Ut=32/2523,Qt=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],Kt=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],en=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],tn=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],nn=new Ue({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:At,fromBase:e=>{return t=Se(e,Qt),Se(t.map(function(e){return((Zt+_t*(e/1e4)**Vt)/(1+Yt*(e/1e4)**Vt))**78.84375}),Kt);var t},toBase(e){let t=function(e){return Se(e,en).map(function(e){return 1e4*(Math.max(e**Ut-Zt,0)/(_t-Yt*e**Ut))**Jt})}(e);return Se(t,tn)},formats:{ictcp:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <percentage>"]}}}),rn=De.D65,an=1/.42,on=2*Math.PI,sn=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],ln=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],cn=[[460,451,288],[460,-891,-261],[460,-220,-6300]],hn={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},un={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},pn=180/Math.PI,dn=Math.PI/180;function gn(e,t){return e.map(e=>{const n=He(t*Math.abs(e)*.01,.42);return 400*We(n,e)/(n+27.13)})}function fn(e,t,n,r,a){const o={};o.discounting=a,o.refWhite=e,o.surround=r;const i=e.map(e=>100*e);o.la=t,o.yb=n;const s=i[1],l=Se(i,sn);let c=hn[o.surround];const h=c[0];o.c=c[1],o.nc=c[2];const u=(1/(5*o.la+1))**4;o.fl=u*o.la+.1*(1-u)*(1-u)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/s,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const p=Math.max(Math.min(h*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=l.map(e=>Re(1,s/e,p)),o.dRgbInv=o.dRgb.map(e=>1/e);const d=gn(l.map((e,t)=>e*o.dRgb[t]),o.fl);return o.aW=o.nbb*(2*d[0]+d[1]+.05*d[2]),o}const mn=fn(rn,64/Math.PI*.2,20,"average",!1);function bn(e,t){if(!(void 0!==e.J^void 0!==e.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==e.C^void 0!==e.M^void 0!==e.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==e.h^void 0!==e.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===e.J||0===e.Q)return[0,0,0];let n=0;n=void 0!==e.h?ut(e.h)*dn:function(e){let t=(e%400+400)%400;const n=Math.floor(.01*t);t%=100;const[r,a]=un.h.slice(n,n+2),[o,i]=un.e.slice(n,n+2);return ut((t*(i*r-o*a)-100*r*i)/(t*(i-o)-100*i))}(e.H)*dn;const r=Math.cos(n),a=Math.sin(n);let o=0;void 0!==e.J?o=.1*He(e.J,.5):void 0!==e.Q&&(o=.25*t.c*e.Q/((t.aW+4)*t.flRoot));let i=0;void 0!==e.C?i=e.C/o:void 0!==e.M?i=e.M/t.flRoot/o:void 0!==e.s&&(i=4e-4*e.s**2*(t.aW+4)/t.c);const s=He(i*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),l=.25*(Math.cos(n+2)+3.8),c=t.aW*He(o,2/t.c/t.z),h=5e4/13*t.nc*t.ncb*l,u=c/t.nbb,p=23*(u+.305)*qe(s,23*h+s*(11*r+108*a)),d=function(e,t){const n=100/t*2588.068098016295;return e.map(e=>{const t=Math.abs(e);return We(n*He(t/(400-t),an),e)})}(Se([u,p*r,p*a],cn).map(e=>1*e/1403),t.fl);return Se(d.map((e,n)=>e*t.dRgbInv[n]),ln).map(e=>e/100)}function vn(e,t){const n=gn(Se(e.map(e=>100*e),sn).map((e,n)=>e*t.dRgb[n]),t.fl),r=n[0]+(-12*n[1]+n[2])/11,a=(n[0]+n[1]-2*n[2])/9,o=(Math.atan2(a,r)%on+on)%on,i=.25*(Math.cos(o+2)+3.8),s=He(5e4/13*t.nc*t.ncb*qe(i*Math.sqrt(r**2+a**2),n[0]+n[1]+1.05*n[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),l=He(t.nbb*(2*n[0]+n[1]+.05*n[2])/t.aW,.5*t.c*t.z),c=100*He(l,2),h=4/t.c*l*(t.aW+4)*t.flRoot,u=s*l,p=u*t.flRoot,d=ut(o*pn),g=function(e){let t=ut(e);t<=un.h[0]&&(t+=360);const n=function(e,t,n=0,r=e.length){for(;n<r;){const a=n+r>>1;e[a]<t?n=a+1:r=a}return n}(un.h,t)-1,[r,a]=un.h.slice(n,n+2),[o,i]=un.e.slice(n,n+2),s=(t-r)/o;return un.H[n]+100*s/(s+(a-t)/i)}(d);return{J:c,C:u,h:d,s:50*He(t.c*s/(t.aW+4),.5),Q:h,M:p,H:g}}new Ue({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Ke,fromBase(e){void 0===this.ε&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);const t=vn(e,mn),n=Math.abs(t.M)<this.ε;return[t.J,n?0:t.M,n?null:t.h]},toBase:e=>bn({J:e[0],M:e[1],h:e[2]},mn)});const yn=216/24389,wn=24389/27;function xn(e){return e>8?Math.pow((e+16)/116,3):e/wn}const Mn=fn(De.D65,200/Math.PI*xn(50),100*xn(50),"average",!1),kn=new Ue({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Ke,fromBase(e){void 0===this.ε&&(this.ε=Object.values(this.coords)[1].refRange[1]/1e5);let t=function(e){const t=116*((n=e[1])>yn?Math.cbrt(n):(wn*n+16)/116)-16;var n;if(0===t)return[0,0,0];const r=vn(e,Mn);return[ut(r.h),r.C,t]}(e);return t[1]<this.ε&&(t[1]=0,t[0]=null),t},toBase:e=>function(e,t){let[n,r,a]=e,o=[],i=0;if(0===a)return[0,0,0];let s=xn(a);i=a>0?.00379058511492914*a**2+.608983189401032*a+.9155088574762233:9514440756550361e-21*a**2+.08693057439788597*a-21.928975842194614;let l=0,c=1/0;for(;l<=15;){o=bn({J:i,C:r,h:n},t);const e=Math.abs(o[1]-s);if(e<c){if(e<=2e-12)return o;c=e}i-=(o[1]-s)*i/(2*o[1]),l+=1}return bn({J:i,C:r,h:n},t)}(e,Mn),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),$n=Math.PI/180,Sn=[1,.007,.0228];function Cn(e){e[1]<0&&(e=kn.fromBase(kn.toBase(e)));const t=Math.log(Math.max(1+Sn[2]*e[1]*Mn.flRoot,1))/Sn[2],n=e[0]*$n,r=t*Math.cos(n),a=t*Math.sin(n);return[e[2],r,a]}const Ln={deltaE76:function(e,t){return function(e,t,n="lab"){let r=(n=Ue.get(n)).from(e),a=n.from(t);return Math.sqrt(r.reduce((e,t,n)=>{let r=a[n];return Ee(t)||Ee(r)?e:e+(r-t)**2},0))}(e,t,"lab")},deltaECMC:function(e,t,{l:n=2,c:r=1}={}){[e,t]=Ve([e,t]);let[a,o,i]=ht.from(e),[,s,l]=pt.from(ht,[a,o,i]),[c,h,u]=ht.from(t),p=pt.from(ht,[c,h,u])[1];s<0&&(s=0),p<0&&(p=0);let d=a-c,g=s-p,f=(o-h)**2+(i-u)**2-g**2,m=.511;a>=16&&(m=.040975*a/(1+.01765*a));let b,v=.0638*s/(1+.0131*s)+.638;Ee(l)&&(l=0),b=l>=164&&l<=345?.56+Math.abs(.2*Math.cos((l+168)*Lt)):.36+Math.abs(.4*Math.cos((l+35)*Lt));let y=Math.pow(s,4),w=Math.sqrt(y/(y+1900)),x=(d/(n*m))**2;return x+=(g/(r*v))**2,x+=f/(v*(w*b+1-w))**2,Math.sqrt(x)},deltaE2000:vt,deltaEJz:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=Xt.from(e),[o,i,s]=Xt.from(t),l=n-o,c=r-i;Ee(a)&&Ee(s)?(a=0,s=0):Ee(a)?a=s:Ee(s)&&(s=a);let h=a-s,u=2*Math.sqrt(r*i)*Math.sin(h/2*(Math.PI/180));return Math.sqrt(l**2+c**2+u**2)},deltaEITP:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=nn.from(e),[o,i,s]=nn.from(t);return 720*Math.sqrt((n-o)**2+.25*(r-i)**2+(a-s)**2)},deltaEOK:$t,deltaEOK2:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=kt.from(e),[o,i,s]=kt.from(t),l=n-o,c=2*(r-i),h=2*(a-s);return Math.sqrt(l**2+c**2+h**2)},deltaEHCT:function(e,t){[e,t]=Ve([e,t]);let[n,r,a]=Cn(kn.from(e)),[o,i,s]=Cn(kn.from(t));return Math.sqrt((n-o)**2+(r-i)**2+(a-s)**2)}},An={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function En(e,{method:t=Xe.gamut_mapping,space:n,deltaEMethod:r="",jnd:a=2,blackWhiteClamp:o}={}){if(e=Ve(e),Ce(arguments[1])?n=arguments[1]:n||(n=e.space),St(e,n=Ue.get(n),{epsilon:0}))return e;let i;if("css"===t)i=function(e,{space:t}={}){const n=.02,r=1e-4;e=Ve(e),t||(t=e.space),t=Ue.get(t);const a=Ue.get("oklch");if(t.isUnbounded)return Rn(e,t);const o=Rn(e,a);let i=o.coords[0];if(i>=1){const n=Rn(Bn.WHITE,t);return n.alpha=e.alpha,Rn(n,t)}if(i<=0){const n=Rn(Bn.BLACK,t);return n.alpha=e.alpha,Rn(n,t)}if(St(o,t,{epsilon:0}))return Rn(o,t);function s(e){const n=Rn(e,t),r=Object.values(t.coords);return n.coords=n.coords.map((e,t)=>{if("range"in r[t]){const[n,a]=r[t].range;return Ie(n,e,a)}return e}),n}let l=0,c=o.coords[1],h=!0,u=Ct(o),p=s(u),d=$t(p,u);if(d<n)return p;for(;c-l>r;){const e=(l+c)/2;if(u.coords[1]=e,h&&St(u,t,{epsilon:0}))l=e;else if(p=s(u),d=$t(p,u),d<n){if(n-d<r)break;h=!1,l=e}else c=e}return p}(e,{space:n});else{if("clip"===t||St(e,n))i=Rn(e,n);else{Object.prototype.hasOwnProperty.call(An,t)&&({method:t,jnd:a,deltaEMethod:r,blackWhiteClamp:o}=An[t]);let s=vt;if(""!==r)for(let e in Ln)if("deltae"+r.toLowerCase()===e.toLowerCase()){s=Ln[e];break}0===a&&(a=1e-16);let l=En(Rn(e,n),{method:"clip",space:n});if(s(e,l)>a){if(o&&3===Object.keys(o).length){let t=Ue.resolveCoord(o.channel),n=nt(Rn(e,t.space),t.id);if(Ee(n)&&(n=0),n>=o.max)return Rn({space:"xyz-d65",coords:De.D65},e.space);if(n<=o.min)return Rn({space:"xyz-d65",coords:[0,0,0]},e.space)}let r=Ue.resolveCoord(t),l=r.space,c=r.id,h=Rn(e,l);h.coords.forEach((e,t)=>{Ee(e)&&(h.coords[t]=0)});let u=(r.range||r.refRange)[0],p=function(e){const t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat("1e"+(t-2)),1e-6)}(a),d=u,g=nt(h,c);for(;g-d>p;){let e=Ct(h);e=En(e,{space:n,method:"clip"}),s(h,e)-a<p?d=nt(h,c):g=nt(h,c),at(h,c,(d+g)/2)}i=Rn(h,n)}else i=l}if("clip"===t||!St(i,n,{epsilon:0})){let e=Object.values(n.coords).map(e=>e.range||[]);i.coords=i.coords.map((t,n)=>{let[r,a]=e[n];return void 0!==r&&(t=Math.max(r,t)),void 0!==a&&(t=Math.min(t,a)),t})}}return n!==e.space&&(i=Rn(i,e.space)),e.coords=i.coords,e}En.returns="color";const Bn={WHITE:{space:kt,coords:[1,0,0],alpha:1},BLACK:{space:kt,coords:[0,0,0],alpha:1}};function Rn(e,t,{inGamut:n}={}){e=Ve(e);let r=(t=Ue.get(t)).from(e),a={space:t,coords:r,alpha:e.alpha};return n&&(a=En(a,!0===n?void 0:n)),a}function zn(e,t={}){var n,r,a,o;let i,{precision:s=Xe.precision,format:l,inGamut:c=!0,coords:h,alpha:u,commas:p}=t,d=Ve(e),g=l,f=d.parseMeta;f&&!l&&(f.format.canSerialize()&&(l=f.format,g=f.formatId),null!=h||(h=f.types),null!=u||(u=f.alphaType),null!=p||(p=f.commas)),g&&(l=null!=(n=d.space.getFormat(l))?n:Ue.findFormat(g)),l||(l=null!=(r=d.space.getFormat("default"))?r:Ue.DEFAULT_FORMAT,g=l.name),l&&l.space&&l.space!==d.space&&(d=Rn(d,l.space));let m=d.coords.slice();if(c||(c=l.toGamut),c&&!St(d)&&(m=En(Ct(d),!0===c?void 0:c).coords),"custom"===l.type){if(!l.serialize)throw new TypeError(`format ${g} can only be used to parse colors, not for serialization`);i=l.serialize(m,d.alpha,t)}else{let e=l.name||"color",t=l.serializeCoords(m,s,h);if("color"===e){let e=l.id||(null==(a=l.ids)?void 0:a[0])||d.space.cssId||d.space.id;t.unshift(e)}let n=d.alpha;void 0!==u&&"object"!=typeof u&&(u="string"==typeof u?{type:u}:{include:u});let r=null!=(o=null==u?void 0:u.type)?o:"<number>",c=!0===(null==u?void 0:u.include)||!0===l.alpha||!1!==(null==u?void 0:u.include)&&!1!==l.alpha&&n<1,g="";if(null!=p||(p=l.commas),c){if(null!==s){let e;"<percentage>"===r&&(e="%",n*=100),n=Ae(n,{precision:s,unit:e})}g=`${p?",":" /"} ${n}`}i=`${e}(${t.join(p?", ":" ")}${g})`}return i}Rn.returns="color";const In=new et({id:"rec2020-linear",cssId:"--rec2020-linear",name:"Linear REC.2020",white:"D65",toXYZ_M:[[.6369580483012914,.14461690358620832,.1688809751641721],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],fromXYZ_M:[[1.716651187971268,-.355670783776392,-.25336628137366],[-.666684351832489,1.616481236634939,.0157685458139111],[.017639857445311,-.042770613257809,.942103121235474]]}),Wn=new et({id:"rec2020",name:"REC.2020",base:In,toBase:e=>e.map(function(e){let t=e<0?-1:1,n=e*t;return t*Math.pow(n,2.4)}),fromBase:e=>e.map(function(e){let t=e<0?-1:1,n=e*t;return t*Math.pow(n,1/2.4)})}),Hn=new et({id:"p3-linear",cssId:"display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ_M:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]}),qn=new et({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ_M:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]}),Pn={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[.4,.2,.6],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let jn=Array(3).fill("<percentage> | <number>[0, 255]"),Tn=Array(3).fill("<number>[0, 255]");const On=new et({id:"srgb",name:"sRGB",base:qn,fromBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n>.0031308?t*(1.055*n**(1/2.4)-.055):12.92*e}),toBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n<=.04045?e/12.92:t*((n+.055)/1.055)**2.4}),formats:{rgb:{coords:jn},rgb_number:{name:"rgb",commas:!0,coords:Tn,alpha:!1},color:{},rgba:{coords:jn,commas:!0,alpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Tn},hex:{type:"custom",toGamut:!0,test:e=>/^#(([a-f0-9]{2}){3,4}|[a-f0-9]{3,4})$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,e=>{t.push(parseInt(e,16)/255)}),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:n=!0,alpha:r}={})=>{(!1!==r&&t<1||!0===r)&&e.push(t),e=e.map(e=>Math.round(255*e));let a=n&&e.every(e=>e%17==0);return"#"+e.map(e=>a?(e/17).toString(16):e.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){let t={spaceId:"srgb",coords:null,alpha:1};if("transparent"===(e=e.toLowerCase())?(t.coords=Pn.black,t.alpha=0):t.coords=Pn[e],t.coords)return t}}}}),Nn=new et({id:"p3",cssId:"display-p3",name:"P3",base:Hn,fromBase:On.fromBase,toBase:On.toBase});function Dn(e){return nt(e,[Ke,"y"])}function Gn(e){return e>=.022?e:e+(.022-e)**1.414}function Fn(e){let t=e<0?-1:1,n=Math.abs(e);return t*Math.pow(n,2.4)}function Xn(e,t){e=Ve(e),t=Ve(t);let n=nt(e,[ht,"l"]),r=nt(t,[ht,"l"]);return Math.abs(n-r)}const Zn=216/24389,_n=24/116,Yn=24389/27;let Vn=De.D65;const Jn=new Ue({id:"lab-d65",name:"Lab D65",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Vn,base:Ke,fromBase(e){let t=e.map((e,t)=>e/Vn[t]).map(e=>e>Zn?Math.cbrt(e):(Yn*e+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>_n?Math.pow(t[0],3):(116*t[0]-16)/Yn,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/Yn,t[2]>_n?Math.pow(t[2],3):(116*t[2]-16)/Yn].map((e,t)=>e*Vn[t])},formats:{"lab-d65":{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <percentage>"]}}}),Un=.5*Math.pow(5,.5)+.5,Qn=Object.freeze(Object.defineProperty({__proto__:null,contrastAPCA:function(e,t){let n,r,a,o,i,s;t=Ve(t),e=Ve(e),t=Rn(t,"srgb"),[o,i,s]=t.coords.map(e=>Ee(e)?0:e);let l=.2126729*Fn(o)+.7151522*Fn(i)+.072175*Fn(s);e=Rn(e,"srgb"),[o,i,s]=e.coords.map(e=>Ee(e)?0:e);let c=.2126729*Fn(o)+.7151522*Fn(i)+.072175*Fn(s),h=Gn(l),u=Gn(c),p=u>h;return Math.abs(u-h)<5e-4?r=0:p?(n=u**.56-h**.57,r=1.14*n):(n=u**.65-h**.62,r=1.14*n),a=Math.abs(r)<.1?0:r>0?r-.027:r+.027,100*a},contrastDeltaPhi:function(e,t){e=Ve(e),t=Ve(t);let n=nt(e,[Jn,"l"]),r=nt(t,[Jn,"l"]),a=Math.abs(Math.pow(n,Un)-Math.pow(r,Un)),o=Math.pow(a,1/Un)*Math.SQRT2-40;return o<7.5?0:o},contrastLstar:Xn,contrastMichelson:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);r>n&&([n,r]=[r,n]);let a=n+r;return 0===a?0:(n-r)/a},contrastWCAG21:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);return r>n&&([n,r]=[r,n]),(n+.05)/(r+.05)},contrastWeber:function(e,t){e=Ve(e),t=Ve(t);let n=Math.max(Dn(e),0),r=Math.max(Dn(t),0);return r>n&&([n,r]=[r,n]),0===r?5e4:(n-r)/r}},Symbol.toStringTag,{value:"Module"}));function Kn(e,t,n){Ce(n)&&(n={algorithm:n});let{algorithm:r,...a}=n||{};if(!r){let e=Object.keys(Qn).map(e=>e.replace(/^contrast/,"")).join(", ");throw new TypeError(`contrast() function needs a contrast algorithm. Please specify one of: ${e}`)}e=Ve(e),t=Ve(t);for(let o in Qn)if("contrast"+r.toLowerCase()===o.toLowerCase())return Qn[o](e,t,a);throw new TypeError(`Unknown contrast algorithm: ${r}`)}const er=new Ue({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:On,fromBase:e=>{let t=Math.max(...e),n=Math.min(...e),[r,a,o]=e,[i,s,l]=[null,0,(n+t)/2],c=t-n;if(0!==c){switch(s=0===l||1===l?0:(t-l)/Math.min(l,1-l),t){case r:i=(a-o)/c+(a<o?6:0);break;case a:i=(o-r)/c+2;break;case o:i=(r-a)/c+4}i*=60}return s<0&&(i+=180,s=Math.abs(s)),i>=360&&(i-=360),[i,100*s,100*l]},toBase:e=>{let[t,n,r]=e;function a(e){let a=(e+t/30)%12,o=n*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(a-3,9-a,1))}return t%=360,t<0&&(t+=360),n/=100,r/=100,[a(0),a(8),a(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]},hsla:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"],commas:!0,alpha:!0}}}),tr=new Ue({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:On,fromBase(e){let t=Math.max(...e),n=Math.min(...e),[r,a,o]=e,[i,s,l]=[null,0,t],c=t-n;if(0!==c){switch(t){case r:i=(a-o)/c+(a<o?6:0);break;case a:i=(o-r)/c+2;break;case o:i=(r-a)/c+4}i*=60}return l&&(s=c/l),i>=360&&(i-=360),[i,100*s,100*l]},toBase(e){let[t,n,r]=e;function a(e){let a=(e+t/60)%6;return r-r*n*Math.max(0,Math.min(a,4-a,1))}return t%=360,t<0&&(t+=360),n/=100,r/=100,[a(5),a(3),a(1)]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),nr=new Ue({id:"hwb",name:"HWB",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},w:{range:[0,100],name:"Whiteness"},b:{range:[0,100],name:"Blackness"}},base:tr,fromBase(e){let[t,n,r]=e;return[t,r*(100-n)/100,100-r]},toBase(e){let[t,n,r]=e;n/=100,r/=100;let a=n+r;if(a>=1)return[t,0,n/a*100];let o=1-r;return[t,100*(0===o?0:1-n/o),100*o]},formats:{hwb:{coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),rr=new et({id:"a98rgb-linear",cssId:"--a98-rgb-linear",name:"Linear Adobe® 98 RGB compatible",white:"D65",toXYZ_M:[[.5766690429101305,.1855582379065463,.1882286462349947],[.29734497525053605,.6273635662554661,.07529145849399788],[.02703136138641234,.07068885253582723,.9913375368376388]],fromXYZ_M:[[2.0415879038107465,-.5650069742788596,-.34473135077832956],[-.9692436362808795,1.8759675015077202,.04155505740717557],[.013444280632031142,-.11836239223101838,1.0151749943912054]]}),ar=new et({id:"a98rgb",cssId:"a98-rgb",name:"Adobe® 98 RGB compatible",base:rr,toBase:e=>e.map(e=>Math.pow(Math.abs(e),563/256)*Math.sign(e)),fromBase:e=>e.map(e=>Math.pow(Math.abs(e),256/563)*Math.sign(e))}),or=new et({id:"prophoto-linear",cssId:"--prophoto-rgb-linear",name:"Linear ProPhoto",white:"D50",base:ot,toXYZ_M:[[.7977666449006423,.13518129740053308,.0313477341283922],[.2880748288194013,.711835234241873,8993693872564e-17],[0,0,.8251046025104602]],fromXYZ_M:[[1.3457868816471583,-.25557208737979464,-.05110186497554526],[-.5446307051249019,1.5082477428451468,.02052744743642139],[0,0,1.2119675456389452]]}),ir=1/512,sr=new et({id:"prophoto",cssId:"prophoto-rgb",name:"ProPhoto",base:or,toBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n<.03125?e/16:t*n**1.8}),fromBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n>=ir?t*n**(1/1.8):16*e})}),lr=new Ue({id:"oklch",name:"OkLCh",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:kt,fromBase:pt.fromBase,toBase:pt.toBase,formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>","<number> | <angle>"]}}}),cr=2*Math.PI,hr=[[4.076741636075958,-3.307711539258063,.2309699031821043],[-1.2684379732850315,2.609757349287688,-.341319376002657],[-.0041960761386756,-.7034186179359362,1.7076146940746117]],ur=[[[-1.8817031,-.80936501],[1.19086277,1.76576728,.59662641,.75515197,.56771245]],[[1.8144408,-1.19445267],[.73956515,-.45954404,.08285427,.12541073,-.14503204]],[[.13110758,1.81333971],[1.35733652,-.00915799,-1.1513021,-.50559606,.00692167]]],pr=Number.MAX_VALUE,dr=.206,gr=(1+dr)/1.03;function fr(e,t){let n=e.length;if(n!==t.length)throw new Error(`Vectors of size ${n} and ${t.length} are not aligned`);let r=0;return e.forEach((e,n)=>{r+=e*t[n]}),r}function mr(e){return.5*(gr*e-dr+Math.sqrt((gr*e-dr)*(gr*e-dr)+.12*gr*e))}function br(e){return(e**2+dr*e)/(gr*(e+.03))}function vr(e){let[t,n]=e;return[n/t,n/(1-t)]}function yr(e,t){let n=Se(e,Mt);return n[0]=n[0]**3,n[1]=n[1]**3,n[2]=n[2]**3,Se(n,t,n)}function wr(e,t,n,r){let a=function(e,t,n,r){let a,o,i,s,l,c,h,u;fr(r[0][0],[e,t])>1?([a,o,i,s,l]=r[0][1],[c,h,u]=n[0]):fr(r[1][0],[e,t])>1?([a,o,i,s,l]=r[1][1],[c,h,u]=n[1]):([a,o,i,s,l]=r[2][1],[c,h,u]=n[2]);let p=a+o*e+i*t+s*e**2+l*e*t,d=fr(Mt[0].slice(1),[e,t]),g=fr(Mt[1].slice(1),[e,t]),f=fr(Mt[2].slice(1),[e,t]),m=1+p*d,b=1+p*g,v=1+p*f,y=c*m**3+h*b**3+u*v**3,w=c*(3*d*m**2)+h*(3*g*b**2)+u*(3*f*v**2);return p-=y*w/(w**2-.5*y*(c*(6*d**2*m)+h*(6*g**2*b)+u*(6*f**2*v))),p}(e,t,n,r),o=yr([1,a*e,a*t],n),i=He(1/Math.max(...o),1/3);return[i,i*a]}function xr(e,t,n){let[r,a,o]=e,i=wr(a,o,t,n),s=function(e,t,n,r,a,o,i,s){let l;if(void 0===s&&(s=wr(e,t,o,i)),(n-a)*s[1]-1*(s[0]-a)<=0)l=s[1]*a/(1*s[0]+s[1]*(a-n));else{l=s[1]*(a-1)/(1*(s[0]-1)+s[1]*(a-n));let r=n-a,i=1,c=fr(Mt[0].slice(1),[e,t]),h=fr(Mt[1].slice(1),[e,t]),u=fr(Mt[2].slice(1),[e,t]),p=r+i*c,d=r+i*h,g=r+i*u,f=a*(1-l)+l*n,m=1*l,b=f+m*c,v=f+m*h,y=f+m*u,w=b**3,x=v**3,M=y**3,k=3*p*b**2,$=3*d*v**2,S=3*g*y**2,C=6*p**2*b,L=6*d**2*v,A=6*g**2*y,E=fr(o[0],[w,x,M])-1,B=fr(o[0],[k,$,S]),R=B/(B*B-.5*E*fr(o[0],[C,L,A])),z=-E*R,I=fr(o[1],[w,x,M])-1,W=fr(o[1],[k,$,S]),H=W/(W*W-.5*I*fr(o[1],[C,L,A])),q=-I*H,P=fr(o[2],[w,x,M])-1,j=fr(o[2],[k,$,S]),T=j/(j*j-.5*P*fr(o[2],[C,L,A])),O=-P*T;z=R>=0?z:pr,q=H>=0?q:pr,O=T>=0?O:pr,l+=Math.min(z,Math.min(q,O))}return l}(a,o,r,0,r,t,n,i),l=vr(i),c=s/Math.min(r*l[0],(1-r)*l[1]),h=function(e,t){return[.11516993+1/(7.4477897+4.1590124*t+e*(1.75198401*t-2.19557347+e*(-2.13704948-10.02301043*t+e*(5.38770819*t-4.24894561+4.69891013*e)))),.11239642+1/(1.6132032-.68124379*t+e*(.40370612+.90148123*t+e*(.6122399*t-.27087943+e*(.00299215-.45399568*t-.14661872*e))))]}(a,o),u=r*h[0],p=(1-r)*h[1],d=.9*c*Math.sqrt(Math.sqrt(1/(1/u**4+1/p**4)));return u=.4*r,p=.8*(1-r),[Math.sqrt(1/(1/u**2+1/p**2)),d,s]}new Ue({id:"okhsl",name:"Okhsl",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,1],name:"Saturation"},l:{range:[0,1],name:"Lightness"}},base:kt,gamutSpace:"self",fromBase:e=>function(e,t,n){let r=e[0],a=0,o=mr(r),i=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/cr;if(0!==o&&1!==o&&0!==i){let o,s,l,c,h=e[1]/i,u=e[2]/i,[p,d,g]=xr([r,h,u],t,n),f=.8;i<d?(s=f*p,l=1-s/d,c=i/(s+l*i),a=c*f):(o=d,s=.2*d**2*1.5625/p,l=1-s/(g-d),c=(i-o)/(s+l*(i-o)),a=f+.2*c)}const l=Math.abs(a)<1e-4;return l||0===o||Math.abs(1-o)<1e-7?(s=null,l||(a=0)):s=ut(360*s),[s,a,o]}(e,hr,ur),toBase:e=>function(e,t,n){let[r,a,o]=e,i=br(o),s=null,l=null;if(r=ut(r)/360,0!==i&&1!==i&&0!==a){let e,o,c,h,u=Math.cos(cr*r),p=Math.sin(cr*r),[d,g,f]=xr([i,u,p],t,n),m=.8;a<m?(e=1.25*a,o=0,c=m*d,h=1-c/g):(e=5*(a-.8),o=g,c=.2*g**2*1.5625/d,h=1-c/(f-g));let b=o+e*c/(1-h*e);s=b*u,l=b*p}return[i,s,l]}(e,hr,ur),formats:{color:{id:"--okhsl",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const Mr=new Ue({id:"okhsv",name:"Okhsv",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,1],name:"Saturation"},v:{range:[0,1],name:"Value"}},base:kt,gamutSpace:"self",fromBase:e=>function(e,t,n){let r=e[0],a=0,o=mr(r),i=Math.sqrt(e[1]**2+e[2]**2),s=.5+Math.atan2(-e[2],-e[1])/cr;if(0!==r&&1!==r&&0!==i){let s=e[1]/i,l=e[2]/i,c=wr(s,l,t,n),[h,u]=vr(c),p=.5,d=1-p/h,g=u/(i+r*u),f=g*r,m=g*i,b=br(f),v=m*b/f,[y,w,x]=yr([b,s*v,l*v],t),M=He(1/Math.max(Math.max(y,w),Math.max(x,0)),1/3);r/=M,i/=M,i=i*mr(r)/r,r=mr(r),o=r/f,a=(p+u)*m/(u*p+u*d*m)}return s=Math.abs(a)<1e-4||0===o?null:ut(360*s),[s,a,o]}(e,hr,ur),toBase:e=>function(e,t,n){let[r,a,o]=e;r=ut(r)/360;let i=br(o),s=null,l=null;if(0!==i&&0!==a){let e=Math.cos(cr*r),c=Math.sin(cr*r),h=wr(e,c,t,n),[u,p]=vr(h),d=.5,g=1-d/u,f=1-a*d/(d+p-p*g*a),m=a*p*d/(d+p-p*g*a);i=o*f;let b=o*m,v=br(f),y=m*v/f,w=br(i);b=b*w/i,i=w;let[x,M,k]=yr([v,e*y,c*y],t),$=He(1/Math.max(Math.max(x,M),Math.max(k,0)),1/3);i*=$,b*=$,s=b*e,l=b*c}return[i,s,l]}(e,hr,ur),formats:{color:{id:"--okhsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});function kr(e){return"display-p3"===e?"p3":"a98-rgb"===e?"a98rgb":e}function $r(e){return"p3"===e?"display-p3":"a98rgb"===e?"a98-rgb":e}function Sr(e){return"100"===e||100===e?"":` / ${e}%`}function Cr(e){return["srgb-linear","display-p3","rec2020","a98-rgb","prophoto","xyz","xyz-d50","xyz-d65"].includes(e)}function Lr(e,t=0){return null==e?"0":Number(e.toFixed(t)).toString()}function Ar(e,t){var n,r,a,o,i,s,l,c,h,u;const p=null!=(n=t.L)?n:50,d=null!=(r=t.A)?r:0,g=null!=(a=t.B)?a:0,f=null!=(o=t.C)?o:0,m=null!=(i=t.H)?i:0,b=null!=(s=t.S)?s:0,v=null!=(l=t.W)?l:0,y=null!=(c=t.R)?c:0,w=null!=(h=t.G)?h:0,x=null!=(u=t.ALP)?u:100;switch(e){case"oklab":return`oklab(${p}% ${d} ${g}${Sr(x)})`;case"oklch":return`oklch(${p}% ${f}% ${m}${Sr(x)})`;case"lab":return`lab(${p}% ${d} ${g}${Sr(x)})`;case"lch":return`lch(${p}% ${f}% ${m}${Sr(x)})`;case"hsl":return`hsl(${m} ${b}% ${p}%${Sr(x)})`;case"hwb":return`hwb(${m} ${v}% ${g}%${Sr(x)})`;case"srgb":return`rgb(${y}% ${w}% ${g}%${Sr(x)})`;case"hex":{const e=Math.round(2.55*Number(y)),t=Math.round(2.55*Number(w)),n=Math.round(2.55*Number(g)),r=Number(x),a=e.toString(16).padStart(2,"0"),o=t.toString(16).padStart(2,"0"),i=n.toString(16).padStart(2,"0"),s=a[0]===a[1]&&o[0]===o[1]&&i[0]===i[1];if(r<100){const e=Math.round(r/100*255).toString(16).padStart(2,"0");return s&&e[0]===e[1]?`#${a[0]}${o[0]}${i[0]}${e[0]}`:`#${a}${o}${i}${e}`}return s?`#${a[0]}${o[0]}${i[0]}`:`#${a}${o}${i}`}default:return Cr(e)?function(e,t,n,r,a){return`color(${"prophoto"===e?"prophoto-rgb":e} ${t}% ${n}% ${r}%${Sr(a)})`}(e,y,w,g,x):"oklch(75% 75% 180)"}}function Er(e,t){var n,r,a,o,i,s;let l=Ve(Ze(t));const c=kr("hex"===e?"srgb":e);l.space.id!==c&&(l=Rn(l,c));const h=$r(l.space.id),u="rgb"===h?"srgb":h,p={},d=null!=(n=l.alpha)?n:1;if("oklab"===u){const[e,t,n]=l.coords;p.L=Lr(100*(null!=e?e:0)),p.A=Lr(t,2),p.B=Lr(n,2),p.ALP=Lr(100*d)}else if("oklch"===u){const[e,t]=null!=(r=lr.coords.c.refRange)?r:[0,1],[n,a,o]=l.coords,i=(null!=a?a:0-e)/(t-e)*100;p.L=Lr(100*(null!=n?n:0)),p.C=Lr(Math.min(100,i),0),p.H=Lr(o),p.ALP=Lr(100*d)}else if("lab"===u){const[e,t,n]=l.coords;p.L=Lr(e),p.A=Lr(t),p.B=Lr(n),p.ALP=Lr(100*d)}else if("lch"===u){const[e,t,n]=l.coords;p.L=Lr(e),p.C=Lr(Math.min(100,(null!=t?t:0)/1.5),0),p.H=Lr(n),p.ALP=Lr(100*d)}else if("hsl"===u){const e=l.coords[0],t=null!=(a=l.coords[1])?a:0,n=null!=(o=l.coords[2])?o:0;p.H=Lr(e),p.S=Lr(t>1?t:100*t),p.L=Lr(n>1?n:100*n),p.ALP=Lr(100*d)}else if("hwb"===u){const e=l.coords[0],t=null!=(i=l.coords[1])?i:0,n=null!=(s=l.coords[2])?s:0;p.H=Lr(e),p.W=Lr(t>1?t:100*t),p.B=Lr(n>1?n:100*n),p.ALP=Lr(100*d)}else if("srgb"===u||"hex"===u){const[e,t,n]=En(l,{space:"srgb",method:"clip"}).coords;p.R=Lr(100*(null!=e?e:0)),p.G=Lr(100*(null!=t?t:0)),p.B=Lr(100*(null!=n?n:0)),p.ALP=Lr(100*d)}else if(Cr(u)){const[e,t,n]=l.coords;p.R=Lr(100*(null!=e?e:0)),p.G=Lr(100*(null!=t?t:0)),p.B=Lr(100*(null!=n?n:0)),p.ALP=Lr(100*d)}return{space:u,ch:p}}Ue.register(On),Ue.register(qn),Ue.register(er),Ue.register(nr),Ue.register(ht),Ue.register(pt),Ue.register(kt),Ue.register(lr),Ue.register(Nn),Ue.register(ar),Ue.register(sr),Ue.register(Wn),Ue.register(Ke),Ue.register(ot),Ue.register(Mr);const Br={okhsv:{fixedIndex:0,xIndex:1,xMax:1,xStep:.01,yIndex:2,yMax:1,yStep:.01},oklch:{fixedIndex:2,xIndex:1,xMax:.4,xStep:.004,yIndex:0,yMax:1,yStep:.01},hsl:{fixedIndex:0,xIndex:1,xMax:100,xStep:1,yIndex:2,yMax:100,yStep:1}},Rr=e=>{if(e)return Br[e.spaceId]};class zr{constructor(e,t){ee(this,a),ee(this,o,de(!1)),ee(this,i,new AbortController),ee(this,s,de(null)),ee(this,l,de(null)),te(this,a,e);const n=null==e?void 0:e.querySelector(".area-canvas");if(!e||!n)return;const r=ve(()=>{var e;const t=K(this,s).value,n=Rr(t);return n&&null!=(e=null==t?void 0:t.coords[n.fixedIndex])?e:0}),c=de(null),h=e=>{if(!K(this,l).value)return;const n=K(this,l).value,r=zn(Rn(e,kr("hex"===n?"srgb":n),{inGamut:!0}),{format:"hex"===n?"hex":void 0});t(Ar(n,Er(n,r).ch))},u=t=>{const n=K(this,s).value,r=Rr(n);if(!n||!r)return;const a=e.getBoundingClientRect(),o=Math.max(0,Math.min(1,(t.clientX-a.left)/a.width)),i=Math.max(0,Math.min(1,1-(t.clientY-a.top)/a.height)),l=structuredClone(n.coords);l[r.xIndex]=o*r.xMax,l[r.yIndex]=i*r.yMax,h({...n,coords:l})};e.addEventListener("pointerdown",t=>{K(this,o).value=!0,e.setPointerCapture(t.pointerId),u(t),c.value=r.value},{signal:K(this,i).signal}),e.addEventListener("pointermove",e=>{K(this,o).value&&(e.preventDefault(),u(e))},{signal:K(this,i).signal}),e.addEventListener("pointerup",t=>{K(this,o).value=!1,e.releasePointerCapture(t.pointerId),c.value=null},{signal:K(this,i).signal}),e.addEventListener("pointercancel",()=>{K(this,o).value=!1,c.value=null},{signal:K(this,i).signal}),e.addEventListener("keydown",e=>{var t,n;const r=K(this,s).value,a=Rr(r);if(!r||!a)return;let o=0,i=0;switch(e.key){case"ArrowRight":o=1;break;case"ArrowLeft":o=-1;break;case"ArrowUp":i=1;break;case"ArrowDown":i=-1;break;default:return}e.preventDefault();const l=null!=(t=r.coords[a.xIndex])?t:0,c=null!=(n=r.coords[a.yIndex])?n:0,u=Math.max(0,Math.min(a.xMax,l+o*a.xStep)),p=Math.max(0,Math.min(a.yMax,c+i*a.yStep)),d=structuredClone(r.coords);d[a.xIndex]=u,d[a.yIndex]=p,h({...r,coords:d})},{signal:K(this,i).signal});const p=ke(()=>{e.classList.toggle("dragging",K(this,o).value),document.body.inert=K(this,o).value}),d=ke(()=>{var e,t,n,r;const o=K(this,s).value,i=Rr(o);if(!o||!i)return;const l=(null!=(e=o.coords[i.xIndex])?e:0)/i.xMax*100,c=(null!=(t=o.coords[i.yIndex])?t:0)/i.yMax*100;null==(n=K(this,a))||n.style.setProperty("--thumb-x",`${l}%`),null==(r=K(this,a))||r.style.setProperty("--thumb-y",100-c+"%")});let g=null,f=null;const m=ke(()=>{var e;f=null!=(e=c.value)?e:r.value,null===g&&(g=requestAnimationFrame(()=>{if(n&&null!==f&&K(this,l).value){const e=K(this,s).value,t=Rr(e);if(!e||!t)return;!function(e,t){const n=160;e.width=n,e.height=100;const r=e.getContext("2d");if(!r)return;const a=r.createImageData(n,100),o=a.data;for(let i=0;i<100;i++){const e=1-i/99;for(let r=0;r<n;r++){const a=r/159,[s,l,c]=Rn(t(a,e),"srgb").coords,h=4*(i*n+r);o[h]=Math.round(255*(null!=s?s:0)),o[h+1]=Math.round(255*(null!=l?l:0)),o[h+2]=Math.round(255*(null!=c?c:0)),o[h+3]=255}}r.putImageData(a,0,0)}(n,(n,r)=>{const a=[0,0,0];return a[t.fixedIndex]=null!=f?f:0,a[t.xIndex]=n*t.xMax,a[t.yIndex]=r*t.yMax,{spaceId:e.spaceId,coords:a,alpha:null}})}g=null,f=null}))});K(this,i).signal.addEventListener("abort",()=>{p(),d(),m(),g&&(cancelAnimationFrame(g),g=null)})}setValue(e,t){K(this,l).value=t;try{let n;n=Rn(e,"oklch"===t||"lch"===t?"oklch":"hsl"===t?"hsl":"okhsv"),K(this,s).value={spaceId:n.space.id,coords:n.coords,alpha:n.alpha}}catch{K(this,s).value=null}}unmount(){K(this,i).abort()}}a=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap,l=new WeakMap;let Ir=null;function Wr(e,t){return e.left>=t.left&&e.top>=t.top&&e.right<=t.right&&e.bottom<=t.bottom}function Hr(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),a=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return a<=n||o<=r?0:(a-n)*(o-r)}const qr=':root{--radius-round: 1e5px;--radius-2: 5px;--radius-3: 1rem}:host{--canvas: Canvas;--canvas-text: CanvasText;--radius-2: .5rem;--radius-3: .75rem;--radius-round: 1e4px;--shadow-elev: #0305081f 0px -1px 2px 0px, #03050821 0px 2px 1px -2px, #03050821 0px 5px 5px -2px, #03050824 0px 10px 10px -2px, #03050826 0px 20px 20px -2px, #0305082b 0px 40px 40px -2px;--shadow-inner: inset 0 0 0 1px color-mix(in oklab, var(--canvas-text), transparent 94%);--checker: repeating-conic-gradient(color-mix(in oklab, var(--canvas-text), transparent 90%) 0% 25%, transparent 0% 50%) 50%/1rem 1rem;color-scheme:light dark;display:flex;align-items:center;gap:10px;position:relative;@media (width < 350px){overflow:hidden}}:host([hidden]){display:none}button{border:1px solid color-mix(in oklab,var(--canvas-text),var(--canvas) 80%);outline-offset:2px;&.trigger{flex-shrink:0;background:none;padding:0;border:none;display:inline-flex;place-content:center;border-radius:var(--radius-round);.chip{display:inline-block;inline-size:1.25rem;block-size:1.25rem;border-radius:var(--radius-round);box-shadow:inset 0 0 0 1px color-mix(in oklab,var(--canvas-text),transparent 92%);background:linear-gradient(var(--value) 0 0),var(--checker);forced-color-adjust:none}}}.input-wrapper{position:relative;display:flex;flex-direction:column;flex:1;min-width:0}.text-input{field-sizing:content;font-family:inherit;padding:1ch 1.5ch;border:1px solid color-mix(in oklab,var(--canvas-text),var(--canvas) 80%);border-radius:var(--radius-2);background:color-mix(in oklab,var(--canvas-text),var(--canvas) 92%);color:var(--canvas-text);box-shadow:var(--shadow-inner);outline-offset:2px;&[aria-invalid=true]{outline-color:red}}.error-message{position:absolute;bottom:-1.5rem;left:0;font-size:12px;color:#ef4444;font-weight:500;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s ease}.error-message:not(:empty){opacity:1}.panel{margin:0;max-inline-size:min(92vw,560px);background:var(--canvas);color:var(--canvas-text);box-shadow:var(--shadow-elev);border-radius:var(--radius-3);padding:0;border:1px solid #0000;overflow:hidden}.area-picker{position:relative;width:100%;aspect-ratio:16 / 9;overflow:hidden;touch-action:none;box-shadow:var(--shadow-inner)}.area-picker:focus-visible{outline-offset:0px}.area-canvas{width:100%;height:100%}.area-thumb{position:absolute;box-sizing:border-box;height:calc(1rem + 8px);aspect-ratio:1;margin-left:calc(-.5rem - 4px);margin-top:calc(-.5rem - 4px);border-radius:var(--radius-round);border:4px solid white;box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026;left:var(--thumb-x, 50%);top:var(--thumb-y, 50%);z-index:1;cursor:grab}.area-picker.dragging .area-thumb{cursor:grabbing}.preview{position:relative;min-inline-size:35ch;display:grid;align-content:end;justify-items:start;padding:.75rem;gap:6px;box-shadow:var(--shadow-inner);background:linear-gradient(var(--value) 0 0),var(--checker);forced-color-adjust:none;&:hover .copy-btn,&:focus-within .copy-btn{opacity:1}>*:not(:hover){opacity:.9}.copy-wrap{position:absolute;top:.5rem;right:.5rem;display:flex;flex-direction:column;align-items:flex-end;gap:.25rem}.copy-btn{color:var(--contrast);background:none;border:1px solid #0000;border-radius:0;padding:0;cursor:pointer;opacity:0;transition:opacity .2s ease;display:inline-flex;align-items:center}.copy-btn svg{display:block}.copy-message{color:var(--contrast);font-size:.8rem;font-weight:500;opacity:0;pointer-events:none;transition:opacity .2s ease;white-space:nowrap}.copy-message.show{opacity:1}.visually-hidden:not(:focus):not(:active){clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}}.space{-webkit-appearance:base-select;-moz-appearance:base-select;appearance:base-select;min-block-size:1lh;line-height:1.1;font-weight:700;margin:0;padding:0;color:var(--contrast);background:transparent;border-radius:0;border:none;&::picker-icon{content:"›";-webkit-appearance:none;transform:rotate(90deg) scale(1.5)}}@supports not selector(::picker-icon){.space{background-image:url(https://api.iconify.design/basil:caret-down-solid.svg);background-size:1rem;background-position:right .5rem center;background-repeat:no-repeat}}.gamut,.info{line-height:1.1;text-box:cap alphabetic;display:block;color:var(--contrast);background:transparent}.gamut{font-size:1rem}.info{font-size:1.25rem}.controls{display:grid;gap:.5rem;padding:.75rem;border-radius:0 0 var(--radius-3) var(--radius-3);.control{display:grid;grid-template-columns:min-content 1fr 4ch;align-items:center;gap:.5rem}.control .num-wrapper{position:relative;display:flex;align-items:center}.control .num-wrapper sup{opacity:.5;font-size:.5em;place-self:start}.control label{font:500 12px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.control input[type=number]{text-align:end;font-size:12px;padding:0;background:none;border:1px solid var(--canvas);border-radius:.25rem;-moz-appearance:textfield;font-variant:tabular-nums;font-family:monospace;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}}.control input[type=range]{width:100%;height:1rem;border-radius:999px;border:1px solid var(--canvas);background:var(--canvas);box-shadow:var(--shadow-inner);-webkit-appearance:none;-moz-appearance:none;appearance:none;forced-color-adjust:none}.control input[type=range].alpha{background:linear-gradient(to right,#0000,#000),var(--checker)}.control input[type=range]::-webkit-slider-thumb{cursor:grab;-webkit-appearance:none;appearance:none;border:4px solid white;height:calc(1rem + 8px);aspect-ratio:1;border-radius:var(--radius-round);box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026}.control input[type=range]:active::-webkit-slider-thumb{cursor:grabbing}.control input[type=range]::-moz-range-thumb{cursor:grab;-moz-appearance:none;appearance:none;border:4px solid white;height:calc(1rem + 8px);aspect-ratio:1;border-radius:var(--radius-round);box-shadow:0 0 1px 1px #00000040,inset 0 1px 2px #00000026;width:calc(8px + 1rem);background:none;box-sizing:border-box}.control input[type=range]:active::-moz-range-thumb{cursor:grabbing}}',Pr="oklch(75% 75% 180)",jr="oklch",Tr=new CSSStyleSheet;"function"==typeof Tr.replaceSync&&Tr.replaceSync(qr);class Or extends HTMLElement{constructor(){if(super(),ee(this,H),ee(this,c,de(Pr)),ee(this,h,de(jr)),ee(this,u,de("auto")),ee(this,p,de(!1)),ee(this,d,de(null)),ee(this,g,de(null)),ee(this,f,de(!1)),ee(this,m,ve(()=>function(e){var t,n;try{const r=Ze(e);let a,o;try{a=null!=(t=Kn(r,"white","WCAG21"))?t:Xn(r,"white"),o=null!=(n=Kn(r,"black","WCAG21"))?n:Xn(r,"black")}catch{a=Xn(r,"white"),o=Xn(r,"black")}return a>o?"white":"black"}catch{return"black"}}(K(this,c).value))),ee(this,b,ve(()=>function(e){let t="srgb";if(!e||e.startsWith("#"))return t;try{const n=Ze(e),r={spaceId:"srgb",coords:Rn(n,"srgb").coords,alpha:null},a={spaceId:"p3",coords:Rn(n,"p3").coords,alpha:null},o={spaceId:"rec2020",coords:Rn(n,"rec2020").coords,alpha:null};St({spaceId:"xyz",coords:Rn(n,"xyz").coords,alpha:null})&&(t="xyz"),St(o)&&(t="rec2020"),St(a)&&(t="p3"),St(r)&&(t="srgb")}catch{}return t}(K(this,c).value))),ee(this,v,null),ee(this,y,null),ee(this,w,null),ee(this,x,null),ee(this,M,null),ee(this,k),ee(this,$,!1),ee(this,S),ee(this,C),ee(this,L),ee(this,A),ee(this,E),ee(this,B),ee(this,R),ee(this,z),ee(this,I),ee(this,W,null),ee(this,j,null),ee(this,T,null),ee(this,O,[]),ee(this,N,null),te(this,S,this.attachShadow({mode:"open",delegatesFocus:!0})),"adoptedStyleSheets"in K(this,S)&&"function"==typeof Tr.replaceSync)K(this,S).adoptedStyleSheets=[Tr];else{const e=document.createElement("style");e.textContent=qr,K(this,S).appendChild(e)}const e=function(){const e=document.createElement("template");return e.innerHTML='\n <button class="trigger" part="trigger" aria-haspopup="dialog" aria-label="Open color picker" title="Open color picker">\n <span class="chip" part="chip"></span>\n </button>\n <div class="input-wrapper">\n <span class="error-message" part="error" role="alert" aria-live="polite"></span>\n <input type="text" class="text-input" part="input" aria-label="Color value" title="Color value" aria-invalid="false" spellcheck="false" />\n </div>\n <div class="panel" popover="auto" part="panel">\n <div class="area-picker" part="area" role="slider" aria-label="Color area picker" tabindex="0">\n <canvas class="area-canvas"></canvas>\n <div class="area-thumb"></div>\n </div>\n <div class="controls" part="controls"></div>\n <div class="preview">\n <div class="copy-wrap">\n <button class="copy-btn">\n <span class="visually-hidden">Copy color</span>\n <svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><title>Copy color</title><path fill="currentColor" d="M5 22q-.825 0-1.413-.588T3 20V6h2v14h11v2H5Zm4-4q-.825 0-1.413-.588T7 16V4q0-.825.588-1.413T9 2h9q.825 0 1.413.588T20 4v12q0 .825-.588 1.413T18 18H9Z"/></svg>\n </button>\n <span class="copy-message" aria-hidden="true">Copied!</span>\n <span class="copy-message-live-region visually-hidden" role="status"></span>\n </div>\n <select class="space" title="Colorspace"></select>\n <output class="info" part="output"></output>\n <span class="gamut" title="Color\'s gamut" part="gamut"></span>\n </div>\n </div>\n ',e}();K(this,S).appendChild(e.content.cloneNode(!0))}static get observedAttributes(){return["value","colorspace","theme","no-alpha"]}get value(){return K(this,c).value}set value(e){if("string"==typeof e&&e)try{const t=$r(Ze(e).spaceId),n="string"==typeof e&&e.trim().startsWith("#");K(this,h).value=n?"hex":"rgb"===t?"srgb":t,K(this,c).value=e,te(this,$,!0),this.setAttribute("value",e),this.setAttribute("colorspace",K(this,h).value),te(this,$,!1),ne(this,H,q).call(this)}catch{}}get colorspace(){return K(this,h).value}set colorspace(e){const t=e||jr;K(this,h).value=t,te(this,$,!0),this.setAttribute("colorspace",t);try{const e=Ze(K(this,c).value),n=Ar(t,Er(t,zn(En(Rn(e,kr("hex"===t?"srgb":t))),{precision:12})).ch);K(this,c).value=n,this.setAttribute("value",n),ne(this,H,q).call(this)}catch{}te(this,$,!1),K(this,L)&&ne(this,H,Y).call(this)}get theme(){return K(this,u).value}set theme(e){const t="light"===e||"dark"===e?e:"auto";K(this,u).value=t,"auto"===t?this.removeAttribute("theme"):this.setAttribute("theme",t)}get noAlpha(){return K(this,f).value}set noAlpha(e){K(this,f).value=!!e,e?this.setAttribute("no-alpha",""):this.removeAttribute("no-alpha")}get gamut(){return K(this,b).value}get contrastColor(){return K(this,m).value}show(e){var t,n;e&&(K(this,d).value=e),null==(n=null==(t=K(this,C))?void 0:t.showPopover)||n.call(t),ne(this,H,D).call(this)}close(){var e,t;null==(t=null==(e=K(this,C))?void 0:e.hidePopover)||t.call(e),ne(this,H,G).call(this)}showPicker(){this.show()}setAnchor(e){K(this,d).value=e}set setColor(e){this.value=e}set setAnchorElement(e){this.setAnchor(e)}connectedCallback(){var e;const t=K(this,S).querySelector("button.trigger");te(this,R,null!=t?t:void 0),te(this,C,K(this,S).querySelector(".panel")),te(this,L,K(this,S).querySelector(".controls")),te(this,A,K(this,S).querySelector(".space")),te(this,E,K(this,S).querySelector("output.info")),te(this,B,K(this,S).querySelector(".chip")),te(this,z,K(this,S).querySelector(".text-input")),te(this,I,K(this,S).querySelector(".error-message"));const n=K(this,S).querySelector(".area-picker");n&&"none"!==getComputedStyle(n).display&&(te(this,k,new zr(n,e=>{K(this,c).value=e,this.setAttribute("value",e),ne(this,H,q).call(this),ne(this,H,Y).call(this)})),te(this,M,ke(()=>{var e;const t=K(this,c).value,n=K(this,h).value;null==(e=K(this,k))||e.setValue(t,n)})));const r=K(this,S).querySelector("button.copy-btn"),a=K(this,S).querySelector(".copy-message"),o=K(this,S).querySelector(".copy-message-live-region");if(r&&a&&o){let e=null;r.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(K(this,c).value),a.classList.add("show"),o.innerText=a.innerText,null!==e&&clearTimeout(e),e=window.setTimeout(()=>{a.classList.remove("show"),o.innerText="",e=null},3e3)}catch{}})}K(this,A).innerHTML='\n <optgroup label="Standard">\n <option value="hex">hex</option>\n <option value="srgb">rgb</option>\n <option value="srgb-linear">srgb-linear</option>\n <option value="hsl">hsl</option>\n <option value="hwb">hwb</option>\n </optgroup>\n <optgroup label="HDR">\n <option value="display-p3">display-p3</option>\n <option value="a98-rgb">a98-rgb</option>\n </optgroup>\n <optgroup label="Ultra HDR">\n <option value="lab">lab</option>\n <option value="lch">lch</option>\n <option value="oklch">oklch</option>\n <option value="oklab">oklab</option>\n <option value="rec2020">rec2020</option>\n <option value="prophoto">prophoto</option>\n <option value="xyz">xyz</option>\n <option value="xyz-d50">xyz-d50</option>\n <option value="xyz-d65">xyz-d65</option>\n </optgroup>\n ',t&&t.addEventListener("click",()=>this.show(t)),K(this,z)&&(K(this,z).value=K(this,c).value,K(this,z).addEventListener("input",e=>{const t=e.target.value;ne(this,H,P).call(this,t)}),K(this,z).addEventListener("paste",e=>{})),this.addEventListener("command",e=>{const t=e.command;if(!t)return;const n=e.source||e.invoker||(document.activeElement instanceof HTMLElement?document.activeElement:null);n&&(te(this,W,n),this.setAnchor(n)),"show-popover"===t||"show"===t?this.show(K(this,W)):"hide-popover"===t||"close"===t?this.close():"toggle-popover"!==t&&"toggle"!==t||(K(this,p).value?this.close():this.show(K(this,W)))}),null==(e=K(this,C))||e.addEventListener("toggle",()=>{var e;const t=K(this,C);let n=!t.hasAttribute("hidden");try{n=null!=(e=t.matches(":popover-open"))&&e}catch{}K(this,p).value=n,n?ne(this,H,D).call(this):ne(this,H,G).call(this),this.dispatchEvent(new CustomEvent(n?"open":"close",{bubbles:!0}))}),K(this,A).addEventListener("change",()=>{this.colorspace=K(this,A).value,ne(this,H,Y).call(this)}),te(this,v,ke(()=>{const e=K(this,c).value,t=K(this,b).value,n=K(this,m).value;K(this,E)&&(K(this,E).value=e),K(this,B)&&K(this,B).style.setProperty("--value",e),K(this,z)&&K(this,z).value!==e&&(K(this,z).value=e),this.style.setProperty("--contrast",n),this.style.setProperty("--counter","white"===n?"black":"white");const r=K(this,S).querySelector(".gamut");r&&(r.textContent=t);const a=K(this,S).querySelector(".preview");a&&a.style.setProperty("--value",e)})),te(this,w,ke(()=>{const e=K(this,g).value;e?(this.setAttribute("data-error",""),K(this,I)&&(K(this,I).textContent=e),K(this,z)&&K(this,z).setAttribute("aria-invalid","true")):(this.removeAttribute("data-error"),K(this,I)&&(K(this,I).textContent=""),K(this,z)&&K(this,z).setAttribute("aria-invalid","false"))})),te(this,y,ke(()=>{const e=K(this,u).value,t="auto"===e?"light dark":e;this.style.setProperty("color-scheme",t)})),this.hasAttribute("value")||this.setAttribute("value",Pr),this.hasAttribute("colorspace")||this.setAttribute("colorspace",K(this,h).value),K(this,A).value=K(this,h).value,ne(this,H,Y).call(this)}disconnectedCallback(){var e,t,n,r,a;null==(e=K(this,y))||e.call(this),null==(t=K(this,v))||t.call(this),null==(n=K(this,w))||n.call(this),null==(r=K(this,M))||r.call(this),null==(a=K(this,k))||a.unmount()}attributeChangedCallback(e,t,n){if(n!==t&&!K(this,$)){if("value"===e&&"string"==typeof n)try{const e=$r(Ze(n).spaceId),t="string"==typeof n&&n.trim().startsWith("#");K(this,c).value=n,K(this,h).value=t?"hex":"rgb"===e?"srgb":e,K(this,A)&&(K(this,A).value=K(this,h).value)}catch{}"colorspace"===e&&n&&(K(this,h).value=n,K(this,A)&&(K(this,A).value=n)),"theme"===e&&(K(this,u).value=n||"auto"),"no-alpha"===e&&(K(this,f).value=null!==n,K(this,L)&&ne(this,H,Y).call(this))}}}return c=new WeakMap,h=new WeakMap,u=new WeakMap,p=new WeakMap,d=new WeakMap,g=new WeakMap,f=new WeakMap,m=new WeakMap,b=new WeakMap,v=new WeakMap,y=new WeakMap,w=new WeakMap,x=new WeakMap,M=new WeakMap,k=new WeakMap,$=new WeakMap,S=new WeakMap,C=new WeakMap,L=new WeakMap,A=new WeakMap,E=new WeakMap,B=new WeakMap,R=new WeakMap,z=new WeakMap,I=new WeakMap,W=new WeakMap,H=new WeakSet,q=function(){const e={value:K(this,c).value,colorspace:K(this,h).value,gamut:K(this,b).value};this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0}))},P=function(e){if(e&&e.trim())try{const t=$r(Ze(e).spaceId),n="string"==typeof e&&e.trim().startsWith("#");K(this,g).value=null,K(this,h).value=n?"hex":"rgb"===t?"srgb":t,K(this,c).value=e,this.setAttribute("value",e),this.setAttribute("colorspace",K(this,h).value),K(this,A)&&(K(this,A).value=K(this,h).value),ne(this,H,q).call(this)}catch(t){K(this,g).value="Invalid color format"}else K(this,g).value="Invalid color format"},j=new WeakMap,T=new WeakMap,O=new WeakMap,N=new WeakMap,D=function(){var e,t;if(K(this,O).length)return;ne(this,H,F).call(this);const n=null!=(t=null!=(e=K(this,d).value)?e:K(this,W))?t:K(this,R);if(n&&K(this,C)){if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>ne(this,H,F).call(this));e.observe(n),e.observe(K(this,C)),e.observe(document.documentElement),K(this,O).push(()=>e.disconnect())}else{const e=()=>ne(this,H,F).call(this);window.addEventListener("resize",e),K(this,O).push(()=>window.removeEventListener("resize",e))}if(window.visualViewport){const e=()=>ne(this,H,F).call(this);window.visualViewport.addEventListener("resize",e),window.visualViewport.addEventListener("scroll",e),K(this,O).push(()=>{var t,n;null==(t=window.visualViewport)||t.removeEventListener("resize",e),null==(n=window.visualViewport)||n.removeEventListener("scroll",e)})}if(function(e){const t=[];let n=e.parentElement;for(;n&&n!==document.documentElement;){const e=getComputedStyle(n),r=e.overflowY,a=e.overflowX;"auto"!==r&&"scroll"!==r&&"auto"!==a&&"scroll"!==a||!(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)||t.push(n),n=n.parentElement}return document.scrollingElement&&t.push(document.scrollingElement),t}(n).forEach(e=>{const t=()=>ne(this,H,F).call(this);e.addEventListener("scroll",t,{passive:!0}),K(this,O).push(()=>e.removeEventListener("scroll",t))}),"undefined"!=typeof IntersectionObserver){const e=new IntersectionObserver(()=>ne(this,H,F).call(this),{threshold:0});e.observe(n),K(this,O).push(()=>e.disconnect())}}},G=function(){K(this,O).forEach(e=>e()),te(this,O,[]),null!==K(this,N)&&(cancelAnimationFrame(K(this,N)),te(this,N,null))},F=function(){null===K(this,N)&&te(this,N,requestAnimationFrame(()=>{te(this,N,null),ne(this,H,X).call(this)}))},X=function(){if(!K(this,C))return;const e=K(this,C),t=ne(this,H,Z).call(this),n=function(){if(Ir)return Ir;const e=document.createElement("div");e.style.position="fixed",e.style.left="-9999px",e.style.top="0",e.style.paddingTop="env(safe-area-inset-top)",e.style.paddingRight="env(safe-area-inset-right)",e.style.paddingBottom="env(safe-area-inset-bottom)",e.style.paddingLeft="env(safe-area-inset-left)",document.documentElement.appendChild(e);const t=getComputedStyle(e),n=parseFloat(t.paddingTop)||0,r=parseFloat(t.paddingRight)||0,a=parseFloat(t.paddingBottom)||0,o=parseFloat(t.paddingLeft)||0;return document.documentElement.removeChild(e),Ir={top:n,right:r,bottom:a,left:o},Ir}(),r=function(e){var t,n,r,a;const o=null!=(n=null==(t=window.visualViewport)?void 0:t.width)?n:window.innerWidth,i=null!=(a=null==(r=window.visualViewport)?void 0:r.height)?a:window.innerHeight,s=window.pageXOffset||document.documentElement.scrollLeft,l=window.pageYOffset||document.documentElement.scrollTop,c=e.left+8+s,h=e.top+8+l,u=o-e.right-8+s,p=i-e.bottom-8+l;return{left:c,top:h,right:u,bottom:p,width:u-c,height:p-h}}(n),a=ne(this,H,_).call(this,e),o=function(e,t){const{width:n,height:r}=t,a=[{placement:"bottom-center",left:e.left+e.width/2-n/2,top:e.bottom+8,right:0,bottom:0},{placement:"top-center",left:e.left+e.width/2-n/2,top:e.top-8-r,right:0,bottom:0},{placement:"right-start",left:e.right+8,top:e.top,right:0,bottom:0},{placement:"left-start",left:e.left-8-n,top:e.top,right:0,bottom:0},{placement:"bottom-left",left:e.left,top:e.bottom+8,right:0,bottom:0},{placement:"bottom-right",left:e.right-n,top:e.bottom+8,right:0,bottom:0},{placement:"top-left",left:e.left,top:e.top-8-r,right:0,bottom:0},{placement:"top-right",left:e.right-n,top:e.top-8-r,right:0,bottom:0}];return a.forEach(e=>{e.right=e.left+n,e.bottom=e.top+r}),a}(t,a),i=function(e,t,n){if(n){const r=e.find(e=>e.placement===n);if(r&&Wr(r,t))return r}for(const o of e)if(Wr(o,t))return o;let r=e[0],a=Hr(r,t);for(let o=1;o<e.length;o++){const n=Hr(e[o],t);n>a&&(a=n,r=e[o])}return r}(o,r,K(this,j));te(this,j,i.placement);const s=Math.round(Math.min(Math.max(i.left,r.left),r.right-a.width)),l=Math.round(Math.min(Math.max(i.top,r.top),r.bottom-a.height)),c=r.bottom-r.top;a.height>c?(e.style.maxHeight=`${c}px`,e.style.overflow="auto"):e.style.maxHeight&&(e.style.maxHeight="",e.style.overflow=""),e.style.position="absolute",e.style.left=`${s}px`,e.style.top=`${l}px`,e.style.setProperty("--ci-panel-placement",i.placement),e.dataset.placement=i.placement},Z=function(){var e,t,n,r,a,o,i;const s=null!=(n=null!=(t=null!=(e=K(this,d).value)?e:K(this,W))?t:K(this,R))?n:this,l=window.pageXOffset||document.documentElement.scrollLeft,c=window.pageYOffset||document.documentElement.scrollTop;if(!s.isConnected){const e=(null!=(a=null==(r=window.visualViewport)?void 0:r.width)?a:window.innerWidth)/2+l,t=(null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:window.innerHeight)/2+c;return{left:e,top:t,right:e,bottom:t,width:0,height:0}}const h=s.getBoundingClientRect();return{left:h.left+l,top:h.top+c,right:h.right+l,bottom:h.bottom+c,width:h.width,height:h.height}},_=function(e){var t;const n=e.getBoundingClientRect();if(n.width>0&&n.height>0)return te(this,T,{width:n.width,height:n.height}),K(this,T);const r={display:e.style.display,position:e.style.position,left:e.style.left,top:e.style.top,visibility:e.style.visibility,maxHeight:e.style.maxHeight};e.style.display="block",e.style.position="absolute",e.style.left="-99999px",e.style.top="0",e.style.visibility="hidden",e.style.maxHeight="none";const a=e.getBoundingClientRect();return e.style.display=r.display,e.style.position=r.position,e.style.left=r.left,e.style.top=r.top,e.style.visibility=r.visibility,e.style.maxHeight=r.maxHeight,a.width>0&&a.height>0?(te(this,T,{width:a.width,height:a.height}),K(this,T)):null!=(t=K(this,T))?t:{width:560,height:400}},Y=function(){var e,t,n,r,a,o,i,s,l,u,p,d,g,m,b,v;K(this,x)&&K(this,x).call(this);const y=K(this,h).value;if(!K(this,L))return;const w=Er(y,K(this,c).value).ch,M={};Object.keys(w).forEach(e=>{M[e]=de(String(w[e]))});const k=(e,t,n,r,a=1,o,i)=>{var s,l;const h="H"===t,u=["L","S","C","W","B","R","G","ALP"].includes(t),p="H"===t,d=document.createElement("div");d.className="control";const g=document.createElement("label");g.textContent=e;const f={L:"Lightness",C:"Chroma",H:"Hue",S:"Saturation",A:"A (green-red axis)",W:"Whiteness",R:"Red",G:"Green",ALP:"Alpha"};"B"===t?g.title="oklab"===y||"lab"===y?"B (blue-yellow axis)":"hwb"===y?"Blackness":"Blue":f[t]&&(g.title=f[t]);const m=document.createElement("input");if(m.type="range",m.min=String(n),m.max=String(r),m.step=String(a),m.classList.add(`ch-${t.toLowerCase()}`),o&&(m.style.backgroundImage=o),i&&(m.style.backgroundColor=i),m.value=String(null!=(s=w[t])?s:0),"ALP"===t){m.classList.add("alpha");try{const e=Ar(y,{...w,ALP:"0"}),t=Ar(y,{...w,ALP:"100"}),n="hsl"===y?"hsl":"lch"===y?"lch":"oklch"===y?"oklch":"oklab";m.style.background=`linear-gradient(to right in ${n}, ${e}, ${t}), var(--checker)`}catch{}}const b=document.createElement("input");b.type="number",b.min=String(n),b.max=String(r),b.step=String(a),b.classList.add(`ch-${t.toLowerCase()}`),b.value=String(null!=(l=w[t])?l:0);const v=document.createElement("div");if(v.className="num-wrapper",v.appendChild(b),u||p){const e=document.createElement("sup");e.textContent=p?"°":"%",v.appendChild(e)}const x=()=>{const e=Ar(y,w);K(this,c).value=e,this.setAttribute("value",e),ne(this,H,q).call(this)},k=e=>{const a=e.target;let o=Number(a.value);if(!Number.isFinite(o))return;o=h?(o%360+360)%360:Math.max(n,Math.min(r,o));const i=function(e,t,n){const r=(e,t=0)=>Number(e.toFixed(t));if("oklab"===e){if("L"===t)return String(r(n,0));if("A"===t||"B"===t)return String(r(n,2))}else if("oklch"===e){if("L"===t)return String(r(n,0));if("C"===t)return String(r(n,0));if("H"===t)return String(r(n,0))}else if("lab"===e){if("L"===t)return String(r(n,0));if("A"===t||"B"===t)return String(r(n,0))}else if("lch"===e){if("L"===t||"C"===t||"H"===t)return String(r(n,0))}else if("hsl"===e||"hwb"===e){if("H"===t)return String(r(n,0));if("S"===t||"L"===t||"W"===t||"B"===t)return String(r(n,0))}else if("srgb"===e||"hex"===e){if("R"===t||"G"===t||"B"===t)return String(r(n,0))}else if(["srgb-linear","display-p3","rec2020","a98-rgb","prophoto","xyz","xyz-d50","xyz-d65"].includes(e)&&("R"===t||"G"===t||"B"===t))return String(r(n,0));return String(r(n,"ALP"===t?0:2))}(y,t,o);w[t]=i,M[t].value=i,m.value=String(w[t]),b.value=String(w[t]),x()};return m.addEventListener("input",k),b.addEventListener("input",k),d.append(g,m,v),d};if(K(this,L).innerHTML="","oklab"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in oklab to right, black, white)"),k("A","A",-.5,.5,.01,"linear-gradient(to right in oklab, oklab(65% -.5 .5), oklab(65% .5 .5))"),k("B","B",-.5,.5,.01,"linear-gradient(to right in oklab, oklab(47% -.03 -.32), oklab(96% 0 .25))"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",n=M.A.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in oklab, oklab(${e}% ${n} ${r} / 0%), oklab(${e}% ${n} ${r} / 100%)), var(--checker)`)}))}else if("oklch"===y){const a=k("A","ALP",0,100,1);K(this,f).value&&(a.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in oklab to right, black, white)"),k("C","C",0,100,1,`linear-gradient(in oklch to right, oklch(${null!=(e=w.L)?e:0}% 1% ${null!=(t=w.H)?t:0}), oklch(${null!=(n=w.L)?n:0}% 100% ${null!=(r=w.H)?r:0}))`),k("H","H",0,359,1,"linear-gradient(to right in oklch longer hue, oklch(90% 75% 0), oklch(90% 75% 0))"),a);const o=K(this,L).querySelector('input[type="range"].ch-c'),i=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"0",t=M.C.value||"0",n=M.H.value||"0";o&&(o.style.backgroundImage=`linear-gradient(in oklch to right, oklch(${e}% 1% ${n}deg), oklch(${e}% 100% ${n}deg))`),i&&(i.style.background=`linear-gradient(to right in oklch, oklch(${e}% ${t}% ${n} / 0%), oklch(${e}% ${t}% ${n} / 100%)), var(--checker)`)}))}else if("lab"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in lab to right, black, white)"),k("A","A",-160,160,1,"linear-gradient(to right in oklab, lab(85% -100 100), lab(55% 100 100))"),k("B","B",-160,160,1,"linear-gradient(to right in oklab, lab(31% 70 -120), lab(96% 0 120))"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",n=M.A.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in lab, lab(${e}% ${n} ${r} / 0%), lab(${e}% ${n} ${r} / 100%)), var(--checker)`)}))}else if("lch"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("L","L",0,100,1,"linear-gradient(in lab to right, black, white)"),k("C","C",0,100,1,`linear-gradient(in lch to right, lch(${null!=(a=w.L)?a:0}% 1% ${null!=(o=w.H)?o:0}), lch(${null!=(i=w.L)?i:0}% 100% ${null!=(s=w.H)?s:0}))`),k("H","H",0,359,1,"linear-gradient(to right in lch longer hue, lch(90% 75% 0), lch(90% 75% 0))"),e);const t=K(this,L).querySelector('input[type="range"].ch-c'),n=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.L.value||"50",r=M.C.value||"0",a=M.H.value||"0";t&&(t.style.backgroundImage=`linear-gradient(in lch to right, lch(${e}% 1% ${a}), lch(${e}% 100% ${a}))`),n&&(n.style.background=`linear-gradient(to right in lch, lch(${e}% ${r}% ${a} / 0%), lch(${e}% ${r}% ${a} / 100%)), var(--checker)`)}))}else if("hsl"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("H","H",0,359,1,"linear-gradient(to right in hsl longer hue, hsl(0 100% 50%), hsl(360 100% 50%))"),k("S","S",0,100,1,`linear-gradient(in hsl to right, hsl(${null!=(l=w.H)?l:0} 0% ${null!=(u=w.L)?u:50}% / 100%), hsl(${null!=(p=w.H)?p:0} 100% ${null!=(d=w.L)?d:50}% / 100%))`),k("L","L",0,100,1,`linear-gradient(in oklab to right, hsl(${null!=(g=w.H)?g:0} ${null!=(m=w.S)?m:100}% 0%), hsl(${null!=(b=w.H)?b:0} ${null!=(v=w.S)?v:100}% 100%))`),e);const t=K(this,L).querySelector('input[type="range"].ch-s'),n=K(this,L).querySelector('input[type="range"].ch-l'),r=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.H.value||"0",a=M.S.value||"100",o=M.L.value||"50";t&&(t.style.backgroundImage=`linear-gradient(in hsl to right, hsl(${e} 0% ${o}% / 100%), hsl(${e} 100% ${o}% / 100%))`),n&&(n.style.backgroundImage=`linear-gradient(in oklab to right, hsl(${e} ${a}% 0%), hsl(${e} ${a}% 100%))`),r&&(r.style.background=`linear-gradient(to right in hsl, hsl(${e} ${a}% ${o}% / 0%), hsl(${e} ${a}% ${o}% / 100%)), var(--checker)`)}))}else if("hwb"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("H","H",0,359,1,"linear-gradient(to right in hsl longer hue, hsl(0 100% 50%), hsl(360 100% 50%))"),k("W","W",0,100,1,"linear-gradient(to right in oklab, #fff0, #fff)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #0000, #000)","white"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.H.value||"0",n=M.W.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in hwb, hwb(${e} ${n}% ${r}% / 0%), hwb(${e} ${n}% ${r}% / 100%)), var(--checker)`)}))}else if("srgb"===y||"hex"===y){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("R","R",0,100,1,"linear-gradient(to right in oklab, #f000, #f00)","black"),k("G","G",0,100,1,"linear-gradient(to right in oklab, #0f00, #0f0)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #00f0, #00f)","black"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.R.value||"0",n=M.G.value||"0",r=M.B.value||"0";t&&(t.style.background=`linear-gradient(to right in srgb, rgb(${e}% ${n}% ${r}% / 0%), rgb(${e}% ${n}% ${r}% / 100%)), var(--checker)`)}))}else if(Cr(y)){const e=k("A","ALP",0,100,1);K(this,f).value&&(e.style.display="none"),K(this,L).append(k("R","R",0,100,1,"linear-gradient(to right in oklab, #f000, #f00)","black"),k("G","G",0,100,1,"linear-gradient(to right in oklab, #0f00, #0f0)","black"),k("B","B",0,100,1,"linear-gradient(to right in oklab, #00f0, #00f)","black"),e);const t=K(this,L).querySelector('input[type="range"].ch-alp');te(this,x,ke(()=>{const e=M.R.value||"0",n=M.G.value||"0",r=M.B.value||"0";if(t){const a=Ar(y,{...w,R:e,G:n,B:r,ALP:"0"}),o=Ar(y,{...w,R:e,G:n,B:r,ALP:"100"});t.style.background=`linear-gradient(to right, ${a}, ${o}), var(--checker)`}}))}},customElements.define("color-input",Or),e.ColorInput=Or,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
3
3
  //# sourceMappingURL=color-input.min.js.map