-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentry-esm.js
1 lines (1 loc) · 8.75 KB
/
entry-esm.js
1
import e from"react";import{createTheming as t}from"theming";import{btoa as r,atob as n}from"abab";var i="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a=!i&&"undefined"!=typeof window&&"undefined"!=typeof document&&9===document.nodeType,o=function(e,t){return t.forEach((function(r,n){return t[n]=e(r,n)})),t},s={},l=a?document.createElement("p").style:{},c={opera:"O",chrome:"webkit",safari:"Webkit",firefox:"Moz",fban:"Webkit",fbav:"Webkit",msie:"ms",node:""},u=function(){if("undefined"==typeof navigator)return"";var e=navigator.userAgent||navigator.vendor||a&&window.opera,t=/(opera|msie|firefox|chrome|safari|fban|fbav|node)/.exec(e.toLowerCase());return t||console.warn("Freyja: No browser match found. Vendor prefixes will be absent."),t?c[t[0]]:""}(),f="-"+u.toLowerCase()+"-",d=["accelerator","animation","appearance","aspectRatio","backdropFilter","backfaceVisibility","backgroundComposite","binding","blockProgression","borderAfter","borderBefore","borderEnd","borderFit","borderStart","borderVerticalSpacing","box","column","filter","flex","flow","fontFeatureSettings","fontSizeDelta","fontSmoothing","grid","hyphenate","hyphens","imageRegion","initialLetter","line","locale","logical","marginAfter","marginBefore","marginBottomCollapse","marginCollapse","marginEnd","marginFit","marginStart","marginTopCollapse","marquee","mask","math","objectFit","perspective","scrollSnap","textAlignLast","textDecoration","textFill","textJustify","textOrientation","textSecurity","textSizeAdjust","textStroke","textUnderline","textZoom","textOverflow","transform","userSelect","wordBreak","wrap"],m={alignContent:"msFlexLinePack",alignSelf:"msFlexItemAlign",alignItems:"msFlexAlign",justifyContent:"msFlexPack",order:"msFlexOrder",flexGrow:"msFlexPositive",flexShrink:"msFlexNegative",flexBasis:"msPreferredSize"},p=["grid","inline-grid","linear-gradient","radial-gradient","repeating-linear-gradient","repeating-radial-gradient"],g={"break-all":["break-word"],flex:["-webkit-box","-ms-flexbox","-webkit-flex"],"flex-end":["end"],"flex-start":["start"],"space-around":["distribute"],"space-between":["justify"]},y={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},b=Object.entries,v=function(e,t){var r=(e.getElementById(t)||function(e,t){var r=e.createElement("style");return r.id=t,e.head.appendChild(r),r}(e,t)).sheet;return function(e){return r.insertRule(e,r.cssRules.length)}},x=function(){},h={keyframes:a?v(document,"__freyja_keyframes"):x,classes:a?v(document,"__freyja_classes"):x,mediaqueries:a?v(document,"__freyja_mediaqueries"):x},w={keyframes:[],classes:[],mediaqueries:[]},k={},j=0,_=function(e,t){!a&&w[t].push(e),h[t](e),j++},S=function(e){return function(e,t){void 0===t&&(t=u);var r=e+t;if(s[r])return s[r];var n=t+e.slice(0,1).toUpperCase()+e.slice(1);return"justifyContent"===e&&"ms"===t&&(e="msFlexPack"),!t||e in l?s[r]=e:m[e]in l?s[r]=m[e]:d.find((function(t){return e.startsWith(t)}))&&n in l?s[r]=n:s[r]=e}(e).replace(/[A-Z]|^ms|^webkit/g,"-$&").toLowerCase()},C=function(e,t){return"number"!=typeof t?function(e,t){var r=e+t;if(s[r])return s[r];if("string"!=typeof t)return s[r]=t;if("content"===e&&!t.length)return s[r]='""';var n=function(t){return l[e]="",l[e]=t,!!l[e].length};try{if(n(t))return s[r]=t}catch(e){return s[r]=t}var i=f+t;if(p.find((function(e){return t.startsWith(e)}))&&n(i))return s[r]=i;var a=g[t]&&g[t].find(n);return s[r]=a||t}(e,t):y[e]?t:t+"px"},z=function(e,t,r){return"@"+(r?f:"")+"keyframes "+e+" {"+t+"}"},F=function(e,t,r){return void 0===t&&(t=""),o((function(e){var n=e[0],i=e[1];if(null==i)return"";if("object"==typeof i){var a=function(e){return void 0===e&&(e=""),"@"===e[0]&&"m"===e[1]}(n)?n:null;return F(i,a?t:t+n,a||r)}var o=n+i+t+r;if(k[o])return k[o];var s=r?"mediaqueries":"classes",l="f"+j.toString(36);return _(function(e,t){return t?t+"{"+e+"}":e}(function(e,t,r){return"."+e+"{"+S(t)+":"+C(t,r)+"}"}(l+t.replace(/&/g,""),n,i),r),s),k[o]=l}),b(e)).filter(Boolean).join(" ")},O=function(e){return[w.keyframes.join(""),w.classes.join(""),w.mediaqueries.join(""),r(JSON.stringify(k)),j]},I=function(e){for(var t in k={},w)w[t]=[];j=0},T=function(){var e=O(),t=e[0],r=e[1],n=e[2],i=e[3],a=e[4];return I(),'<style id="__freyja_keyframes">'+t+'</style><style id="__freyja_classes" data-freyja-rules="'+a+'" data-freyja-cache="'+i+'">'+r+'</style><style id="__freyja_mediaqueries">'+n+"</style>"},L=function(){var t=O(),r=t[0],n=t[1],i=t[2],a=t[3],o=t[4];return I(),e.createElement(e.Fragment,null,e.createElement("style",{id:"__freyja_keyframes",dangerouslySetInnerHTML:{__html:r}}),e.createElement("style",{id:"__freyja_classes","data-freyja-rules":o,"data-freyja-cache":a,dangerouslySetInnerHTML:{__html:n}}),e.createElement("style",{id:"__freyja_mediaqueries",dangerouslySetInnerHTML:{__html:i}}))},E=Math.pow,A=Object.entries,W=[.25,.5,.6,.7,.85,1,1.25,1.5,1.75,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,12,14,16,18,20],q=function(e,t,r){return E(r,t)*e},B=function(e,t,r,n,i){return void 0===i&&(i="px"),"calc("+e+i+" + ("+(t-e)+") * ((100vw - "+r+i+") / ("+(n-r)+")))"},P=A({up:"0deg",right:"90deg",down:"180deg",left:"270deg"}).reduce((function(e,t){var r=t[0],n=t[1];return e[r]=function(e,t){return{backgroundImage:"linear-gradient("+n+", "+e+", "+t+")"}},e}),{center:function(e,t){return{backgroundImage:"radial-gradient(circle, "+e+", "+t+")"}}}),H=function(e){return function(t,r){return t[r]=e,t}},N=["::-webkit-input-placeholder",":-moz-placeholder","::-moz-placeholder",":-ms-input-placeholder"],R=["::-webkit-slider-thumb","::-moz-range-thumb","::-ms-thumb"],D=["::-webkit-slider-runnable-track","::-moz-range-track","::-ms-track"],M={bounce:"cubic-bezier(.44,-0.1,.72,1.34)",out:"cubic-bezier(.37,.54,.66,.99)",in:"cubic-bezier(.36,.01,.8,.65)"},V=A(M).reduce((function(e,t){var r,n=t[0],i=t[1];return Object.assign({},e,((r={})[n]={fast:{transition:"all 200ms "+i},medium:{transition:"all 320ms "+i},slow:{transition:"all 480ms "+i}},r))}),{fast:{transition:"all 200ms ease-in-out"},medium:{transition:"all 320ms ease-in-out"},slow:{transition:"all 480ms ease-in-out"}}),G=Object.freeze({__proto__:null,scale:function(e,t){return void 0===e&&(e=0),void 0===t&&(t="rem"),""+W[e+5]+t},media:{ebook:"@media screen and (min-width: 420px)",tablet:"@media screen and (min-width: 580px)",laptop:"@media screen and (min-width: 740px)",desktop:"@media screen and (min-width: 980px)"},fluidType:function(e){var t;void 0===e&&(e={});var r=e.minFontSize;void 0===r&&(r=16);var n=e.maxFontSize;void 0===n&&(n=20);var i=e.minLeading;void 0===i&&(i=1.3);var a=e.maxLeading;void 0===a&&(a=1.5);var o=e.minViewWidth;void 0===o&&(o=320);var s=e.maxViewWidth;void 0===s&&(s=1080);var l=e.minTypeScale;void 0===l&&(l=1.1);var c=e.maxTypeScale;void 0===c&&(c=1.35);var u=e.typeLevel;return void 0===u&&(u=0),(t={fontSize:q(r,u,l),lineHeight:i})["@media screen and (min-width: "+o+"px)"]={fontSize:B(q(r,u,l),q(n,u,c),o,s),lineHeight:B(i,a,o/r,s/n,"em")},t["@media screen and (min-width: "+s+"px)"]={fontSize:q(n,u,c),lineHeight:a},t},gradient:P,placeholder:function(e){return N.reduce(H(e),{})},rangeThumb:function(e){return R.reduce(H(e),{})},rangeTrack:function(e){return D.reduce(H(e),{})},layout:{center:{display:"flex",alignItems:"center",justifyContent:"center",alignContent:"center"},center_h:{display:"flex",alignItems:"center",alignContent:"center"},center_v:{display:"flex",justifyContent:"center"},row:{display:"flex",alignItems:"stretch",flexDirection:"row",justifyContent:"space-between"},column:{display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"space-between"},list:{display:"flex",alignItems:"stretch",justifyContent:"left"}},ease:M,transition:V}),J=Object.entries,U=Object.assign({},G,{animation:function(e){var t=function(e,t){void 0===t&&(t="an");for(var r=5381,n=e.length;n;)r=33*r^e.charCodeAt(--n);return t+(r>>>0).toString(36)}(JSON.stringify(e));if(k[t])return k[t];var r=o((function(e){var t=e[0],r=e[1];return t+" {"+b(r).reduce((function(e,t){var r=t[0],n=t[1];return""+e+S(r)+":"+C(r,n)+";"}),"")+"}"}),b(e)).join(" ");return _(z(t,r,!0),"keyframes"),_(z(t,r),"keyframes"),k[t]=t}}),Z=t(e.createContext({})),$=Z.withTheme,K=Z.ThemeProvider,Q=Z.useTheme;!function(e){if(a){var t=document.getElementById("__freyja_classes");t.dataset.freyjaCache&&(k=JSON.parse(n(t.dataset.freyjaCache))||{},j=parseInt(t.dataset.freyjaRules))}}();function X(e,t){return void 0===t&&(t={}),r=e(Q(),t,U),J(r).reduce((function(e,t){var r=t[0],n=t[1];return e[r]=F(n),e}),{});var r}export default X;export{L as StyleComponents,K as ThemeProvider,T as styleTags,Q as useTheme,$ as withTheme};