@react-native/debugger-frontend
Version:
Debugger frontend for React Native based on Chrome DevTools
1 lines • 97.6 kB
JavaScript
import*as t from"../root/root.js";import*as e from"../platform/platform.js";export{UIString}from"../platform/platform.js";import*as r from"../i18n/i18n.js";var s=Object.freeze({__proto__:null});const n=[];var i=Object.freeze({__proto__:null,registerAppProvider:function(t){n.push(t)},getRegisteredAppProviders:function(){return n.filter((e=>t.Runtime.Runtime.isDescriptorEnabled({experiment:void 0,condition:e.condition}))).sort(((t,e)=>(t.order||0)-(e.order||0)))}});const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(123);for(let t=0;t<64;++t)o[a.charCodeAt(t)]=t;var l=Object.freeze({__proto__:null,BASE64_CHARS:a,BASE64_CODES:o,decode:function(t){let e=3*t.length/4>>>0;61===t.charCodeAt(t.length-2)?e-=2:61===t.charCodeAt(t.length-1)&&(e-=1);const r=new Uint8Array(e);for(let e=0,s=0;e<t.length;e+=4){const n=o[t.charCodeAt(e+0)],i=o[t.charCodeAt(e+1)],a=o[t.charCodeAt(e+2)],l=o[t.charCodeAt(e+3)];r[s++]=n<<2|i>>4,r[s++]=(15&i)<<4|a>>2,r[s++]=(3&a)<<6|63&l}return r.buffer},encode:function(t){return new Promise(((e,r)=>{const s=new FileReader;s.onerror=()=>r(new Error("failed to convert to base64")),s.onload=()=>{const t=s.result,[,r]=t.split(",",2);e(r)},s.readAsDataURL(new Blob([t]))}))}});var h=Object.freeze({__proto__:null,CharacterIdMap:class{#t;#e;#r;constructor(){this.#t=new Map,this.#e=new Map,this.#r=33}toChar(t){let e=this.#t.get(t);if(!e){if(this.#r>=65535)throw new Error("CharacterIdMap ran out of capacity!");e=String.fromCharCode(this.#r++),this.#t.set(t,e),this.#e.set(e,t)}return e}fromChar(t){const e=this.#e.get(t);return void 0===e?null:e}}});const c=.9642,u=.8251;class g{values=[0,0,0];constructor(t){t&&(this.values=t)}}class d{values=[[0,0,0],[0,0,0],[0,0,0]];constructor(t){t&&(this.values=t)}multiply(t){const e=new g;for(let r=0;r<3;++r)e.values[r]=this.values[r][0]*t.values[0]+this.values[r][1]*t.values[1]+this.values[r][2]*t.values[2];return e}}class p{g;a;b;c;d;e;f;constructor(t,e,r=0,s=0,n=0,i=0,a=0){this.g=t,this.a=e,this.b=r,this.c=s,this.d=n,this.e=i,this.f=a}eval(t){const e=t<0?-1:1,r=t*e;return r<this.d?e*(this.c*r+this.f):e*(Math.pow(this.a*r+this.b,this.g)+this.e)}}const m={sRGB:new p(2.4,1/1.055,.055/1.055,1/12.92,.04045,0,0),sRGB_INVERSE:new p(.416667,1.13728,-0,12.92,.0031308,-.0549698,-0),proPhotoRGB:new p(1.8,1),proPhotoRGB_INVERSE:new p(.555556,1,-0,0,0,0,0),k2Dot2:new p(2.2,1),k2Dot2_INVERSE:new p(.454545,1),rec2020:new p(2.22222,.909672,.0903276,.222222,.0812429,0,0),rec2020_INVERSE:new p(.45,1.23439,-0,4.5,.018054,-.0993195,-0)},y={sRGB:new d([[.436065674,.385147095,.143066406],[.222488403,.716873169,.06060791],[.013916016,.097076416,.714096069]]),sRGB_INVERSE:new d([[3.134112151374599,-1.6173924597114966,-.4906334036481285],[-.9787872938826594,1.9162795854799963,.0334547139520088],[.07198304248352326,-.2289858493321844,1.4053851325241447]]),displayP3:new d([[.515102,.291965,.157153],[.241182,.692236,.0665819],[-.00104941,.0418818,.784378]]),displayP3_INVERSE:new d([[2.404045155982687,-.9898986932663839,-.3976317191366333],[-.8422283799266768,1.7988505115115485,.016048170293157416],[.04818705979712955,-.09737385156228891,1.2735066448052303]]),adobeRGB:new d([[.60974,.20528,.14919],[.31111,.62567,.06322],[.01947,.06087,.74457]]),adobeRGB_INVERSE:new d([[1.9625385510109137,-.6106892546501431,-.3413827467482388],[-.9787580455521,1.9161624707082339,.03341676594241408],[.028696263137883395,-.1406807819331586,1.349252109991369]]),rec2020:new d([[.673459,.165661,.1251],[.279033,.675338,.0456288],[-.00193139,.0299794,.797162]]),rec2020_INVERSE:new d([[1.647275201661012,-.3936024771460771,-.23598028884792507],[-.6826176165196962,1.647617775014935,.01281626807852422],[.029662725298529837,-.06291668721366285,1.2533964313435522]]),xyz:new d([[1,0,0],[0,1,0],[0,0,1]])};function f(t){return t*(Math.PI/180)}function b(t,e,r,s){return[t.eval(e),t.eval(r),t.eval(s)]}const w=new d([[.9999999984505198,.39633779217376786,.2158037580607588],[1.0000000088817609,-.10556134232365635,-.06385417477170591],[1.0000000546724108,-.08948418209496575,-1.2914855378640917]]),S=new d([[.2104542553,.7936177849999999,-.0040720468],[1.9779984951000003,-2.4285922049999997,.4505937099000001],[.025904037099999982,.7827717662,-.8086757660000001]]),x=new d([[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]]),v=new d([[1.226879873374156,-.5578149965554814,.2813910501772159],[-.040575762624313734,1.1122868293970596,-.07171106666151703],[-.07637294974672144,-.4214933239627915,1.586924024427242]]),T=new d([[.7976700747153241,.13519395152800417,.03135596341127167],[.28803902352472205,.7118744007923554,8661179538844252e-20],[2.739876695467402e-7,-14405226518969991e-22,.825211112593861]]),z=new d([[1.3459533710138858,-.25561367037652133,-.051116041522131374],[-.544600415668951,1.5081687311475767,.020535163968720935],[-13975622054109725e-22,2717590904589903e-21,1.2118111696814942]]),R=new d([[1.0478573189120088,.022907374491829943,-.050162247377152525],[.029570500050499514,.9904755577034089,-.017061518194840468],[-.00924047197558879,.015052921526981566,.7519708530777581]]),I=new d([[.9555366447632887,-.02306009252137888,.06321844147263304],[-.028315378228764922,1.009951351591575,.021026001591792402],[.012308773293784308,-.02050053471777469,1.3301947294775631]]),P=new d([[3.2408089365140573,-1.5375788839307314,-.4985609572551541],[-.9692732213205414,1.876110235238969,.041560501141251774],[.05567030990267439,-.2040007921971802,1.0571046720577026]]);class A{static labToXyzd50(t,e,r){let s=(t+16)/116,n=s+e/500,i=s-r/200;function a(t){return t<=24/116?108/841*(t-16/116):t*t*t}return n=a(n)*c,s=1*a(s),i=a(i)*u,[n,s,i]}static xyzd50ToLab(t,e,r){function s(t){return t<=.008856451679035631?841/108*t+16/116:Math.pow(t,1/3)}t=s(t/c);return[116*(e=s(e/1))-16,500*(t-e),200*(e-(r=s(r/u)))]}static oklabToXyzd65(t,e,r){const s=new g([t,e,r]),n=w.multiply(s);n.values[0]=n.values[0]*n.values[0]*n.values[0],n.values[1]=n.values[1]*n.values[1]*n.values[1],n.values[2]=n.values[2]*n.values[2]*n.values[2];return v.multiply(n).values}static xyzd65ToOklab(t,e,r){const s=new g([t,e,r]),n=x.multiply(s);n.values[0]=Math.pow(n.values[0],1/3),n.values[1]=Math.pow(n.values[1],1/3),n.values[2]=Math.pow(n.values[2],1/3);const i=S.multiply(n);return[i.values[0],i.values[1],i.values[2]]}static lchToLab(t,e,r){return void 0===r?[t,0,0]:[t,e*Math.cos(f(r)),e*Math.sin(f(r))]}static labToLch(t,e,r){return[t,Math.sqrt(e*e+r*r),(s=Math.atan2(r,e),s*(180/Math.PI))];var s}static displayP3ToXyzd50(t,e,r){const[s,n,i]=b(m.sRGB,t,e,r),a=new g([s,n,i]);return y.displayP3.multiply(a).values}static xyzd50ToDisplayP3(t,e,r){const s=new g([t,e,r]),n=y.displayP3_INVERSE.multiply(s);return b(m.sRGB_INVERSE,n.values[0],n.values[1],n.values[2])}static proPhotoToXyzd50(t,e,r){const[s,n,i]=b(m.proPhotoRGB,t,e,r),a=new g([s,n,i]);return T.multiply(a).values}static xyzd50ToProPhoto(t,e,r){const s=new g([t,e,r]),n=z.multiply(s);return b(m.proPhotoRGB_INVERSE,n.values[0],n.values[1],n.values[2])}static adobeRGBToXyzd50(t,e,r){const[s,n,i]=b(m.k2Dot2,t,e,r),a=new g([s,n,i]);return y.adobeRGB.multiply(a).values}static xyzd50ToAdobeRGB(t,e,r){const s=new g([t,e,r]),n=y.adobeRGB_INVERSE.multiply(s);return b(m.k2Dot2_INVERSE,n.values[0],n.values[1],n.values[2])}static rec2020ToXyzd50(t,e,r){const[s,n,i]=b(m.rec2020,t,e,r),a=new g([s,n,i]);return y.rec2020.multiply(a).values}static xyzd50ToRec2020(t,e,r){const s=new g([t,e,r]),n=y.rec2020_INVERSE.multiply(s);return b(m.rec2020_INVERSE,n.values[0],n.values[1],n.values[2])}static xyzd50ToD65(t,e,r){const s=new g([t,e,r]);return I.multiply(s).values}static xyzd65ToD50(t,e,r){const s=new g([t,e,r]);return R.multiply(s).values}static xyzd65TosRGBLinear(t,e,r){const s=new g([t,e,r]);return P.multiply(s).values}static xyzd50TosRGBLinear(t,e,r){const s=new g([t,e,r]);return y.sRGB_INVERSE.multiply(s).values}static srgbLinearToXyzd50(t,e,r){const s=new g([t,e,r]);return y.sRGB.multiply(s).values}static srgbToXyzd50(t,e,r){const[s,n,i]=b(m.sRGB,t,e,r),a=new g([s,n,i]);return y.sRGB.multiply(a).values}static xyzd50ToSrgb(t,e,r){const s=new g([t,e,r]),n=y.sRGB_INVERSE.multiply(s);return b(m.sRGB_INVERSE,n.values[0],n.values[1],n.values[2])}static oklchToXyzd50(t,e,r){const[s,n,i]=A.lchToLab(t,e,r),[a,o,l]=A.oklabToXyzd65(s,n,i);return A.xyzd65ToD50(a,o,l)}static xyzd50ToOklch(t,e,r){const[s,n,i]=A.xyzd50ToD65(t,e,r),[a,o,l]=A.xyzd65ToOklab(s,n,i);return A.labToLch(a,o,l)}}var E=Object.freeze({__proto__:null,ColorConverter:A});function k(t,e){const r=t[3];return[(1-r)*e[0]+r*t[0],(1-r)*e[1]+r*t[1],(1-r)*e[2]+r*t[2],r+e[3]*(1-r)]}function C([t,e,r]){const s=Math.max(t,e,r),n=Math.min(t,e,r),i=s-n;let a;return a=n===s?0:t===s?(1/6*(e-r)/i+1)%1:e===s?1/6*(r-t)/i+1/3:1/6*(t-e)/i+2/3,a}function L(t){const[e,r,s]=_([...t,void 0]);return[e,r,s]}function _([t,e,r,s]){const n=Math.max(t,e,r),i=Math.min(t,e,r),a=n-i,o=n+i,l=.5*o;let h;return h=0===l||1===l?0:l<=.5?a/o:a/(2-o),[C([t,e,r]),h,l,s]}function O(t){const[e,r,s]=B([...t,void 0]);return[e,r,s]}function B([t,e,r,s]){const n=C([t,e,r]),i=Math.max(t,e,r);return[n,Math.min(t,e,r),1-i,s]}function N([t,e,r]){return.2126*(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4))}const V=2.4,G=.56,M=.57,W=.65,X=.62,F=.022,D=1.414,U=1.14,j=1.14,$=.027,H=.1,q=5e-4;function Z([t,e,r]){return.2126729*Math.pow(t,V)+.7151522*Math.pow(e,V)+.072175*Math.pow(r,V)}function Y(t,e){return J(Z(k(t,e)),Z(e))}function K(t){return t>F?t:t+Math.pow(F-t,D)}function J(t,e){if(t=K(t),e=K(e),Math.abs(t-e)<q)return 0;let r=0;return e>t?(r=(Math.pow(e,G)-Math.pow(t,M))*U,r=r<H?0:r-$):(r=(Math.pow(e,W)-Math.pow(t,X))*j,r=r>-H?0:r+$),100*r}function Q(t,e,r){function s(){return r?Math.pow(Math.abs(Math.pow(t,W)-(-e-$)/j),1/X):Math.pow(Math.abs(Math.pow(t,G)-(e+$)/U),1/M)}t=K(t),e/=100;let n=s();return(n<0||n>1)&&(r=!r,n=s()),n}const tt=[[12,-1,-1,-1,-1,100,90,80,-1,-1],[14,-1,-1,-1,100,90,80,60,60,-1],[16,-1,-1,100,90,80,60,55,50,50],[18,-1,-1,90,80,60,55,50,40,40],[24,-1,100,80,60,55,50,40,38,35],[30,-1,90,70,55,50,40,38,35,40],[36,-1,80,60,50,40,38,35,30,25],[48,100,70,55,40,38,35,30,25,20],[60,90,60,50,38,35,30,25,20,20],[72,80,55,40,35,30,25,20,20,20],[96,70,50,35,30,25,20,20,20,20],[120,60,40,30,25,20,20,20,20,20]];function et(t,e){const r=72*parseFloat(t.replace("px",""))/96;return(isNaN(Number(e))?["bold","bolder"].includes(e):Number(e)>=600)?r>=14:r>=18}tt.reverse();const rt={aa:3,aaa:4.5},st={aa:4.5,aaa:7};var nt=Object.freeze({__proto__:null,blendColors:k,rgbToHsl:L,rgbaToHsla:_,rgbToHwb:O,rgbaToHwba:B,luminance:N,contrastRatio:function(t,e){const r=N(k(t,e)),s=N(e);return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)},luminanceAPCA:Z,contrastRatioAPCA:Y,contrastRatioByLuminanceAPCA:J,desiredLuminanceAPCA:Q,getAPCAThreshold:function(t,e){const r=parseFloat(t.replace("px","")),s=parseFloat(e);for(const[t,...e]of tt)if(r>=t)for(const[t,r]of[900,800,700,600,500,400,300,200,100].entries())if(s>=r){const r=e[e.length-1-t];return-1===r?null:r}return null},isLargeFont:et,getContrastThreshold:function(t,e){return et(t,e)?rt:st}});function it(t){return(t%360+360)%360}function at(t){const e=t.replace(/(deg|g?rad|turn)$/,"");if(isNaN(e)||t.match(/\s+(deg|g?rad|turn)/))return null;const r=parseFloat(e);return t.includes("turn")?360*r:t.includes("grad")?9*r/10:t.includes("rad")?180*r/Math.PI:r}function ot(t){switch(t){case"srgb":return"srgb";case"srgb-linear":return"srgb-linear";case"display-p3":return"display-p3";case"a98-rgb":return"a98-rgb";case"prophoto-rgb":return"prophoto-rgb";case"rec2020":return"rec2020";case"xyz":return"xyz";case"xyz-d50":return"xyz-d50";case"xyz-d65":return"xyz-d65"}return null}function lt(t,e){const r=Math.sign(t),s=Math.abs(t),[n,i]=e;return r*(s*(i-n)/100+n)}function ht(t,{min:e,max:r}){return null===t||(void 0!==e&&(t=Math.max(t,e)),void 0!==r&&(t=Math.min(t,r))),t}function ct(t,e){if(!t.endsWith("%"))return null;const r=parseFloat(t.substr(0,t.length-1));return isNaN(r)?null:lt(r,e)}function ut(t){const e=parseFloat(t);return isNaN(e)?null:e}function gt(t){return void 0===t?null:ht(ct(t,[0,1])??ut(t),{min:0,max:1})}function dt(t,e=[0,1]){if(isNaN(t.replace("%","")))return null;const r=parseFloat(t);return-1!==t.indexOf("%")?t.indexOf("%")!==t.length-1?null:lt(r,e):r}function pt(t){const e=dt(t);return null===e?null:-1!==t.indexOf("%")?e:e/255}function mt(t){const e=t.replace(/(deg|g?rad|turn)$/,"");if(isNaN(e)||t.match(/\s+(deg|g?rad|turn)/))return null;const r=parseFloat(e);return-1!==t.indexOf("turn")?r%1:-1!==t.indexOf("grad")?r/400%1:-1!==t.indexOf("rad")?r/(2*Math.PI)%1:r/360%1}function yt(t){if(t.indexOf("%")!==t.length-1||isNaN(t.replace("%","")))return null;return parseFloat(t)/100}function ft(t){const e=t[0];let r=t[1];const s=t[2];function n(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}let i;r<0&&(r=0),i=s<=.5?s*(1+r):s+r-s*r;const a=2*s-i,o=e,l=e-1/3;return[n(a,i,e+1/3),n(a,i,o),n(a,i,l),t[3]]}function bt(t){return ft(function(t){const e=t[0];let r=t[1];const s=t[2],n=(2-r)*s;return 0===s||0===r?r=0:r*=s/(n<1?n:2-n),[e,r,n/2,t[3]]}(t))}function wt(t,e,r){function s(){return r?(t+.05)*e-.05:(t+.05)/e-.05}let n=s();return(n<0||n>1)&&(r=!r,n=s()),n}function St(t,e,r,s,n){let i=t[r],a=1,o=n(t)-s,l=Math.sign(o);for(let e=100;e;e--){if(Math.abs(o)<2e-4)return t[r]=i,i;const e=Math.sign(o);if(e!==l)a/=2,l=e;else if(i<0||i>1)return null;i+=a*(2===r?-o:o),t[r]=i,o=n(t)-s}return null}function xt(t,e,r=.01){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(const r in t)if(!xt(t[r],e[r]))return!1;return!0}return!Array.isArray(t)&&!Array.isArray(e)&&(null===t||null===e?t===e:Math.abs(t-e)<r)}function vt(t,e,r=.01){return t-e<=r}class Tt{l;a;b;alpha;#s;#n;static#i={hex:t=>new Ot(t.#a(!1),"hex"),hexa:t=>new Ot(t.#a(!0),"hexa"),rgb:t=>new Ot(t.#a(!1),"rgb"),rgba:t=>new Ot(t.#a(!0),"rgba"),hsl:t=>new At(...L(t.#a(!1)),t.alpha),hsla:t=>new At(...L(t.#a(!1)),t.alpha),hwb:t=>new Et(...O(t.#a(!1)),t.alpha),hwba:t=>new Et(...O(t.#a(!1)),t.alpha),lch:t=>new zt(...A.labToLch(t.l,t.a,t.b),t.alpha),oklch:t=>new It(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>t,oklab:t=>new Rt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new Pt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new Pt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new Pt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new Pt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new Pt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new Pt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new Pt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new Pt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new Pt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.labToXyzd50(this.l,this.a,this.b)}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=ht(t,{min:0,max:100}),(xt(this.l,0,1)||xt(this.l,100,1))&&(e=r=0),this.a=e,this.b=r,this.alpha=ht(s,{min:0,max:1}),this.#s=n}is(t){return t===this.format()}as(t){return Tt.#i[t](this)}asLegacyColor(){return this.as("rgba")}equal(t){const e=t.as("lab");return xt(e.l,this.l,1)&&xt(e.a,this.a)&&xt(e.b,this.b)&&xt(e.alpha,this.alpha)}format(){return"lab"}setAlpha(t){return new Tt(this.l,this.a,this.b,t,void 0)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.a,this.b)}#l(t,r,s){const n=null===this.alpha||xt(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`lab(${e.StringUtilities.stringifyWithPrecision(t,0)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=ct(t[0],[0,100])??ut(t[0]);if(null===r)return null;const s=ct(t[1],[0,125])??ut(t[1]);if(null===s)return null;const n=ct(t[2],[0,125])??ut(t[2]);if(null===n)return null;const i=gt(t[3]);return new Tt(r,s,n,i,e)}}class zt{#n;l;c;h;alpha;#s;static#i={hex:t=>new Ot(t.#a(!1),"hex"),hexa:t=>new Ot(t.#a(!0),"hexa"),rgb:t=>new Ot(t.#a(!1),"rgb"),rgba:t=>new Ot(t.#a(!0),"rgba"),hsl:t=>new At(...L(t.#a(!1)),t.alpha),hsla:t=>new At(...L(t.#a(!1)),t.alpha),hwb:t=>new Et(...O(t.#a(!1)),t.alpha),hwba:t=>new Et(...O(t.#a(!1)),t.alpha),lch:t=>t,oklch:t=>new It(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new Tt(...A.lchToLab(t.l,t.c,t.h),t.alpha),oklab:t=>new Rt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new Pt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new Pt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new Pt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new Pt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new Pt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new Pt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new Pt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new Pt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new Pt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.labToXyzd50(...A.lchToLab(this.l,this.c,this.h))}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=ht(t,{min:0,max:100}),e=xt(this.l,0,1)||xt(this.l,100,1)?0:e,this.c=ht(e,{min:0}),r=xt(e,0)?0:r,this.h=it(r),this.alpha=ht(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return zt.#i[t](this)}equal(t){const e=t.as("lch");return xt(e.l,this.l,1)&&xt(e.c,this.c)&&xt(e.h,this.h)&&xt(e.alpha,this.alpha)}format(){return"lch"}setAlpha(t){return new zt(this.l,this.c,this.h,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.c,this.h)}#l(t,r,s){const n=null===this.alpha||xt(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`lch(${e.StringUtilities.stringifyWithPrecision(t,0)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}isHuePowerless(){return xt(this.c,0)}static fromSpec(t,e){const r=ct(t[0],[0,100])??ut(t[0]);if(null===r)return null;const s=ct(t[1],[0,150])??ut(t[1]);if(null===s)return null;const n=at(t[2]);if(null===n)return null;const i=gt(t[3]);return new zt(r,s,n,i,e)}}class Rt{#n;l;a;b;alpha;#s;static#i={hex:t=>new Ot(t.#a(!1),"hex"),hexa:t=>new Ot(t.#a(!0),"hexa"),rgb:t=>new Ot(t.#a(!1),"rgb"),rgba:t=>new Ot(t.#a(!0),"rgba"),hsl:t=>new At(...L(t.#a(!1)),t.alpha),hsla:t=>new At(...L(t.#a(!1)),t.alpha),hwb:t=>new Et(...O(t.#a(!1)),t.alpha),hwba:t=>new Et(...O(t.#a(!1)),t.alpha),lch:t=>new zt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new It(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new Tt(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>t,srgb:t=>new Pt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new Pt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new Pt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new Pt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new Pt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new Pt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new Pt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new Pt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new Pt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.xyzd65ToD50(...A.oklabToXyzd65(this.l,this.a,this.b))}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=ht(t,{min:0,max:1}),(xt(this.l,0)||xt(this.l,1))&&(e=r=0),this.a=e,this.b=r,this.alpha=ht(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return Rt.#i[t](this)}equal(t){const e=t.as("oklab");return xt(e.l,this.l)&&xt(e.a,this.a)&&xt(e.b,this.b)&&xt(e.alpha,this.alpha)}format(){return"oklab"}setAlpha(t){return new Rt(this.l,this.a,this.b,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.a,this.b)}#l(t,r,s){const n=null===this.alpha||xt(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`oklab(${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=ct(t[0],[0,1])??ut(t[0]);if(null===r)return null;const s=ct(t[1],[0,.4])??ut(t[1]);if(null===s)return null;const n=ct(t[2],[0,.4])??ut(t[2]);if(null===n)return null;const i=gt(t[3]);return new Rt(r,s,n,i,e)}}class It{#n;l;c;h;alpha;#s;static#i={hex:t=>new Ot(t.#a(!1),"hex"),hexa:t=>new Ot(t.#a(!0),"hexa"),rgb:t=>new Ot(t.#a(!1),"rgb"),rgba:t=>new Ot(t.#a(!0),"rgba"),hsl:t=>new At(...L(t.#a(!1)),t.alpha),hsla:t=>new At(...L(t.#a(!1)),t.alpha),hwb:t=>new Et(...O(t.#a(!1)),t.alpha),hwba:t=>new Et(...O(t.#a(!1)),t.alpha),lch:t=>new zt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>t,lab:t=>new Tt(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new Rt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new Pt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new Pt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new Pt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new Pt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new Pt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new Pt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new Pt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new Pt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new Pt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.oklchToXyzd50(this.l,this.c,this.h)}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=ht(t,{min:0,max:1}),e=xt(this.l,0)||xt(this.l,1)?0:e,this.c=ht(e,{min:0}),r=xt(e,0)?0:r,this.h=it(r),this.alpha=ht(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return It.#i[t](this)}equal(t){const e=t.as("oklch");return xt(e.l,this.l)&&xt(e.c,this.c)&&xt(e.h,this.h)&&xt(e.alpha,this.alpha)}format(){return"oklch"}setAlpha(t){return new It(this.l,this.c,this.h,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.c,this.h)}#l(t,r,s){const n=null===this.alpha||xt(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`oklch(${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=ct(t[0],[0,1])??ut(t[0]);if(null===r)return null;const s=ct(t[1],[0,.4])??ut(t[1]);if(null===s)return null;const n=at(t[2]);if(null===n)return null;const i=gt(t[3]);return new It(r,s,n,i,e)}}class Pt{#n;p0;p1;p2;alpha;colorSpace;#s;static#i={hex:t=>new Ot(t.#a(!1),"hex"),hexa:t=>new Ot(t.#a(!0),"hexa"),rgb:t=>new Ot(t.#a(!1),"rgb"),rgba:t=>new Ot(t.#a(!0),"rgba"),hsl:t=>new At(...L(t.#a(!1)),t.alpha),hsla:t=>new At(...L(t.#a(!1)),t.alpha),hwb:t=>new Et(...O(t.#a(!1)),t.alpha),hwba:t=>new Et(...O(t.#a(!1)),t.alpha),lch:t=>new zt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new It(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new Tt(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new Rt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new Pt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new Pt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new Pt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new Pt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new Pt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new Pt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new Pt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new Pt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new Pt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){const[t,e,r]=this.#n;switch(this.colorSpace){case"srgb":return A.srgbToXyzd50(t,e,r);case"srgb-linear":return A.srgbLinearToXyzd50(t,e,r);case"display-p3":return A.displayP3ToXyzd50(t,e,r);case"a98-rgb":return A.adobeRGBToXyzd50(t,e,r);case"prophoto-rgb":return A.proPhotoToXyzd50(t,e,r);case"rec2020":return A.rec2020ToXyzd50(t,e,r);case"xyz-d50":return[t,e,r];case"xyz":case"xyz-d65":return A.xyzd65ToD50(t,e,r)}throw new Error("Invalid color space")}#a(t=!0){const[e,r,s]=this.#n,n="srgb"===this.colorSpace?[e,r,s]:[...A.xyzd50ToSrgb(...this.#o())];return t?[...n,this.alpha??void 0]:n}constructor(t,e,r,s,n,i){this.#n=[e,r,s],this.colorSpace=t,this.#s=i,"xyz-d50"!==this.colorSpace&&"xyz-d65"!==this.colorSpace&&"xyz"!==this.colorSpace&&(e=ht(e,{min:0,max:1}),r=ht(r,{min:0,max:1}),s=ht(s,{min:0,max:1})),this.p0=e,this.p1=r,this.p2=s,this.alpha=ht(n,{min:0,max:1})}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return this.colorSpace===t?this:Pt.#i[t](this)}equal(t){const e=t.as(this.colorSpace);return xt(this.p0,e.p0)&&xt(this.p1,e.p1)&&xt(this.p2,e.p2)&&xt(this.alpha,e.alpha)}format(){return this.colorSpace}setAlpha(t){return new Pt(this.colorSpace,this.p0,this.p1,this.p2,t)}asString(t){return t?this.as(t).asString():this.#l(this.p0,this.p1,this.p2)}#l(t,r,s){const n=null===this.alpha||xt(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`color(${this.colorSpace} ${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return"xyz-d50"!==this.colorSpace&&"xyz-d65"!==this.colorSpace&&"xyz"!==this.colorSpace&&!xt(this.#n,[this.p0,this.p1,this.p2])}static fromSpec(t,e){const[r,s]=e.split("/",2),n=r.trim().split(/\s+/),[i,...a]=n,o=ot(i);if(!o)return null;if(0===a.length&&void 0===s)return new Pt(o,0,0,0,null,t);if(0===a.length&&void 0!==s&&s.trim().split(/\s+/).length>1)return null;if(a.length>3)return null;const l=a.map((t=>"none"===t?"0":t)).map((t=>dt(t,[0,1])));if(l.includes(null))return null;const h=s?dt(s,[0,1])??1:1,c=[l[0]??0,l[1]??0,l[2]??0,h];return new Pt(o,...c,t)}}class At{h;s;l;alpha;#n;#s;static#i={hex:t=>new Ot(t.#a(!1),"hex"),hexa:t=>new Ot(t.#a(!0),"hexa"),rgb:t=>new Ot(t.#a(!1),"rgb"),rgba:t=>new Ot(t.#a(!0),"rgba"),hsl:t=>t,hsla:t=>t,hwb:t=>new Et(...O(t.#a(!1)),t.alpha),hwba:t=>new Et(...O(t.#a(!1)),t.alpha),lch:t=>new zt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new It(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new Tt(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new Rt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new Pt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new Pt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new Pt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new Pt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new Pt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new Pt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new Pt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new Pt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new Pt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#a(t=!0){const e=ft([this.h,this.s,this.l,0]);return t?[e[0],e[1],e[2],this.alpha??void 0]:[e[0],e[1],e[2]]}#o(){const t=this.#a(!1);return A.srgbToXyzd50(t[0],t[1],t[2])}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=ht(r,{min:0,max:1}),e=xt(this.l,0)||xt(this.l,1)?0:e,this.s=ht(e,{min:0,max:1}),t=xt(this.s,0)?0:t,this.h=it(360*t)/360,this.alpha=ht(s??null,{min:0,max:1}),this.#s=n}equal(t){const e=t.as("hsl");return xt(this.h,e.h)&&xt(this.s,e.s)&&xt(this.l,e.l)&&xt(this.alpha,e.alpha)}asString(t){return t?this.as(t).asString():this.#l(this.h,this.s,this.l)}#l(t,r,s){const n=e.StringUtilities.sprintf("hsl(%sdeg %s% %s%",e.StringUtilities.stringifyWithPrecision(360*t),e.StringUtilities.stringifyWithPrecision(100*r),e.StringUtilities.stringifyWithPrecision(100*s));return null!==this.alpha&&1!==this.alpha?n+e.StringUtilities.sprintf(" / %s%)",e.StringUtilities.stringifyWithPrecision(100*this.alpha)):n+")"}setAlpha(t){return new At(this.h,this.s,this.l,t)}format(){return null===this.alpha||1===this.alpha?"hsl":"hsla"}is(t){return t===this.format()}as(t){return t===this.format()?this:At.#i[t](this)}asLegacyColor(){return this.as("rgba")}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!vt(this.#n[1],1)||!vt(0,this.#n[1])}static fromSpec(t,e){const r=mt(t[0]);if(null===r)return null;const s=yt(t[1]);if(null===s)return null;const n=yt(t[2]);if(null===n)return null;const i=gt(t[3]);return new At(r,s,n,i,e)}hsva(){const t=this.s*(this.l<.5?this.l:1-this.l);return[this.h,0!==t?2*t/(this.l+t):0,this.l+t,this.alpha??1]}canonicalHSLA(){return[Math.round(360*this.h),Math.round(100*this.s),Math.round(100*this.l),this.alpha??1]}}class Et{h;w;b;alpha;#n;#s;static#i={hex:t=>new Ot(t.#a(!1),"hex"),hexa:t=>new Ot(t.#a(!0),"hexa"),rgb:t=>new Ot(t.#a(!1),"rgb"),rgba:t=>new Ot(t.#a(!0),"rgba"),hsl:t=>new At(...L(t.#a(!1)),t.alpha),hsla:t=>new At(...L(t.#a(!1)),t.alpha),hwb:t=>t,hwba:t=>t,lch:t=>new zt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new It(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new Tt(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new Rt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new Pt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new Pt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new Pt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new Pt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new Pt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new Pt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new Pt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new Pt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new Pt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#a(t=!0){const e=function(t){const e=t[0],r=t[1],s=t[2],n=r/(r+s);let i=[n,n,n,t[3]];if(r+s<1){i=ft([e,1,.5,t[3]]);for(let t=0;t<3;++t)i[t]+=r-(r+s)*i[t]}return i}([this.h,this.w,this.b,0]);return t?[e[0],e[1],e[2],this.alpha??void 0]:[e[0],e[1],e[2]]}#o(){const t=this.#a(!1);return A.srgbToXyzd50(t[0],t[1],t[2])}constructor(t,e,r,s,n){if(this.#n=[t,e,r],this.w=ht(e,{min:0,max:1}),this.b=ht(r,{min:0,max:1}),t=vt(1,this.w+this.b)?0:t,this.h=it(360*t)/360,this.alpha=ht(s,{min:0,max:1}),vt(1,this.w+this.b)){const t=this.w/this.b;this.b=1/(1+t),this.w=1-this.b}this.#s=n}equal(t){const e=t.as("hwb");return xt(this.h,e.h)&&xt(this.w,e.w)&&xt(this.b,e.b)&&xt(this.alpha,e.alpha)}asString(t){return t?this.as(t).asString():this.#l(this.h,this.w,this.b)}#l(t,r,s){const n=e.StringUtilities.sprintf("hwb(%sdeg %s% %s%",e.StringUtilities.stringifyWithPrecision(360*t),e.StringUtilities.stringifyWithPrecision(100*r),e.StringUtilities.stringifyWithPrecision(100*s));return null!==this.alpha&&1!==this.alpha?n+e.StringUtilities.sprintf(" / %s%)",e.StringUtilities.stringifyWithPrecision(100*this.alpha)):n+")"}setAlpha(t){return new Et(this.h,this.w,this.b,t,this.#s)}format(){return null===this.alpha||xt(this.alpha,1)?"hwb":"hwba"}is(t){return t===this.format()}as(t){return t===this.format()?this:Et.#i[t](this)}asLegacyColor(){return this.as("rgba")}getAuthoredText(){return this.#s??null}canonicalHWBA(){return[Math.round(360*this.h),Math.round(100*this.w),Math.round(100*this.b),this.alpha??1]}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!(vt(this.#n[1],1)&&vt(0,this.#n[1])&&vt(this.#n[2],1)&&vt(0,this.#n[2]))}static fromSpec(t,e){const r=mt(t[0]);if(null===r)return null;const s=yt(t[1]);if(null===s)return null;const n=yt(t[2]);if(null===n)return null;const i=gt(t[3]);return new Et(r,s,n,i,e)}}function kt(t){return Math.round(255*t)}class Ct{color;constructor(t){this.color=t}get alpha(){return this.color.alpha}equal(t){return this.color.equal(t)}setAlpha(t){return this.color.setAlpha(t)}format(){return 1!==(this.alpha??1)?"hexa":"hex"}as(t){return this.color.as(t)}is(t){return this.color.is(t)}asLegacyColor(){return this.color.asLegacyColor()}getAuthoredText(){return this.color.getAuthoredText()}getRawParameters(){return this.color.getRawParameters()}isGamutClipped(){return this.color.isGamutClipped()}asString(t){if(t)return this.as(t).asString();const[e,r,s]=this.color.rgba();return this.stringify(e,r,s)}getAsRawString(t){if(t)return this.as(t).getAsRawString();const[e,r,s]=this.getRawParameters();return this.stringify(e,r,s)}}class Lt extends Ct{setAlpha(t){return new Lt(this.color.setAlpha(t))}asString(t){return t&&t!==this.format()?super.as(t).asString():super.asString()}stringify(t,r,s){function n(t){return(Math.round(255*t)/17).toString(16)}return this.color.hasAlpha()?e.StringUtilities.sprintf("#%s%s%s%s",n(t),n(r),n(s),n(this.alpha??1)).toLowerCase():e.StringUtilities.sprintf("#%s%s%s",n(t),n(r),n(s)).toLowerCase()}}class _t extends Ct{nickname;constructor(t,e){super(e),this.nickname=t}static fromName(t,e){const r=t.toLowerCase(),s=Nt.get(r);return void 0!==s?new _t(r,Ot.fromRGBA(s,e)):null}stringify(){return this.nickname}getAsRawString(t){return this.color.getAsRawString(t)}}class Ot{#n;#h;#s;#c;static#i={hex:t=>new Ot(t.#h,"hex"),hexa:t=>new Ot(t.#h,"hexa"),rgb:t=>new Ot(t.#h,"rgb"),rgba:t=>new Ot(t.#h,"rgba"),hsl:t=>new At(...L([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hsla:t=>new At(...L([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hwb:t=>new Et(...O([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hwba:t=>new Et(...O([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),lch:t=>new zt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new It(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new Tt(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new Rt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new Pt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new Pt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new Pt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new Pt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new Pt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new Pt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new Pt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new Pt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new Pt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){const[t,e,r]=this.#h;return A.srgbToXyzd50(t,e,r)}get alpha(){switch(this.format()){case"hexa":case"rgba":return this.#h[3];default:return null}}asLegacyColor(){return this}nickname(){const t=Vt.get(String(this.canonicalRGBA()));return t?new _t(t,this):null}shortHex(){for(let t=0;t<4;++t){if(Math.round(255*this.#h[t])%17)return null}return new Lt(this)}constructor(t,e,r){this.#s=r||null,this.#c=e,this.#n=[t[0],t[1],t[2]],this.#h=[ht(t[0],{min:0,max:1}),ht(t[1],{min:0,max:1}),ht(t[2],{min:0,max:1}),ht(t[3]??1,{min:0,max:1})]}static fromHex(t,e){const r=4===(t=t.toLowerCase()).length||8===t.length?"hexa":"hex",s=t.length<=4;s&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3));const n=parseInt(t.substring(0,2),16),i=parseInt(t.substring(2,4),16),a=parseInt(t.substring(4,6),16);let o=1;8===t.length&&(o=parseInt(t.substring(6,8),16)/255);const l=new Ot([n/255,i/255,a/255,o],r,e);return s?new Lt(l):l}static fromRGBAFunction(t,r,s,n,i){const a=[pt(t),pt(r),pt(s),n?(o=n,dt(o)):1];var o;return e.ArrayUtilities.arrayDoesNotContainNullOrUndefined(a)?new Ot(a,n?"rgba":"rgb",i):null}static fromRGBA(t,e){return new Ot([t[0]/255,t[1]/255,t[2]/255,t[3]],"rgba",e)}static fromHSVA(t){const e=bt(t);return new Ot(e,"rgba")}is(t){return t===this.format()}as(t){return t===this.format()?this:Ot.#i[t](this)}format(){return this.#c}hasAlpha(){return 1!==this.#h[3]}detectHEXFormat(){return this.hasAlpha()?"hexa":"hex"}asString(t){return t?this.as(t).asString():this.#l(t,this.#h[0],this.#h[1],this.#h[2])}#l(t,r,s,n){function i(t){const e=Math.round(255*t).toString(16);return 1===e.length?"0"+e:e}switch(t||(t=this.#c),t){case"rgb":case"rgba":{const t=e.StringUtilities.sprintf("rgb(%d %d %d",kt(r),kt(s),kt(n));return this.hasAlpha()?t+e.StringUtilities.sprintf(" / %d%)",Math.round(100*this.#h[3])):t+")"}case"hex":case"hexa":return this.hasAlpha()?e.StringUtilities.sprintf("#%s%s%s%s",i(r),i(s),i(n),i(this.#h[3])).toLowerCase():e.StringUtilities.sprintf("#%s%s%s",i(r),i(s),i(n)).toLowerCase()}}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(t,...this.#n)}isGamutClipped(){return!xt(this.#n.map(kt),[this.#h[0],this.#h[1],this.#h[2]].map(kt),1)}rgba(){return[...this.#h]}canonicalRGBA(){const t=new Array(4);for(let e=0;e<3;++e)t[e]=Math.round(255*this.#h[e]);return t[3]=this.#h[3],t}toProtocolRGBA(){const t=this.canonicalRGBA(),e={r:t[0],g:t[1],b:t[2],a:void 0};return 1!==t[3]&&(e.a=t[3]),e}invert(){const t=[0,0,0,0];return t[0]=1-this.#h[0],t[1]=1-this.#h[1],t[2]=1-this.#h[2],t[3]=this.#h[3],new Ot(t,"rgba")}setAlpha(t){const e=[...this.#h];return e[3]=t,new Ot(e,"rgba")}blendWith(t){const e=k(t.#h,this.#h);return new Ot(e,"rgba")}blendWithAlpha(t){const e=[...this.#h];return e[3]*=t,new Ot(e,"rgba")}setFormat(t){this.#c=t}equal(t){const e=t.as(this.#c);return xt(kt(this.#h[0]),kt(e.#h[0]),1)&&xt(kt(this.#h[1]),kt(e.#h[1]),1)&&xt(kt(this.#h[2]),kt(e.#h[2]),1)&&xt(this.#h[3],e.#h[3])}}const Bt=[["aliceblue",[240,248,255]],["antiquewhite",[250,235,215]],["aqua",[0,255,255]],["aquamarine",[127,255,212]],["azure",[240,255,255]],["beige",[245,245,220]],["bisque",[255,228,196]],["black",[0,0,0]],["blanchedalmond",[255,235,205]],["blue",[0,0,255]],["blueviolet",[138,43,226]],["brown",[165,42,42]],["burlywood",[222,184,135]],["cadetblue",[95,158,160]],["chartreuse",[127,255,0]],["chocolate",[210,105,30]],["coral",[255,127,80]],["cornflowerblue",[100,149,237]],["cornsilk",[255,248,220]],["crimson",[237,20,61]],["cyan",[0,255,255]],["darkblue",[0,0,139]],["darkcyan",[0,139,139]],["darkgoldenrod",[184,134,11]],["darkgray",[169,169,169]],["darkgrey",[169,169,169]],["darkgreen",[0,100,0]],["darkkhaki",[189,183,107]],["darkmagenta",[139,0,139]],["darkolivegreen",[85,107,47]],["darkorange",[255,140,0]],["darkorchid",[153,50,204]],["darkred",[139,0,0]],["darksalmon",[233,150,122]],["darkseagreen",[143,188,143]],["darkslateblue",[72,61,139]],["darkslategray",[47,79,79]],["darkslategrey",[47,79,79]],["darkturquoise",[0,206,209]],["darkviolet",[148,0,211]],["deeppink",[255,20,147]],["deepskyblue",[0,191,255]],["dimgray",[105,105,105]],["dimgrey",[105,105,105]],["dodgerblue",[30,144,255]],["firebrick",[178,34,34]],["floralwhite",[255,250,240]],["forestgreen",[34,139,34]],["fuchsia",[255,0,255]],["gainsboro",[220,220,220]],["ghostwhite",[248,248,255]],["gold",[255,215,0]],["goldenrod",[218,165,32]],["gray",[128,128,128]],["grey",[128,128,128]],["green",[0,128,0]],["greenyellow",[173,255,47]],["honeydew",[240,255,240]],["hotpink",[255,105,180]],["indianred",[205,92,92]],["indigo",[75,0,130]],["ivory",[255,255,240]],["khaki",[240,230,140]],["lavender",[230,230,250]],["lavenderblush",[255,240,245]],["lawngreen",[124,252,0]],["lemonchiffon",[255,250,205]],["lightblue",[173,216,230]],["lightcoral",[240,128,128]],["lightcyan",[224,255,255]],["lightgoldenrodyellow",[250,250,210]],["lightgreen",[144,238,144]],["lightgray",[211,211,211]],["lightgrey",[211,211,211]],["lightpink",[255,182,193]],["lightsalmon",[255,160,122]],["lightseagreen",[32,178,170]],["lightskyblue",[135,206,250]],["lightslategray",[119,136,153]],["lightslategrey",[119,136,153]],["lightsteelblue",[176,196,222]],["lightyellow",[255,255,224]],["lime",[0,255,0]],["limegreen",[50,205,50]],["linen",[250,240,230]],["magenta",[255,0,255]],["maroon",[128,0,0]],["mediumaquamarine",[102,205,170]],["mediumblue",[0,0,205]],["mediumorchid",[186,85,211]],["mediumpurple",[147,112,219]],["mediumseagreen",[60,179,113]],["mediumslateblue",[123,104,238]],["mediumspringgreen",[0,250,154]],["mediumturquoise",[72,209,204]],["mediumvioletred",[199,21,133]],["midnightblue",[25,25,112]],["mintcream",[245,255,250]],["mistyrose",[255,228,225]],["moccasin",[255,228,181]],["navajowhite",[255,222,173]],["navy",[0,0,128]],["oldlace",[253,245,230]],["olive",[128,128,0]],["olivedrab",[107,142,35]],["orange",[255,165,0]],["orangered",[255,69,0]],["orchid",[218,112,214]],["palegoldenrod",[238,232,170]],["palegreen",[152,251,152]],["paleturquoise",[175,238,238]],["palevioletred",[219,112,147]],["papayawhip",[255,239,213]],["peachpuff",[255,218,185]],["peru",[205,133,63]],["pink",[255,192,203]],["plum",[221,160,221]],["powderblue",[176,224,230]],["purple",[128,0,128]],["rebeccapurple",[102,51,153]],["red",[255,0,0]],["rosybrown",[188,143,143]],["royalblue",[65,105,225]],["saddlebrown",[139,69,19]],["salmon",[250,128,114]],["sandybrown",[244,164,96]],["seagreen",[46,139,87]],["seashell",[255,245,238]],["sienna",[160,82,45]],["silver",[192,192,192]],["skyblue",[135,206,235]],["slateblue",[106,90,205]],["slategray",[112,128,144]],["slategrey",[112,128,144]],["snow",[255,250,250]],["springgreen",[0,255,127]],["steelblue",[70,130,180]],["tan",[210,180,140]],["teal",[0,128,128]],["thistle",[216,191,216]],["tomato",[255,99,71]],["turquoise",[64,224,208]],["violet",[238,130,238]],["wheat",[245,222,179]],["white",[255,255,255]],["whitesmoke",[245,245,245]],["yellow",[255,255,0]],["yellowgreen",[154,205,50]],["transparent",[0,0,0,0]]];console.assert(Bt.every((([t])=>t.toLowerCase()===t)),"All color nicknames must be lowercase.");const Nt=new Map(Bt),Vt=new Map(Bt.map((([t,[e,r,s,n=1]])=>[String([e,r,s,n]),t]))),Gt=[127,32,210],Mt={Content:Ot.fromRGBA([111,168,220,.66]),ContentLight:Ot.fromRGBA([111,168,220,.5]),ContentOutline:Ot.fromRGBA([9,83,148]),Padding:Ot.fromRGBA([147,196,125,.55]),PaddingLight:Ot.fromRGBA([147,196,125,.4]),Border:Ot.fromRGBA([255,229,153,.66]),BorderLight:Ot.fromRGBA([255,229,153,.5]),Margin:Ot.fromRGBA([246,178,107,.66]),MarginLight:Ot.fromRGBA([246,178,107,.5]),EventTarget:Ot.fromRGBA([255,196,196,.66]),Shape:Ot.fromRGBA([96,82,177,.8]),ShapeMargin:Ot.fromRGBA([96,82,127,.6]),CssGrid:Ot.fromRGBA([75,0,130,1]),LayoutLine:Ot.fromRGBA([...Gt,1]),GridBorder:Ot.fromRGBA([...Gt,1]),GapBackground:Ot.fromRGBA([...Gt,.3]),GapHatch:Ot.fromRGBA([...Gt,.8]),GridAreaBorder:Ot.fromRGBA([26,115,232,1])},Wt={ParentOutline:Ot.fromRGBA([224,90,183,1]),ChildOutline:Ot.fromRGBA([0,120,212,1])},Xt={Resizer:Ot.fromRGBA([222,225,230,1]),ResizerHandle:Ot.fromRGBA([166,166,166,1]),Mask:Ot.fromRGBA([248,249,249,1])};var Ft=Object.freeze({__proto__:null,getFormat:function(t){switch(t){case"hex":return"hex";case"hexa":return"hexa";case"rgb":return"rgb";case"rgba":return"rgba";case"hsl":return"hsl";case"hsla":return"hsla";case"hwb":return"hwb";case"hwba":return"hwba";case"lch":return"lch";case"oklch":return"oklch";case"lab":return"lab";case"oklab":return"oklab"}return ot(t)},parse:function(t){if(!t.match(/\s/)){const e=t.toLowerCase().match(/^(?:#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(\w+))$/i);if(e)return e[1]?Ot.fromHex(e[1],t):e[2]?_t.fromName(e[2],t):null}const e=t.toLowerCase().match(/^\s*(?:(rgba?)|(hsla?)|(hwba?)|(lch)|(oklch)|(lab)|(oklab)|(color))\((.*)\)\s*$/);if(e){const r=Boolean(e[1]),s=Boolean(e[2]),n=Boolean(e[3]),i=Boolean(e[4]),a=Boolean(e[5]),o=Boolean(e[6]),l=Boolean(e[7]),h=Boolean(e[8]),c=e[9];if(h)return Pt.fromSpec(t,c);const u=function(t,{allowCommas:e,convertNoneToZero:r}){const s=t.trim();let n=[];e&&(n=s.split(/\s*,\s*/));if(!e||1===n.length)if(n=s.split(/\s+/),"/"===n[3]){if(n.splice(3,1),4!==n.length)return null}else if(n.length>2&&-1!==n[2].indexOf("/")||n.length>3&&-1!==n[3].indexOf("/")){const t=n.slice(2,4).join("");n=n.slice(0,2).concat(t.split(/\//)).concat(n.slice(4))}else if(n.length>=4)return null;if(3!==n.length&&4!==n.length||n.indexOf("")>-1)return null;if(r)return n.map((t=>"none"===t?"0":t));return n}(c,{allowCommas:r||s,convertNoneToZero:!(r||s||n)});if(!u)return null;const g=[u[0],u[1],u[2],u[3]];if(r)return Ot.fromRGBAFunction(u[0],u[1],u[2],u[3],t);if(s)return At.fromSpec(g,t);if(n)return Et.fromSpec(g,t);if(i)return zt.fromSpec(g,t);if(a)return It.fromSpec(g,t);if(o)return Tt.fromSpec(g,t);if(l)return Rt.fromSpec(g,t)}return null},parseHueNumeric:mt,hsl2rgb:ft,hsva2rgba:bt,rgb2hsv:function(t){const e=L(t),r=e[0];let s=e[1];const n=e[2];return s*=n<.5?n:1-n,[r,0!==s?2*s/(n+s):0,n+s]},desiredLuminance:wt,approachColorValue:St,findFgColorForContrast:function(t,e,r){const s=t.as("hsl").hsva(),n=e.rgba(),i=t=>N(k(Ot.fromHSVA(t).rgba(),n)),a=N(e.rgba()),o=wt(a,r,i(s)>a);return St(s,0,2,o,i)?Ot.fromHSVA(s):(s[2]=1,St(s,0,1,o,i)?Ot.fromHSVA(s):null)},findFgColorForContrastAPCA:function(t,e,r){const s=t.as("hsl").hsva(),n=(e.rgba(),t=>Z(Ot.fromHSVA(t).rgba())),i=Z(e.rgba()),a=Q(i,r,n(s)>=i);if(St(s,0,2,a,n)){const t=Ot.fromHSVA(s);if(Math.abs(Y(e.rgba(),t.rgba()))>=r)return t}if(s[2]=1,St(s,0,1,a,n)){const t=Ot.fromHSVA(s);if(Math.abs(Y(e.rgba(),t.rgba()))>=r)return t}return null},Lab:Tt,LCH:zt,Oklab:Rt,Oklch:It,ColorFunction:Pt,HSL:At,HWB:Et,ShortHex:Lt,Nickname:_t,Legacy:Ot,Regex:/((?:rgba?|hsla?|hwba?|lab|lch|oklab|oklch|color)\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b[a-zA-Z]+\b(?!-))/g,ColorMixRegex:/color-mix\(.*,\s*(?<firstColor>.+)\s*,\s*(?<secondColor>.+)\s*\)/g,Nicknames:Nt,PageHighlight:Mt,SourceOrderHighlight:Wt,IsolationModeHighlight:Xt,Generator:class{#u;#g;#d;#p;#m;constructor(t,e,r,s){this.#u=t||{min:0,max:360,count:void 0},this.#g=e||67,this.#d=r||80,this.#p=s||1,this.#m=new Map}setColorForID(t,e){this.#m.set(t,e)}colorForID(t){let e=this.#m.get(t);return e||(e=this.generateColorForID(t),this.#m.set(t,e)),e}generateColorForID(t){const r=e.StringUtilities.hashCode(t),s=this.indexToValueInSpace(r,this.#u),n=this.indexToValueInSpace(r>>8,this.#g),i=this.indexToValueInSpace(r>>16,this.#d),a=this.indexToValueInSpace(r>>24,this.#p),o=`hsl(${s}deg ${n}% ${i}%`;return 1!==a?`${o} / ${Math.floor(100*a)}%)`:`${o})`}indexToValueInSpace(t,e){if("number"==typeof e)return e;const r=e.count||e.max-e.min;return t%=r,e.min+Math.floor(t/(r-1)*(e.max-e.min))}}});class Dt{listeners;addEventListener(t,e,r){this.listeners||(this.listeners=new Map);let s=this.listeners.get(t);return s||(s=new Set,this.listeners.set(t,s)),s.add({thisObject:r,listener:e}),{eventTarget:this,eventType:t,thisObject:r,listener:e}}once(t){return new Promise((e=>{const r=this.addEventListener(t,(s=>{this.removeEventListener(t,r.listener),e(s.data)}))}))}removeEventListener(t,e,r){const s=this.listeners?.get(t);if(s){for(const t of s)t.listener===e&&t.thisObject===r&&(t.disposed=!0,s.delete(t));s.size||this.listeners?.delete(t)}}hasEventListeners(t){return Boolean(this.listeners&&this.listeners.has(t))}dispatchEventToListeners(t,...[e]){const r=this.listeners?.get(t);if(!r)return;const s={data:e,source:this};for(const t of[...r])t.disposed||t.listener.call(t.thisObject,s)}}var Ut=Object.freeze({__proto__:null,ObjectWrapper:Dt,eventMixin:function(t){return class extends t{#y=new Dt;addEventListener(t,e,r){return this.#y.addEventListener(t,e,r)}once(t){return this.#y.once(t)}removeEventListener(t,e,r){this.#y.removeEventListener(t,e,r)}hasEventListeners(t){return this.#y.hasEventListeners(t)}dispatchEventToListeners(t,...e){this.#y.dispatchEventToListeners(t,...e)}}}});const jt={elementsPanel:"Elements panel",stylesSidebar:"styles sidebar",changesDrawer:"Changes drawer",issuesView:"Issues view",networkPanel:"Network panel",applicationPanel:"Application panel",sourcesPanel:"Sources panel",memoryInspectorPanel:"Memory inspector panel",developerResourcesPanel:"Developer Resources panel"},$t=r.i18n.registerUIStrings("core/common/Revealer.ts",jt),Ht=r.i18n.getLazilyComputedLocalizedString.bind(void 0,$t);let qt;class Zt{registeredRevealers=[];static instance(){return void 0===qt&&(qt=new Zt),qt}static removeInstance(){qt=void 0}register(t){this.registeredRevealers.push(t)}async reveal(t,e){const r=await Promise.all(this.getApplicableRegisteredRevealers(t).map((t=>t.loadRevealer())));if(r.length<1)throw new Error(`No revealers found for ${t}`);if(r.length>1)throw new Error(`Conflicting reveals found for ${t}`);return await r[0].reveal(t,e)}getApplicableRegisteredRevealers(t){return this.registeredRevealers.filter((e=>{for(const r of e.contextTypes())if(t instanceof r)return!0;return!1}))}}async function Yt(t,e=!1){await Zt.instance().reveal(t,e)}const Kt={DEVELOPER_RESO