Build 576754stable
Module 187322
10,092 characters · in 40041.5a3e48a93289fd56.jsDependencies
Required by (107)
2422627192343373652539255427804873655759587366315283297920089306795035106236109802113325123292135261138617144165144228156652156867166005166444187654189812193663201001215497224640251333260598277370289498292666302557305866320080334295342298349288354948356343359378361739364522377980381687408121414711417098417454424045436405444550453314465558467884489718491182496920501335508274510830568385573725601973609308623646631963635242643374655045657048657718657977672130682455689035689175703007706897724029732771738266777485786826788593793325808124826745830647862482878314885996902550925435928078935462939249970309979186981714983495994064
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(t,e,n){"use strict";let i;n.d(e,{oP:()=>R,vN:()=>P,xp:()=>D});var r,o=n(64700),a=n(627968),s=Object.defineProperty,l=(t,e,n)=>{let i;return(i="symbol"!=typeof e?e+"":e)in t?s(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,n},u={exports:{}},c={}.hasOwnProperty;function h(){for(var t=[],e=0;e<arguments.length;e++){var n=arguments[e];if(n){var i=typeof n;if("string"===i||"number"===i)t.push(n);else if(Array.isArray(n)){if(n.length){var r=h.apply(null,n);r&&t.push(r)}}else if("object"===i){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){t.push(n.toString());continue}for(var o in n)c.call(n,o)&&n[o]&&t.push(o)}}}return t.join(" ")}u.exports?(h.default=h,u.exports=h):window.classNames=h;let d=u.exports;var f=function(t,e,n,i,r,o,a,s){if(!t){var l;if(void 0===e)l=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,i,r,o,a,s],c=0;(l=Error(e.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}};let p=/^#[0-9a-f]{3,8}$/i,g=/^((?:rgb|hsl)a?)\s*\(([^)]*)\)/i;class m{constructor(t,e,n,i){this.red=t,this.green=e,this.blue=n,this.alpha=i}toHexString(){let t=Math.round(this.red).toString(16),e=Math.round(this.green).toString(16),n=Math.round(this.blue).toString(16);return"#"+(this.red>15.5?t:"0"+t)+(this.green>15.5?e:"0"+e)+(this.blue>15.5?n:"0"+n)}static parseString(t){return t.match(g)?this.parseColorFnString(t):t.match(p)?this.parseHexString(t):void 0}static parseRgbString(t){return"transparent"===t?new m(0,0,0,0):this.parseColorFnString(t)}static parseHexString(t){if(!t.match(p)||[6,8].includes(t.length))return;if((t=t.replace("#","")).length<6){let[e,n,i,r]=t.split("");t=e+e+n+n+i+i,r&&(t+=r+r)}let e=t.match(/.{1,2}/g);if(null!=e)return new m(parseInt(e[0],16),parseInt(e[1],16),parseInt(e[2],16),null!=e[3]?parseInt(e[3],16)/255:1)}static parseColorFnString(t){var e;let[,n,i]=null!=(e=t.match(g))?e:[];if(!n||!i)return;let r=i.split(/\s*[,/\s]\s*/).map(t=>t.replace(",","").trim()).filter(t=>""!==t).map((t,e)=>(function(t,e,n){if(/%$/.test(e))return 3===n?parseFloat(e)/100:255*parseFloat(e)/100;if("h"===t[n]){if(/turn$/.test(e))return 360*parseFloat(e);if(/rad$/.test(e))return 57.3*parseFloat(e)}return parseFloat(e)})(n,t,e));if("hsl"===n.substr(0,3)){let t=function({hue:t,saturation:e,lightness:n,alpha:i}){let r=(1-Math.abs(2*(n/=255)-1))*(e/=255),o=r*(1-Math.abs(t/60%2-1)),a=n-r/2,s=(t<60?[r,o,0]:t<120?[o,r,0]:t<180?[0,r,o]:t<240?[0,o,r]:t<300?[o,0,r]:[r,0,o]).map(t=>Math.round((t+a)*255));return{red:s[0],green:s[1],blue:s[2],alpha:i}}({hue:r[0],saturation:r[1],lightness:r[2],alpha:r[3]});return new m(t.red,t.green,t.blue,t.alpha)}return new m(r[0],r[1],r[2],"number"==typeof r[3]?r[3]:1)}toHSL(){return function({red:t,green:e,blue:n,alpha:i}){let r=t/255,o=e/255,a=n/255,s=Math.max(r,o,a),l=Math.min(r,o,a),u=s-l,c=(s+l)/2,h=u>0?u/(1-Math.abs(2*c-1)):0;if(0===u)return{hue:0,saturation:h,lightness:c,alpha:i};let d=0;switch(s){case r:d=(o-a)/u%6;break;case o:d=(a-r)/u+2;break;case a:d=(o-a)/u+4}return{hue:60*d,saturation:h,lightness:c,alpha:i}}({red:this.red,green:this.green,blue:this.blue,alpha:this.alpha})}getRelativeLuminance(){let t=this.red/255,e=this.green/255,n=this.blue/255;return .2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}}function y(t,e){let n=t.alpha;return new m((1-n)*e.red+n*t.red,(1-n)*e.green+n*t.green,(1-n)*e.blue+n*t.blue,t.alpha+e.alpha*(1-t.alpha))}function v(t){if(t)return parseInt(t)>0?t:void 0}class b{constructor(){l(this,"targetElement"),l(this,"targetAncestry"),l(this,"boundingBox"),l(this,"className"),l(this,"offset",0),l(this,"zIndex"),l(this,"container",null),l(this,"themeOptions"),l(this,"invalidate",()=>null)}setContainer(t){this.container=t}setThemeOptions(t){this.themeOptions=t}showElement(t,e={}){var n;this.targetElement=t,this.targetAncestry=this.getElementAncestors(this.targetElement),this.boundingBox=void 0,this.className=e.className,this.offset=null!=(n=e.offset)?n:0,this.zIndex=e.zIndex,this!==i&&(null==i||i.hide(),i=this),this.invalidate()}hide(){this.targetElement=void 0,this.targetAncestry=void 0,this.boundingBox=void 0,this.className=void 0,this.offset=0,this.zIndex=void 0,this.invalidate()}get visible(){return null!=this.targetElement||null!=this.boundingBox}getElementAncestors(t){if(null==t)return{elements:[],styles:[]};let e=[],n=[],i=t;for(;null!=i;)e.push(i),"u">typeof window&&n.push(window.getComputedStyle(i)),i=i.parentElement;return{elements:e,styles:n}}getNextZIndexForAncestry(t){for(let e=0;e<t.elements.length;e++){let n=t.elements[e],i=parseInt(t.styles[e].getPropertyValue("z-index"));if(!isNaN(i))return i+1;if(n===this.container)break}}getBorderRadius(t){var e,n,i,r,o,a,s,l;let u=null!=(n=v(null==(e=t.styles[0])?void 0:e.borderTopLeftRadius))?n:"0",c=null!=(r=v(null==(i=t.styles[0])?void 0:i.borderTopRightRadius))?r:"0",h=null!=(a=v(null==(o=t.styles[0])?void 0:o.borderBottomRightRadius))?a:"0",d=null!=(l=v(null==(s=t.styles[0])?void 0:s.borderBottomLeftRadius))?l:"0";if("0"!==u||"0"!==c||"0"!==h||"0"!==d)return`${u} ${c} ${h} ${d}`}makePositionFromDOMRect(t){var e,n,i,r;if(null==this.container)return{};let o=this.container.getBoundingClientRect(),{scrollTop:a,scrollLeft:s}=this.container,l=0,u=0,c=0,h=0;return"number"==typeof this.offset?(l=this.offset,u=this.offset,c=this.offset,h=this.offset):(l=null!=(e=this.offset.top)?e:0,u=null!=(n=this.offset.right)?n:0,c=null!=(i=this.offset.bottom)?i:0,h=null!=(r=this.offset.left)?r:0),{top:a+t.top-o.top+l,width:t.width-(u+h),height:t.height-(c+l),left:s+t.left-o.left+h}}getStyle(){var t;let e={};if(null!=this.boundingBox&&(e={...this.makePositionFromDOMRect(this.boundingBox),zIndex:this.zIndex}),null!=this.targetElement&&null!=this.targetAncestry){let n=function(t){let e=[];for(let n of t.styles.slice(1)){let t=m.parseString(n.backgroundColor);if(null!=t){if(t.alpha>.95)return t;e.push(t)}}return e.push(new m(255,255,255,1)),e.reduce(y)}(this.targetAncestry);e={...this.makePositionFromDOMRect(this.targetElement.getBoundingClientRect()),zIndex:null!=(t=this.zIndex)?t:this.getNextZIndexForAncestry(this.targetAncestry),"--__adaptive-focus-ring-color":function(t,e){if(null==t)return"var(--focus-primary)";let{saturation:n}=t.toHSL(),i=t.getRelativeLuminance();return n<=.4?"var(--focus-primary)":"u">typeof e?i<(e.brightnessTreshold||.2)?"var(--focus-light, rgba(255,255,255,0.7))":"var(--focus-dark, rgba(0, 0, 0, 0.85))":"rgba(255,255,255,0.7)"}(n,this.themeOptions),"--__adaptive-focus-ring-radius":this.getBorderRadius(this.targetAncestry)}}return e}}let w=new b;"u">typeof window&&w.setContainer(document.body);let x=o.createContext(w);var _=function(t,e,n,i){var r=n?n.call(i,t,e):void 0;if(void 0!==r)return!!r;if(t===e)return!0;if("object"!=typeof t||!t||"object"!=typeof e||!e)return!1;var o=Object.keys(t),a=Object.keys(e);if(o.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(e),l=0;l<o.length;l++){var u=o[l];if(!s(u))return!1;var c=t[u],h=e[u];if(!1===(r=n?n.call(i,c,h,u):void 0)||void 0===r&&c!==h)return!1}return!0};let S=!1,E,T={};function C(){if(!S)return;let t=null==i?void 0:i.getStyle();null==t||_(t,T)?null!=E&&cancelAnimationFrame(E):(T=t,null==i||i.invalidate()),E=requestAnimationFrame(C)}let A=!1,R={get ringsEnabled(){return A},setRingsEnabled(t){A=t,null==i||i.invalidate()},enableAnimationTracking(){S=!0,E=requestAnimationFrame(C)},disableAnimationTracking(){S=!1,null!=E&&cancelAnimationFrame(E)}};function D(t){let{containerRef:e,children:n,themeOptions:i}=t,r=o.useRef(new b);return o.useEffect(()=>{r.current.setContainer(e.current),r.current.setThemeOptions(i)},[e.current]),(0,a.jsxs)(x.Provider,{value:r.current,children:[n,(0,a.jsx)(M,{})]})}function M(){let t=o.useContext(x),[,e]=o.useState({});return o.useEffect(()=>(t.invalidate=()=>e({}),()=>{t.invalidate=()=>null}),[t]),R.ringsEnabled&&t.visible?(0,a.jsx)("div",{className:d("focus-rings-ring",t.className),style:t.getStyle()}):null}let k="u">typeof window&&(null==(r=window.document)?void 0:r.createElement)!=null?o.useLayoutEffect:o.useEffect;function P(t){let{within:e=!1,enabled:n=!0,focused:i,offset:r=0,focusTarget:a,ringTarget:s,ringClassName:l,focusClassName:u,focusWithinClassName:c,children:h}=t;null!=a&&f(null!=s,"FocusRing was given a focusTarget but the required ringTarget was not provided. A ringTarget is required to avoid ambiguity of where the ring will be applied."),null!=i&&f(null!=s,"FocusRing was given a controlled focused prop but no ringTarget to apply the ring to. A ringTarget is required since it cannot be inferred through regular focus events.");let p=o.useRef(!1),[g,m]=o.useState(!1),y=o.useContext(x),v=o.Children.only(h),{onBlur:b,onFocus:w,..._}=v.props,S=o.useMemo(()=>({className:l,offset:r}),[l,r]);k(()=>{n&&y.invalidate()}),o.useEffect(()=>{n||y.hide()},[n,y]),o.useEffect(()=>()=>{p.current&&y.hide()},[y]),o.useEffect(()=>{let t=null==s?void 0:s.current;null==i||null==t||(p.current=i,i?y.showElement(t,S):!1===i&&y.hide())},[i,S,y,s]),k(()=>{if(null!=i)return;let t=null==a?void 0:a.current,n=null==s?void 0:s.current;if(null!=t&&null!=n)return t.addEventListener("focusin",r,!0),t.addEventListener("focusout",o,!0),()=>{t.removeEventListener("focusin",r,!0),t.removeEventListener("focusout",o,!0)};function r(t){if(null!=n){if(t.currentTarget===t.target){p.current=!0,y.showElement(n,S);return}m(!0),e&&y.showElement(n,S)}}function o(){y.hide(),p.current=!1,m(!1)}},[e,S,i,y,a,s]);let E=o.useCallback(t=>{y.hide(),p.current=!1,m(!1),null==b||b(t)},[b,y]),T=o.useCallback(t=>{let n=null==s?void 0:s.current;t.currentTarget===t.target?(p.current=!0,y.showElement(null!=n?n:t.currentTarget,S)):(m(!0),e&&y.showElement(null!=n?n:t.currentTarget,S)),null==w||w(t)},[s,e,w,y,S]);return n&&null==a&&null==i?o.cloneElement(v,{..._,className:d(_.className,p.current?u:void 0,g?c:void 0),onBlur:E,onFocus:T}):v}}