Greasy Fork is available in English.

ani2mpv

讓動畫瘋跳轉到 MPV

  1. // ==UserScript==
  2. // @name ani2mpv
  3. // @namespace npm/vite-plugin-monkey
  4. // @version 1.0.1
  5. // @author Yotsuba
  6. // @description 讓動畫瘋跳轉到 MPV
  7. // @license MIT
  8. // @icon https://vitejs.dev/logo.svg
  9. // @match https://ani.gamer.com.tw/animeVideo.php?sn=*
  10. // @require https://cdn.jsdelivr.net/npm/react@18.3.1/umd/react.production.min.js
  11. // @require https://cdn.jsdelivr.net/npm/react-dom@18.3.1/umd/react-dom.production.min.js
  12. // ==/UserScript==
  13.  
  14. (function (React, ReactDOM) {
  15. 'use strict';
  16.  
  17. function _interopNamespaceDefault(e) {
  18. const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
  19. if (e) {
  20. for (const k in e) {
  21. if (k !== 'default') {
  22. const d = Object.getOwnPropertyDescriptor(e, k);
  23. Object.defineProperty(n, k, d.get ? d : {
  24. enumerable: true,
  25. get: () => e[k]
  26. });
  27. }
  28. }
  29. }
  30. n.default = e;
  31. return Object.freeze(n);
  32. }
  33.  
  34. const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
  35.  
  36. var __defProp = Object.defineProperty;
  37. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  38. var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  39. var jsxRuntime = { exports: {} };
  40. var reactJsxRuntime_production_min = {};
  41. /**
  42. * @license React
  43. * react-jsx-runtime.production.min.js
  44. *
  45. * Copyright (c) Facebook, Inc. and its affiliates.
  46. *
  47. * This source code is licensed under the MIT license found in the
  48. * LICENSE file in the root directory of this source tree.
  49. */
  50. var f$1 = React, k$1 = Symbol.for("react.element"), l$1 = Symbol.for("react.fragment"), m$2 = Object.prototype.hasOwnProperty, n$1 = f$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$1 = { key: true, ref: true, __self: true, __source: true };
  51. function q$1(c2, a, g2) {
  52. var b2, d2 = {}, e2 = null, h2 = null;
  53. void 0 !== g2 && (e2 = "" + g2);
  54. void 0 !== a.key && (e2 = "" + a.key);
  55. void 0 !== a.ref && (h2 = a.ref);
  56. for (b2 in a) m$2.call(a, b2) && !p$1.hasOwnProperty(b2) && (d2[b2] = a[b2]);
  57. if (c2 && c2.defaultProps) for (b2 in a = c2.defaultProps, a) void 0 === d2[b2] && (d2[b2] = a[b2]);
  58. return { $$typeof: k$1, type: c2, key: e2, ref: h2, props: d2, _owner: n$1.current };
  59. }
  60. reactJsxRuntime_production_min.Fragment = l$1;
  61. reactJsxRuntime_production_min.jsx = q$1;
  62. reactJsxRuntime_production_min.jsxs = q$1;
  63. {
  64. jsxRuntime.exports = reactJsxRuntime_production_min;
  65. }
  66. var jsxRuntimeExports = jsxRuntime.exports;
  67. var client = {};
  68. var m$1 = ReactDOM;
  69. {
  70. client.createRoot = m$1.createRoot;
  71. client.hydrateRoot = m$1.hydrateRoot;
  72. }
  73. const ad = getAd()[0];
  74. const sn = animefun.videoSn;
  75. const device = animefun.getdeviceid();
  76. const title = animefun.title + " - 巴哈姆特動畫瘋";
  77. const version = "3.7.7";
  78. const VERSION$1 = version;
  79. const _hasBuffer = typeof Buffer === "function";
  80. const _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
  81. const _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
  82. const b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  83. const b64chs = Array.prototype.slice.call(b64ch);
  84. const b64tab = ((a) => {
  85. let tab = {};
  86. a.forEach((c2, i) => tab[c2] = i);
  87. return tab;
  88. })(b64chs);
  89. const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
  90. const _fromCC = String.fromCharCode.bind(String);
  91. const _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
  92. const _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
  93. const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
  94. const btoaPolyfill = (bin) => {
  95. let u32, c0, c1, c2, asc = "";
  96. const pad = bin.length % 3;
  97. for (let i = 0; i < bin.length; ) {
  98. if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255)
  99. throw new TypeError("invalid character found");
  100. u32 = c0 << 16 | c1 << 8 | c2;
  101. asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
  102. }
  103. return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
  104. };
  105. const _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
  106. const _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
  107. const maxargs = 4096;
  108. let strs = [];
  109. for (let i = 0, l2 = u8a.length; i < l2; i += maxargs) {
  110. strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
  111. }
  112. return _btoa(strs.join(""));
  113. };
  114. const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
  115. const cb_utob = (c2) => {
  116. if (c2.length < 2) {
  117. var cc = c2.charCodeAt(0);
  118. return cc < 128 ? c2 : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
  119. } else {
  120. var cc = 65536 + (c2.charCodeAt(0) - 55296) * 1024 + (c2.charCodeAt(1) - 56320);
  121. return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
  122. }
  123. };
  124. const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
  125. const utob = (u) => u.replace(re_utob, cb_utob);
  126. const _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
  127. const encode$2 = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
  128. const encodeURI = (src) => encode$2(src, true);
  129. const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
  130. const cb_btou = (cccc) => {
  131. switch (cccc.length) {
  132. case 4:
  133. var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
  134. return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
  135. case 3:
  136. return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
  137. default:
  138. return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
  139. }
  140. };
  141. const btou = (b2) => b2.replace(re_btou, cb_btou);
  142. const atobPolyfill = (asc) => {
  143. asc = asc.replace(/\s+/g, "");
  144. if (!b64re.test(asc))
  145. throw new TypeError("malformed base64.");
  146. asc += "==".slice(2 - (asc.length & 3));
  147. let u24, bin = "", r1, r2;
  148. for (let i = 0; i < asc.length; ) {
  149. u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
  150. bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
  151. }
  152. return bin;
  153. };
  154. const _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
  155. const _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c2) => c2.charCodeAt(0)));
  156. const toUint8Array = (a) => _toUint8Array(_unURI(a));
  157. const _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
  158. const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
  159. const decode = (src) => _decode(_unURI(src));
  160. const isValid = (src) => {
  161. if (typeof src !== "string")
  162. return false;
  163. const s = src.replace(/\s+/g, "").replace(/={0,2}$/, "");
  164. return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
  165. };
  166. const _noEnum = (v2) => {
  167. return {
  168. value: v2,
  169. enumerable: false,
  170. writable: true,
  171. configurable: true
  172. };
  173. };
  174. const extendString = function() {
  175. const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
  176. _add("fromBase64", function() {
  177. return decode(this);
  178. });
  179. _add("toBase64", function(urlsafe) {
  180. return encode$2(this, urlsafe);
  181. });
  182. _add("toBase64URI", function() {
  183. return encode$2(this, true);
  184. });
  185. _add("toBase64URL", function() {
  186. return encode$2(this, true);
  187. });
  188. _add("toUint8Array", function() {
  189. return toUint8Array(this);
  190. });
  191. };
  192. const extendUint8Array = function() {
  193. const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
  194. _add("toBase64", function(urlsafe) {
  195. return fromUint8Array(this, urlsafe);
  196. });
  197. _add("toBase64URI", function() {
  198. return fromUint8Array(this, true);
  199. });
  200. _add("toBase64URL", function() {
  201. return fromUint8Array(this, true);
  202. });
  203. };
  204. const extendBuiltins = () => {
  205. extendString();
  206. extendUint8Array();
  207. };
  208. const gBase64 = {
  209. version,
  210. VERSION: VERSION$1,
  211. atob: _atob,
  212. atobPolyfill,
  213. btoa: _btoa,
  214. btoaPolyfill,
  215. fromBase64: decode,
  216. toBase64: encode$2,
  217. encode: encode$2,
  218. encodeURI,
  219. encodeURL: encodeURI,
  220. utob,
  221. btou,
  222. decode,
  223. isValid,
  224. fromUint8Array,
  225. toUint8Array,
  226. extendString,
  227. extendUint8Array,
  228. extendBuiltins
  229. };
  230. function animeToMpv(url) {
  231. const mpv = `mpv://play/${gBase64.encodeURI(url)}/?v_title=${gBase64.encodeURI(title)}`;
  232. window.location.href = mpv;
  233. }
  234. function formatMuiErrorMessage(code, ...args) {
  235. const url = new URL(`https://mui.com/production-error/?code=${code}`);
  236. args.forEach((arg2) => url.searchParams.append("args[]", arg2));
  237. return `Minified MUI error #${code}; visit ${url} for the full message.`;
  238. }
  239. function _extends() {
  240. return _extends = Object.assign ? Object.assign.bind() : function(n2) {
  241. for (var e2 = 1; e2 < arguments.length; e2++) {
  242. var t2 = arguments[e2];
  243. for (var r2 in t2) ({}).hasOwnProperty.call(t2, r2) && (n2[r2] = t2[r2]);
  244. }
  245. return n2;
  246. }, _extends.apply(null, arguments);
  247. }
  248. function memoize$1(fn) {
  249. var cache = /* @__PURE__ */ Object.create(null);
  250. return function(arg2) {
  251. if (cache[arg2] === void 0) cache[arg2] = fn(arg2);
  252. return cache[arg2];
  253. };
  254. }
  255. var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
  256. var isPropValid = /* @__PURE__ */ memoize$1(
  257. function(prop) {
  258. return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
  259. }
  260. /* Z+1 */
  261. );
  262. var isDevelopment$2 = false;
  263. function sheetForTag(tag) {
  264. if (tag.sheet) {
  265. return tag.sheet;
  266. }
  267. for (var i = 0; i < document.styleSheets.length; i++) {
  268. if (document.styleSheets[i].ownerNode === tag) {
  269. return document.styleSheets[i];
  270. }
  271. }
  272. return void 0;
  273. }
  274. function createStyleElement(options) {
  275. var tag = document.createElement("style");
  276. tag.setAttribute("data-emotion", options.key);
  277. if (options.nonce !== void 0) {
  278. tag.setAttribute("nonce", options.nonce);
  279. }
  280. tag.appendChild(document.createTextNode(""));
  281. tag.setAttribute("data-s", "");
  282. return tag;
  283. }
  284. var StyleSheet = /* @__PURE__ */ function() {
  285. function StyleSheet2(options) {
  286. var _this = this;
  287. this._insertTag = function(tag) {
  288. var before;
  289. if (_this.tags.length === 0) {
  290. if (_this.insertionPoint) {
  291. before = _this.insertionPoint.nextSibling;
  292. } else if (_this.prepend) {
  293. before = _this.container.firstChild;
  294. } else {
  295. before = _this.before;
  296. }
  297. } else {
  298. before = _this.tags[_this.tags.length - 1].nextSibling;
  299. }
  300. _this.container.insertBefore(tag, before);
  301. _this.tags.push(tag);
  302. };
  303. this.isSpeedy = options.speedy === void 0 ? !isDevelopment$2 : options.speedy;
  304. this.tags = [];
  305. this.ctr = 0;
  306. this.nonce = options.nonce;
  307. this.key = options.key;
  308. this.container = options.container;
  309. this.prepend = options.prepend;
  310. this.insertionPoint = options.insertionPoint;
  311. this.before = null;
  312. }
  313. var _proto = StyleSheet2.prototype;
  314. _proto.hydrate = function hydrate(nodes) {
  315. nodes.forEach(this._insertTag);
  316. };
  317. _proto.insert = function insert(rule) {
  318. if (this.ctr % (this.isSpeedy ? 65e3 : 1) === 0) {
  319. this._insertTag(createStyleElement(this));
  320. }
  321. var tag = this.tags[this.tags.length - 1];
  322. if (this.isSpeedy) {
  323. var sheet = sheetForTag(tag);
  324. try {
  325. sheet.insertRule(rule, sheet.cssRules.length);
  326. } catch (e2) {
  327. }
  328. } else {
  329. tag.appendChild(document.createTextNode(rule));
  330. }
  331. this.ctr++;
  332. };
  333. _proto.flush = function flush() {
  334. this.tags.forEach(function(tag) {
  335. var _tag$parentNode;
  336. return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
  337. });
  338. this.tags = [];
  339. this.ctr = 0;
  340. };
  341. return StyleSheet2;
  342. }();
  343. var MS = "-ms-";
  344. var MOZ = "-moz-";
  345. var WEBKIT = "-webkit-";
  346. var COMMENT = "comm";
  347. var RULESET = "rule";
  348. var DECLARATION = "decl";
  349. var IMPORT = "@import";
  350. var KEYFRAMES = "@keyframes";
  351. var LAYER = "@layer";
  352. var abs = Math.abs;
  353. var from = String.fromCharCode;
  354. var assign = Object.assign;
  355. function hash(value, length2) {
  356. return charat(value, 0) ^ 45 ? (((length2 << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3) : 0;
  357. }
  358. function trim$1(value) {
  359. return value.trim();
  360. }
  361. function match(value, pattern) {
  362. return (value = pattern.exec(value)) ? value[0] : value;
  363. }
  364. function replace(value, pattern, replacement) {
  365. return value.replace(pattern, replacement);
  366. }
  367. function indexof(value, search) {
  368. return value.indexOf(search);
  369. }
  370. function charat(value, index) {
  371. return value.charCodeAt(index) | 0;
  372. }
  373. function substr(value, begin, end) {
  374. return value.slice(begin, end);
  375. }
  376. function strlen(value) {
  377. return value.length;
  378. }
  379. function sizeof(value) {
  380. return value.length;
  381. }
  382. function append(value, array) {
  383. return array.push(value), value;
  384. }
  385. function combine(array, callback) {
  386. return array.map(callback).join("");
  387. }
  388. var line = 1;
  389. var column = 1;
  390. var length = 0;
  391. var position = 0;
  392. var character = 0;
  393. var characters = "";
  394. function node(value, root, parent, type, props, children, length2) {
  395. return { value, root, parent, type, props, children, line, column, length: length2, return: "" };
  396. }
  397. function copy(root, props) {
  398. return assign(node("", null, null, "", null, null, 0), root, { length: -root.length }, props);
  399. }
  400. function char() {
  401. return character;
  402. }
  403. function prev() {
  404. character = position > 0 ? charat(characters, --position) : 0;
  405. if (column--, character === 10)
  406. column = 1, line--;
  407. return character;
  408. }
  409. function next() {
  410. character = position < length ? charat(characters, position++) : 0;
  411. if (column++, character === 10)
  412. column = 1, line++;
  413. return character;
  414. }
  415. function peek() {
  416. return charat(characters, position);
  417. }
  418. function caret() {
  419. return position;
  420. }
  421. function slice(begin, end) {
  422. return substr(characters, begin, end);
  423. }
  424. function token(type) {
  425. switch (type) {
  426. case 0:
  427. case 9:
  428. case 10:
  429. case 13:
  430. case 32:
  431. return 5;
  432. case 33:
  433. case 43:
  434. case 44:
  435. case 47:
  436. case 62:
  437. case 64:
  438. case 126:
  439. case 59:
  440. case 123:
  441. case 125:
  442. return 4;
  443. case 58:
  444. return 3;
  445. case 34:
  446. case 39:
  447. case 40:
  448. case 91:
  449. return 2;
  450. case 41:
  451. case 93:
  452. return 1;
  453. }
  454. return 0;
  455. }
  456. function alloc(value) {
  457. return line = column = 1, length = strlen(characters = value), position = 0, [];
  458. }
  459. function dealloc(value) {
  460. return characters = "", value;
  461. }
  462. function delimit(type) {
  463. return trim$1(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
  464. }
  465. function whitespace(type) {
  466. while (character = peek())
  467. if (character < 33)
  468. next();
  469. else
  470. break;
  471. return token(type) > 2 || token(character) > 3 ? "" : " ";
  472. }
  473. function escaping(index, count) {
  474. while (--count && next())
  475. if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
  476. break;
  477. return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
  478. }
  479. function delimiter(type) {
  480. while (next())
  481. switch (character) {
  482. case type:
  483. return position;
  484. case 34:
  485. case 39:
  486. if (type !== 34 && type !== 39)
  487. delimiter(character);
  488. break;
  489. case 40:
  490. if (type === 41)
  491. delimiter(type);
  492. break;
  493. case 92:
  494. next();
  495. break;
  496. }
  497. return position;
  498. }
  499. function commenter(type, index) {
  500. while (next())
  501. if (type + character === 47 + 10)
  502. break;
  503. else if (type + character === 42 + 42 && peek() === 47)
  504. break;
  505. return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
  506. }
  507. function identifier(index) {
  508. while (!token(peek()))
  509. next();
  510. return slice(index, position);
  511. }
  512. function compile(value) {
  513. return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value));
  514. }
  515. function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
  516. var index = 0;
  517. var offset = 0;
  518. var length2 = pseudo;
  519. var atrule = 0;
  520. var property = 0;
  521. var previous = 0;
  522. var variable = 1;
  523. var scanning = 1;
  524. var ampersand = 1;
  525. var character2 = 0;
  526. var type = "";
  527. var props = rules;
  528. var children = rulesets;
  529. var reference = rule;
  530. var characters2 = type;
  531. while (scanning)
  532. switch (previous = character2, character2 = next()) {
  533. case 40:
  534. if (previous != 108 && charat(characters2, length2 - 1) == 58) {
  535. if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f") != -1)
  536. ampersand = -1;
  537. break;
  538. }
  539. case 34:
  540. case 39:
  541. case 91:
  542. characters2 += delimit(character2);
  543. break;
  544. case 9:
  545. case 10:
  546. case 13:
  547. case 32:
  548. characters2 += whitespace(previous);
  549. break;
  550. case 92:
  551. characters2 += escaping(caret() - 1, 7);
  552. continue;
  553. case 47:
  554. switch (peek()) {
  555. case 42:
  556. case 47:
  557. append(comment(commenter(next(), caret()), root, parent), declarations);
  558. break;
  559. default:
  560. characters2 += "/";
  561. }
  562. break;
  563. case 123 * variable:
  564. points[index++] = strlen(characters2) * ampersand;
  565. case 125 * variable:
  566. case 59:
  567. case 0:
  568. switch (character2) {
  569. case 0:
  570. case 125:
  571. scanning = 0;
  572. case 59 + offset:
  573. if (ampersand == -1) characters2 = replace(characters2, /\f/g, "");
  574. if (property > 0 && strlen(characters2) - length2)
  575. append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2), declarations);
  576. break;
  577. case 59:
  578. characters2 += ";";
  579. default:
  580. append(reference = ruleset(characters2, root, parent, index, offset, rules, points, type, props = [], children = [], length2), rulesets);
  581. if (character2 === 123)
  582. if (offset === 0)
  583. parse(characters2, root, reference, reference, props, rulesets, length2, points, children);
  584. else
  585. switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
  586. case 100:
  587. case 108:
  588. case 109:
  589. case 115:
  590. parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length2), children), rules, children, length2, points, rule ? props : children);
  591. break;
  592. default:
  593. parse(characters2, reference, reference, reference, [""], children, 0, points, children);
  594. }
  595. }
  596. index = offset = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo;
  597. break;
  598. case 58:
  599. length2 = 1 + strlen(characters2), property = previous;
  600. default:
  601. if (variable < 1) {
  602. if (character2 == 123)
  603. --variable;
  604. else if (character2 == 125 && variable++ == 0 && prev() == 125)
  605. continue;
  606. }
  607. switch (characters2 += from(character2), character2 * variable) {
  608. case 38:
  609. ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
  610. break;
  611. case 44:
  612. points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
  613. break;
  614. case 64:
  615. if (peek() === 45)
  616. characters2 += delimit(next());
  617. atrule = peek(), offset = length2 = strlen(type = characters2 += identifier(caret())), character2++;
  618. break;
  619. case 45:
  620. if (previous === 45 && strlen(characters2) == 2)
  621. variable = 0;
  622. }
  623. }
  624. return rulesets;
  625. }
  626. function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length2) {
  627. var post = offset - 1;
  628. var rule = offset === 0 ? rules : [""];
  629. var size = sizeof(rule);
  630. for (var i = 0, j = 0, k2 = 0; i < index; ++i)
  631. for (var x2 = 0, y2 = substr(value, post + 1, post = abs(j = points[i])), z2 = value; x2 < size; ++x2)
  632. if (z2 = trim$1(j > 0 ? rule[x2] + " " + y2 : replace(y2, /&\f/g, rule[x2])))
  633. props[k2++] = z2;
  634. return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length2);
  635. }
  636. function comment(value, root, parent) {
  637. return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
  638. }
  639. function declaration(value, root, parent, length2) {
  640. return node(value, root, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2);
  641. }
  642. function serialize(children, callback) {
  643. var output = "";
  644. var length2 = sizeof(children);
  645. for (var i = 0; i < length2; i++)
  646. output += callback(children[i], i, children, callback) || "";
  647. return output;
  648. }
  649. function stringify(element, index, children, callback) {
  650. switch (element.type) {
  651. case LAYER:
  652. if (element.children.length) break;
  653. case IMPORT:
  654. case DECLARATION:
  655. return element.return = element.return || element.value;
  656. case COMMENT:
  657. return "";
  658. case KEYFRAMES:
  659. return element.return = element.value + "{" + serialize(element.children, callback) + "}";
  660. case RULESET:
  661. element.value = element.props.join(",");
  662. }
  663. return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
  664. }
  665. function middleware(collection) {
  666. var length2 = sizeof(collection);
  667. return function(element, index, children, callback) {
  668. var output = "";
  669. for (var i = 0; i < length2; i++)
  670. output += collection[i](element, index, children, callback) || "";
  671. return output;
  672. };
  673. }
  674. function rulesheet(callback) {
  675. return function(element) {
  676. if (!element.root) {
  677. if (element = element.return)
  678. callback(element);
  679. }
  680. };
  681. }
  682. var identifierWithPointTracking = function identifierWithPointTracking2(begin, points, index) {
  683. var previous = 0;
  684. var character2 = 0;
  685. while (true) {
  686. previous = character2;
  687. character2 = peek();
  688. if (previous === 38 && character2 === 12) {
  689. points[index] = 1;
  690. }
  691. if (token(character2)) {
  692. break;
  693. }
  694. next();
  695. }
  696. return slice(begin, position);
  697. };
  698. var toRules = function toRules2(parsed, points) {
  699. var index = -1;
  700. var character2 = 44;
  701. do {
  702. switch (token(character2)) {
  703. case 0:
  704. if (character2 === 38 && peek() === 12) {
  705. points[index] = 1;
  706. }
  707. parsed[index] += identifierWithPointTracking(position - 1, points, index);
  708. break;
  709. case 2:
  710. parsed[index] += delimit(character2);
  711. break;
  712. case 4:
  713. if (character2 === 44) {
  714. parsed[++index] = peek() === 58 ? "&\f" : "";
  715. points[index] = parsed[index].length;
  716. break;
  717. }
  718. default:
  719. parsed[index] += from(character2);
  720. }
  721. } while (character2 = next());
  722. return parsed;
  723. };
  724. var getRules = function getRules2(value, points) {
  725. return dealloc(toRules(alloc(value), points));
  726. };
  727. var fixedElements = /* @__PURE__ */ new WeakMap();
  728. var compat = function compat2(element) {
  729. if (element.type !== "rule" || !element.parent || // positive .length indicates that this rule contains pseudo
  730. // negative .length indicates that this rule has been already prefixed
  731. element.length < 1) {
  732. return;
  733. }
  734. var value = element.value, parent = element.parent;
  735. var isImplicitRule = element.column === parent.column && element.line === parent.line;
  736. while (parent.type !== "rule") {
  737. parent = parent.parent;
  738. if (!parent) return;
  739. }
  740. if (element.props.length === 1 && value.charCodeAt(0) !== 58 && !fixedElements.get(parent)) {
  741. return;
  742. }
  743. if (isImplicitRule) {
  744. return;
  745. }
  746. fixedElements.set(element, true);
  747. var points = [];
  748. var rules = getRules(value, points);
  749. var parentRules = parent.props;
  750. for (var i = 0, k2 = 0; i < rules.length; i++) {
  751. for (var j = 0; j < parentRules.length; j++, k2++) {
  752. element.props[k2] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
  753. }
  754. }
  755. };
  756. var removeLabel = function removeLabel2(element) {
  757. if (element.type === "decl") {
  758. var value = element.value;
  759. if (
  760. // charcode for l
  761. value.charCodeAt(0) === 108 && // charcode for b
  762. value.charCodeAt(2) === 98
  763. ) {
  764. element["return"] = "";
  765. element.value = "";
  766. }
  767. }
  768. };
  769. function prefix(value, length2) {
  770. switch (hash(value, length2)) {
  771. case 5103:
  772. return WEBKIT + "print-" + value + value;
  773. case 5737:
  774. case 4201:
  775. case 3177:
  776. case 3433:
  777. case 1641:
  778. case 4457:
  779. case 2921:
  780. case 5572:
  781. case 6356:
  782. case 5844:
  783. case 3191:
  784. case 6645:
  785. case 3005:
  786. case 6391:
  787. case 5879:
  788. case 5623:
  789. case 6135:
  790. case 4599:
  791. case 4855:
  792. case 4215:
  793. case 6389:
  794. case 5109:
  795. case 5365:
  796. case 5621:
  797. case 3829:
  798. return WEBKIT + value + value;
  799. case 5349:
  800. case 4246:
  801. case 4810:
  802. case 6968:
  803. case 2756:
  804. return WEBKIT + value + MOZ + value + MS + value + value;
  805. case 6828:
  806. case 4268:
  807. return WEBKIT + value + MS + value + value;
  808. case 6165:
  809. return WEBKIT + value + MS + "flex-" + value + value;
  810. case 5187:
  811. return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
  812. case 5443:
  813. return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/, "") + value;
  814. case 4675:
  815. return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/, "") + value;
  816. case 5548:
  817. return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
  818. case 5292:
  819. return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
  820. case 6060:
  821. return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
  822. case 4554:
  823. return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
  824. case 6187:
  825. return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
  826. case 5495:
  827. case 3959:
  828. return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
  829. case 4968:
  830. return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
  831. case 4095:
  832. case 3583:
  833. case 4068:
  834. case 2532:
  835. return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
  836. case 8116:
  837. case 7059:
  838. case 5753:
  839. case 5535:
  840. case 5445:
  841. case 5701:
  842. case 4933:
  843. case 4677:
  844. case 5533:
  845. case 5789:
  846. case 5021:
  847. case 4765:
  848. if (strlen(value) - 1 - length2 > 6) switch (charat(value, length2 + 1)) {
  849. case 109:
  850. if (charat(value, length2 + 4) !== 45) break;
  851. case 102:
  852. return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length2 + 3) == 108 ? "$3" : "$2-$3")) + value;
  853. case 115:
  854. return ~indexof(value, "stretch") ? prefix(replace(value, "stretch", "fill-available"), length2) + value : value;
  855. }
  856. break;
  857. case 4949:
  858. if (charat(value, length2 + 1) !== 115) break;
  859. case 6444:
  860. switch (charat(value, strlen(value) - 3 - (~indexof(value, "!important") && 10))) {
  861. case 107:
  862. return replace(value, ":", ":" + WEBKIT) + value;
  863. case 101:
  864. return replace(value, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
  865. }
  866. break;
  867. case 5936:
  868. switch (charat(value, length2 + 11)) {
  869. case 114:
  870. return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
  871. case 108:
  872. return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
  873. case 45:
  874. return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
  875. }
  876. return WEBKIT + value + MS + value + value;
  877. }
  878. return value;
  879. }
  880. var prefixer = function prefixer2(element, index, children, callback) {
  881. if (element.length > -1) {
  882. if (!element["return"]) switch (element.type) {
  883. case DECLARATION:
  884. element["return"] = prefix(element.value, element.length);
  885. break;
  886. case KEYFRAMES:
  887. return serialize([copy(element, {
  888. value: replace(element.value, "@", "@" + WEBKIT)
  889. })], callback);
  890. case RULESET:
  891. if (element.length) return combine(element.props, function(value) {
  892. switch (match(value, /(::plac\w+|:read-\w+)/)) {
  893. case ":read-only":
  894. case ":read-write":
  895. return serialize([copy(element, {
  896. props: [replace(value, /:(read-\w+)/, ":" + MOZ + "$1")]
  897. })], callback);
  898. case "::placeholder":
  899. return serialize([copy(element, {
  900. props: [replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")]
  901. }), copy(element, {
  902. props: [replace(value, /:(plac\w+)/, ":" + MOZ + "$1")]
  903. }), copy(element, {
  904. props: [replace(value, /:(plac\w+)/, MS + "input-$1")]
  905. })], callback);
  906. }
  907. return "";
  908. });
  909. }
  910. }
  911. };
  912. var defaultStylisPlugins = [prefixer];
  913. var createCache = function createCache2(options) {
  914. var key = options.key;
  915. if (key === "css") {
  916. var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])");
  917. Array.prototype.forEach.call(ssrStyles, function(node2) {
  918. var dataEmotionAttribute = node2.getAttribute("data-emotion");
  919. if (dataEmotionAttribute.indexOf(" ") === -1) {
  920. return;
  921. }
  922. document.head.appendChild(node2);
  923. node2.setAttribute("data-s", "");
  924. });
  925. }
  926. var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
  927. var inserted = {};
  928. var container;
  929. var nodesToHydrate = [];
  930. {
  931. container = options.container || document.head;
  932. Array.prototype.forEach.call(
  933. // this means we will ignore elements which don't have a space in them which
  934. // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
  935. document.querySelectorAll('style[data-emotion^="' + key + ' "]'),
  936. function(node2) {
  937. var attrib = node2.getAttribute("data-emotion").split(" ");
  938. for (var i = 1; i < attrib.length; i++) {
  939. inserted[attrib[i]] = true;
  940. }
  941. nodesToHydrate.push(node2);
  942. }
  943. );
  944. }
  945. var _insert;
  946. var omnipresentPlugins = [compat, removeLabel];
  947. {
  948. var currentSheet;
  949. var finalizingPlugins = [stringify, rulesheet(function(rule) {
  950. currentSheet.insert(rule);
  951. })];
  952. var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
  953. var stylis = function stylis2(styles) {
  954. return serialize(compile(styles), serializer);
  955. };
  956. _insert = function insert(selector, serialized, sheet, shouldCache) {
  957. currentSheet = sheet;
  958. stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
  959. if (shouldCache) {
  960. cache.inserted[serialized.name] = true;
  961. }
  962. };
  963. }
  964. var cache = {
  965. key,
  966. sheet: new StyleSheet({
  967. key,
  968. container,
  969. nonce: options.nonce,
  970. speedy: options.speedy,
  971. prepend: options.prepend,
  972. insertionPoint: options.insertionPoint
  973. }),
  974. nonce: options.nonce,
  975. inserted,
  976. registered: {},
  977. insert: _insert
  978. };
  979. cache.sheet.hydrate(nodesToHydrate);
  980. return cache;
  981. };
  982. var reactIs$1 = { exports: {} };
  983. var reactIs_production_min = {};
  984. /** @license React v16.13.1
  985. * react-is.production.min.js
  986. *
  987. * Copyright (c) Facebook, Inc. and its affiliates.
  988. *
  989. * This source code is licensed under the MIT license found in the
  990. * LICENSE file in the root directory of this source tree.
  991. */
  992. var b = "function" === typeof Symbol && Symbol.for, c = b ? Symbol.for("react.element") : 60103, d = b ? Symbol.for("react.portal") : 60106, e = b ? Symbol.for("react.fragment") : 60107, f = b ? Symbol.for("react.strict_mode") : 60108, g = b ? Symbol.for("react.profiler") : 60114, h = b ? Symbol.for("react.provider") : 60109, k = b ? Symbol.for("react.context") : 60110, l = b ? Symbol.for("react.async_mode") : 60111, m = b ? Symbol.for("react.concurrent_mode") : 60111, n = b ? Symbol.for("react.forward_ref") : 60112, p = b ? Symbol.for("react.suspense") : 60113, q = b ? Symbol.for("react.suspense_list") : 60120, r$1 = b ? Symbol.for("react.memo") : 60115, t = b ? Symbol.for("react.lazy") : 60116, v = b ? Symbol.for("react.block") : 60121, w = b ? Symbol.for("react.fundamental") : 60117, x = b ? Symbol.for("react.responder") : 60118, y = b ? Symbol.for("react.scope") : 60119;
  993. function z(a) {
  994. if ("object" === typeof a && null !== a) {
  995. var u = a.$$typeof;
  996. switch (u) {
  997. case c:
  998. switch (a = a.type, a) {
  999. case l:
  1000. case m:
  1001. case e:
  1002. case g:
  1003. case f:
  1004. case p:
  1005. return a;
  1006. default:
  1007. switch (a = a && a.$$typeof, a) {
  1008. case k:
  1009. case n:
  1010. case t:
  1011. case r$1:
  1012. case h:
  1013. return a;
  1014. default:
  1015. return u;
  1016. }
  1017. }
  1018. case d:
  1019. return u;
  1020. }
  1021. }
  1022. }
  1023. function A(a) {
  1024. return z(a) === m;
  1025. }
  1026. reactIs_production_min.AsyncMode = l;
  1027. reactIs_production_min.ConcurrentMode = m;
  1028. reactIs_production_min.ContextConsumer = k;
  1029. reactIs_production_min.ContextProvider = h;
  1030. reactIs_production_min.Element = c;
  1031. reactIs_production_min.ForwardRef = n;
  1032. reactIs_production_min.Fragment = e;
  1033. reactIs_production_min.Lazy = t;
  1034. reactIs_production_min.Memo = r$1;
  1035. reactIs_production_min.Portal = d;
  1036. reactIs_production_min.Profiler = g;
  1037. reactIs_production_min.StrictMode = f;
  1038. reactIs_production_min.Suspense = p;
  1039. reactIs_production_min.isAsyncMode = function(a) {
  1040. return A(a) || z(a) === l;
  1041. };
  1042. reactIs_production_min.isConcurrentMode = A;
  1043. reactIs_production_min.isContextConsumer = function(a) {
  1044. return z(a) === k;
  1045. };
  1046. reactIs_production_min.isContextProvider = function(a) {
  1047. return z(a) === h;
  1048. };
  1049. reactIs_production_min.isElement = function(a) {
  1050. return "object" === typeof a && null !== a && a.$$typeof === c;
  1051. };
  1052. reactIs_production_min.isForwardRef = function(a) {
  1053. return z(a) === n;
  1054. };
  1055. reactIs_production_min.isFragment = function(a) {
  1056. return z(a) === e;
  1057. };
  1058. reactIs_production_min.isLazy = function(a) {
  1059. return z(a) === t;
  1060. };
  1061. reactIs_production_min.isMemo = function(a) {
  1062. return z(a) === r$1;
  1063. };
  1064. reactIs_production_min.isPortal = function(a) {
  1065. return z(a) === d;
  1066. };
  1067. reactIs_production_min.isProfiler = function(a) {
  1068. return z(a) === g;
  1069. };
  1070. reactIs_production_min.isStrictMode = function(a) {
  1071. return z(a) === f;
  1072. };
  1073. reactIs_production_min.isSuspense = function(a) {
  1074. return z(a) === p;
  1075. };
  1076. reactIs_production_min.isValidElementType = function(a) {
  1077. return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r$1 || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
  1078. };
  1079. reactIs_production_min.typeOf = z;
  1080. {
  1081. reactIs$1.exports = reactIs_production_min;
  1082. }
  1083. var reactIsExports = reactIs$1.exports;
  1084. var reactIs = reactIsExports;
  1085. var FORWARD_REF_STATICS = {
  1086. "$$typeof": true,
  1087. render: true,
  1088. defaultProps: true,
  1089. displayName: true,
  1090. propTypes: true
  1091. };
  1092. var MEMO_STATICS = {
  1093. "$$typeof": true,
  1094. compare: true,
  1095. defaultProps: true,
  1096. displayName: true,
  1097. propTypes: true,
  1098. type: true
  1099. };
  1100. var TYPE_STATICS = {};
  1101. TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
  1102. TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
  1103. var isBrowser = true;
  1104. function getRegisteredStyles(registered, registeredStyles, classNames) {
  1105. var rawClassName = "";
  1106. classNames.split(" ").forEach(function(className) {
  1107. if (registered[className] !== void 0) {
  1108. registeredStyles.push(registered[className] + ";");
  1109. } else if (className) {
  1110. rawClassName += className + " ";
  1111. }
  1112. });
  1113. return rawClassName;
  1114. }
  1115. var registerStyles = function registerStyles2(cache, serialized, isStringTag2) {
  1116. var className = cache.key + "-" + serialized.name;
  1117. if (
  1118. // we only need to add the styles to the registered cache if the
  1119. // class name could be used further down
  1120. // the tree but if it's a string tag, we know it won't
  1121. // so we don't have to add it to registered cache.
  1122. // this improves memory usage since we can avoid storing the whole style string
  1123. (isStringTag2 === false || // we need to always store it if we're in compat mode and
  1124. // in node since emotion-server relies on whether a style is in
  1125. // the registered cache to know whether a style is global or not
  1126. // also, note that this check will be dead code eliminated in the browser
  1127. isBrowser === false) && cache.registered[className] === void 0
  1128. ) {
  1129. cache.registered[className] = serialized.styles;
  1130. }
  1131. };
  1132. var insertStyles = function insertStyles2(cache, serialized, isStringTag2) {
  1133. registerStyles(cache, serialized, isStringTag2);
  1134. var className = cache.key + "-" + serialized.name;
  1135. if (cache.inserted[serialized.name] === void 0) {
  1136. var current = serialized;
  1137. do {
  1138. cache.insert(serialized === current ? "." + className : "", current, cache.sheet, true);
  1139. current = current.next;
  1140. } while (current !== void 0);
  1141. }
  1142. };
  1143. function murmur2(str) {
  1144. var h2 = 0;
  1145. var k2, i = 0, len = str.length;
  1146. for (; len >= 4; ++i, len -= 4) {
  1147. k2 = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;
  1148. k2 = /* Math.imul(k, m): */
  1149. (k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16);
  1150. k2 ^= /* k >>> r: */
  1151. k2 >>> 24;
  1152. h2 = /* Math.imul(k, m): */
  1153. (k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
  1154. (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
  1155. }
  1156. switch (len) {
  1157. case 3:
  1158. h2 ^= (str.charCodeAt(i + 2) & 255) << 16;
  1159. case 2:
  1160. h2 ^= (str.charCodeAt(i + 1) & 255) << 8;
  1161. case 1:
  1162. h2 ^= str.charCodeAt(i) & 255;
  1163. h2 = /* Math.imul(h, m): */
  1164. (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
  1165. }
  1166. h2 ^= h2 >>> 13;
  1167. h2 = /* Math.imul(h, m): */
  1168. (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
  1169. return ((h2 ^ h2 >>> 15) >>> 0).toString(36);
  1170. }
  1171. var unitlessKeys = {
  1172. animationIterationCount: 1,
  1173. aspectRatio: 1,
  1174. borderImageOutset: 1,
  1175. borderImageSlice: 1,
  1176. borderImageWidth: 1,
  1177. boxFlex: 1,
  1178. boxFlexGroup: 1,
  1179. boxOrdinalGroup: 1,
  1180. columnCount: 1,
  1181. columns: 1,
  1182. flex: 1,
  1183. flexGrow: 1,
  1184. flexPositive: 1,
  1185. flexShrink: 1,
  1186. flexNegative: 1,
  1187. flexOrder: 1,
  1188. gridRow: 1,
  1189. gridRowEnd: 1,
  1190. gridRowSpan: 1,
  1191. gridRowStart: 1,
  1192. gridColumn: 1,
  1193. gridColumnEnd: 1,
  1194. gridColumnSpan: 1,
  1195. gridColumnStart: 1,
  1196. msGridRow: 1,
  1197. msGridRowSpan: 1,
  1198. msGridColumn: 1,
  1199. msGridColumnSpan: 1,
  1200. fontWeight: 1,
  1201. lineHeight: 1,
  1202. opacity: 1,
  1203. order: 1,
  1204. orphans: 1,
  1205. scale: 1,
  1206. tabSize: 1,
  1207. widows: 1,
  1208. zIndex: 1,
  1209. zoom: 1,
  1210. WebkitLineClamp: 1,
  1211. // SVG-related properties
  1212. fillOpacity: 1,
  1213. floodOpacity: 1,
  1214. stopOpacity: 1,
  1215. strokeDasharray: 1,
  1216. strokeDashoffset: 1,
  1217. strokeMiterlimit: 1,
  1218. strokeOpacity: 1,
  1219. strokeWidth: 1
  1220. };
  1221. var isDevelopment$1 = false;
  1222. var hyphenateRegex = /[A-Z]|^ms/g;
  1223. var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
  1224. var isCustomProperty = function isCustomProperty2(property) {
  1225. return property.charCodeAt(1) === 45;
  1226. };
  1227. var isProcessableValue = function isProcessableValue2(value) {
  1228. return value != null && typeof value !== "boolean";
  1229. };
  1230. var processStyleName = /* @__PURE__ */ memoize$1(function(styleName) {
  1231. return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
  1232. });
  1233. var processStyleValue = function processStyleValue2(key, value) {
  1234. switch (key) {
  1235. case "animation":
  1236. case "animationName": {
  1237. if (typeof value === "string") {
  1238. return value.replace(animationRegex, function(match2, p1, p2) {
  1239. cursor = {
  1240. name: p1,
  1241. styles: p2,
  1242. next: cursor
  1243. };
  1244. return p1;
  1245. });
  1246. }
  1247. }
  1248. }
  1249. if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === "number" && value !== 0) {
  1250. return value + "px";
  1251. }
  1252. return value;
  1253. };
  1254. var noComponentSelectorMessage = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
  1255. function handleInterpolation(mergedProps, registered, interpolation) {
  1256. if (interpolation == null) {
  1257. return "";
  1258. }
  1259. var componentSelector = interpolation;
  1260. if (componentSelector.__emotion_styles !== void 0) {
  1261. return componentSelector;
  1262. }
  1263. switch (typeof interpolation) {
  1264. case "boolean": {
  1265. return "";
  1266. }
  1267. case "object": {
  1268. var keyframes3 = interpolation;
  1269. if (keyframes3.anim === 1) {
  1270. cursor = {
  1271. name: keyframes3.name,
  1272. styles: keyframes3.styles,
  1273. next: cursor
  1274. };
  1275. return keyframes3.name;
  1276. }
  1277. var serializedStyles = interpolation;
  1278. if (serializedStyles.styles !== void 0) {
  1279. var next2 = serializedStyles.next;
  1280. if (next2 !== void 0) {
  1281. while (next2 !== void 0) {
  1282. cursor = {
  1283. name: next2.name,
  1284. styles: next2.styles,
  1285. next: cursor
  1286. };
  1287. next2 = next2.next;
  1288. }
  1289. }
  1290. var styles = serializedStyles.styles + ";";
  1291. return styles;
  1292. }
  1293. return createStringFromObject(mergedProps, registered, interpolation);
  1294. }
  1295. case "function": {
  1296. if (mergedProps !== void 0) {
  1297. var previousCursor = cursor;
  1298. var result = interpolation(mergedProps);
  1299. cursor = previousCursor;
  1300. return handleInterpolation(mergedProps, registered, result);
  1301. }
  1302. break;
  1303. }
  1304. }
  1305. var asString = interpolation;
  1306. if (registered == null) {
  1307. return asString;
  1308. }
  1309. var cached = registered[asString];
  1310. return cached !== void 0 ? cached : asString;
  1311. }
  1312. function createStringFromObject(mergedProps, registered, obj) {
  1313. var string = "";
  1314. if (Array.isArray(obj)) {
  1315. for (var i = 0; i < obj.length; i++) {
  1316. string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
  1317. }
  1318. } else {
  1319. for (var key in obj) {
  1320. var value = obj[key];
  1321. if (typeof value !== "object") {
  1322. var asString = value;
  1323. if (registered != null && registered[asString] !== void 0) {
  1324. string += key + "{" + registered[asString] + "}";
  1325. } else if (isProcessableValue(asString)) {
  1326. string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
  1327. }
  1328. } else {
  1329. if (key === "NO_COMPONENT_SELECTOR" && isDevelopment$1) {
  1330. throw new Error(noComponentSelectorMessage);
  1331. }
  1332. if (Array.isArray(value) && typeof value[0] === "string" && (registered == null || registered[value[0]] === void 0)) {
  1333. for (var _i = 0; _i < value.length; _i++) {
  1334. if (isProcessableValue(value[_i])) {
  1335. string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
  1336. }
  1337. }
  1338. } else {
  1339. var interpolated = handleInterpolation(mergedProps, registered, value);
  1340. switch (key) {
  1341. case "animation":
  1342. case "animationName": {
  1343. string += processStyleName(key) + ":" + interpolated + ";";
  1344. break;
  1345. }
  1346. default: {
  1347. string += key + "{" + interpolated + "}";
  1348. }
  1349. }
  1350. }
  1351. }
  1352. }
  1353. }
  1354. return string;
  1355. }
  1356. var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g;
  1357. var cursor;
  1358. function serializeStyles(args, registered, mergedProps) {
  1359. if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && args[0].styles !== void 0) {
  1360. return args[0];
  1361. }
  1362. var stringMode = true;
  1363. var styles = "";
  1364. cursor = void 0;
  1365. var strings = args[0];
  1366. if (strings == null || strings.raw === void 0) {
  1367. stringMode = false;
  1368. styles += handleInterpolation(mergedProps, registered, strings);
  1369. } else {
  1370. var asTemplateStringsArr = strings;
  1371. styles += asTemplateStringsArr[0];
  1372. }
  1373. for (var i = 1; i < args.length; i++) {
  1374. styles += handleInterpolation(mergedProps, registered, args[i]);
  1375. if (stringMode) {
  1376. var templateStringsArr = strings;
  1377. styles += templateStringsArr[i];
  1378. }
  1379. }
  1380. labelPattern.lastIndex = 0;
  1381. var identifierName = "";
  1382. var match2;
  1383. while ((match2 = labelPattern.exec(styles)) !== null) {
  1384. identifierName += "-" + match2[1];
  1385. }
  1386. var name = murmur2(styles) + identifierName;
  1387. return {
  1388. name,
  1389. styles,
  1390. next: cursor
  1391. };
  1392. }
  1393. var syncFallback = function syncFallback2(create) {
  1394. return create();
  1395. };
  1396. var useInsertionEffect = React__namespace["useInsertionEffect"] ? React__namespace["useInsertionEffect"] : false;
  1397. var useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;
  1398. var EmotionCacheContext = /* @__PURE__ */ React__namespace.createContext(
  1399. // we're doing this to avoid preconstruct's dead code elimination in this one case
  1400. // because this module is primarily intended for the browser and node
  1401. // but it's also required in react native and similar environments sometimes
  1402. // and we could have a special build just for that
  1403. // but this is much easier and the native packages
  1404. // might use a different theme context in the future anyway
  1405. typeof HTMLElement !== "undefined" ? /* @__PURE__ */ createCache({
  1406. key: "css"
  1407. }) : null
  1408. );
  1409. EmotionCacheContext.Provider;
  1410. var withEmotionCache = function withEmotionCache2(func) {
  1411. return /* @__PURE__ */ React.forwardRef(function(props, ref) {
  1412. var cache = React.useContext(EmotionCacheContext);
  1413. return func(props, cache, ref);
  1414. });
  1415. };
  1416. var ThemeContext = /* @__PURE__ */ React__namespace.createContext({});
  1417. function css() {
  1418. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  1419. args[_key] = arguments[_key];
  1420. }
  1421. return serializeStyles(args);
  1422. }
  1423. var keyframes = function keyframes2() {
  1424. var insertable = css.apply(void 0, arguments);
  1425. var name = "animation-" + insertable.name;
  1426. return {
  1427. name,
  1428. styles: "@keyframes " + name + "{" + insertable.styles + "}",
  1429. anim: 1,
  1430. toString: function toString3() {
  1431. return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
  1432. }
  1433. };
  1434. };
  1435. var testOmitPropsOnStringTag = isPropValid;
  1436. var testOmitPropsOnComponent = function testOmitPropsOnComponent2(key) {
  1437. return key !== "theme";
  1438. };
  1439. var getDefaultShouldForwardProp = function getDefaultShouldForwardProp2(tag) {
  1440. return typeof tag === "string" && // 96 is one less than the char code
  1441. // for "a" so this is checking that
  1442. // it's a lowercase character
  1443. tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
  1444. };
  1445. var composeShouldForwardProps = function composeShouldForwardProps2(tag, options, isReal) {
  1446. var shouldForwardProp2;
  1447. if (options) {
  1448. var optionsShouldForwardProp = options.shouldForwardProp;
  1449. shouldForwardProp2 = tag.__emotion_forwardProp && optionsShouldForwardProp ? function(propName) {
  1450. return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
  1451. } : optionsShouldForwardProp;
  1452. }
  1453. if (typeof shouldForwardProp2 !== "function" && isReal) {
  1454. shouldForwardProp2 = tag.__emotion_forwardProp;
  1455. }
  1456. return shouldForwardProp2;
  1457. };
  1458. var isDevelopment = false;
  1459. var Insertion = function Insertion2(_ref) {
  1460. var cache = _ref.cache, serialized = _ref.serialized, isStringTag2 = _ref.isStringTag;
  1461. registerStyles(cache, serialized, isStringTag2);
  1462. useInsertionEffectAlwaysWithSyncFallback(function() {
  1463. return insertStyles(cache, serialized, isStringTag2);
  1464. });
  1465. return null;
  1466. };
  1467. var createStyled$1 = function createStyled(tag, options) {
  1468. var isReal = tag.__emotion_real === tag;
  1469. var baseTag = isReal && tag.__emotion_base || tag;
  1470. var identifierName;
  1471. var targetClassName;
  1472. if (options !== void 0) {
  1473. identifierName = options.label;
  1474. targetClassName = options.target;
  1475. }
  1476. var shouldForwardProp2 = composeShouldForwardProps(tag, options, isReal);
  1477. var defaultShouldForwardProp = shouldForwardProp2 || getDefaultShouldForwardProp(baseTag);
  1478. var shouldUseAs = !defaultShouldForwardProp("as");
  1479. return function() {
  1480. var args = arguments;
  1481. var styles = isReal && tag.__emotion_styles !== void 0 ? tag.__emotion_styles.slice(0) : [];
  1482. if (identifierName !== void 0) {
  1483. styles.push("label:" + identifierName + ";");
  1484. }
  1485. if (args[0] == null || args[0].raw === void 0) {
  1486. styles.push.apply(styles, args);
  1487. } else {
  1488. styles.push(args[0][0]);
  1489. var len = args.length;
  1490. var i = 1;
  1491. for (; i < len; i++) {
  1492. styles.push(args[i], args[0][i]);
  1493. }
  1494. }
  1495. var Styled = withEmotionCache(function(props, cache, ref) {
  1496. var FinalTag = shouldUseAs && props.as || baseTag;
  1497. var className = "";
  1498. var classInterpolations = [];
  1499. var mergedProps = props;
  1500. if (props.theme == null) {
  1501. mergedProps = {};
  1502. for (var key in props) {
  1503. mergedProps[key] = props[key];
  1504. }
  1505. mergedProps.theme = React__namespace.useContext(ThemeContext);
  1506. }
  1507. if (typeof props.className === "string") {
  1508. className = getRegisteredStyles(cache.registered, classInterpolations, props.className);
  1509. } else if (props.className != null) {
  1510. className = props.className + " ";
  1511. }
  1512. var serialized = serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
  1513. className += cache.key + "-" + serialized.name;
  1514. if (targetClassName !== void 0) {
  1515. className += " " + targetClassName;
  1516. }
  1517. var finalShouldForwardProp = shouldUseAs && shouldForwardProp2 === void 0 ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
  1518. var newProps = {};
  1519. for (var _key in props) {
  1520. if (shouldUseAs && _key === "as") continue;
  1521. if (finalShouldForwardProp(_key)) {
  1522. newProps[_key] = props[_key];
  1523. }
  1524. }
  1525. newProps.className = className;
  1526. if (ref) {
  1527. newProps.ref = ref;
  1528. }
  1529. return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(Insertion, {
  1530. cache,
  1531. serialized,
  1532. isStringTag: typeof FinalTag === "string"
  1533. }), /* @__PURE__ */ React__namespace.createElement(FinalTag, newProps));
  1534. });
  1535. Styled.displayName = identifierName !== void 0 ? identifierName : "Styled(" + (typeof baseTag === "string" ? baseTag : baseTag.displayName || baseTag.name || "Component") + ")";
  1536. Styled.defaultProps = tag.defaultProps;
  1537. Styled.__emotion_real = Styled;
  1538. Styled.__emotion_base = baseTag;
  1539. Styled.__emotion_styles = styles;
  1540. Styled.__emotion_forwardProp = shouldForwardProp2;
  1541. Object.defineProperty(Styled, "toString", {
  1542. value: function value() {
  1543. if (targetClassName === void 0 && isDevelopment) {
  1544. return "NO_COMPONENT_SELECTOR";
  1545. }
  1546. return "." + targetClassName;
  1547. }
  1548. });
  1549. Styled.withComponent = function(nextTag, nextOptions) {
  1550. return createStyled(nextTag, _extends({}, options, nextOptions, {
  1551. shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
  1552. })).apply(void 0, styles);
  1553. };
  1554. return Styled;
  1555. };
  1556. };
  1557. var tags = [
  1558. "a",
  1559. "abbr",
  1560. "address",
  1561. "area",
  1562. "article",
  1563. "aside",
  1564. "audio",
  1565. "b",
  1566. "base",
  1567. "bdi",
  1568. "bdo",
  1569. "big",
  1570. "blockquote",
  1571. "body",
  1572. "br",
  1573. "button",
  1574. "canvas",
  1575. "caption",
  1576. "cite",
  1577. "code",
  1578. "col",
  1579. "colgroup",
  1580. "data",
  1581. "datalist",
  1582. "dd",
  1583. "del",
  1584. "details",
  1585. "dfn",
  1586. "dialog",
  1587. "div",
  1588. "dl",
  1589. "dt",
  1590. "em",
  1591. "embed",
  1592. "fieldset",
  1593. "figcaption",
  1594. "figure",
  1595. "footer",
  1596. "form",
  1597. "h1",
  1598. "h2",
  1599. "h3",
  1600. "h4",
  1601. "h5",
  1602. "h6",
  1603. "head",
  1604. "header",
  1605. "hgroup",
  1606. "hr",
  1607. "html",
  1608. "i",
  1609. "iframe",
  1610. "img",
  1611. "input",
  1612. "ins",
  1613. "kbd",
  1614. "keygen",
  1615. "label",
  1616. "legend",
  1617. "li",
  1618. "link",
  1619. "main",
  1620. "map",
  1621. "mark",
  1622. "marquee",
  1623. "menu",
  1624. "menuitem",
  1625. "meta",
  1626. "meter",
  1627. "nav",
  1628. "noscript",
  1629. "object",
  1630. "ol",
  1631. "optgroup",
  1632. "option",
  1633. "output",
  1634. "p",
  1635. "param",
  1636. "picture",
  1637. "pre",
  1638. "progress",
  1639. "q",
  1640. "rp",
  1641. "rt",
  1642. "ruby",
  1643. "s",
  1644. "samp",
  1645. "script",
  1646. "section",
  1647. "select",
  1648. "small",
  1649. "source",
  1650. "span",
  1651. "strong",
  1652. "style",
  1653. "sub",
  1654. "summary",
  1655. "sup",
  1656. "table",
  1657. "tbody",
  1658. "td",
  1659. "textarea",
  1660. "tfoot",
  1661. "th",
  1662. "thead",
  1663. "time",
  1664. "title",
  1665. "tr",
  1666. "track",
  1667. "u",
  1668. "ul",
  1669. "var",
  1670. "video",
  1671. "wbr",
  1672. // SVG
  1673. "circle",
  1674. "clipPath",
  1675. "defs",
  1676. "ellipse",
  1677. "foreignObject",
  1678. "g",
  1679. "image",
  1680. "line",
  1681. "linearGradient",
  1682. "mask",
  1683. "path",
  1684. "pattern",
  1685. "polygon",
  1686. "polyline",
  1687. "radialGradient",
  1688. "rect",
  1689. "stop",
  1690. "svg",
  1691. "text",
  1692. "tspan"
  1693. ];
  1694. var newStyled = createStyled$1.bind();
  1695. tags.forEach(function(tagName) {
  1696. newStyled[tagName] = newStyled(tagName);
  1697. });
  1698. /**
  1699. * @mui/styled-engine v6.1.5
  1700. *
  1701. * @license MIT
  1702. * This source code is licensed under the MIT license found in the
  1703. * LICENSE file in the root directory of this source tree.
  1704. */
  1705. function styled$1(tag, options) {
  1706. const stylesFactory = newStyled(tag, options);
  1707. return stylesFactory;
  1708. }
  1709. function internal_mutateStyles(tag, processor) {
  1710. if (Array.isArray(tag.__emotion_styles)) {
  1711. tag.__emotion_styles = processor(tag.__emotion_styles);
  1712. }
  1713. }
  1714. const wrapper = [];
  1715. function internal_serializeStyles(styles) {
  1716. wrapper[0] = styles;
  1717. return serializeStyles(wrapper);
  1718. }
  1719. function isPlainObject$1(item) {
  1720. if (typeof item !== "object" || item === null) {
  1721. return false;
  1722. }
  1723. const prototype2 = Object.getPrototypeOf(item);
  1724. return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
  1725. }
  1726. function deepClone(source) {
  1727. if (!isPlainObject$1(source)) {
  1728. return source;
  1729. }
  1730. const output = {};
  1731. Object.keys(source).forEach((key) => {
  1732. output[key] = deepClone(source[key]);
  1733. });
  1734. return output;
  1735. }
  1736. function deepmerge(target, source, options = {
  1737. clone: true
  1738. }) {
  1739. const output = options.clone ? {
  1740. ...target
  1741. } : target;
  1742. if (isPlainObject$1(target) && isPlainObject$1(source)) {
  1743. Object.keys(source).forEach((key) => {
  1744. if (isPlainObject$1(source[key]) && // Avoid prototype pollution
  1745. Object.prototype.hasOwnProperty.call(target, key) && isPlainObject$1(target[key])) {
  1746. output[key] = deepmerge(target[key], source[key], options);
  1747. } else if (options.clone) {
  1748. output[key] = isPlainObject$1(source[key]) ? deepClone(source[key]) : source[key];
  1749. } else {
  1750. output[key] = source[key];
  1751. }
  1752. });
  1753. }
  1754. return output;
  1755. }
  1756. const sortBreakpointsValues = (values2) => {
  1757. const breakpointsAsArray = Object.keys(values2).map((key) => ({
  1758. key,
  1759. val: values2[key]
  1760. })) || [];
  1761. breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
  1762. return breakpointsAsArray.reduce((acc, obj) => {
  1763. return {
  1764. ...acc,
  1765. [obj.key]: obj.val
  1766. };
  1767. }, {});
  1768. };
  1769. function createBreakpoints(breakpoints) {
  1770. const {
  1771. // The breakpoint **start** at this value.
  1772. // For instance with the first breakpoint xs: [xs, sm).
  1773. values: values2 = {
  1774. xs: 0,
  1775. // phone
  1776. sm: 600,
  1777. // tablet
  1778. md: 900,
  1779. // small laptop
  1780. lg: 1200,
  1781. // desktop
  1782. xl: 1536
  1783. // large screen
  1784. },
  1785. unit = "px",
  1786. step = 5,
  1787. ...other
  1788. } = breakpoints;
  1789. const sortedValues = sortBreakpointsValues(values2);
  1790. const keys = Object.keys(sortedValues);
  1791. function up(key) {
  1792. const value = typeof values2[key] === "number" ? values2[key] : key;
  1793. return `@media (min-width:${value}${unit})`;
  1794. }
  1795. function down(key) {
  1796. const value = typeof values2[key] === "number" ? values2[key] : key;
  1797. return `@media (max-width:${value - step / 100}${unit})`;
  1798. }
  1799. function between(start, end) {
  1800. const endIndex = keys.indexOf(end);
  1801. return `@media (min-width:${typeof values2[start] === "number" ? values2[start] : start}${unit}) and (max-width:${(endIndex !== -1 && typeof values2[keys[endIndex]] === "number" ? values2[keys[endIndex]] : end) - step / 100}${unit})`;
  1802. }
  1803. function only(key) {
  1804. if (keys.indexOf(key) + 1 < keys.length) {
  1805. return between(key, keys[keys.indexOf(key) + 1]);
  1806. }
  1807. return up(key);
  1808. }
  1809. function not(key) {
  1810. const keyIndex = keys.indexOf(key);
  1811. if (keyIndex === 0) {
  1812. return up(keys[1]);
  1813. }
  1814. if (keyIndex === keys.length - 1) {
  1815. return down(keys[keyIndex]);
  1816. }
  1817. return between(key, keys[keys.indexOf(key) + 1]).replace("@media", "@media not all and");
  1818. }
  1819. return {
  1820. keys,
  1821. values: sortedValues,
  1822. up,
  1823. down,
  1824. between,
  1825. only,
  1826. not,
  1827. unit,
  1828. ...other
  1829. };
  1830. }
  1831. function sortContainerQueries(theme, css2) {
  1832. if (!theme.containerQueries) {
  1833. return css2;
  1834. }
  1835. const sorted = Object.keys(css2).filter((key) => key.startsWith("@container")).sort((a, b2) => {
  1836. var _a, _b;
  1837. const regex = /min-width:\s*([0-9.]+)/;
  1838. return +(((_a = a.match(regex)) == null ? void 0 : _a[1]) || 0) - +(((_b = b2.match(regex)) == null ? void 0 : _b[1]) || 0);
  1839. });
  1840. if (!sorted.length) {
  1841. return css2;
  1842. }
  1843. return sorted.reduce((acc, key) => {
  1844. const value = css2[key];
  1845. delete acc[key];
  1846. acc[key] = value;
  1847. return acc;
  1848. }, {
  1849. ...css2
  1850. });
  1851. }
  1852. function isCqShorthand(breakpointKeys, value) {
  1853. return value === "@" || value.startsWith("@") && (breakpointKeys.some((key) => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
  1854. }
  1855. function getContainerQuery(theme, shorthand) {
  1856. const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
  1857. if (!matches) {
  1858. return null;
  1859. }
  1860. const [, containerQuery, containerName] = matches;
  1861. const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
  1862. return theme.containerQueries(containerName).up(value);
  1863. }
  1864. function cssContainerQueries(themeInput) {
  1865. const toContainerQuery = (mediaQuery, name) => mediaQuery.replace("@media", name ? `@container ${name}` : "@container");
  1866. function attachCq(node22, name) {
  1867. node22.up = (...args) => toContainerQuery(themeInput.breakpoints.up(...args), name);
  1868. node22.down = (...args) => toContainerQuery(themeInput.breakpoints.down(...args), name);
  1869. node22.between = (...args) => toContainerQuery(themeInput.breakpoints.between(...args), name);
  1870. node22.only = (...args) => toContainerQuery(themeInput.breakpoints.only(...args), name);
  1871. node22.not = (...args) => {
  1872. const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
  1873. if (result.includes("not all and")) {
  1874. return result.replace("not all and ", "").replace("min-width:", "width<").replace("max-width:", "width>").replace("and", "or");
  1875. }
  1876. return result;
  1877. };
  1878. }
  1879. const node2 = {};
  1880. const containerQueries = (name) => {
  1881. attachCq(node2, name);
  1882. return node2;
  1883. };
  1884. attachCq(containerQueries);
  1885. return {
  1886. ...themeInput,
  1887. containerQueries
  1888. };
  1889. }
  1890. const shape = {
  1891. borderRadius: 4
  1892. };
  1893. function merge$1(acc, item) {
  1894. if (!item) {
  1895. return acc;
  1896. }
  1897. return deepmerge(acc, item, {
  1898. clone: false
  1899. // No need to clone deep, it's way faster.
  1900. });
  1901. }
  1902. const values$1 = {
  1903. xs: 0,
  1904. // phone
  1905. sm: 600,
  1906. // tablet
  1907. md: 900,
  1908. // small laptop
  1909. lg: 1200,
  1910. // desktop
  1911. xl: 1536
  1912. // large screen
  1913. };
  1914. const defaultBreakpoints = {
  1915. // Sorted ASC by size. That's important.
  1916. // It can't be configured as it's used statically for propTypes.
  1917. keys: ["xs", "sm", "md", "lg", "xl"],
  1918. up: (key) => `@media (min-width:${values$1[key]}px)`
  1919. };
  1920. const defaultContainerQueries = {
  1921. containerQueries: (containerName) => ({
  1922. up: (key) => {
  1923. let result = typeof key === "number" ? key : values$1[key] || key;
  1924. if (typeof result === "number") {
  1925. result = `${result}px`;
  1926. }
  1927. return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;
  1928. }
  1929. })
  1930. };
  1931. function handleBreakpoints(props, propValue, styleFromPropValue) {
  1932. const theme = props.theme || {};
  1933. if (Array.isArray(propValue)) {
  1934. const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
  1935. return propValue.reduce((acc, item, index) => {
  1936. acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
  1937. return acc;
  1938. }, {});
  1939. }
  1940. if (typeof propValue === "object") {
  1941. const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
  1942. return Object.keys(propValue).reduce((acc, breakpoint) => {
  1943. if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
  1944. const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
  1945. if (containerKey) {
  1946. acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
  1947. }
  1948. } else if (Object.keys(themeBreakpoints.values || values$1).includes(breakpoint)) {
  1949. const mediaKey = themeBreakpoints.up(breakpoint);
  1950. acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
  1951. } else {
  1952. const cssKey = breakpoint;
  1953. acc[cssKey] = propValue[cssKey];
  1954. }
  1955. return acc;
  1956. }, {});
  1957. }
  1958. const output = styleFromPropValue(propValue);
  1959. return output;
  1960. }
  1961. function createEmptyBreakpointObject(breakpointsInput = {}) {
  1962. var _a;
  1963. const breakpointsInOrder = (_a = breakpointsInput.keys) == null ? void 0 : _a.reduce((acc, key) => {
  1964. const breakpointStyleKey = breakpointsInput.up(key);
  1965. acc[breakpointStyleKey] = {};
  1966. return acc;
  1967. }, {});
  1968. return breakpointsInOrder || {};
  1969. }
  1970. function removeUnusedBreakpoints(breakpointKeys, style2) {
  1971. return breakpointKeys.reduce((acc, key) => {
  1972. const breakpointOutput = acc[key];
  1973. const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
  1974. if (isBreakpointUnused) {
  1975. delete acc[key];
  1976. }
  1977. return acc;
  1978. }, style2);
  1979. }
  1980. function capitalize(string) {
  1981. if (typeof string !== "string") {
  1982. throw new Error(formatMuiErrorMessage(7));
  1983. }
  1984. return string.charAt(0).toUpperCase() + string.slice(1);
  1985. }
  1986. function getPath(obj, path, checkVars = true) {
  1987. if (!path || typeof path !== "string") {
  1988. return null;
  1989. }
  1990. if (obj && obj.vars && checkVars) {
  1991. const val = `vars.${path}`.split(".").reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
  1992. if (val != null) {
  1993. return val;
  1994. }
  1995. }
  1996. return path.split(".").reduce((acc, item) => {
  1997. if (acc && acc[item] != null) {
  1998. return acc[item];
  1999. }
  2000. return null;
  2001. }, obj);
  2002. }
  2003. function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
  2004. let value;
  2005. if (typeof themeMapping === "function") {
  2006. value = themeMapping(propValueFinal);
  2007. } else if (Array.isArray(themeMapping)) {
  2008. value = themeMapping[propValueFinal] || userValue;
  2009. } else {
  2010. value = getPath(themeMapping, propValueFinal) || userValue;
  2011. }
  2012. if (transform) {
  2013. value = transform(value, userValue, themeMapping);
  2014. }
  2015. return value;
  2016. }
  2017. function style$1(options) {
  2018. const {
  2019. prop,
  2020. cssProperty = options.prop,
  2021. themeKey,
  2022. transform
  2023. } = options;
  2024. const fn = (props) => {
  2025. if (props[prop] == null) {
  2026. return null;
  2027. }
  2028. const propValue = props[prop];
  2029. const theme = props.theme;
  2030. const themeMapping = getPath(theme, themeKey) || {};
  2031. const styleFromPropValue = (propValueFinal) => {
  2032. let value = getStyleValue(themeMapping, transform, propValueFinal);
  2033. if (propValueFinal === value && typeof propValueFinal === "string") {
  2034. value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === "default" ? "" : capitalize(propValueFinal)}`, propValueFinal);
  2035. }
  2036. if (cssProperty === false) {
  2037. return value;
  2038. }
  2039. return {
  2040. [cssProperty]: value
  2041. };
  2042. };
  2043. return handleBreakpoints(props, propValue, styleFromPropValue);
  2044. };
  2045. fn.propTypes = {};
  2046. fn.filterProps = [prop];
  2047. return fn;
  2048. }
  2049. function memoize(fn) {
  2050. const cache = {};
  2051. return (arg2) => {
  2052. if (cache[arg2] === void 0) {
  2053. cache[arg2] = fn(arg2);
  2054. }
  2055. return cache[arg2];
  2056. };
  2057. }
  2058. const properties = {
  2059. m: "margin",
  2060. p: "padding"
  2061. };
  2062. const directions = {
  2063. t: "Top",
  2064. r: "Right",
  2065. b: "Bottom",
  2066. l: "Left",
  2067. x: ["Left", "Right"],
  2068. y: ["Top", "Bottom"]
  2069. };
  2070. const aliases = {
  2071. marginX: "mx",
  2072. marginY: "my",
  2073. paddingX: "px",
  2074. paddingY: "py"
  2075. };
  2076. const getCssProperties = memoize((prop) => {
  2077. if (prop.length > 2) {
  2078. if (aliases[prop]) {
  2079. prop = aliases[prop];
  2080. } else {
  2081. return [prop];
  2082. }
  2083. }
  2084. const [a, b2] = prop.split("");
  2085. const property = properties[a];
  2086. const direction = directions[b2] || "";
  2087. return Array.isArray(direction) ? direction.map((dir) => property + dir) : [property + direction];
  2088. });
  2089. const marginKeys = ["m", "mt", "mr", "mb", "ml", "mx", "my", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "marginInline", "marginInlineStart", "marginInlineEnd", "marginBlock", "marginBlockStart", "marginBlockEnd"];
  2090. const paddingKeys = ["p", "pt", "pr", "pb", "pl", "px", "py", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlock", "paddingBlockStart", "paddingBlockEnd"];
  2091. [...marginKeys, ...paddingKeys];
  2092. function createUnaryUnit(theme, themeKey, defaultValue, propName) {
  2093. const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
  2094. if (typeof themeSpacing === "number" || typeof themeSpacing === "string") {
  2095. return (val) => {
  2096. if (typeof val === "string") {
  2097. return val;
  2098. }
  2099. if (typeof themeSpacing === "string") {
  2100. return `calc(${val} * ${themeSpacing})`;
  2101. }
  2102. return themeSpacing * val;
  2103. };
  2104. }
  2105. if (Array.isArray(themeSpacing)) {
  2106. return (val) => {
  2107. if (typeof val === "string") {
  2108. return val;
  2109. }
  2110. const abs2 = Math.abs(val);
  2111. const transformed = themeSpacing[abs2];
  2112. if (val >= 0) {
  2113. return transformed;
  2114. }
  2115. if (typeof transformed === "number") {
  2116. return -transformed;
  2117. }
  2118. return `-${transformed}`;
  2119. };
  2120. }
  2121. if (typeof themeSpacing === "function") {
  2122. return themeSpacing;
  2123. }
  2124. return () => void 0;
  2125. }
  2126. function createUnarySpacing(theme) {
  2127. return createUnaryUnit(theme, "spacing", 8);
  2128. }
  2129. function getValue(transformer, propValue) {
  2130. if (typeof propValue === "string" || propValue == null) {
  2131. return propValue;
  2132. }
  2133. return transformer(propValue);
  2134. }
  2135. function getStyleFromPropValue(cssProperties, transformer) {
  2136. return (propValue) => cssProperties.reduce((acc, cssProperty) => {
  2137. acc[cssProperty] = getValue(transformer, propValue);
  2138. return acc;
  2139. }, {});
  2140. }
  2141. function resolveCssProperty(props, keys, prop, transformer) {
  2142. if (!keys.includes(prop)) {
  2143. return null;
  2144. }
  2145. const cssProperties = getCssProperties(prop);
  2146. const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
  2147. const propValue = props[prop];
  2148. return handleBreakpoints(props, propValue, styleFromPropValue);
  2149. }
  2150. function style(props, keys) {
  2151. const transformer = createUnarySpacing(props.theme);
  2152. return Object.keys(props).map((prop) => resolveCssProperty(props, keys, prop, transformer)).reduce(merge$1, {});
  2153. }
  2154. function margin(props) {
  2155. return style(props, marginKeys);
  2156. }
  2157. margin.propTypes = {};
  2158. margin.filterProps = marginKeys;
  2159. function padding(props) {
  2160. return style(props, paddingKeys);
  2161. }
  2162. padding.propTypes = {};
  2163. padding.filterProps = paddingKeys;
  2164. function createSpacing(spacingInput = 8, transform = createUnarySpacing({
  2165. spacing: spacingInput
  2166. })) {
  2167. if (spacingInput.mui) {
  2168. return spacingInput;
  2169. }
  2170. const spacing = (...argsInput) => {
  2171. const args = argsInput.length === 0 ? [1] : argsInput;
  2172. return args.map((argument) => {
  2173. const output = transform(argument);
  2174. return typeof output === "number" ? `${output}px` : output;
  2175. }).join(" ");
  2176. };
  2177. spacing.mui = true;
  2178. return spacing;
  2179. }
  2180. function compose(...styles) {
  2181. const handlers = styles.reduce((acc, style2) => {
  2182. style2.filterProps.forEach((prop) => {
  2183. acc[prop] = style2;
  2184. });
  2185. return acc;
  2186. }, {});
  2187. const fn = (props) => {
  2188. return Object.keys(props).reduce((acc, prop) => {
  2189. if (handlers[prop]) {
  2190. return merge$1(acc, handlers[prop](props));
  2191. }
  2192. return acc;
  2193. }, {});
  2194. };
  2195. fn.propTypes = {};
  2196. fn.filterProps = styles.reduce((acc, style2) => acc.concat(style2.filterProps), []);
  2197. return fn;
  2198. }
  2199. function borderTransform(value) {
  2200. if (typeof value !== "number") {
  2201. return value;
  2202. }
  2203. return `${value}px solid`;
  2204. }
  2205. function createBorderStyle(prop, transform) {
  2206. return style$1({
  2207. prop,
  2208. themeKey: "borders",
  2209. transform
  2210. });
  2211. }
  2212. const border = createBorderStyle("border", borderTransform);
  2213. const borderTop = createBorderStyle("borderTop", borderTransform);
  2214. const borderRight = createBorderStyle("borderRight", borderTransform);
  2215. const borderBottom = createBorderStyle("borderBottom", borderTransform);
  2216. const borderLeft = createBorderStyle("borderLeft", borderTransform);
  2217. const borderColor = createBorderStyle("borderColor");
  2218. const borderTopColor = createBorderStyle("borderTopColor");
  2219. const borderRightColor = createBorderStyle("borderRightColor");
  2220. const borderBottomColor = createBorderStyle("borderBottomColor");
  2221. const borderLeftColor = createBorderStyle("borderLeftColor");
  2222. const outline = createBorderStyle("outline", borderTransform);
  2223. const outlineColor = createBorderStyle("outlineColor");
  2224. const borderRadius = (props) => {
  2225. if (props.borderRadius !== void 0 && props.borderRadius !== null) {
  2226. const transformer = createUnaryUnit(props.theme, "shape.borderRadius", 4);
  2227. const styleFromPropValue = (propValue) => ({
  2228. borderRadius: getValue(transformer, propValue)
  2229. });
  2230. return handleBreakpoints(props, props.borderRadius, styleFromPropValue);
  2231. }
  2232. return null;
  2233. };
  2234. borderRadius.propTypes = {};
  2235. borderRadius.filterProps = ["borderRadius"];
  2236. compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius, outline, outlineColor);
  2237. const gap = (props) => {
  2238. if (props.gap !== void 0 && props.gap !== null) {
  2239. const transformer = createUnaryUnit(props.theme, "spacing", 8);
  2240. const styleFromPropValue = (propValue) => ({
  2241. gap: getValue(transformer, propValue)
  2242. });
  2243. return handleBreakpoints(props, props.gap, styleFromPropValue);
  2244. }
  2245. return null;
  2246. };
  2247. gap.propTypes = {};
  2248. gap.filterProps = ["gap"];
  2249. const columnGap = (props) => {
  2250. if (props.columnGap !== void 0 && props.columnGap !== null) {
  2251. const transformer = createUnaryUnit(props.theme, "spacing", 8);
  2252. const styleFromPropValue = (propValue) => ({
  2253. columnGap: getValue(transformer, propValue)
  2254. });
  2255. return handleBreakpoints(props, props.columnGap, styleFromPropValue);
  2256. }
  2257. return null;
  2258. };
  2259. columnGap.propTypes = {};
  2260. columnGap.filterProps = ["columnGap"];
  2261. const rowGap = (props) => {
  2262. if (props.rowGap !== void 0 && props.rowGap !== null) {
  2263. const transformer = createUnaryUnit(props.theme, "spacing", 8);
  2264. const styleFromPropValue = (propValue) => ({
  2265. rowGap: getValue(transformer, propValue)
  2266. });
  2267. return handleBreakpoints(props, props.rowGap, styleFromPropValue);
  2268. }
  2269. return null;
  2270. };
  2271. rowGap.propTypes = {};
  2272. rowGap.filterProps = ["rowGap"];
  2273. const gridColumn = style$1({
  2274. prop: "gridColumn"
  2275. });
  2276. const gridRow = style$1({
  2277. prop: "gridRow"
  2278. });
  2279. const gridAutoFlow = style$1({
  2280. prop: "gridAutoFlow"
  2281. });
  2282. const gridAutoColumns = style$1({
  2283. prop: "gridAutoColumns"
  2284. });
  2285. const gridAutoRows = style$1({
  2286. prop: "gridAutoRows"
  2287. });
  2288. const gridTemplateColumns = style$1({
  2289. prop: "gridTemplateColumns"
  2290. });
  2291. const gridTemplateRows = style$1({
  2292. prop: "gridTemplateRows"
  2293. });
  2294. const gridTemplateAreas = style$1({
  2295. prop: "gridTemplateAreas"
  2296. });
  2297. const gridArea = style$1({
  2298. prop: "gridArea"
  2299. });
  2300. compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
  2301. function paletteTransform(value, userValue) {
  2302. if (userValue === "grey") {
  2303. return userValue;
  2304. }
  2305. return value;
  2306. }
  2307. const color = style$1({
  2308. prop: "color",
  2309. themeKey: "palette",
  2310. transform: paletteTransform
  2311. });
  2312. const bgcolor = style$1({
  2313. prop: "bgcolor",
  2314. cssProperty: "backgroundColor",
  2315. themeKey: "palette",
  2316. transform: paletteTransform
  2317. });
  2318. const backgroundColor = style$1({
  2319. prop: "backgroundColor",
  2320. themeKey: "palette",
  2321. transform: paletteTransform
  2322. });
  2323. compose(color, bgcolor, backgroundColor);
  2324. function sizingTransform(value) {
  2325. return value <= 1 && value !== 0 ? `${value * 100}%` : value;
  2326. }
  2327. const width = style$1({
  2328. prop: "width",
  2329. transform: sizingTransform
  2330. });
  2331. const maxWidth = (props) => {
  2332. if (props.maxWidth !== void 0 && props.maxWidth !== null) {
  2333. const styleFromPropValue = (propValue) => {
  2334. var _a, _b, _c, _d, _e;
  2335. const breakpoint = ((_c = (_b = (_a = props.theme) == null ? void 0 : _a.breakpoints) == null ? void 0 : _b.values) == null ? void 0 : _c[propValue]) || values$1[propValue];
  2336. if (!breakpoint) {
  2337. return {
  2338. maxWidth: sizingTransform(propValue)
  2339. };
  2340. }
  2341. if (((_e = (_d = props.theme) == null ? void 0 : _d.breakpoints) == null ? void 0 : _e.unit) !== "px") {
  2342. return {
  2343. maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
  2344. };
  2345. }
  2346. return {
  2347. maxWidth: breakpoint
  2348. };
  2349. };
  2350. return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
  2351. }
  2352. return null;
  2353. };
  2354. maxWidth.filterProps = ["maxWidth"];
  2355. const minWidth = style$1({
  2356. prop: "minWidth",
  2357. transform: sizingTransform
  2358. });
  2359. const height = style$1({
  2360. prop: "height",
  2361. transform: sizingTransform
  2362. });
  2363. const maxHeight = style$1({
  2364. prop: "maxHeight",
  2365. transform: sizingTransform
  2366. });
  2367. const minHeight = style$1({
  2368. prop: "minHeight",
  2369. transform: sizingTransform
  2370. });
  2371. style$1({
  2372. prop: "size",
  2373. cssProperty: "width",
  2374. transform: sizingTransform
  2375. });
  2376. style$1({
  2377. prop: "size",
  2378. cssProperty: "height",
  2379. transform: sizingTransform
  2380. });
  2381. const boxSizing = style$1({
  2382. prop: "boxSizing"
  2383. });
  2384. compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
  2385. const defaultSxConfig = {
  2386. // borders
  2387. border: {
  2388. themeKey: "borders",
  2389. transform: borderTransform
  2390. },
  2391. borderTop: {
  2392. themeKey: "borders",
  2393. transform: borderTransform
  2394. },
  2395. borderRight: {
  2396. themeKey: "borders",
  2397. transform: borderTransform
  2398. },
  2399. borderBottom: {
  2400. themeKey: "borders",
  2401. transform: borderTransform
  2402. },
  2403. borderLeft: {
  2404. themeKey: "borders",
  2405. transform: borderTransform
  2406. },
  2407. borderColor: {
  2408. themeKey: "palette"
  2409. },
  2410. borderTopColor: {
  2411. themeKey: "palette"
  2412. },
  2413. borderRightColor: {
  2414. themeKey: "palette"
  2415. },
  2416. borderBottomColor: {
  2417. themeKey: "palette"
  2418. },
  2419. borderLeftColor: {
  2420. themeKey: "palette"
  2421. },
  2422. outline: {
  2423. themeKey: "borders",
  2424. transform: borderTransform
  2425. },
  2426. outlineColor: {
  2427. themeKey: "palette"
  2428. },
  2429. borderRadius: {
  2430. themeKey: "shape.borderRadius",
  2431. style: borderRadius
  2432. },
  2433. // palette
  2434. color: {
  2435. themeKey: "palette",
  2436. transform: paletteTransform
  2437. },
  2438. bgcolor: {
  2439. themeKey: "palette",
  2440. cssProperty: "backgroundColor",
  2441. transform: paletteTransform
  2442. },
  2443. backgroundColor: {
  2444. themeKey: "palette",
  2445. transform: paletteTransform
  2446. },
  2447. // spacing
  2448. p: {
  2449. style: padding
  2450. },
  2451. pt: {
  2452. style: padding
  2453. },
  2454. pr: {
  2455. style: padding
  2456. },
  2457. pb: {
  2458. style: padding
  2459. },
  2460. pl: {
  2461. style: padding
  2462. },
  2463. px: {
  2464. style: padding
  2465. },
  2466. py: {
  2467. style: padding
  2468. },
  2469. padding: {
  2470. style: padding
  2471. },
  2472. paddingTop: {
  2473. style: padding
  2474. },
  2475. paddingRight: {
  2476. style: padding
  2477. },
  2478. paddingBottom: {
  2479. style: padding
  2480. },
  2481. paddingLeft: {
  2482. style: padding
  2483. },
  2484. paddingX: {
  2485. style: padding
  2486. },
  2487. paddingY: {
  2488. style: padding
  2489. },
  2490. paddingInline: {
  2491. style: padding
  2492. },
  2493. paddingInlineStart: {
  2494. style: padding
  2495. },
  2496. paddingInlineEnd: {
  2497. style: padding
  2498. },
  2499. paddingBlock: {
  2500. style: padding
  2501. },
  2502. paddingBlockStart: {
  2503. style: padding
  2504. },
  2505. paddingBlockEnd: {
  2506. style: padding
  2507. },
  2508. m: {
  2509. style: margin
  2510. },
  2511. mt: {
  2512. style: margin
  2513. },
  2514. mr: {
  2515. style: margin
  2516. },
  2517. mb: {
  2518. style: margin
  2519. },
  2520. ml: {
  2521. style: margin
  2522. },
  2523. mx: {
  2524. style: margin
  2525. },
  2526. my: {
  2527. style: margin
  2528. },
  2529. margin: {
  2530. style: margin
  2531. },
  2532. marginTop: {
  2533. style: margin
  2534. },
  2535. marginRight: {
  2536. style: margin
  2537. },
  2538. marginBottom: {
  2539. style: margin
  2540. },
  2541. marginLeft: {
  2542. style: margin
  2543. },
  2544. marginX: {
  2545. style: margin
  2546. },
  2547. marginY: {
  2548. style: margin
  2549. },
  2550. marginInline: {
  2551. style: margin
  2552. },
  2553. marginInlineStart: {
  2554. style: margin
  2555. },
  2556. marginInlineEnd: {
  2557. style: margin
  2558. },
  2559. marginBlock: {
  2560. style: margin
  2561. },
  2562. marginBlockStart: {
  2563. style: margin
  2564. },
  2565. marginBlockEnd: {
  2566. style: margin
  2567. },
  2568. // display
  2569. displayPrint: {
  2570. cssProperty: false,
  2571. transform: (value) => ({
  2572. "@media print": {
  2573. display: value
  2574. }
  2575. })
  2576. },
  2577. display: {},
  2578. overflow: {},
  2579. textOverflow: {},
  2580. visibility: {},
  2581. whiteSpace: {},
  2582. // flexbox
  2583. flexBasis: {},
  2584. flexDirection: {},
  2585. flexWrap: {},
  2586. justifyContent: {},
  2587. alignItems: {},
  2588. alignContent: {},
  2589. order: {},
  2590. flex: {},
  2591. flexGrow: {},
  2592. flexShrink: {},
  2593. alignSelf: {},
  2594. justifyItems: {},
  2595. justifySelf: {},
  2596. // grid
  2597. gap: {
  2598. style: gap
  2599. },
  2600. rowGap: {
  2601. style: rowGap
  2602. },
  2603. columnGap: {
  2604. style: columnGap
  2605. },
  2606. gridColumn: {},
  2607. gridRow: {},
  2608. gridAutoFlow: {},
  2609. gridAutoColumns: {},
  2610. gridAutoRows: {},
  2611. gridTemplateColumns: {},
  2612. gridTemplateRows: {},
  2613. gridTemplateAreas: {},
  2614. gridArea: {},
  2615. // positions
  2616. position: {},
  2617. zIndex: {
  2618. themeKey: "zIndex"
  2619. },
  2620. top: {},
  2621. right: {},
  2622. bottom: {},
  2623. left: {},
  2624. // shadows
  2625. boxShadow: {
  2626. themeKey: "shadows"
  2627. },
  2628. // sizing
  2629. width: {
  2630. transform: sizingTransform
  2631. },
  2632. maxWidth: {
  2633. style: maxWidth
  2634. },
  2635. minWidth: {
  2636. transform: sizingTransform
  2637. },
  2638. height: {
  2639. transform: sizingTransform
  2640. },
  2641. maxHeight: {
  2642. transform: sizingTransform
  2643. },
  2644. minHeight: {
  2645. transform: sizingTransform
  2646. },
  2647. boxSizing: {},
  2648. // typography
  2649. font: {
  2650. themeKey: "font"
  2651. },
  2652. fontFamily: {
  2653. themeKey: "typography"
  2654. },
  2655. fontSize: {
  2656. themeKey: "typography"
  2657. },
  2658. fontStyle: {
  2659. themeKey: "typography"
  2660. },
  2661. fontWeight: {
  2662. themeKey: "typography"
  2663. },
  2664. letterSpacing: {},
  2665. textTransform: {},
  2666. lineHeight: {},
  2667. textAlign: {},
  2668. typography: {
  2669. cssProperty: false,
  2670. themeKey: "typography"
  2671. }
  2672. };
  2673. function objectsHaveSameKeys(...objects) {
  2674. const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
  2675. const union = new Set(allKeys);
  2676. return objects.every((object) => union.size === Object.keys(object).length);
  2677. }
  2678. function callIfFn(maybeFn, arg2) {
  2679. return typeof maybeFn === "function" ? maybeFn(arg2) : maybeFn;
  2680. }
  2681. function unstable_createStyleFunctionSx() {
  2682. function getThemeValue(prop, val, theme, config) {
  2683. const props = {
  2684. [prop]: val,
  2685. theme
  2686. };
  2687. const options = config[prop];
  2688. if (!options) {
  2689. return {
  2690. [prop]: val
  2691. };
  2692. }
  2693. const {
  2694. cssProperty = prop,
  2695. themeKey,
  2696. transform,
  2697. style: style2
  2698. } = options;
  2699. if (val == null) {
  2700. return null;
  2701. }
  2702. if (themeKey === "typography" && val === "inherit") {
  2703. return {
  2704. [prop]: val
  2705. };
  2706. }
  2707. const themeMapping = getPath(theme, themeKey) || {};
  2708. if (style2) {
  2709. return style2(props);
  2710. }
  2711. const styleFromPropValue = (propValueFinal) => {
  2712. let value = getStyleValue(themeMapping, transform, propValueFinal);
  2713. if (propValueFinal === value && typeof propValueFinal === "string") {
  2714. value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === "default" ? "" : capitalize(propValueFinal)}`, propValueFinal);
  2715. }
  2716. if (cssProperty === false) {
  2717. return value;
  2718. }
  2719. return {
  2720. [cssProperty]: value
  2721. };
  2722. };
  2723. return handleBreakpoints(props, val, styleFromPropValue);
  2724. }
  2725. function styleFunctionSx2(props) {
  2726. const {
  2727. sx,
  2728. theme = {}
  2729. } = props || {};
  2730. if (!sx) {
  2731. return null;
  2732. }
  2733. const config = theme.unstable_sxConfig ?? defaultSxConfig;
  2734. function traverse(sxInput) {
  2735. let sxObject = sxInput;
  2736. if (typeof sxInput === "function") {
  2737. sxObject = sxInput(theme);
  2738. } else if (typeof sxInput !== "object") {
  2739. return sxInput;
  2740. }
  2741. if (!sxObject) {
  2742. return null;
  2743. }
  2744. const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
  2745. const breakpointsKeys = Object.keys(emptyBreakpoints);
  2746. let css2 = emptyBreakpoints;
  2747. Object.keys(sxObject).forEach((styleKey) => {
  2748. const value = callIfFn(sxObject[styleKey], theme);
  2749. if (value !== null && value !== void 0) {
  2750. if (typeof value === "object") {
  2751. if (config[styleKey]) {
  2752. css2 = merge$1(css2, getThemeValue(styleKey, value, theme, config));
  2753. } else {
  2754. const breakpointsValues = handleBreakpoints({
  2755. theme
  2756. }, value, (x2) => ({
  2757. [styleKey]: x2
  2758. }));
  2759. if (objectsHaveSameKeys(breakpointsValues, value)) {
  2760. css2[styleKey] = styleFunctionSx2({
  2761. sx: value,
  2762. theme
  2763. });
  2764. } else {
  2765. css2 = merge$1(css2, breakpointsValues);
  2766. }
  2767. }
  2768. } else {
  2769. css2 = merge$1(css2, getThemeValue(styleKey, value, theme, config));
  2770. }
  2771. }
  2772. });
  2773. return sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css2));
  2774. }
  2775. return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
  2776. }
  2777. return styleFunctionSx2;
  2778. }
  2779. const styleFunctionSx = unstable_createStyleFunctionSx();
  2780. styleFunctionSx.filterProps = ["sx"];
  2781. function applyStyles(key, styles) {
  2782. var _a;
  2783. const theme = this;
  2784. if (theme.vars) {
  2785. if (!((_a = theme.colorSchemes) == null ? void 0 : _a[key]) || typeof theme.getColorSchemeSelector !== "function") {
  2786. return {};
  2787. }
  2788. let selector = theme.getColorSchemeSelector(key);
  2789. if (selector === "&") {
  2790. return styles;
  2791. }
  2792. if (selector.includes("data-") || selector.includes(".")) {
  2793. selector = `*:where(${selector.replace(/\s*&$/, "")}) &`;
  2794. }
  2795. return {
  2796. [selector]: styles
  2797. };
  2798. }
  2799. if (theme.palette.mode === key) {
  2800. return styles;
  2801. }
  2802. return {};
  2803. }
  2804. function createTheme$1(options = {}, ...args) {
  2805. const {
  2806. breakpoints: breakpointsInput = {},
  2807. palette: paletteInput = {},
  2808. spacing: spacingInput,
  2809. shape: shapeInput = {},
  2810. ...other
  2811. } = options;
  2812. const breakpoints = createBreakpoints(breakpointsInput);
  2813. const spacing = createSpacing(spacingInput);
  2814. let muiTheme = deepmerge({
  2815. breakpoints,
  2816. direction: "ltr",
  2817. components: {},
  2818. // Inject component definitions.
  2819. palette: {
  2820. mode: "light",
  2821. ...paletteInput
  2822. },
  2823. spacing,
  2824. shape: {
  2825. ...shape,
  2826. ...shapeInput
  2827. }
  2828. }, other);
  2829. muiTheme = cssContainerQueries(muiTheme);
  2830. muiTheme.applyStyles = applyStyles;
  2831. muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
  2832. muiTheme.unstable_sxConfig = {
  2833. ...defaultSxConfig,
  2834. ...other == null ? void 0 : other.unstable_sxConfig
  2835. };
  2836. muiTheme.unstable_sx = function sx(props) {
  2837. return styleFunctionSx({
  2838. sx: props,
  2839. theme: this
  2840. });
  2841. };
  2842. return muiTheme;
  2843. }
  2844. function isObjectEmpty$1(obj) {
  2845. return Object.keys(obj).length === 0;
  2846. }
  2847. function useTheme$1(defaultTheme2 = null) {
  2848. const contextTheme = React__namespace.useContext(ThemeContext);
  2849. return !contextTheme || isObjectEmpty$1(contextTheme) ? defaultTheme2 : contextTheme;
  2850. }
  2851. const systemDefaultTheme$1 = createTheme$1();
  2852. function useTheme(defaultTheme2 = systemDefaultTheme$1) {
  2853. return useTheme$1(defaultTheme2);
  2854. }
  2855. const splitProps = (props) => {
  2856. var _a;
  2857. const result = {
  2858. systemProps: {},
  2859. otherProps: {}
  2860. };
  2861. const config = ((_a = props == null ? void 0 : props.theme) == null ? void 0 : _a.unstable_sxConfig) ?? defaultSxConfig;
  2862. Object.keys(props).forEach((prop) => {
  2863. if (config[prop]) {
  2864. result.systemProps[prop] = props[prop];
  2865. } else {
  2866. result.otherProps[prop] = props[prop];
  2867. }
  2868. });
  2869. return result;
  2870. };
  2871. function extendSxProp(props) {
  2872. const {
  2873. sx: inSx,
  2874. ...other
  2875. } = props;
  2876. const {
  2877. systemProps,
  2878. otherProps
  2879. } = splitProps(other);
  2880. let finalSx;
  2881. if (Array.isArray(inSx)) {
  2882. finalSx = [systemProps, ...inSx];
  2883. } else if (typeof inSx === "function") {
  2884. finalSx = (...args) => {
  2885. const result = inSx(...args);
  2886. if (!isPlainObject$1(result)) {
  2887. return systemProps;
  2888. }
  2889. return {
  2890. ...systemProps,
  2891. ...result
  2892. };
  2893. };
  2894. } else {
  2895. finalSx = {
  2896. ...systemProps,
  2897. ...inSx
  2898. };
  2899. }
  2900. return {
  2901. ...otherProps,
  2902. sx: finalSx
  2903. };
  2904. }
  2905. const defaultGenerator = (componentName) => componentName;
  2906. const createClassNameGenerator = () => {
  2907. let generate = defaultGenerator;
  2908. return {
  2909. configure(generator) {
  2910. generate = generator;
  2911. },
  2912. generate(componentName) {
  2913. return generate(componentName);
  2914. },
  2915. reset() {
  2916. generate = defaultGenerator;
  2917. }
  2918. };
  2919. };
  2920. const ClassNameGenerator = createClassNameGenerator();
  2921. function r(e2) {
  2922. var t2, f2, n2 = "";
  2923. if ("string" == typeof e2 || "number" == typeof e2) n2 += e2;
  2924. else if ("object" == typeof e2) if (Array.isArray(e2)) {
  2925. var o = e2.length;
  2926. for (t2 = 0; t2 < o; t2++) e2[t2] && (f2 = r(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
  2927. } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2);
  2928. return n2;
  2929. }
  2930. function clsx() {
  2931. for (var e2, t2, f2 = 0, n2 = "", o = arguments.length; f2 < o; f2++) (e2 = arguments[f2]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2);
  2932. return n2;
  2933. }
  2934. function createBox(options = {}) {
  2935. const {
  2936. themeId,
  2937. defaultTheme: defaultTheme2,
  2938. defaultClassName = "MuiBox-root",
  2939. generateClassName
  2940. } = options;
  2941. const BoxRoot = styled$1("div", {
  2942. shouldForwardProp: (prop) => prop !== "theme" && prop !== "sx" && prop !== "as"
  2943. })(styleFunctionSx);
  2944. const Box2 = /* @__PURE__ */ React__namespace.forwardRef(function Box3(inProps, ref) {
  2945. const theme = useTheme(defaultTheme2);
  2946. const {
  2947. className,
  2948. component = "div",
  2949. ...other
  2950. } = extendSxProp(inProps);
  2951. return /* @__PURE__ */ jsxRuntimeExports.jsx(BoxRoot, {
  2952. as: component,
  2953. ref,
  2954. className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
  2955. theme: themeId ? theme[themeId] || theme : theme,
  2956. ...other
  2957. });
  2958. });
  2959. return Box2;
  2960. }
  2961. const globalStateClasses = {
  2962. active: "active",
  2963. checked: "checked",
  2964. completed: "completed",
  2965. disabled: "disabled",
  2966. error: "error",
  2967. expanded: "expanded",
  2968. focused: "focused",
  2969. focusVisible: "focusVisible",
  2970. open: "open",
  2971. readOnly: "readOnly",
  2972. required: "required",
  2973. selected: "selected"
  2974. };
  2975. function generateUtilityClass(componentName, slot, globalStatePrefix = "Mui") {
  2976. const globalStateClass = globalStateClasses[slot];
  2977. return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
  2978. }
  2979. function generateUtilityClasses(componentName, slots, globalStatePrefix = "Mui") {
  2980. const result = {};
  2981. slots.forEach((slot) => {
  2982. result[slot] = generateUtilityClass(componentName, slot, globalStatePrefix);
  2983. });
  2984. return result;
  2985. }
  2986. function preprocessStyles(input) {
  2987. const {
  2988. variants,
  2989. ...style2
  2990. } = input;
  2991. const result = {
  2992. variants,
  2993. style: internal_serializeStyles(style2),
  2994. isProcessed: true
  2995. };
  2996. if (result.style === style2) {
  2997. return result;
  2998. }
  2999. if (variants) {
  3000. variants.forEach((variant) => {
  3001. if (typeof variant.style !== "function") {
  3002. variant.style = internal_serializeStyles(variant.style);
  3003. }
  3004. });
  3005. }
  3006. return result;
  3007. }
  3008. const systemDefaultTheme = createTheme$1();
  3009. function shouldForwardProp(prop) {
  3010. return prop !== "ownerState" && prop !== "theme" && prop !== "sx" && prop !== "as";
  3011. }
  3012. function defaultOverridesResolver(slot) {
  3013. if (!slot) {
  3014. return null;
  3015. }
  3016. return (_props, styles) => styles[slot];
  3017. }
  3018. function attachTheme(props, themeId, defaultTheme2) {
  3019. props.theme = isObjectEmpty(props.theme) ? defaultTheme2 : props.theme[themeId] || props.theme;
  3020. }
  3021. function processStyle(props, style2) {
  3022. const resolvedStyle = typeof style2 === "function" ? style2(props) : style2;
  3023. if (Array.isArray(resolvedStyle)) {
  3024. return resolvedStyle.flatMap((subStyle) => processStyle(props, subStyle));
  3025. }
  3026. if (Array.isArray(resolvedStyle == null ? void 0 : resolvedStyle.variants)) {
  3027. let rootStyle;
  3028. if (resolvedStyle.isProcessed) {
  3029. rootStyle = resolvedStyle.style;
  3030. } else {
  3031. const {
  3032. variants,
  3033. ...otherStyles
  3034. } = resolvedStyle;
  3035. rootStyle = otherStyles;
  3036. }
  3037. return processStyleVariants(props, resolvedStyle.variants, [rootStyle]);
  3038. }
  3039. if (resolvedStyle == null ? void 0 : resolvedStyle.isProcessed) {
  3040. return resolvedStyle.style;
  3041. }
  3042. return resolvedStyle;
  3043. }
  3044. function processStyleVariants(props, variants, results = []) {
  3045. var _a;
  3046. let mergedState;
  3047. variantLoop: for (let i = 0; i < variants.length; i += 1) {
  3048. const variant = variants[i];
  3049. if (typeof variant.props === "function") {
  3050. mergedState ?? (mergedState = {
  3051. ...props,
  3052. ...props.ownerState,
  3053. ownerState: props.ownerState
  3054. });
  3055. if (!variant.props(mergedState)) {
  3056. continue;
  3057. }
  3058. } else {
  3059. for (const key in variant.props) {
  3060. if (props[key] !== variant.props[key] && ((_a = props.ownerState) == null ? void 0 : _a[key]) !== variant.props[key]) {
  3061. continue variantLoop;
  3062. }
  3063. }
  3064. }
  3065. if (typeof variant.style === "function") {
  3066. mergedState ?? (mergedState = {
  3067. ...props,
  3068. ...props.ownerState,
  3069. ownerState: props.ownerState
  3070. });
  3071. results.push(variant.style(mergedState));
  3072. } else {
  3073. results.push(variant.style);
  3074. }
  3075. }
  3076. return results;
  3077. }
  3078. function createStyled2(input = {}) {
  3079. const {
  3080. themeId,
  3081. defaultTheme: defaultTheme2 = systemDefaultTheme,
  3082. rootShouldForwardProp: rootShouldForwardProp2 = shouldForwardProp,
  3083. slotShouldForwardProp: slotShouldForwardProp2 = shouldForwardProp
  3084. } = input;
  3085. function styleAttachTheme(props) {
  3086. attachTheme(props, themeId, defaultTheme2);
  3087. }
  3088. const styled2 = (tag, inputOptions = {}) => {
  3089. internal_mutateStyles(tag, (styles) => styles.filter((style2) => style2 !== styleFunctionSx));
  3090. const {
  3091. name: componentName,
  3092. slot: componentSlot,
  3093. skipVariantsResolver: inputSkipVariantsResolver,
  3094. skipSx: inputSkipSx,
  3095. // TODO v6: remove `lowercaseFirstLetter()` in the next major release
  3096. // For more details: https://github.com/mui/material-ui/pull/37908
  3097. overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot)),
  3098. ...options
  3099. } = inputOptions;
  3100. const skipVariantsResolver = inputSkipVariantsResolver !== void 0 ? inputSkipVariantsResolver : (
  3101. // TODO v6: remove `Root` in the next major release
  3102. // For more details: https://github.com/mui/material-ui/pull/37908
  3103. componentSlot && componentSlot !== "Root" && componentSlot !== "root" || false
  3104. );
  3105. const skipSx = inputSkipSx || false;
  3106. let shouldForwardPropOption = shouldForwardProp;
  3107. if (componentSlot === "Root" || componentSlot === "root") {
  3108. shouldForwardPropOption = rootShouldForwardProp2;
  3109. } else if (componentSlot) {
  3110. shouldForwardPropOption = slotShouldForwardProp2;
  3111. } else if (isStringTag(tag)) {
  3112. shouldForwardPropOption = void 0;
  3113. }
  3114. const defaultStyledResolver = styled$1(tag, {
  3115. shouldForwardProp: shouldForwardPropOption,
  3116. label: generateStyledLabel(),
  3117. ...options
  3118. });
  3119. const transformStyle = (style2) => {
  3120. if (typeof style2 === "function" && style2.__emotion_real !== style2) {
  3121. return function styleFunctionProcessor(props) {
  3122. return processStyle(props, style2);
  3123. };
  3124. }
  3125. if (isPlainObject$1(style2)) {
  3126. const serialized = preprocessStyles(style2);
  3127. if (!serialized.variants) {
  3128. return serialized.style;
  3129. }
  3130. return function styleObjectProcessor(props) {
  3131. return processStyle(props, serialized);
  3132. };
  3133. }
  3134. return style2;
  3135. };
  3136. const muiStyledResolver = (...expressionsInput) => {
  3137. const expressionsHead = [];
  3138. const expressionsBody = expressionsInput.map(transformStyle);
  3139. const expressionsTail = [];
  3140. expressionsHead.push(styleAttachTheme);
  3141. if (componentName && overridesResolver) {
  3142. expressionsTail.push(function styleThemeOverrides(props) {
  3143. var _a, _b;
  3144. const theme = props.theme;
  3145. const styleOverrides = (_b = (_a = theme.components) == null ? void 0 : _a[componentName]) == null ? void 0 : _b.styleOverrides;
  3146. if (!styleOverrides) {
  3147. return null;
  3148. }
  3149. const resolvedStyleOverrides = {};
  3150. for (const slotKey in styleOverrides) {
  3151. resolvedStyleOverrides[slotKey] = processStyle(props, styleOverrides[slotKey]);
  3152. }
  3153. return overridesResolver(props, resolvedStyleOverrides);
  3154. });
  3155. }
  3156. if (componentName && !skipVariantsResolver) {
  3157. expressionsTail.push(function styleThemeVariants(props) {
  3158. var _a, _b;
  3159. const theme = props.theme;
  3160. const themeVariants = (_b = (_a = theme == null ? void 0 : theme.components) == null ? void 0 : _a[componentName]) == null ? void 0 : _b.variants;
  3161. if (!themeVariants) {
  3162. return null;
  3163. }
  3164. return processStyleVariants(props, themeVariants);
  3165. });
  3166. }
  3167. if (!skipSx) {
  3168. expressionsTail.push(styleFunctionSx);
  3169. }
  3170. if (Array.isArray(expressionsBody[0])) {
  3171. const inputStrings = expressionsBody.shift();
  3172. const placeholdersHead = new Array(expressionsHead.length).fill("");
  3173. const placeholdersTail = new Array(expressionsTail.length).fill("");
  3174. let outputStrings;
  3175. {
  3176. outputStrings = [...placeholdersHead, ...inputStrings, ...placeholdersTail];
  3177. outputStrings.raw = [...placeholdersHead, ...inputStrings.raw, ...placeholdersTail];
  3178. }
  3179. expressionsHead.unshift(outputStrings);
  3180. }
  3181. const expressions = [...expressionsHead, ...expressionsBody, ...expressionsTail];
  3182. const Component = defaultStyledResolver(...expressions);
  3183. if (tag.muiName) {
  3184. Component.muiName = tag.muiName;
  3185. }
  3186. return Component;
  3187. };
  3188. if (defaultStyledResolver.withConfig) {
  3189. muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
  3190. }
  3191. return muiStyledResolver;
  3192. };
  3193. return styled2;
  3194. }
  3195. function generateStyledLabel(componentName, componentSlot) {
  3196. let label;
  3197. return label;
  3198. }
  3199. function isObjectEmpty(object) {
  3200. for (const _ in object) {
  3201. return false;
  3202. }
  3203. return true;
  3204. }
  3205. function isStringTag(tag) {
  3206. return typeof tag === "string" && // 96 is one less than the char code
  3207. // for "a" so this is checking that
  3208. // it's a lowercase character
  3209. tag.charCodeAt(0) > 96;
  3210. }
  3211. function lowercaseFirstLetter(string) {
  3212. if (!string) {
  3213. return string;
  3214. }
  3215. return string.charAt(0).toLowerCase() + string.slice(1);
  3216. }
  3217. function resolveProps(defaultProps2, props) {
  3218. const output = {
  3219. ...props
  3220. };
  3221. for (const key in defaultProps2) {
  3222. if (Object.prototype.hasOwnProperty.call(defaultProps2, key)) {
  3223. const propName = key;
  3224. if (propName === "components" || propName === "slots") {
  3225. output[propName] = {
  3226. ...defaultProps2[propName],
  3227. ...output[propName]
  3228. };
  3229. } else if (propName === "componentsProps" || propName === "slotProps") {
  3230. const defaultSlotProps = defaultProps2[propName];
  3231. const slotProps = props[propName];
  3232. if (!slotProps) {
  3233. output[propName] = defaultSlotProps || {};
  3234. } else if (!defaultSlotProps) {
  3235. output[propName] = slotProps;
  3236. } else {
  3237. output[propName] = {
  3238. ...slotProps
  3239. };
  3240. for (const slotKey in defaultSlotProps) {
  3241. if (Object.prototype.hasOwnProperty.call(defaultSlotProps, slotKey)) {
  3242. const slotPropName = slotKey;
  3243. output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
  3244. }
  3245. }
  3246. }
  3247. } else if (output[propName] === void 0) {
  3248. output[propName] = defaultProps2[propName];
  3249. }
  3250. }
  3251. }
  3252. return output;
  3253. }
  3254. const useEnhancedEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
  3255. function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
  3256. return Math.max(min, Math.min(val, max));
  3257. }
  3258. function clampWrapper(value, min = 0, max = 1) {
  3259. return clamp(value, min, max);
  3260. }
  3261. function hexToRgb(color2) {
  3262. color2 = color2.slice(1);
  3263. const re = new RegExp(`.{1,${color2.length >= 6 ? 2 : 1}}`, "g");
  3264. let colors = color2.match(re);
  3265. if (colors && colors[0].length === 1) {
  3266. colors = colors.map((n2) => n2 + n2);
  3267. }
  3268. return colors ? `rgb${colors.length === 4 ? "a" : ""}(${colors.map((n2, index) => {
  3269. return index < 3 ? parseInt(n2, 16) : Math.round(parseInt(n2, 16) / 255 * 1e3) / 1e3;
  3270. }).join(", ")})` : "";
  3271. }
  3272. function decomposeColor(color2) {
  3273. if (color2.type) {
  3274. return color2;
  3275. }
  3276. if (color2.charAt(0) === "#") {
  3277. return decomposeColor(hexToRgb(color2));
  3278. }
  3279. const marker = color2.indexOf("(");
  3280. const type = color2.substring(0, marker);
  3281. if (!["rgb", "rgba", "hsl", "hsla", "color"].includes(type)) {
  3282. throw new Error(formatMuiErrorMessage(9, color2));
  3283. }
  3284. let values2 = color2.substring(marker + 1, color2.length - 1);
  3285. let colorSpace;
  3286. if (type === "color") {
  3287. values2 = values2.split(" ");
  3288. colorSpace = values2.shift();
  3289. if (values2.length === 4 && values2[3].charAt(0) === "/") {
  3290. values2[3] = values2[3].slice(1);
  3291. }
  3292. if (!["srgb", "display-p3", "a98-rgb", "prophoto-rgb", "rec-2020"].includes(colorSpace)) {
  3293. throw new Error(formatMuiErrorMessage(10, colorSpace));
  3294. }
  3295. } else {
  3296. values2 = values2.split(",");
  3297. }
  3298. values2 = values2.map((value) => parseFloat(value));
  3299. return {
  3300. type,
  3301. values: values2,
  3302. colorSpace
  3303. };
  3304. }
  3305. const colorChannel = (color2) => {
  3306. const decomposedColor = decomposeColor(color2);
  3307. return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.includes("hsl") && idx !== 0 ? `${val}%` : val).join(" ");
  3308. };
  3309. const private_safeColorChannel = (color2, warning) => {
  3310. try {
  3311. return colorChannel(color2);
  3312. } catch (error) {
  3313. if (warning && false) {
  3314. console.warn(warning);
  3315. }
  3316. return color2;
  3317. }
  3318. };
  3319. function recomposeColor(color2) {
  3320. const {
  3321. type,
  3322. colorSpace
  3323. } = color2;
  3324. let {
  3325. values: values2
  3326. } = color2;
  3327. if (type.includes("rgb")) {
  3328. values2 = values2.map((n2, i) => i < 3 ? parseInt(n2, 10) : n2);
  3329. } else if (type.includes("hsl")) {
  3330. values2[1] = `${values2[1]}%`;
  3331. values2[2] = `${values2[2]}%`;
  3332. }
  3333. if (type.includes("color")) {
  3334. values2 = `${colorSpace} ${values2.join(" ")}`;
  3335. } else {
  3336. values2 = `${values2.join(", ")}`;
  3337. }
  3338. return `${type}(${values2})`;
  3339. }
  3340. function hslToRgb(color2) {
  3341. color2 = decomposeColor(color2);
  3342. const {
  3343. values: values2
  3344. } = color2;
  3345. const h2 = values2[0];
  3346. const s = values2[1] / 100;
  3347. const l2 = values2[2] / 100;
  3348. const a = s * Math.min(l2, 1 - l2);
  3349. const f2 = (n2, k2 = (n2 + h2 / 30) % 12) => l2 - a * Math.max(Math.min(k2 - 3, 9 - k2, 1), -1);
  3350. let type = "rgb";
  3351. const rgb = [Math.round(f2(0) * 255), Math.round(f2(8) * 255), Math.round(f2(4) * 255)];
  3352. if (color2.type === "hsla") {
  3353. type += "a";
  3354. rgb.push(values2[3]);
  3355. }
  3356. return recomposeColor({
  3357. type,
  3358. values: rgb
  3359. });
  3360. }
  3361. function getLuminance(color2) {
  3362. color2 = decomposeColor(color2);
  3363. let rgb = color2.type === "hsl" || color2.type === "hsla" ? decomposeColor(hslToRgb(color2)).values : color2.values;
  3364. rgb = rgb.map((val) => {
  3365. if (color2.type !== "color") {
  3366. val /= 255;
  3367. }
  3368. return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
  3369. });
  3370. return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
  3371. }
  3372. function getContrastRatio(foreground, background) {
  3373. const lumA = getLuminance(foreground);
  3374. const lumB = getLuminance(background);
  3375. return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
  3376. }
  3377. function alpha(color2, value) {
  3378. color2 = decomposeColor(color2);
  3379. value = clampWrapper(value);
  3380. if (color2.type === "rgb" || color2.type === "hsl") {
  3381. color2.type += "a";
  3382. }
  3383. if (color2.type === "color") {
  3384. color2.values[3] = `/${value}`;
  3385. } else {
  3386. color2.values[3] = value;
  3387. }
  3388. return recomposeColor(color2);
  3389. }
  3390. function private_safeAlpha(color2, value, warning) {
  3391. try {
  3392. return alpha(color2, value);
  3393. } catch (error) {
  3394. return color2;
  3395. }
  3396. }
  3397. function darken(color2, coefficient) {
  3398. color2 = decomposeColor(color2);
  3399. coefficient = clampWrapper(coefficient);
  3400. if (color2.type.includes("hsl")) {
  3401. color2.values[2] *= 1 - coefficient;
  3402. } else if (color2.type.includes("rgb") || color2.type.includes("color")) {
  3403. for (let i = 0; i < 3; i += 1) {
  3404. color2.values[i] *= 1 - coefficient;
  3405. }
  3406. }
  3407. return recomposeColor(color2);
  3408. }
  3409. function private_safeDarken(color2, coefficient, warning) {
  3410. try {
  3411. return darken(color2, coefficient);
  3412. } catch (error) {
  3413. return color2;
  3414. }
  3415. }
  3416. function lighten(color2, coefficient) {
  3417. color2 = decomposeColor(color2);
  3418. coefficient = clampWrapper(coefficient);
  3419. if (color2.type.includes("hsl")) {
  3420. color2.values[2] += (100 - color2.values[2]) * coefficient;
  3421. } else if (color2.type.includes("rgb")) {
  3422. for (let i = 0; i < 3; i += 1) {
  3423. color2.values[i] += (255 - color2.values[i]) * coefficient;
  3424. }
  3425. } else if (color2.type.includes("color")) {
  3426. for (let i = 0; i < 3; i += 1) {
  3427. color2.values[i] += (1 - color2.values[i]) * coefficient;
  3428. }
  3429. }
  3430. return recomposeColor(color2);
  3431. }
  3432. function private_safeLighten(color2, coefficient, warning) {
  3433. try {
  3434. return lighten(color2, coefficient);
  3435. } catch (error) {
  3436. return color2;
  3437. }
  3438. }
  3439. function emphasize(color2, coefficient = 0.15) {
  3440. return getLuminance(color2) > 0.5 ? darken(color2, coefficient) : lighten(color2, coefficient);
  3441. }
  3442. function private_safeEmphasize(color2, coefficient, warning) {
  3443. try {
  3444. return emphasize(color2, coefficient);
  3445. } catch (error) {
  3446. return color2;
  3447. }
  3448. }
  3449. function setRef(ref, value) {
  3450. if (typeof ref === "function") {
  3451. ref(value);
  3452. } else if (ref) {
  3453. ref.current = value;
  3454. }
  3455. }
  3456. function useEventCallback(fn) {
  3457. const ref = React__namespace.useRef(fn);
  3458. useEnhancedEffect(() => {
  3459. ref.current = fn;
  3460. });
  3461. return React__namespace.useRef((...args) => (
  3462. // @ts-expect-error hide `this`
  3463. (0, ref.current)(...args)
  3464. )).current;
  3465. }
  3466. function useForkRef(...refs) {
  3467. return React__namespace.useMemo(() => {
  3468. if (refs.every((ref) => ref == null)) {
  3469. return null;
  3470. }
  3471. return (instance) => {
  3472. refs.forEach((ref) => {
  3473. setRef(ref, instance);
  3474. });
  3475. };
  3476. }, refs);
  3477. }
  3478. const UNINITIALIZED = {};
  3479. function useLazyRef(init, initArg) {
  3480. const ref = React__namespace.useRef(UNINITIALIZED);
  3481. if (ref.current === UNINITIALIZED) {
  3482. ref.current = init(initArg);
  3483. }
  3484. return ref;
  3485. }
  3486. const EMPTY = [];
  3487. function useOnMount(fn) {
  3488. React__namespace.useEffect(fn, EMPTY);
  3489. }
  3490. class Timeout {
  3491. constructor() {
  3492. __publicField(this, "currentId", null);
  3493. __publicField(this, "clear", () => {
  3494. if (this.currentId !== null) {
  3495. clearTimeout(this.currentId);
  3496. this.currentId = null;
  3497. }
  3498. });
  3499. __publicField(this, "disposeEffect", () => {
  3500. return this.clear;
  3501. });
  3502. }
  3503. static create() {
  3504. return new Timeout();
  3505. }
  3506. /**
  3507. * Executes `fn` after `delay`, clearing any previously scheduled call.
  3508. */
  3509. start(delay, fn) {
  3510. this.clear();
  3511. this.currentId = setTimeout(() => {
  3512. this.currentId = null;
  3513. fn();
  3514. }, delay);
  3515. }
  3516. }
  3517. function useTimeout() {
  3518. const timeout = useLazyRef(Timeout.create).current;
  3519. useOnMount(timeout.disposeEffect);
  3520. return timeout;
  3521. }
  3522. function isFocusVisible(element) {
  3523. try {
  3524. return element.matches(":focus-visible");
  3525. } catch (error) {
  3526. }
  3527. return false;
  3528. }
  3529. function composeClasses(slots, getUtilityClass, classes = void 0) {
  3530. const output = {};
  3531. for (const slotName in slots) {
  3532. const slot = slots[slotName];
  3533. let buffer = "";
  3534. let start = true;
  3535. for (let i = 0; i < slot.length; i += 1) {
  3536. const value = slot[i];
  3537. if (value) {
  3538. buffer += (start === true ? "" : " ") + getUtilityClass(value);
  3539. start = false;
  3540. if (classes && classes[value]) {
  3541. buffer += " " + classes[value];
  3542. }
  3543. }
  3544. }
  3545. output[slotName] = buffer;
  3546. }
  3547. return output;
  3548. }
  3549. const PropsContext = /* @__PURE__ */ React__namespace.createContext(void 0);
  3550. function getThemeProps(params) {
  3551. const {
  3552. theme,
  3553. name,
  3554. props
  3555. } = params;
  3556. if (!theme || !theme.components || !theme.components[name]) {
  3557. return props;
  3558. }
  3559. const config = theme.components[name];
  3560. if (config.defaultProps) {
  3561. return resolveProps(config.defaultProps, props);
  3562. }
  3563. if (!config.styleOverrides && !config.variants) {
  3564. return resolveProps(config, props);
  3565. }
  3566. return props;
  3567. }
  3568. function useDefaultProps$1({
  3569. props,
  3570. name
  3571. }) {
  3572. const ctx = React__namespace.useContext(PropsContext);
  3573. return getThemeProps({
  3574. props,
  3575. name,
  3576. theme: {
  3577. components: ctx
  3578. }
  3579. });
  3580. }
  3581. const arg = {
  3582. theme: void 0
  3583. };
  3584. function unstable_memoTheme(styleFn) {
  3585. let lastValue;
  3586. let lastTheme;
  3587. return function styleMemoized(props) {
  3588. let value = lastValue;
  3589. if (value === void 0 || props.theme !== lastTheme) {
  3590. arg.theme = props.theme;
  3591. value = preprocessStyles(styleFn(arg));
  3592. lastValue = value;
  3593. lastTheme = props.theme;
  3594. }
  3595. return value;
  3596. };
  3597. }
  3598. function createGetCssVar$1(prefix2 = "") {
  3599. function appendVar(...vars) {
  3600. if (!vars.length) {
  3601. return "";
  3602. }
  3603. const value = vars[0];
  3604. if (typeof value === "string" && !value.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)) {
  3605. return `, var(--${prefix2 ? `${prefix2}-` : ""}${value}${appendVar(...vars.slice(1))})`;
  3606. }
  3607. return `, ${value}`;
  3608. }
  3609. const getCssVar = (field, ...fallbacks) => {
  3610. return `var(--${prefix2 ? `${prefix2}-` : ""}${field}${appendVar(...fallbacks)})`;
  3611. };
  3612. return getCssVar;
  3613. }
  3614. const assignNestedKeys = (obj, keys, value, arrayKeys = []) => {
  3615. let temp = obj;
  3616. keys.forEach((k2, index) => {
  3617. if (index === keys.length - 1) {
  3618. if (Array.isArray(temp)) {
  3619. temp[Number(k2)] = value;
  3620. } else if (temp && typeof temp === "object") {
  3621. temp[k2] = value;
  3622. }
  3623. } else if (temp && typeof temp === "object") {
  3624. if (!temp[k2]) {
  3625. temp[k2] = arrayKeys.includes(k2) ? [] : {};
  3626. }
  3627. temp = temp[k2];
  3628. }
  3629. });
  3630. };
  3631. const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
  3632. function recurse(object, parentKeys = [], arrayKeys = []) {
  3633. Object.entries(object).forEach(([key, value]) => {
  3634. if (!shouldSkipPaths || shouldSkipPaths && !shouldSkipPaths([...parentKeys, key])) {
  3635. if (value !== void 0 && value !== null) {
  3636. if (typeof value === "object" && Object.keys(value).length > 0) {
  3637. recurse(value, [...parentKeys, key], Array.isArray(value) ? [...arrayKeys, key] : arrayKeys);
  3638. } else {
  3639. callback([...parentKeys, key], value, arrayKeys);
  3640. }
  3641. }
  3642. }
  3643. });
  3644. }
  3645. recurse(obj);
  3646. };
  3647. const getCssValue = (keys, value) => {
  3648. if (typeof value === "number") {
  3649. if (["lineHeight", "fontWeight", "opacity", "zIndex"].some((prop) => keys.includes(prop))) {
  3650. return value;
  3651. }
  3652. const lastKey = keys[keys.length - 1];
  3653. if (lastKey.toLowerCase().includes("opacity")) {
  3654. return value;
  3655. }
  3656. return `${value}px`;
  3657. }
  3658. return value;
  3659. };
  3660. function cssVarsParser(theme, options) {
  3661. const {
  3662. prefix: prefix2,
  3663. shouldSkipGeneratingVar: shouldSkipGeneratingVar2
  3664. } = options || {};
  3665. const css2 = {};
  3666. const vars = {};
  3667. const varsWithDefaults = {};
  3668. walkObjectDeep(
  3669. theme,
  3670. (keys, value, arrayKeys) => {
  3671. if (typeof value === "string" || typeof value === "number") {
  3672. if (!shouldSkipGeneratingVar2 || !shouldSkipGeneratingVar2(keys, value)) {
  3673. const cssVar = `--${prefix2 ? `${prefix2}-` : ""}${keys.join("-")}`;
  3674. const resolvedValue = getCssValue(keys, value);
  3675. Object.assign(css2, {
  3676. [cssVar]: resolvedValue
  3677. });
  3678. assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
  3679. assignNestedKeys(varsWithDefaults, keys, `var(${cssVar}, ${resolvedValue})`, arrayKeys);
  3680. }
  3681. }
  3682. },
  3683. (keys) => keys[0] === "vars"
  3684. // skip 'vars/*' paths
  3685. );
  3686. return {
  3687. css: css2,
  3688. vars,
  3689. varsWithDefaults
  3690. };
  3691. }
  3692. function prepareCssVars(theme, parserConfig = {}) {
  3693. const {
  3694. getSelector = defaultGetSelector2,
  3695. disableCssColorScheme,
  3696. colorSchemeSelector: selector
  3697. } = parserConfig;
  3698. const {
  3699. colorSchemes = {},
  3700. components,
  3701. defaultColorScheme = "light",
  3702. ...otherTheme
  3703. } = theme;
  3704. const {
  3705. vars: rootVars,
  3706. css: rootCss,
  3707. varsWithDefaults: rootVarsWithDefaults
  3708. } = cssVarsParser(otherTheme, parserConfig);
  3709. let themeVars = rootVarsWithDefaults;
  3710. const colorSchemesMap = {};
  3711. const {
  3712. [defaultColorScheme]: defaultScheme,
  3713. ...otherColorSchemes
  3714. } = colorSchemes;
  3715. Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
  3716. const {
  3717. vars,
  3718. css: css2,
  3719. varsWithDefaults
  3720. } = cssVarsParser(scheme, parserConfig);
  3721. themeVars = deepmerge(themeVars, varsWithDefaults);
  3722. colorSchemesMap[key] = {
  3723. css: css2,
  3724. vars
  3725. };
  3726. });
  3727. if (defaultScheme) {
  3728. const {
  3729. css: css2,
  3730. vars,
  3731. varsWithDefaults
  3732. } = cssVarsParser(defaultScheme, parserConfig);
  3733. themeVars = deepmerge(themeVars, varsWithDefaults);
  3734. colorSchemesMap[defaultColorScheme] = {
  3735. css: css2,
  3736. vars
  3737. };
  3738. }
  3739. function defaultGetSelector2(colorScheme, cssObject) {
  3740. var _a, _b;
  3741. let rule = selector;
  3742. if (selector === "class") {
  3743. rule = ".%s";
  3744. }
  3745. if (selector === "data") {
  3746. rule = "[data-%s]";
  3747. }
  3748. if ((selector == null ? void 0 : selector.startsWith("data-")) && !selector.includes("%s")) {
  3749. rule = `[${selector}="%s"]`;
  3750. }
  3751. if (colorScheme) {
  3752. if (rule === "media") {
  3753. if (theme.defaultColorScheme === colorScheme) {
  3754. return ":root";
  3755. }
  3756. const mode = ((_b = (_a = colorSchemes[colorScheme]) == null ? void 0 : _a.palette) == null ? void 0 : _b.mode) || colorScheme;
  3757. return {
  3758. [`@media (prefers-color-scheme: ${mode})`]: {
  3759. ":root": cssObject
  3760. }
  3761. };
  3762. }
  3763. if (rule) {
  3764. if (theme.defaultColorScheme === colorScheme) {
  3765. return `:root, ${rule.replace("%s", String(colorScheme))}`;
  3766. }
  3767. return rule.replace("%s", String(colorScheme));
  3768. }
  3769. }
  3770. return ":root";
  3771. }
  3772. const generateThemeVars = () => {
  3773. let vars = {
  3774. ...rootVars
  3775. };
  3776. Object.entries(colorSchemesMap).forEach(([, {
  3777. vars: schemeVars
  3778. }]) => {
  3779. vars = deepmerge(vars, schemeVars);
  3780. });
  3781. return vars;
  3782. };
  3783. const generateStyleSheets = () => {
  3784. var _a, _b;
  3785. const stylesheets = [];
  3786. const colorScheme = theme.defaultColorScheme || "light";
  3787. function insertStyleSheet(key, css2) {
  3788. if (Object.keys(css2).length) {
  3789. stylesheets.push(typeof key === "string" ? {
  3790. [key]: {
  3791. ...css2
  3792. }
  3793. } : key);
  3794. }
  3795. }
  3796. insertStyleSheet(getSelector(void 0, {
  3797. ...rootCss
  3798. }), rootCss);
  3799. const {
  3800. [colorScheme]: defaultSchemeVal,
  3801. ...other
  3802. } = colorSchemesMap;
  3803. if (defaultSchemeVal) {
  3804. const {
  3805. css: css2
  3806. } = defaultSchemeVal;
  3807. const cssColorSheme = (_b = (_a = colorSchemes[colorScheme]) == null ? void 0 : _a.palette) == null ? void 0 : _b.mode;
  3808. const finalCss = !disableCssColorScheme && cssColorSheme ? {
  3809. colorScheme: cssColorSheme,
  3810. ...css2
  3811. } : {
  3812. ...css2
  3813. };
  3814. insertStyleSheet(getSelector(colorScheme, {
  3815. ...finalCss
  3816. }), finalCss);
  3817. }
  3818. Object.entries(other).forEach(([key, {
  3819. css: css2
  3820. }]) => {
  3821. var _a2, _b2;
  3822. const cssColorSheme = (_b2 = (_a2 = colorSchemes[key]) == null ? void 0 : _a2.palette) == null ? void 0 : _b2.mode;
  3823. const finalCss = !disableCssColorScheme && cssColorSheme ? {
  3824. colorScheme: cssColorSheme,
  3825. ...css2
  3826. } : {
  3827. ...css2
  3828. };
  3829. insertStyleSheet(getSelector(key, {
  3830. ...finalCss
  3831. }), finalCss);
  3832. });
  3833. return stylesheets;
  3834. };
  3835. return {
  3836. vars: themeVars,
  3837. generateThemeVars,
  3838. generateStyleSheets
  3839. };
  3840. }
  3841. function createGetColorSchemeSelector(selector) {
  3842. return function getColorSchemeSelector(colorScheme) {
  3843. if (selector === "media") {
  3844. return `@media (prefers-color-scheme: ${colorScheme})`;
  3845. }
  3846. if (selector) {
  3847. if (selector.startsWith("data-") && !selector.includes("%s")) {
  3848. return `[${selector}="${colorScheme}"] &`;
  3849. }
  3850. if (selector === "class") {
  3851. return `.${colorScheme} &`;
  3852. }
  3853. if (selector === "data") {
  3854. return `[data-${colorScheme}] &`;
  3855. }
  3856. return `${selector.replace("%s", colorScheme)} &`;
  3857. }
  3858. return "&";
  3859. };
  3860. }
  3861. const THEME_ID = "$$material";
  3862. const common = {
  3863. black: "#000",
  3864. white: "#fff"
  3865. };
  3866. const grey = {
  3867. 50: "#fafafa",
  3868. 100: "#f5f5f5",
  3869. 200: "#eeeeee",
  3870. 300: "#e0e0e0",
  3871. 400: "#bdbdbd",
  3872. 500: "#9e9e9e",
  3873. 600: "#757575",
  3874. 700: "#616161",
  3875. 800: "#424242",
  3876. 900: "#212121",
  3877. A100: "#f5f5f5",
  3878. A200: "#eeeeee",
  3879. A400: "#bdbdbd",
  3880. A700: "#616161"
  3881. };
  3882. const purple = {
  3883. 50: "#f3e5f5",
  3884. 100: "#e1bee7",
  3885. 200: "#ce93d8",
  3886. 300: "#ba68c8",
  3887. 400: "#ab47bc",
  3888. 500: "#9c27b0",
  3889. 600: "#8e24aa",
  3890. 700: "#7b1fa2",
  3891. 800: "#6a1b9a",
  3892. 900: "#4a148c",
  3893. A100: "#ea80fc",
  3894. A200: "#e040fb",
  3895. A400: "#d500f9",
  3896. A700: "#aa00ff"
  3897. };
  3898. const red = {
  3899. 50: "#ffebee",
  3900. 100: "#ffcdd2",
  3901. 200: "#ef9a9a",
  3902. 300: "#e57373",
  3903. 400: "#ef5350",
  3904. 500: "#f44336",
  3905. 600: "#e53935",
  3906. 700: "#d32f2f",
  3907. 800: "#c62828",
  3908. 900: "#b71c1c",
  3909. A100: "#ff8a80",
  3910. A200: "#ff5252",
  3911. A400: "#ff1744",
  3912. A700: "#d50000"
  3913. };
  3914. const orange = {
  3915. 50: "#fff3e0",
  3916. 100: "#ffe0b2",
  3917. 200: "#ffcc80",
  3918. 300: "#ffb74d",
  3919. 400: "#ffa726",
  3920. 500: "#ff9800",
  3921. 600: "#fb8c00",
  3922. 700: "#f57c00",
  3923. 800: "#ef6c00",
  3924. 900: "#e65100",
  3925. A100: "#ffd180",
  3926. A200: "#ffab40",
  3927. A400: "#ff9100",
  3928. A700: "#ff6d00"
  3929. };
  3930. const blue = {
  3931. 50: "#e3f2fd",
  3932. 100: "#bbdefb",
  3933. 200: "#90caf9",
  3934. 300: "#64b5f6",
  3935. 400: "#42a5f5",
  3936. 500: "#2196f3",
  3937. 600: "#1e88e5",
  3938. 700: "#1976d2",
  3939. 800: "#1565c0",
  3940. 900: "#0d47a1",
  3941. A100: "#82b1ff",
  3942. A200: "#448aff",
  3943. A400: "#2979ff",
  3944. A700: "#2962ff"
  3945. };
  3946. const lightBlue = {
  3947. 50: "#e1f5fe",
  3948. 100: "#b3e5fc",
  3949. 200: "#81d4fa",
  3950. 300: "#4fc3f7",
  3951. 400: "#29b6f6",
  3952. 500: "#03a9f4",
  3953. 600: "#039be5",
  3954. 700: "#0288d1",
  3955. 800: "#0277bd",
  3956. 900: "#01579b",
  3957. A100: "#80d8ff",
  3958. A200: "#40c4ff",
  3959. A400: "#00b0ff",
  3960. A700: "#0091ea"
  3961. };
  3962. const green = {
  3963. 50: "#e8f5e9",
  3964. 100: "#c8e6c9",
  3965. 200: "#a5d6a7",
  3966. 300: "#81c784",
  3967. 400: "#66bb6a",
  3968. 500: "#4caf50",
  3969. 600: "#43a047",
  3970. 700: "#388e3c",
  3971. 800: "#2e7d32",
  3972. 900: "#1b5e20",
  3973. A100: "#b9f6ca",
  3974. A200: "#69f0ae",
  3975. A400: "#00e676",
  3976. A700: "#00c853"
  3977. };
  3978. function getLight() {
  3979. return {
  3980. // The colors used to style the text.
  3981. text: {
  3982. // The most important text.
  3983. primary: "rgba(0, 0, 0, 0.87)",
  3984. // Secondary text.
  3985. secondary: "rgba(0, 0, 0, 0.6)",
  3986. // Disabled text have even lower visual prominence.
  3987. disabled: "rgba(0, 0, 0, 0.38)"
  3988. },
  3989. // The color used to divide different elements.
  3990. divider: "rgba(0, 0, 0, 0.12)",
  3991. // The background colors used to style the surfaces.
  3992. // Consistency between these values is important.
  3993. background: {
  3994. paper: common.white,
  3995. default: common.white
  3996. },
  3997. // The colors used to style the action elements.
  3998. action: {
  3999. // The color of an active action like an icon button.
  4000. active: "rgba(0, 0, 0, 0.54)",
  4001. // The color of an hovered action.
  4002. hover: "rgba(0, 0, 0, 0.04)",
  4003. hoverOpacity: 0.04,
  4004. // The color of a selected action.
  4005. selected: "rgba(0, 0, 0, 0.08)",
  4006. selectedOpacity: 0.08,
  4007. // The color of a disabled action.
  4008. disabled: "rgba(0, 0, 0, 0.26)",
  4009. // The background color of a disabled action.
  4010. disabledBackground: "rgba(0, 0, 0, 0.12)",
  4011. disabledOpacity: 0.38,
  4012. focus: "rgba(0, 0, 0, 0.12)",
  4013. focusOpacity: 0.12,
  4014. activatedOpacity: 0.12
  4015. }
  4016. };
  4017. }
  4018. const light = getLight();
  4019. function getDark() {
  4020. return {
  4021. text: {
  4022. primary: common.white,
  4023. secondary: "rgba(255, 255, 255, 0.7)",
  4024. disabled: "rgba(255, 255, 255, 0.5)",
  4025. icon: "rgba(255, 255, 255, 0.5)"
  4026. },
  4027. divider: "rgba(255, 255, 255, 0.12)",
  4028. background: {
  4029. paper: "#121212",
  4030. default: "#121212"
  4031. },
  4032. action: {
  4033. active: common.white,
  4034. hover: "rgba(255, 255, 255, 0.08)",
  4035. hoverOpacity: 0.08,
  4036. selected: "rgba(255, 255, 255, 0.16)",
  4037. selectedOpacity: 0.16,
  4038. disabled: "rgba(255, 255, 255, 0.3)",
  4039. disabledBackground: "rgba(255, 255, 255, 0.12)",
  4040. disabledOpacity: 0.38,
  4041. focus: "rgba(255, 255, 255, 0.12)",
  4042. focusOpacity: 0.12,
  4043. activatedOpacity: 0.24
  4044. }
  4045. };
  4046. }
  4047. const dark = getDark();
  4048. function addLightOrDark(intent, direction, shade, tonalOffset) {
  4049. const tonalOffsetLight = tonalOffset.light || tonalOffset;
  4050. const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
  4051. if (!intent[direction]) {
  4052. if (intent.hasOwnProperty(shade)) {
  4053. intent[direction] = intent[shade];
  4054. } else if (direction === "light") {
  4055. intent.light = lighten(intent.main, tonalOffsetLight);
  4056. } else if (direction === "dark") {
  4057. intent.dark = darken(intent.main, tonalOffsetDark);
  4058. }
  4059. }
  4060. }
  4061. function getDefaultPrimary(mode = "light") {
  4062. if (mode === "dark") {
  4063. return {
  4064. main: blue[200],
  4065. light: blue[50],
  4066. dark: blue[400]
  4067. };
  4068. }
  4069. return {
  4070. main: blue[700],
  4071. light: blue[400],
  4072. dark: blue[800]
  4073. };
  4074. }
  4075. function getDefaultSecondary(mode = "light") {
  4076. if (mode === "dark") {
  4077. return {
  4078. main: purple[200],
  4079. light: purple[50],
  4080. dark: purple[400]
  4081. };
  4082. }
  4083. return {
  4084. main: purple[500],
  4085. light: purple[300],
  4086. dark: purple[700]
  4087. };
  4088. }
  4089. function getDefaultError(mode = "light") {
  4090. if (mode === "dark") {
  4091. return {
  4092. main: red[500],
  4093. light: red[300],
  4094. dark: red[700]
  4095. };
  4096. }
  4097. return {
  4098. main: red[700],
  4099. light: red[400],
  4100. dark: red[800]
  4101. };
  4102. }
  4103. function getDefaultInfo(mode = "light") {
  4104. if (mode === "dark") {
  4105. return {
  4106. main: lightBlue[400],
  4107. light: lightBlue[300],
  4108. dark: lightBlue[700]
  4109. };
  4110. }
  4111. return {
  4112. main: lightBlue[700],
  4113. light: lightBlue[500],
  4114. dark: lightBlue[900]
  4115. };
  4116. }
  4117. function getDefaultSuccess(mode = "light") {
  4118. if (mode === "dark") {
  4119. return {
  4120. main: green[400],
  4121. light: green[300],
  4122. dark: green[700]
  4123. };
  4124. }
  4125. return {
  4126. main: green[800],
  4127. light: green[500],
  4128. dark: green[900]
  4129. };
  4130. }
  4131. function getDefaultWarning(mode = "light") {
  4132. if (mode === "dark") {
  4133. return {
  4134. main: orange[400],
  4135. light: orange[300],
  4136. dark: orange[700]
  4137. };
  4138. }
  4139. return {
  4140. main: "#ed6c02",
  4141. // closest to orange[800] that pass 3:1.
  4142. light: orange[500],
  4143. dark: orange[900]
  4144. };
  4145. }
  4146. function createPalette(palette) {
  4147. const {
  4148. mode = "light",
  4149. contrastThreshold = 3,
  4150. tonalOffset = 0.2,
  4151. ...other
  4152. } = palette;
  4153. const primary = palette.primary || getDefaultPrimary(mode);
  4154. const secondary = palette.secondary || getDefaultSecondary(mode);
  4155. const error = palette.error || getDefaultError(mode);
  4156. const info = palette.info || getDefaultInfo(mode);
  4157. const success = palette.success || getDefaultSuccess(mode);
  4158. const warning = palette.warning || getDefaultWarning(mode);
  4159. function getContrastText(background) {
  4160. const contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
  4161. return contrastText;
  4162. }
  4163. const augmentColor = ({
  4164. color: color2,
  4165. name,
  4166. mainShade = 500,
  4167. lightShade = 300,
  4168. darkShade = 700
  4169. }) => {
  4170. color2 = {
  4171. ...color2
  4172. };
  4173. if (!color2.main && color2[mainShade]) {
  4174. color2.main = color2[mainShade];
  4175. }
  4176. if (!color2.hasOwnProperty("main")) {
  4177. throw new Error(formatMuiErrorMessage(11, name ? ` (${name})` : "", mainShade));
  4178. }
  4179. if (typeof color2.main !== "string") {
  4180. throw new Error(formatMuiErrorMessage(12, name ? ` (${name})` : "", JSON.stringify(color2.main)));
  4181. }
  4182. addLightOrDark(color2, "light", lightShade, tonalOffset);
  4183. addLightOrDark(color2, "dark", darkShade, tonalOffset);
  4184. if (!color2.contrastText) {
  4185. color2.contrastText = getContrastText(color2.main);
  4186. }
  4187. return color2;
  4188. };
  4189. let modeHydrated;
  4190. if (mode === "light") {
  4191. modeHydrated = getLight();
  4192. } else if (mode === "dark") {
  4193. modeHydrated = getDark();
  4194. }
  4195. const paletteOutput = deepmerge({
  4196. // A collection of common colors.
  4197. common: {
  4198. ...common
  4199. },
  4200. // prevent mutable object.
  4201. // The palette mode, can be light or dark.
  4202. mode,
  4203. // The colors used to represent primary interface elements for a user.
  4204. primary: augmentColor({
  4205. color: primary,
  4206. name: "primary"
  4207. }),
  4208. // The colors used to represent secondary interface elements for a user.
  4209. secondary: augmentColor({
  4210. color: secondary,
  4211. name: "secondary",
  4212. mainShade: "A400",
  4213. lightShade: "A200",
  4214. darkShade: "A700"
  4215. }),
  4216. // The colors used to represent interface elements that the user should be made aware of.
  4217. error: augmentColor({
  4218. color: error,
  4219. name: "error"
  4220. }),
  4221. // The colors used to represent potentially dangerous actions or important messages.
  4222. warning: augmentColor({
  4223. color: warning,
  4224. name: "warning"
  4225. }),
  4226. // The colors used to present information to the user that is neutral and not necessarily important.
  4227. info: augmentColor({
  4228. color: info,
  4229. name: "info"
  4230. }),
  4231. // The colors used to indicate the successful completion of an action that user triggered.
  4232. success: augmentColor({
  4233. color: success,
  4234. name: "success"
  4235. }),
  4236. // The grey colors.
  4237. grey,
  4238. // Used by `getContrastText()` to maximize the contrast between
  4239. // the background and the text.
  4240. contrastThreshold,
  4241. // Takes a background color and returns the text color that maximizes the contrast.
  4242. getContrastText,
  4243. // Generate a rich color object.
  4244. augmentColor,
  4245. // Used by the functions below to shift a color's luminance by approximately
  4246. // two indexes within its tonal palette.
  4247. // E.g., shift from Red 500 to Red 300 or Red 700.
  4248. tonalOffset,
  4249. // The light and dark mode object.
  4250. ...modeHydrated
  4251. }, other);
  4252. return paletteOutput;
  4253. }
  4254. function prepareTypographyVars(typography) {
  4255. const vars = {};
  4256. const entries = Object.entries(typography);
  4257. entries.forEach((entry) => {
  4258. const [key, value] = entry;
  4259. if (typeof value === "object") {
  4260. vars[key] = `${value.fontStyle ? `${value.fontStyle} ` : ""}${value.fontVariant ? `${value.fontVariant} ` : ""}${value.fontWeight ? `${value.fontWeight} ` : ""}${value.fontStretch ? `${value.fontStretch} ` : ""}${value.fontSize || ""}${value.lineHeight ? `/${value.lineHeight} ` : ""}${value.fontFamily || ""}`;
  4261. }
  4262. });
  4263. return vars;
  4264. }
  4265. function createMixins(breakpoints, mixins) {
  4266. return {
  4267. toolbar: {
  4268. minHeight: 56,
  4269. [breakpoints.up("xs")]: {
  4270. "@media (orientation: landscape)": {
  4271. minHeight: 48
  4272. }
  4273. },
  4274. [breakpoints.up("sm")]: {
  4275. minHeight: 64
  4276. }
  4277. },
  4278. ...mixins
  4279. };
  4280. }
  4281. function round(value) {
  4282. return Math.round(value * 1e5) / 1e5;
  4283. }
  4284. const caseAllCaps = {
  4285. textTransform: "uppercase"
  4286. };
  4287. const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
  4288. function createTypography(palette, typography) {
  4289. const {
  4290. fontFamily = defaultFontFamily,
  4291. // The default font size of the Material Specification.
  4292. fontSize = 14,
  4293. // px
  4294. fontWeightLight = 300,
  4295. fontWeightRegular = 400,
  4296. fontWeightMedium = 500,
  4297. fontWeightBold = 700,
  4298. // Tell MUI what's the font-size on the html element.
  4299. // 16px is the default font-size used by browsers.
  4300. htmlFontSize = 16,
  4301. // Apply the CSS properties to all the variants.
  4302. allVariants,
  4303. pxToRem: pxToRem2,
  4304. ...other
  4305. } = typeof typography === "function" ? typography(palette) : typography;
  4306. const coef = fontSize / 14;
  4307. const pxToRem = pxToRem2 || ((size) => `${size / htmlFontSize * coef}rem`);
  4308. const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => ({
  4309. fontFamily,
  4310. fontWeight,
  4311. fontSize: pxToRem(size),
  4312. // Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/
  4313. lineHeight,
  4314. // The letter spacing was designed for the Roboto font-family. Using the same letter-spacing
  4315. // across font-families can cause issues with the kerning.
  4316. ...fontFamily === defaultFontFamily ? {
  4317. letterSpacing: `${round(letterSpacing / size)}em`
  4318. } : {},
  4319. ...casing,
  4320. ...allVariants
  4321. });
  4322. const variants = {
  4323. h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
  4324. h2: buildVariant(fontWeightLight, 60, 1.2, -0.5),
  4325. h3: buildVariant(fontWeightRegular, 48, 1.167, 0),
  4326. h4: buildVariant(fontWeightRegular, 34, 1.235, 0.25),
  4327. h5: buildVariant(fontWeightRegular, 24, 1.334, 0),
  4328. h6: buildVariant(fontWeightMedium, 20, 1.6, 0.15),
  4329. subtitle1: buildVariant(fontWeightRegular, 16, 1.75, 0.15),
  4330. subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
  4331. body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
  4332. body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
  4333. button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
  4334. caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
  4335. overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
  4336. // TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types.
  4337. inherit: {
  4338. fontFamily: "inherit",
  4339. fontWeight: "inherit",
  4340. fontSize: "inherit",
  4341. lineHeight: "inherit",
  4342. letterSpacing: "inherit"
  4343. }
  4344. };
  4345. return deepmerge({
  4346. htmlFontSize,
  4347. pxToRem,
  4348. fontFamily,
  4349. fontSize,
  4350. fontWeightLight,
  4351. fontWeightRegular,
  4352. fontWeightMedium,
  4353. fontWeightBold,
  4354. ...variants
  4355. }, other, {
  4356. clone: false
  4357. // No need to clone deep
  4358. });
  4359. }
  4360. const shadowKeyUmbraOpacity = 0.2;
  4361. const shadowKeyPenumbraOpacity = 0.14;
  4362. const shadowAmbientShadowOpacity = 0.12;
  4363. function createShadow(...px) {
  4364. return [`${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`, `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`, `${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(",");
  4365. }
  4366. const shadows = ["none", createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
  4367. const easing = {
  4368. // This is the most common easing curve.
  4369. easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
  4370. // Objects enter the screen at full velocity from off-screen and
  4371. // slowly decelerate to a resting point.
  4372. easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
  4373. // Objects leave the screen at full velocity. They do not decelerate when off-screen.
  4374. easeIn: "cubic-bezier(0.4, 0, 1, 1)",
  4375. // The sharp curve is used by objects that may return to the screen at any time.
  4376. sharp: "cubic-bezier(0.4, 0, 0.6, 1)"
  4377. };
  4378. const duration = {
  4379. shortest: 150,
  4380. shorter: 200,
  4381. short: 250,
  4382. // most basic recommended timing
  4383. standard: 300,
  4384. // this is to be used in complex animations
  4385. complex: 375,
  4386. // recommended when something is entering screen
  4387. enteringScreen: 225,
  4388. // recommended when something is leaving screen
  4389. leavingScreen: 195
  4390. };
  4391. function formatMs(milliseconds) {
  4392. return `${Math.round(milliseconds)}ms`;
  4393. }
  4394. function getAutoHeightDuration(height2) {
  4395. if (!height2) {
  4396. return 0;
  4397. }
  4398. const constant = height2 / 36;
  4399. return Math.min(Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10), 3e3);
  4400. }
  4401. function createTransitions(inputTransitions) {
  4402. const mergedEasing = {
  4403. ...easing,
  4404. ...inputTransitions.easing
  4405. };
  4406. const mergedDuration = {
  4407. ...duration,
  4408. ...inputTransitions.duration
  4409. };
  4410. const create = (props = ["all"], options = {}) => {
  4411. const {
  4412. duration: durationOption = mergedDuration.standard,
  4413. easing: easingOption = mergedEasing.easeInOut,
  4414. delay = 0,
  4415. ...other
  4416. } = options;
  4417. return (Array.isArray(props) ? props : [props]).map((animatedProp) => `${animatedProp} ${typeof durationOption === "string" ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === "string" ? delay : formatMs(delay)}`).join(",");
  4418. };
  4419. return {
  4420. getAutoHeightDuration,
  4421. create,
  4422. ...inputTransitions,
  4423. easing: mergedEasing,
  4424. duration: mergedDuration
  4425. };
  4426. }
  4427. const zIndex = {
  4428. mobileStepper: 1e3,
  4429. fab: 1050,
  4430. speedDial: 1050,
  4431. appBar: 1100,
  4432. drawer: 1200,
  4433. modal: 1300,
  4434. snackbar: 1400,
  4435. tooltip: 1500
  4436. };
  4437. function isSerializable(val) {
  4438. return isPlainObject$1(val) || typeof val === "undefined" || typeof val === "string" || typeof val === "boolean" || typeof val === "number" || Array.isArray(val);
  4439. }
  4440. function stringifyTheme(baseTheme = {}) {
  4441. const serializableTheme = {
  4442. ...baseTheme
  4443. };
  4444. function serializeTheme(object) {
  4445. const array = Object.entries(object);
  4446. for (let index = 0; index < array.length; index++) {
  4447. const [key, value] = array[index];
  4448. if (!isSerializable(value) || key.startsWith("unstable_")) {
  4449. delete object[key];
  4450. } else if (isPlainObject$1(value)) {
  4451. object[key] = {
  4452. ...value
  4453. };
  4454. serializeTheme(object[key]);
  4455. }
  4456. }
  4457. }
  4458. serializeTheme(serializableTheme);
  4459. return `import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
  4460.  
  4461. const theme = ${JSON.stringify(serializableTheme, null, 2)};
  4462.  
  4463. theme.breakpoints = createBreakpoints(theme.breakpoints || {});
  4464. theme.transitions = createTransitions(theme.transitions || {});
  4465.  
  4466. export default theme;`;
  4467. }
  4468. function createThemeNoVars(options = {}, ...args) {
  4469. const {
  4470. breakpoints: breakpointsInput,
  4471. mixins: mixinsInput = {},
  4472. spacing: spacingInput,
  4473. palette: paletteInput = {},
  4474. transitions: transitionsInput = {},
  4475. typography: typographyInput = {},
  4476. shape: shapeInput,
  4477. ...other
  4478. } = options;
  4479. if (options.vars) {
  4480. throw new Error(formatMuiErrorMessage(20));
  4481. }
  4482. const palette = createPalette(paletteInput);
  4483. const systemTheme = createTheme$1(options);
  4484. let muiTheme = deepmerge(systemTheme, {
  4485. mixins: createMixins(systemTheme.breakpoints, mixinsInput),
  4486. palette,
  4487. // Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol.
  4488. shadows: shadows.slice(),
  4489. typography: createTypography(palette, typographyInput),
  4490. transitions: createTransitions(transitionsInput),
  4491. zIndex: {
  4492. ...zIndex
  4493. }
  4494. });
  4495. muiTheme = deepmerge(muiTheme, other);
  4496. muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
  4497. muiTheme.unstable_sxConfig = {
  4498. ...defaultSxConfig,
  4499. ...other == null ? void 0 : other.unstable_sxConfig
  4500. };
  4501. muiTheme.unstable_sx = function sx(props) {
  4502. return styleFunctionSx({
  4503. sx: props,
  4504. theme: this
  4505. });
  4506. };
  4507. muiTheme.toRuntimeSource = stringifyTheme;
  4508. return muiTheme;
  4509. }
  4510. function getOverlayAlpha(elevation) {
  4511. let alphaValue;
  4512. if (elevation < 1) {
  4513. alphaValue = 5.11916 * elevation ** 2;
  4514. } else {
  4515. alphaValue = 4.5 * Math.log(elevation + 1) + 2;
  4516. }
  4517. return Math.round(alphaValue * 10) / 1e3;
  4518. }
  4519. const defaultDarkOverlays = [...Array(25)].map((_, index) => {
  4520. if (index === 0) {
  4521. return "none";
  4522. }
  4523. const overlay = getOverlayAlpha(index);
  4524. return `linear-gradient(rgba(255 255 255 / ${overlay}), rgba(255 255 255 / ${overlay}))`;
  4525. });
  4526. function getOpacity(mode) {
  4527. return {
  4528. inputPlaceholder: mode === "dark" ? 0.5 : 0.42,
  4529. inputUnderline: mode === "dark" ? 0.7 : 0.42,
  4530. switchTrackDisabled: mode === "dark" ? 0.2 : 0.12,
  4531. switchTrack: mode === "dark" ? 0.3 : 0.38
  4532. };
  4533. }
  4534. function getOverlays(mode) {
  4535. return mode === "dark" ? defaultDarkOverlays : [];
  4536. }
  4537. function createColorScheme(options) {
  4538. const {
  4539. palette: paletteInput = {
  4540. mode: "light"
  4541. },
  4542. // need to cast to avoid module augmentation test
  4543. opacity,
  4544. overlays,
  4545. ...rest
  4546. } = options;
  4547. const palette = createPalette(paletteInput);
  4548. return {
  4549. palette,
  4550. opacity: {
  4551. ...getOpacity(palette.mode),
  4552. ...opacity
  4553. },
  4554. overlays: overlays || getOverlays(palette.mode),
  4555. ...rest
  4556. };
  4557. }
  4558. function shouldSkipGeneratingVar(keys) {
  4559. var _a;
  4560. return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) || // ends with sxConfig
  4561. keys[0] === "palette" && !!((_a = keys[1]) == null ? void 0 : _a.match(/(mode|contrastThreshold|tonalOffset)/));
  4562. }
  4563. const excludeVariablesFromRoot = (cssVarPrefix) => [...[...Array(25)].map((_, index) => `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}overlays-${index}`), `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}palette-AppBar-darkBg`, `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}palette-AppBar-darkColor`];
  4564. const defaultGetSelector = (theme) => (colorScheme, css2) => {
  4565. const root = theme.rootSelector || ":root";
  4566. const selector = theme.colorSchemeSelector;
  4567. let rule = selector;
  4568. if (selector === "class") {
  4569. rule = ".%s";
  4570. }
  4571. if (selector === "data") {
  4572. rule = "[data-%s]";
  4573. }
  4574. if ((selector == null ? void 0 : selector.startsWith("data-")) && !selector.includes("%s")) {
  4575. rule = `[${selector}="%s"]`;
  4576. }
  4577. if (theme.defaultColorScheme === colorScheme) {
  4578. if (colorScheme === "dark") {
  4579. const excludedVariables = {};
  4580. excludeVariablesFromRoot(theme.cssVarPrefix).forEach((cssVar) => {
  4581. excludedVariables[cssVar] = css2[cssVar];
  4582. delete css2[cssVar];
  4583. });
  4584. if (rule === "media") {
  4585. return {
  4586. [root]: css2,
  4587. [`@media (prefers-color-scheme: dark)`]: {
  4588. [root]: excludedVariables
  4589. }
  4590. };
  4591. }
  4592. if (rule) {
  4593. return {
  4594. [rule.replace("%s", colorScheme)]: excludedVariables,
  4595. [`${root}, ${rule.replace("%s", colorScheme)}`]: css2
  4596. };
  4597. }
  4598. return {
  4599. [root]: {
  4600. ...css2,
  4601. ...excludedVariables
  4602. }
  4603. };
  4604. }
  4605. if (rule && rule !== "media") {
  4606. return `${root}, ${rule.replace("%s", String(colorScheme))}`;
  4607. }
  4608. } else if (colorScheme) {
  4609. if (rule === "media") {
  4610. return {
  4611. [`@media (prefers-color-scheme: ${String(colorScheme)})`]: {
  4612. [root]: css2
  4613. }
  4614. };
  4615. }
  4616. if (rule) {
  4617. return rule.replace("%s", String(colorScheme));
  4618. }
  4619. }
  4620. return root;
  4621. };
  4622. function assignNode(obj, keys) {
  4623. keys.forEach((k2) => {
  4624. if (!obj[k2]) {
  4625. obj[k2] = {};
  4626. }
  4627. });
  4628. }
  4629. function setColor(obj, key, defaultValue) {
  4630. if (!obj[key] && defaultValue) {
  4631. obj[key] = defaultValue;
  4632. }
  4633. }
  4634. function toRgb(color2) {
  4635. if (!color2 || !color2.startsWith("hsl")) {
  4636. return color2;
  4637. }
  4638. return hslToRgb(color2);
  4639. }
  4640. function setColorChannel(obj, key) {
  4641. if (!(`${key}Channel` in obj)) {
  4642. obj[`${key}Channel`] = private_safeColorChannel(toRgb(obj[key]), `MUI: Can't create \`palette.${key}Channel\` because \`palette.${key}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
  4643. To suppress this warning, you need to explicitly provide the \`palette.${key}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`);
  4644. }
  4645. }
  4646. function getSpacingVal(spacingInput) {
  4647. if (typeof spacingInput === "number") {
  4648. return `${spacingInput}px`;
  4649. }
  4650. if (typeof spacingInput === "string" || typeof spacingInput === "function" || Array.isArray(spacingInput)) {
  4651. return spacingInput;
  4652. }
  4653. return "8px";
  4654. }
  4655. const silent = (fn) => {
  4656. try {
  4657. return fn();
  4658. } catch (error) {
  4659. }
  4660. return void 0;
  4661. };
  4662. const createGetCssVar = (cssVarPrefix = "mui") => createGetCssVar$1(cssVarPrefix);
  4663. function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
  4664. if (!scheme) {
  4665. return void 0;
  4666. }
  4667. scheme = scheme === true ? {} : scheme;
  4668. const mode = colorScheme === "dark" ? "dark" : "light";
  4669. if (!restTheme) {
  4670. colorSchemes[colorScheme] = createColorScheme({
  4671. ...scheme,
  4672. palette: {
  4673. mode,
  4674. ...scheme == null ? void 0 : scheme.palette
  4675. }
  4676. });
  4677. return void 0;
  4678. }
  4679. const {
  4680. palette,
  4681. ...muiTheme
  4682. } = createThemeNoVars({
  4683. ...restTheme,
  4684. palette: {
  4685. mode,
  4686. ...scheme == null ? void 0 : scheme.palette
  4687. }
  4688. });
  4689. colorSchemes[colorScheme] = {
  4690. ...scheme,
  4691. palette,
  4692. opacity: {
  4693. ...getOpacity(mode),
  4694. ...scheme == null ? void 0 : scheme.opacity
  4695. },
  4696. overlays: (scheme == null ? void 0 : scheme.overlays) || getOverlays(mode)
  4697. };
  4698. return muiTheme;
  4699. }
  4700. function createThemeWithVars(options = {}, ...args) {
  4701. const {
  4702. colorSchemes: colorSchemesInput = {
  4703. light: true
  4704. },
  4705. defaultColorScheme: defaultColorSchemeInput,
  4706. disableCssColorScheme = false,
  4707. cssVarPrefix = "mui",
  4708. shouldSkipGeneratingVar: shouldSkipGeneratingVar$1 = shouldSkipGeneratingVar,
  4709. colorSchemeSelector: selector = colorSchemesInput.light && colorSchemesInput.dark ? "media" : void 0,
  4710. rootSelector = ":root",
  4711. ...input
  4712. } = options;
  4713. const firstColorScheme = Object.keys(colorSchemesInput)[0];
  4714. const defaultColorScheme = defaultColorSchemeInput || (colorSchemesInput.light && firstColorScheme !== "light" ? "light" : firstColorScheme);
  4715. const getCssVar = createGetCssVar(cssVarPrefix);
  4716. const {
  4717. [defaultColorScheme]: defaultSchemeInput,
  4718. light: builtInLight,
  4719. dark: builtInDark,
  4720. ...customColorSchemes
  4721. } = colorSchemesInput;
  4722. const colorSchemes = {
  4723. ...customColorSchemes
  4724. };
  4725. let defaultScheme = defaultSchemeInput;
  4726. if (defaultColorScheme === "dark" && !("dark" in colorSchemesInput) || defaultColorScheme === "light" && !("light" in colorSchemesInput)) {
  4727. defaultScheme = true;
  4728. }
  4729. if (!defaultScheme) {
  4730. throw new Error(formatMuiErrorMessage(21, defaultColorScheme));
  4731. }
  4732. const muiTheme = attachColorScheme$1(colorSchemes, defaultScheme, input, defaultColorScheme);
  4733. if (builtInLight && !colorSchemes.light) {
  4734. attachColorScheme$1(colorSchemes, builtInLight, void 0, "light");
  4735. }
  4736. if (builtInDark && !colorSchemes.dark) {
  4737. attachColorScheme$1(colorSchemes, builtInDark, void 0, "dark");
  4738. }
  4739. let theme = {
  4740. defaultColorScheme,
  4741. ...muiTheme,
  4742. cssVarPrefix,
  4743. colorSchemeSelector: selector,
  4744. rootSelector,
  4745. getCssVar,
  4746. colorSchemes,
  4747. font: {
  4748. ...prepareTypographyVars(muiTheme.typography),
  4749. ...muiTheme.font
  4750. },
  4751. spacing: getSpacingVal(input.spacing)
  4752. };
  4753. Object.keys(theme.colorSchemes).forEach((key) => {
  4754. const palette = theme.colorSchemes[key].palette;
  4755. const setCssVarColor = (cssVar) => {
  4756. const tokens = cssVar.split("-");
  4757. const color2 = tokens[1];
  4758. const colorToken = tokens[2];
  4759. return getCssVar(cssVar, palette[color2][colorToken]);
  4760. };
  4761. if (palette.mode === "light") {
  4762. setColor(palette.common, "background", "#fff");
  4763. setColor(palette.common, "onBackground", "#000");
  4764. }
  4765. if (palette.mode === "dark") {
  4766. setColor(palette.common, "background", "#000");
  4767. setColor(palette.common, "onBackground", "#fff");
  4768. }
  4769. assignNode(palette, ["Alert", "AppBar", "Avatar", "Button", "Chip", "FilledInput", "LinearProgress", "Skeleton", "Slider", "SnackbarContent", "SpeedDialAction", "StepConnector", "StepContent", "Switch", "TableCell", "Tooltip"]);
  4770. if (palette.mode === "light") {
  4771. setColor(palette.Alert, "errorColor", private_safeDarken(palette.error.light, 0.6));
  4772. setColor(palette.Alert, "infoColor", private_safeDarken(palette.info.light, 0.6));
  4773. setColor(palette.Alert, "successColor", private_safeDarken(palette.success.light, 0.6));
  4774. setColor(palette.Alert, "warningColor", private_safeDarken(palette.warning.light, 0.6));
  4775. setColor(palette.Alert, "errorFilledBg", setCssVarColor("palette-error-main"));
  4776. setColor(palette.Alert, "infoFilledBg", setCssVarColor("palette-info-main"));
  4777. setColor(palette.Alert, "successFilledBg", setCssVarColor("palette-success-main"));
  4778. setColor(palette.Alert, "warningFilledBg", setCssVarColor("palette-warning-main"));
  4779. setColor(palette.Alert, "errorFilledColor", silent(() => palette.getContrastText(palette.error.main)));
  4780. setColor(palette.Alert, "infoFilledColor", silent(() => palette.getContrastText(palette.info.main)));
  4781. setColor(palette.Alert, "successFilledColor", silent(() => palette.getContrastText(palette.success.main)));
  4782. setColor(palette.Alert, "warningFilledColor", silent(() => palette.getContrastText(palette.warning.main)));
  4783. setColor(palette.Alert, "errorStandardBg", private_safeLighten(palette.error.light, 0.9));
  4784. setColor(palette.Alert, "infoStandardBg", private_safeLighten(palette.info.light, 0.9));
  4785. setColor(palette.Alert, "successStandardBg", private_safeLighten(palette.success.light, 0.9));
  4786. setColor(palette.Alert, "warningStandardBg", private_safeLighten(palette.warning.light, 0.9));
  4787. setColor(palette.Alert, "errorIconColor", setCssVarColor("palette-error-main"));
  4788. setColor(palette.Alert, "infoIconColor", setCssVarColor("palette-info-main"));
  4789. setColor(palette.Alert, "successIconColor", setCssVarColor("palette-success-main"));
  4790. setColor(palette.Alert, "warningIconColor", setCssVarColor("palette-warning-main"));
  4791. setColor(palette.AppBar, "defaultBg", setCssVarColor("palette-grey-100"));
  4792. setColor(palette.Avatar, "defaultBg", setCssVarColor("palette-grey-400"));
  4793. setColor(palette.Button, "inheritContainedBg", setCssVarColor("palette-grey-300"));
  4794. setColor(palette.Button, "inheritContainedHoverBg", setCssVarColor("palette-grey-A100"));
  4795. setColor(palette.Chip, "defaultBorder", setCssVarColor("palette-grey-400"));
  4796. setColor(palette.Chip, "defaultAvatarColor", setCssVarColor("palette-grey-700"));
  4797. setColor(palette.Chip, "defaultIconColor", setCssVarColor("palette-grey-700"));
  4798. setColor(palette.FilledInput, "bg", "rgba(0, 0, 0, 0.06)");
  4799. setColor(palette.FilledInput, "hoverBg", "rgba(0, 0, 0, 0.09)");
  4800. setColor(palette.FilledInput, "disabledBg", "rgba(0, 0, 0, 0.12)");
  4801. setColor(palette.LinearProgress, "primaryBg", private_safeLighten(palette.primary.main, 0.62));
  4802. setColor(palette.LinearProgress, "secondaryBg", private_safeLighten(palette.secondary.main, 0.62));
  4803. setColor(palette.LinearProgress, "errorBg", private_safeLighten(palette.error.main, 0.62));
  4804. setColor(palette.LinearProgress, "infoBg", private_safeLighten(palette.info.main, 0.62));
  4805. setColor(palette.LinearProgress, "successBg", private_safeLighten(palette.success.main, 0.62));
  4806. setColor(palette.LinearProgress, "warningBg", private_safeLighten(palette.warning.main, 0.62));
  4807. setColor(palette.Skeleton, "bg", `rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.11)`);
  4808. setColor(palette.Slider, "primaryTrack", private_safeLighten(palette.primary.main, 0.62));
  4809. setColor(palette.Slider, "secondaryTrack", private_safeLighten(palette.secondary.main, 0.62));
  4810. setColor(palette.Slider, "errorTrack", private_safeLighten(palette.error.main, 0.62));
  4811. setColor(palette.Slider, "infoTrack", private_safeLighten(palette.info.main, 0.62));
  4812. setColor(palette.Slider, "successTrack", private_safeLighten(palette.success.main, 0.62));
  4813. setColor(palette.Slider, "warningTrack", private_safeLighten(palette.warning.main, 0.62));
  4814. const snackbarContentBackground = private_safeEmphasize(palette.background.default, 0.8);
  4815. setColor(palette.SnackbarContent, "bg", snackbarContentBackground);
  4816. setColor(palette.SnackbarContent, "color", silent(() => palette.getContrastText(snackbarContentBackground)));
  4817. setColor(palette.SpeedDialAction, "fabHoverBg", private_safeEmphasize(palette.background.paper, 0.15));
  4818. setColor(palette.StepConnector, "border", setCssVarColor("palette-grey-400"));
  4819. setColor(palette.StepContent, "border", setCssVarColor("palette-grey-400"));
  4820. setColor(palette.Switch, "defaultColor", setCssVarColor("palette-common-white"));
  4821. setColor(palette.Switch, "defaultDisabledColor", setCssVarColor("palette-grey-100"));
  4822. setColor(palette.Switch, "primaryDisabledColor", private_safeLighten(palette.primary.main, 0.62));
  4823. setColor(palette.Switch, "secondaryDisabledColor", private_safeLighten(palette.secondary.main, 0.62));
  4824. setColor(palette.Switch, "errorDisabledColor", private_safeLighten(palette.error.main, 0.62));
  4825. setColor(palette.Switch, "infoDisabledColor", private_safeLighten(palette.info.main, 0.62));
  4826. setColor(palette.Switch, "successDisabledColor", private_safeLighten(palette.success.main, 0.62));
  4827. setColor(palette.Switch, "warningDisabledColor", private_safeLighten(palette.warning.main, 0.62));
  4828. setColor(palette.TableCell, "border", private_safeLighten(private_safeAlpha(palette.divider, 1), 0.88));
  4829. setColor(palette.Tooltip, "bg", private_safeAlpha(palette.grey[700], 0.92));
  4830. }
  4831. if (palette.mode === "dark") {
  4832. setColor(palette.Alert, "errorColor", private_safeLighten(palette.error.light, 0.6));
  4833. setColor(palette.Alert, "infoColor", private_safeLighten(palette.info.light, 0.6));
  4834. setColor(palette.Alert, "successColor", private_safeLighten(palette.success.light, 0.6));
  4835. setColor(palette.Alert, "warningColor", private_safeLighten(palette.warning.light, 0.6));
  4836. setColor(palette.Alert, "errorFilledBg", setCssVarColor("palette-error-dark"));
  4837. setColor(palette.Alert, "infoFilledBg", setCssVarColor("palette-info-dark"));
  4838. setColor(palette.Alert, "successFilledBg", setCssVarColor("palette-success-dark"));
  4839. setColor(palette.Alert, "warningFilledBg", setCssVarColor("palette-warning-dark"));
  4840. setColor(palette.Alert, "errorFilledColor", silent(() => palette.getContrastText(palette.error.dark)));
  4841. setColor(palette.Alert, "infoFilledColor", silent(() => palette.getContrastText(palette.info.dark)));
  4842. setColor(palette.Alert, "successFilledColor", silent(() => palette.getContrastText(palette.success.dark)));
  4843. setColor(palette.Alert, "warningFilledColor", silent(() => palette.getContrastText(palette.warning.dark)));
  4844. setColor(palette.Alert, "errorStandardBg", private_safeDarken(palette.error.light, 0.9));
  4845. setColor(palette.Alert, "infoStandardBg", private_safeDarken(palette.info.light, 0.9));
  4846. setColor(palette.Alert, "successStandardBg", private_safeDarken(palette.success.light, 0.9));
  4847. setColor(palette.Alert, "warningStandardBg", private_safeDarken(palette.warning.light, 0.9));
  4848. setColor(palette.Alert, "errorIconColor", setCssVarColor("palette-error-main"));
  4849. setColor(palette.Alert, "infoIconColor", setCssVarColor("palette-info-main"));
  4850. setColor(palette.Alert, "successIconColor", setCssVarColor("palette-success-main"));
  4851. setColor(palette.Alert, "warningIconColor", setCssVarColor("palette-warning-main"));
  4852. setColor(palette.AppBar, "defaultBg", setCssVarColor("palette-grey-900"));
  4853. setColor(palette.AppBar, "darkBg", setCssVarColor("palette-background-paper"));
  4854. setColor(palette.AppBar, "darkColor", setCssVarColor("palette-text-primary"));
  4855. setColor(palette.Avatar, "defaultBg", setCssVarColor("palette-grey-600"));
  4856. setColor(palette.Button, "inheritContainedBg", setCssVarColor("palette-grey-800"));
  4857. setColor(palette.Button, "inheritContainedHoverBg", setCssVarColor("palette-grey-700"));
  4858. setColor(palette.Chip, "defaultBorder", setCssVarColor("palette-grey-700"));
  4859. setColor(palette.Chip, "defaultAvatarColor", setCssVarColor("palette-grey-300"));
  4860. setColor(palette.Chip, "defaultIconColor", setCssVarColor("palette-grey-300"));
  4861. setColor(palette.FilledInput, "bg", "rgba(255, 255, 255, 0.09)");
  4862. setColor(palette.FilledInput, "hoverBg", "rgba(255, 255, 255, 0.13)");
  4863. setColor(palette.FilledInput, "disabledBg", "rgba(255, 255, 255, 0.12)");
  4864. setColor(palette.LinearProgress, "primaryBg", private_safeDarken(palette.primary.main, 0.5));
  4865. setColor(palette.LinearProgress, "secondaryBg", private_safeDarken(palette.secondary.main, 0.5));
  4866. setColor(palette.LinearProgress, "errorBg", private_safeDarken(palette.error.main, 0.5));
  4867. setColor(palette.LinearProgress, "infoBg", private_safeDarken(palette.info.main, 0.5));
  4868. setColor(palette.LinearProgress, "successBg", private_safeDarken(palette.success.main, 0.5));
  4869. setColor(palette.LinearProgress, "warningBg", private_safeDarken(palette.warning.main, 0.5));
  4870. setColor(palette.Skeleton, "bg", `rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.13)`);
  4871. setColor(palette.Slider, "primaryTrack", private_safeDarken(palette.primary.main, 0.5));
  4872. setColor(palette.Slider, "secondaryTrack", private_safeDarken(palette.secondary.main, 0.5));
  4873. setColor(palette.Slider, "errorTrack", private_safeDarken(palette.error.main, 0.5));
  4874. setColor(palette.Slider, "infoTrack", private_safeDarken(palette.info.main, 0.5));
  4875. setColor(palette.Slider, "successTrack", private_safeDarken(palette.success.main, 0.5));
  4876. setColor(palette.Slider, "warningTrack", private_safeDarken(palette.warning.main, 0.5));
  4877. const snackbarContentBackground = private_safeEmphasize(palette.background.default, 0.98);
  4878. setColor(palette.SnackbarContent, "bg", snackbarContentBackground);
  4879. setColor(palette.SnackbarContent, "color", silent(() => palette.getContrastText(snackbarContentBackground)));
  4880. setColor(palette.SpeedDialAction, "fabHoverBg", private_safeEmphasize(palette.background.paper, 0.15));
  4881. setColor(palette.StepConnector, "border", setCssVarColor("palette-grey-600"));
  4882. setColor(palette.StepContent, "border", setCssVarColor("palette-grey-600"));
  4883. setColor(palette.Switch, "defaultColor", setCssVarColor("palette-grey-300"));
  4884. setColor(palette.Switch, "defaultDisabledColor", setCssVarColor("palette-grey-600"));
  4885. setColor(palette.Switch, "primaryDisabledColor", private_safeDarken(palette.primary.main, 0.55));
  4886. setColor(palette.Switch, "secondaryDisabledColor", private_safeDarken(palette.secondary.main, 0.55));
  4887. setColor(palette.Switch, "errorDisabledColor", private_safeDarken(palette.error.main, 0.55));
  4888. setColor(palette.Switch, "infoDisabledColor", private_safeDarken(palette.info.main, 0.55));
  4889. setColor(palette.Switch, "successDisabledColor", private_safeDarken(palette.success.main, 0.55));
  4890. setColor(palette.Switch, "warningDisabledColor", private_safeDarken(palette.warning.main, 0.55));
  4891. setColor(palette.TableCell, "border", private_safeDarken(private_safeAlpha(palette.divider, 1), 0.68));
  4892. setColor(palette.Tooltip, "bg", private_safeAlpha(palette.grey[700], 0.92));
  4893. }
  4894. setColorChannel(palette.background, "default");
  4895. setColorChannel(palette.background, "paper");
  4896. setColorChannel(palette.common, "background");
  4897. setColorChannel(palette.common, "onBackground");
  4898. setColorChannel(palette, "divider");
  4899. Object.keys(palette).forEach((color2) => {
  4900. const colors = palette[color2];
  4901. if (colors && typeof colors === "object") {
  4902. if (colors.main) {
  4903. setColor(palette[color2], "mainChannel", private_safeColorChannel(toRgb(colors.main)));
  4904. }
  4905. if (colors.light) {
  4906. setColor(palette[color2], "lightChannel", private_safeColorChannel(toRgb(colors.light)));
  4907. }
  4908. if (colors.dark) {
  4909. setColor(palette[color2], "darkChannel", private_safeColorChannel(toRgb(colors.dark)));
  4910. }
  4911. if (colors.contrastText) {
  4912. setColor(palette[color2], "contrastTextChannel", private_safeColorChannel(toRgb(colors.contrastText)));
  4913. }
  4914. if (color2 === "text") {
  4915. setColorChannel(palette[color2], "primary");
  4916. setColorChannel(palette[color2], "secondary");
  4917. }
  4918. if (color2 === "action") {
  4919. if (colors.active) {
  4920. setColorChannel(palette[color2], "active");
  4921. }
  4922. if (colors.selected) {
  4923. setColorChannel(palette[color2], "selected");
  4924. }
  4925. }
  4926. }
  4927. });
  4928. });
  4929. theme = args.reduce((acc, argument) => deepmerge(acc, argument), theme);
  4930. const parserConfig = {
  4931. prefix: cssVarPrefix,
  4932. disableCssColorScheme,
  4933. shouldSkipGeneratingVar: shouldSkipGeneratingVar$1,
  4934. getSelector: defaultGetSelector(theme)
  4935. };
  4936. const {
  4937. vars,
  4938. generateThemeVars,
  4939. generateStyleSheets
  4940. } = prepareCssVars(theme, parserConfig);
  4941. theme.vars = vars;
  4942. Object.entries(theme.colorSchemes[theme.defaultColorScheme]).forEach(([key, value]) => {
  4943. theme[key] = value;
  4944. });
  4945. theme.generateThemeVars = generateThemeVars;
  4946. theme.generateStyleSheets = generateStyleSheets;
  4947. theme.generateSpacing = function generateSpacing() {
  4948. return createSpacing(input.spacing, createUnarySpacing(this));
  4949. };
  4950. theme.getColorSchemeSelector = createGetColorSchemeSelector(selector);
  4951. theme.spacing = theme.generateSpacing();
  4952. theme.shouldSkipGeneratingVar = shouldSkipGeneratingVar$1;
  4953. theme.unstable_sxConfig = {
  4954. ...defaultSxConfig,
  4955. ...input == null ? void 0 : input.unstable_sxConfig
  4956. };
  4957. theme.unstable_sx = function sx(props) {
  4958. return styleFunctionSx({
  4959. sx: props,
  4960. theme: this
  4961. });
  4962. };
  4963. theme.toRuntimeSource = stringifyTheme;
  4964. return theme;
  4965. }
  4966. function attachColorScheme(theme, scheme, colorScheme) {
  4967. if (!theme.colorSchemes) {
  4968. return void 0;
  4969. }
  4970. if (colorScheme) {
  4971. theme.colorSchemes[scheme] = {
  4972. ...colorScheme !== true && colorScheme,
  4973. palette: createPalette({
  4974. ...colorScheme === true ? {} : colorScheme.palette,
  4975. mode: scheme
  4976. })
  4977. // cast type to skip module augmentation test
  4978. };
  4979. }
  4980. }
  4981. function createTheme(options = {}, ...args) {
  4982. const {
  4983. palette,
  4984. cssVariables = false,
  4985. colorSchemes: initialColorSchemes = !palette ? {
  4986. light: true
  4987. } : void 0,
  4988. defaultColorScheme: initialDefaultColorScheme = palette == null ? void 0 : palette.mode,
  4989. ...rest
  4990. } = options;
  4991. const defaultColorSchemeInput = initialDefaultColorScheme || "light";
  4992. const defaultScheme = initialColorSchemes == null ? void 0 : initialColorSchemes[defaultColorSchemeInput];
  4993. const colorSchemesInput = {
  4994. ...initialColorSchemes,
  4995. ...palette ? {
  4996. [defaultColorSchemeInput]: {
  4997. ...typeof defaultScheme !== "boolean" && defaultScheme,
  4998. palette
  4999. }
  5000. } : void 0
  5001. };
  5002. if (cssVariables === false) {
  5003. if (!("colorSchemes" in options)) {
  5004. return createThemeNoVars(options, ...args);
  5005. }
  5006. let paletteOptions = palette;
  5007. if (!("palette" in options)) {
  5008. if (colorSchemesInput[defaultColorSchemeInput]) {
  5009. if (colorSchemesInput[defaultColorSchemeInput] !== true) {
  5010. paletteOptions = colorSchemesInput[defaultColorSchemeInput].palette;
  5011. } else if (defaultColorSchemeInput === "dark") {
  5012. paletteOptions = {
  5013. mode: "dark"
  5014. };
  5015. }
  5016. }
  5017. }
  5018. const theme = createThemeNoVars({
  5019. ...options,
  5020. palette: paletteOptions
  5021. }, ...args);
  5022. theme.defaultColorScheme = defaultColorSchemeInput;
  5023. theme.colorSchemes = colorSchemesInput;
  5024. if (theme.palette.mode === "light") {
  5025. theme.colorSchemes.light = {
  5026. ...colorSchemesInput.light !== true && colorSchemesInput.light,
  5027. palette: theme.palette
  5028. };
  5029. attachColorScheme(theme, "dark", colorSchemesInput.dark);
  5030. }
  5031. if (theme.palette.mode === "dark") {
  5032. theme.colorSchemes.dark = {
  5033. ...colorSchemesInput.dark !== true && colorSchemesInput.dark,
  5034. palette: theme.palette
  5035. };
  5036. attachColorScheme(theme, "light", colorSchemesInput.light);
  5037. }
  5038. return theme;
  5039. }
  5040. if (!palette && !("light" in colorSchemesInput) && defaultColorSchemeInput === "light") {
  5041. colorSchemesInput.light = true;
  5042. }
  5043. return createThemeWithVars({
  5044. ...rest,
  5045. colorSchemes: colorSchemesInput,
  5046. defaultColorScheme: defaultColorSchemeInput,
  5047. ...typeof cssVariables !== "boolean" && cssVariables
  5048. }, ...args);
  5049. }
  5050. const defaultTheme$1 = createTheme();
  5051. function slotShouldForwardProp(prop) {
  5052. return prop !== "ownerState" && prop !== "theme" && prop !== "sx" && prop !== "as";
  5053. }
  5054. const rootShouldForwardProp = (prop) => slotShouldForwardProp(prop) && prop !== "classes";
  5055. const styled = createStyled2({
  5056. themeId: THEME_ID,
  5057. defaultTheme: defaultTheme$1,
  5058. rootShouldForwardProp
  5059. });
  5060. const boxClasses = generateUtilityClasses("MuiBox", ["root"]);
  5061. const defaultTheme = createTheme();
  5062. const Box = createBox({
  5063. themeId: THEME_ID,
  5064. defaultTheme,
  5065. defaultClassName: boxClasses.root,
  5066. generateClassName: ClassNameGenerator.generate
  5067. });
  5068. const memoTheme = unstable_memoTheme;
  5069. function useDefaultProps(params) {
  5070. return useDefaultProps$1(params);
  5071. }
  5072. class LazyRipple {
  5073. constructor() {
  5074. __publicField(this, "mountEffect", () => {
  5075. if (this.shouldMount && !this.didMount) {
  5076. if (this.ref.current !== null) {
  5077. this.didMount = true;
  5078. this.mounted.resolve();
  5079. }
  5080. }
  5081. });
  5082. this.ref = {
  5083. current: null
  5084. };
  5085. this.mounted = null;
  5086. this.didMount = false;
  5087. this.shouldMount = false;
  5088. this.setShouldMount = null;
  5089. }
  5090. /** React ref to the ripple instance */
  5091. /** If the ripple component should be mounted */
  5092. /** Promise that resolves when the ripple component is mounted */
  5093. /** If the ripple component has been mounted */
  5094. /** React state hook setter */
  5095. static create() {
  5096. return new LazyRipple();
  5097. }
  5098. static use() {
  5099. const ripple = useLazyRef(LazyRipple.create).current;
  5100. const [shouldMount, setShouldMount] = React__namespace.useState(false);
  5101. ripple.shouldMount = shouldMount;
  5102. ripple.setShouldMount = setShouldMount;
  5103. React__namespace.useEffect(ripple.mountEffect, [shouldMount]);
  5104. return ripple;
  5105. }
  5106. mount() {
  5107. if (!this.mounted) {
  5108. this.mounted = createControlledPromise();
  5109. this.shouldMount = true;
  5110. this.setShouldMount(this.shouldMount);
  5111. }
  5112. return this.mounted;
  5113. }
  5114. /* Ripple API */
  5115. start(...args) {
  5116. this.mount().then(() => {
  5117. var _a;
  5118. return (_a = this.ref.current) == null ? void 0 : _a.start(...args);
  5119. });
  5120. }
  5121. stop(...args) {
  5122. this.mount().then(() => {
  5123. var _a;
  5124. return (_a = this.ref.current) == null ? void 0 : _a.stop(...args);
  5125. });
  5126. }
  5127. pulsate(...args) {
  5128. this.mount().then(() => {
  5129. var _a;
  5130. return (_a = this.ref.current) == null ? void 0 : _a.pulsate(...args);
  5131. });
  5132. }
  5133. }
  5134. function useLazyRipple() {
  5135. return LazyRipple.use();
  5136. }
  5137. function createControlledPromise() {
  5138. let resolve;
  5139. let reject;
  5140. const p2 = new Promise((resolveFn, rejectFn) => {
  5141. resolve = resolveFn;
  5142. reject = rejectFn;
  5143. });
  5144. p2.resolve = resolve;
  5145. p2.reject = reject;
  5146. return p2;
  5147. }
  5148. function _objectWithoutPropertiesLoose(r2, e2) {
  5149. if (null == r2) return {};
  5150. var t2 = {};
  5151. for (var n2 in r2) if ({}.hasOwnProperty.call(r2, n2)) {
  5152. if (e2.includes(n2)) continue;
  5153. t2[n2] = r2[n2];
  5154. }
  5155. return t2;
  5156. }
  5157. function _setPrototypeOf(t2, e2) {
  5158. return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e3) {
  5159. return t3.__proto__ = e3, t3;
  5160. }, _setPrototypeOf(t2, e2);
  5161. }
  5162. function _inheritsLoose(t2, o) {
  5163. t2.prototype = Object.create(o.prototype), t2.prototype.constructor = t2, _setPrototypeOf(t2, o);
  5164. }
  5165. const TransitionGroupContext = React.createContext(null);
  5166. function _assertThisInitialized(e2) {
  5167. if (void 0 === e2) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  5168. return e2;
  5169. }
  5170. function getChildMapping(children, mapFn) {
  5171. var mapper = function mapper2(child) {
  5172. return mapFn && React.isValidElement(child) ? mapFn(child) : child;
  5173. };
  5174. var result = /* @__PURE__ */ Object.create(null);
  5175. if (children) React.Children.map(children, function(c2) {
  5176. return c2;
  5177. }).forEach(function(child) {
  5178. result[child.key] = mapper(child);
  5179. });
  5180. return result;
  5181. }
  5182. function mergeChildMappings(prev2, next2) {
  5183. prev2 = prev2 || {};
  5184. next2 = next2 || {};
  5185. function getValueForKey(key) {
  5186. return key in next2 ? next2[key] : prev2[key];
  5187. }
  5188. var nextKeysPending = /* @__PURE__ */ Object.create(null);
  5189. var pendingKeys = [];
  5190. for (var prevKey in prev2) {
  5191. if (prevKey in next2) {
  5192. if (pendingKeys.length) {
  5193. nextKeysPending[prevKey] = pendingKeys;
  5194. pendingKeys = [];
  5195. }
  5196. } else {
  5197. pendingKeys.push(prevKey);
  5198. }
  5199. }
  5200. var i;
  5201. var childMapping = {};
  5202. for (var nextKey in next2) {
  5203. if (nextKeysPending[nextKey]) {
  5204. for (i = 0; i < nextKeysPending[nextKey].length; i++) {
  5205. var pendingNextKey = nextKeysPending[nextKey][i];
  5206. childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
  5207. }
  5208. }
  5209. childMapping[nextKey] = getValueForKey(nextKey);
  5210. }
  5211. for (i = 0; i < pendingKeys.length; i++) {
  5212. childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
  5213. }
  5214. return childMapping;
  5215. }
  5216. function getProp(child, prop, props) {
  5217. return props[prop] != null ? props[prop] : child.props[prop];
  5218. }
  5219. function getInitialChildMapping(props, onExited) {
  5220. return getChildMapping(props.children, function(child) {
  5221. return React.cloneElement(child, {
  5222. onExited: onExited.bind(null, child),
  5223. in: true,
  5224. appear: getProp(child, "appear", props),
  5225. enter: getProp(child, "enter", props),
  5226. exit: getProp(child, "exit", props)
  5227. });
  5228. });
  5229. }
  5230. function getNextChildMapping(nextProps, prevChildMapping, onExited) {
  5231. var nextChildMapping = getChildMapping(nextProps.children);
  5232. var children = mergeChildMappings(prevChildMapping, nextChildMapping);
  5233. Object.keys(children).forEach(function(key) {
  5234. var child = children[key];
  5235. if (!React.isValidElement(child)) return;
  5236. var hasPrev = key in prevChildMapping;
  5237. var hasNext = key in nextChildMapping;
  5238. var prevChild = prevChildMapping[key];
  5239. var isLeaving = React.isValidElement(prevChild) && !prevChild.props.in;
  5240. if (hasNext && (!hasPrev || isLeaving)) {
  5241. children[key] = React.cloneElement(child, {
  5242. onExited: onExited.bind(null, child),
  5243. in: true,
  5244. exit: getProp(child, "exit", nextProps),
  5245. enter: getProp(child, "enter", nextProps)
  5246. });
  5247. } else if (!hasNext && hasPrev && !isLeaving) {
  5248. children[key] = React.cloneElement(child, {
  5249. in: false
  5250. });
  5251. } else if (hasNext && hasPrev && React.isValidElement(prevChild)) {
  5252. children[key] = React.cloneElement(child, {
  5253. onExited: onExited.bind(null, child),
  5254. in: prevChild.props.in,
  5255. exit: getProp(child, "exit", nextProps),
  5256. enter: getProp(child, "enter", nextProps)
  5257. });
  5258. }
  5259. });
  5260. return children;
  5261. }
  5262. var values = Object.values || function(obj) {
  5263. return Object.keys(obj).map(function(k2) {
  5264. return obj[k2];
  5265. });
  5266. };
  5267. var defaultProps = {
  5268. component: "div",
  5269. childFactory: function childFactory(child) {
  5270. return child;
  5271. }
  5272. };
  5273. var TransitionGroup = /* @__PURE__ */ function(_React$Component) {
  5274. _inheritsLoose(TransitionGroup2, _React$Component);
  5275. function TransitionGroup2(props, context) {
  5276. var _this;
  5277. _this = _React$Component.call(this, props, context) || this;
  5278. var handleExited = _this.handleExited.bind(_assertThisInitialized(_this));
  5279. _this.state = {
  5280. contextValue: {
  5281. isMounting: true
  5282. },
  5283. handleExited,
  5284. firstRender: true
  5285. };
  5286. return _this;
  5287. }
  5288. var _proto = TransitionGroup2.prototype;
  5289. _proto.componentDidMount = function componentDidMount() {
  5290. this.mounted = true;
  5291. this.setState({
  5292. contextValue: {
  5293. isMounting: false
  5294. }
  5295. });
  5296. };
  5297. _proto.componentWillUnmount = function componentWillUnmount() {
  5298. this.mounted = false;
  5299. };
  5300. TransitionGroup2.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
  5301. var prevChildMapping = _ref.children, handleExited = _ref.handleExited, firstRender = _ref.firstRender;
  5302. return {
  5303. children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
  5304. firstRender: false
  5305. };
  5306. };
  5307. _proto.handleExited = function handleExited(child, node2) {
  5308. var currentChildMapping = getChildMapping(this.props.children);
  5309. if (child.key in currentChildMapping) return;
  5310. if (child.props.onExited) {
  5311. child.props.onExited(node2);
  5312. }
  5313. if (this.mounted) {
  5314. this.setState(function(state) {
  5315. var children = _extends({}, state.children);
  5316. delete children[child.key];
  5317. return {
  5318. children
  5319. };
  5320. });
  5321. }
  5322. };
  5323. _proto.render = function render() {
  5324. var _this$props = this.props, Component = _this$props.component, childFactory2 = _this$props.childFactory, props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
  5325. var contextValue = this.state.contextValue;
  5326. var children = values(this.state.children).map(childFactory2);
  5327. delete props.appear;
  5328. delete props.enter;
  5329. delete props.exit;
  5330. if (Component === null) {
  5331. return /* @__PURE__ */ React.createElement(TransitionGroupContext.Provider, {
  5332. value: contextValue
  5333. }, children);
  5334. }
  5335. return /* @__PURE__ */ React.createElement(TransitionGroupContext.Provider, {
  5336. value: contextValue
  5337. }, /* @__PURE__ */ React.createElement(Component, props, children));
  5338. };
  5339. return TransitionGroup2;
  5340. }(React.Component);
  5341. TransitionGroup.propTypes = {};
  5342. TransitionGroup.defaultProps = defaultProps;
  5343. function Ripple(props) {
  5344. const {
  5345. className,
  5346. classes,
  5347. pulsate = false,
  5348. rippleX,
  5349. rippleY,
  5350. rippleSize,
  5351. in: inProp,
  5352. onExited,
  5353. timeout
  5354. } = props;
  5355. const [leaving, setLeaving] = React__namespace.useState(false);
  5356. const rippleClassName = clsx(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
  5357. const rippleStyles = {
  5358. width: rippleSize,
  5359. height: rippleSize,
  5360. top: -(rippleSize / 2) + rippleY,
  5361. left: -(rippleSize / 2) + rippleX
  5362. };
  5363. const childClassName = clsx(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);
  5364. if (!inProp && !leaving) {
  5365. setLeaving(true);
  5366. }
  5367. React__namespace.useEffect(() => {
  5368. if (!inProp && onExited != null) {
  5369. const timeoutId = setTimeout(onExited, timeout);
  5370. return () => {
  5371. clearTimeout(timeoutId);
  5372. };
  5373. }
  5374. return void 0;
  5375. }, [onExited, inProp, timeout]);
  5376. return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
  5377. className: rippleClassName,
  5378. style: rippleStyles,
  5379. children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
  5380. className: childClassName
  5381. })
  5382. });
  5383. }
  5384. const touchRippleClasses = generateUtilityClasses("MuiTouchRipple", ["root", "ripple", "rippleVisible", "ripplePulsate", "child", "childLeaving", "childPulsate"]);
  5385. const DURATION = 550;
  5386. const DELAY_RIPPLE = 80;
  5387. const enterKeyframe = keyframes`
  5388. 0% {
  5389. transform: scale(0);
  5390. opacity: 0.1;
  5391. }
  5392.  
  5393. 100% {
  5394. transform: scale(1);
  5395. opacity: 0.3;
  5396. }
  5397. `;
  5398. const exitKeyframe = keyframes`
  5399. 0% {
  5400. opacity: 1;
  5401. }
  5402.  
  5403. 100% {
  5404. opacity: 0;
  5405. }
  5406. `;
  5407. const pulsateKeyframe = keyframes`
  5408. 0% {
  5409. transform: scale(1);
  5410. }
  5411.  
  5412. 50% {
  5413. transform: scale(0.92);
  5414. }
  5415.  
  5416. 100% {
  5417. transform: scale(1);
  5418. }
  5419. `;
  5420. const TouchRippleRoot = styled("span", {
  5421. name: "MuiTouchRipple",
  5422. slot: "Root"
  5423. })({
  5424. overflow: "hidden",
  5425. pointerEvents: "none",
  5426. position: "absolute",
  5427. zIndex: 0,
  5428. top: 0,
  5429. right: 0,
  5430. bottom: 0,
  5431. left: 0,
  5432. borderRadius: "inherit"
  5433. });
  5434. const TouchRippleRipple = styled(Ripple, {
  5435. name: "MuiTouchRipple",
  5436. slot: "Ripple"
  5437. })`
  5438. opacity: 0;
  5439. position: absolute;
  5440.  
  5441. &.${touchRippleClasses.rippleVisible} {
  5442. opacity: 0.3;
  5443. transform: scale(1);
  5444. animation-name: ${enterKeyframe};
  5445. animation-duration: ${DURATION}ms;
  5446. animation-timing-function: ${({
  5447. theme
  5448. }) => theme.transitions.easing.easeInOut};
  5449. }
  5450.  
  5451. &.${touchRippleClasses.ripplePulsate} {
  5452. animation-duration: ${({
  5453. theme
  5454. }) => theme.transitions.duration.shorter}ms;
  5455. }
  5456.  
  5457. & .${touchRippleClasses.child} {
  5458. opacity: 1;
  5459. display: block;
  5460. width: 100%;
  5461. height: 100%;
  5462. border-radius: 50%;
  5463. background-color: currentColor;
  5464. }
  5465.  
  5466. & .${touchRippleClasses.childLeaving} {
  5467. opacity: 0;
  5468. animation-name: ${exitKeyframe};
  5469. animation-duration: ${DURATION}ms;
  5470. animation-timing-function: ${({
  5471. theme
  5472. }) => theme.transitions.easing.easeInOut};
  5473. }
  5474.  
  5475. & .${touchRippleClasses.childPulsate} {
  5476. position: absolute;
  5477. /* @noflip */
  5478. left: 0px;
  5479. top: 0;
  5480. animation-name: ${pulsateKeyframe};
  5481. animation-duration: 2500ms;
  5482. animation-timing-function: ${({
  5483. theme
  5484. }) => theme.transitions.easing.easeInOut};
  5485. animation-iteration-count: infinite;
  5486. animation-delay: 200ms;
  5487. }
  5488. `;
  5489. const TouchRipple = /* @__PURE__ */ React__namespace.forwardRef(function TouchRipple2(inProps, ref) {
  5490. const props = useDefaultProps({
  5491. props: inProps,
  5492. name: "MuiTouchRipple"
  5493. });
  5494. const {
  5495. center: centerProp = false,
  5496. classes = {},
  5497. className,
  5498. ...other
  5499. } = props;
  5500. const [ripples, setRipples] = React__namespace.useState([]);
  5501. const nextKey = React__namespace.useRef(0);
  5502. const rippleCallback = React__namespace.useRef(null);
  5503. React__namespace.useEffect(() => {
  5504. if (rippleCallback.current) {
  5505. rippleCallback.current();
  5506. rippleCallback.current = null;
  5507. }
  5508. }, [ripples]);
  5509. const ignoringMouseDown = React__namespace.useRef(false);
  5510. const startTimer = useTimeout();
  5511. const startTimerCommit = React__namespace.useRef(null);
  5512. const container = React__namespace.useRef(null);
  5513. const startCommit = React__namespace.useCallback((params) => {
  5514. const {
  5515. pulsate: pulsate2,
  5516. rippleX,
  5517. rippleY,
  5518. rippleSize,
  5519. cb
  5520. } = params;
  5521. setRipples((oldRipples) => [...oldRipples, /* @__PURE__ */ jsxRuntimeExports.jsx(TouchRippleRipple, {
  5522. classes: {
  5523. ripple: clsx(classes.ripple, touchRippleClasses.ripple),
  5524. rippleVisible: clsx(classes.rippleVisible, touchRippleClasses.rippleVisible),
  5525. ripplePulsate: clsx(classes.ripplePulsate, touchRippleClasses.ripplePulsate),
  5526. child: clsx(classes.child, touchRippleClasses.child),
  5527. childLeaving: clsx(classes.childLeaving, touchRippleClasses.childLeaving),
  5528. childPulsate: clsx(classes.childPulsate, touchRippleClasses.childPulsate)
  5529. },
  5530. timeout: DURATION,
  5531. pulsate: pulsate2,
  5532. rippleX,
  5533. rippleY,
  5534. rippleSize
  5535. }, nextKey.current)]);
  5536. nextKey.current += 1;
  5537. rippleCallback.current = cb;
  5538. }, [classes]);
  5539. const start = React__namespace.useCallback((event = {}, options = {}, cb = () => {
  5540. }) => {
  5541. const {
  5542. pulsate: pulsate2 = false,
  5543. center = centerProp || options.pulsate,
  5544. fakeElement = false
  5545. // For test purposes
  5546. } = options;
  5547. if ((event == null ? void 0 : event.type) === "mousedown" && ignoringMouseDown.current) {
  5548. ignoringMouseDown.current = false;
  5549. return;
  5550. }
  5551. if ((event == null ? void 0 : event.type) === "touchstart") {
  5552. ignoringMouseDown.current = true;
  5553. }
  5554. const element = fakeElement ? null : container.current;
  5555. const rect = element ? element.getBoundingClientRect() : {
  5556. width: 0,
  5557. height: 0,
  5558. left: 0,
  5559. top: 0
  5560. };
  5561. let rippleX;
  5562. let rippleY;
  5563. let rippleSize;
  5564. if (center || event === void 0 || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
  5565. rippleX = Math.round(rect.width / 2);
  5566. rippleY = Math.round(rect.height / 2);
  5567. } else {
  5568. const {
  5569. clientX,
  5570. clientY
  5571. } = event.touches && event.touches.length > 0 ? event.touches[0] : event;
  5572. rippleX = Math.round(clientX - rect.left);
  5573. rippleY = Math.round(clientY - rect.top);
  5574. }
  5575. if (center) {
  5576. rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);
  5577. if (rippleSize % 2 === 0) {
  5578. rippleSize += 1;
  5579. }
  5580. } else {
  5581. const sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
  5582. const sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
  5583. rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
  5584. }
  5585. if (event == null ? void 0 : event.touches) {
  5586. if (startTimerCommit.current === null) {
  5587. startTimerCommit.current = () => {
  5588. startCommit({
  5589. pulsate: pulsate2,
  5590. rippleX,
  5591. rippleY,
  5592. rippleSize,
  5593. cb
  5594. });
  5595. };
  5596. startTimer.start(DELAY_RIPPLE, () => {
  5597. if (startTimerCommit.current) {
  5598. startTimerCommit.current();
  5599. startTimerCommit.current = null;
  5600. }
  5601. });
  5602. }
  5603. } else {
  5604. startCommit({
  5605. pulsate: pulsate2,
  5606. rippleX,
  5607. rippleY,
  5608. rippleSize,
  5609. cb
  5610. });
  5611. }
  5612. }, [centerProp, startCommit, startTimer]);
  5613. const pulsate = React__namespace.useCallback(() => {
  5614. start({}, {
  5615. pulsate: true
  5616. });
  5617. }, [start]);
  5618. const stop = React__namespace.useCallback((event, cb) => {
  5619. startTimer.clear();
  5620. if ((event == null ? void 0 : event.type) === "touchend" && startTimerCommit.current) {
  5621. startTimerCommit.current();
  5622. startTimerCommit.current = null;
  5623. startTimer.start(0, () => {
  5624. stop(event, cb);
  5625. });
  5626. return;
  5627. }
  5628. startTimerCommit.current = null;
  5629. setRipples((oldRipples) => {
  5630. if (oldRipples.length > 0) {
  5631. return oldRipples.slice(1);
  5632. }
  5633. return oldRipples;
  5634. });
  5635. rippleCallback.current = cb;
  5636. }, [startTimer]);
  5637. React__namespace.useImperativeHandle(ref, () => ({
  5638. pulsate,
  5639. start,
  5640. stop
  5641. }), [pulsate, start, stop]);
  5642. return /* @__PURE__ */ jsxRuntimeExports.jsx(TouchRippleRoot, {
  5643. className: clsx(touchRippleClasses.root, classes.root, className),
  5644. ref: container,
  5645. ...other,
  5646. children: /* @__PURE__ */ jsxRuntimeExports.jsx(TransitionGroup, {
  5647. component: null,
  5648. exit: true,
  5649. children: ripples
  5650. })
  5651. });
  5652. });
  5653. function getButtonBaseUtilityClass(slot) {
  5654. return generateUtilityClass("MuiButtonBase", slot);
  5655. }
  5656. const buttonBaseClasses = generateUtilityClasses("MuiButtonBase", ["root", "disabled", "focusVisible"]);
  5657. const useUtilityClasses$1 = (ownerState) => {
  5658. const {
  5659. disabled,
  5660. focusVisible,
  5661. focusVisibleClassName,
  5662. classes
  5663. } = ownerState;
  5664. const slots = {
  5665. root: ["root", disabled && "disabled", focusVisible && "focusVisible"]
  5666. };
  5667. const composedClasses = composeClasses(slots, getButtonBaseUtilityClass, classes);
  5668. if (focusVisible && focusVisibleClassName) {
  5669. composedClasses.root += ` ${focusVisibleClassName}`;
  5670. }
  5671. return composedClasses;
  5672. };
  5673. const ButtonBaseRoot = styled("button", {
  5674. name: "MuiButtonBase",
  5675. slot: "Root",
  5676. overridesResolver: (props, styles) => styles.root
  5677. })({
  5678. display: "inline-flex",
  5679. alignItems: "center",
  5680. justifyContent: "center",
  5681. position: "relative",
  5682. boxSizing: "border-box",
  5683. WebkitTapHighlightColor: "transparent",
  5684. backgroundColor: "transparent",
  5685. // Reset default value
  5686. // We disable the focus ring for mouse, touch and keyboard users.
  5687. outline: 0,
  5688. border: 0,
  5689. margin: 0,
  5690. // Remove the margin in Safari
  5691. borderRadius: 0,
  5692. padding: 0,
  5693. // Remove the padding in Firefox
  5694. cursor: "pointer",
  5695. userSelect: "none",
  5696. verticalAlign: "middle",
  5697. MozAppearance: "none",
  5698. // Reset
  5699. WebkitAppearance: "none",
  5700. // Reset
  5701. textDecoration: "none",
  5702. // So we take precedent over the style of a native <a /> element.
  5703. color: "inherit",
  5704. "&::-moz-focus-inner": {
  5705. borderStyle: "none"
  5706. // Remove Firefox dotted outline.
  5707. },
  5708. [`&.${buttonBaseClasses.disabled}`]: {
  5709. pointerEvents: "none",
  5710. // Disable link interactions
  5711. cursor: "default"
  5712. },
  5713. "@media print": {
  5714. colorAdjust: "exact"
  5715. }
  5716. });
  5717. const ButtonBase = /* @__PURE__ */ React__namespace.forwardRef(function ButtonBase2(inProps, ref) {
  5718. const props = useDefaultProps({
  5719. props: inProps,
  5720. name: "MuiButtonBase"
  5721. });
  5722. const {
  5723. action,
  5724. centerRipple = false,
  5725. children,
  5726. className,
  5727. component = "button",
  5728. disabled = false,
  5729. disableRipple = false,
  5730. disableTouchRipple = false,
  5731. focusRipple = false,
  5732. focusVisibleClassName,
  5733. LinkComponent = "a",
  5734. onBlur,
  5735. onClick,
  5736. onContextMenu,
  5737. onDragLeave,
  5738. onFocus,
  5739. onFocusVisible,
  5740. onKeyDown,
  5741. onKeyUp,
  5742. onMouseDown,
  5743. onMouseLeave,
  5744. onMouseUp,
  5745. onTouchEnd,
  5746. onTouchMove,
  5747. onTouchStart,
  5748. tabIndex = 0,
  5749. TouchRippleProps,
  5750. touchRippleRef,
  5751. type,
  5752. ...other
  5753. } = props;
  5754. const buttonRef = React__namespace.useRef(null);
  5755. const ripple = useLazyRipple();
  5756. const handleRippleRef = useForkRef(ripple.ref, touchRippleRef);
  5757. const [focusVisible, setFocusVisible] = React__namespace.useState(false);
  5758. if (disabled && focusVisible) {
  5759. setFocusVisible(false);
  5760. }
  5761. React__namespace.useImperativeHandle(action, () => ({
  5762. focusVisible: () => {
  5763. setFocusVisible(true);
  5764. buttonRef.current.focus();
  5765. }
  5766. }), []);
  5767. const enableTouchRipple = ripple.shouldMount && !disableRipple && !disabled;
  5768. React__namespace.useEffect(() => {
  5769. if (focusVisible && focusRipple && !disableRipple) {
  5770. ripple.pulsate();
  5771. }
  5772. }, [disableRipple, focusRipple, focusVisible, ripple]);
  5773. function useRippleHandler(rippleAction, eventCallback, skipRippleAction = disableTouchRipple) {
  5774. return useEventCallback((event) => {
  5775. if (eventCallback) {
  5776. eventCallback(event);
  5777. }
  5778. const ignore = skipRippleAction;
  5779. if (!ignore) {
  5780. ripple[rippleAction](event);
  5781. }
  5782. return true;
  5783. });
  5784. }
  5785. const handleMouseDown = useRippleHandler("start", onMouseDown);
  5786. const handleContextMenu = useRippleHandler("stop", onContextMenu);
  5787. const handleDragLeave = useRippleHandler("stop", onDragLeave);
  5788. const handleMouseUp = useRippleHandler("stop", onMouseUp);
  5789. const handleMouseLeave = useRippleHandler("stop", (event) => {
  5790. if (focusVisible) {
  5791. event.preventDefault();
  5792. }
  5793. if (onMouseLeave) {
  5794. onMouseLeave(event);
  5795. }
  5796. });
  5797. const handleTouchStart = useRippleHandler("start", onTouchStart);
  5798. const handleTouchEnd = useRippleHandler("stop", onTouchEnd);
  5799. const handleTouchMove = useRippleHandler("stop", onTouchMove);
  5800. const handleBlur = useRippleHandler("stop", (event) => {
  5801. if (!isFocusVisible(event.target)) {
  5802. setFocusVisible(false);
  5803. }
  5804. if (onBlur) {
  5805. onBlur(event);
  5806. }
  5807. }, false);
  5808. const handleFocus = useEventCallback((event) => {
  5809. if (!buttonRef.current) {
  5810. buttonRef.current = event.currentTarget;
  5811. }
  5812. if (isFocusVisible(event.target)) {
  5813. setFocusVisible(true);
  5814. if (onFocusVisible) {
  5815. onFocusVisible(event);
  5816. }
  5817. }
  5818. if (onFocus) {
  5819. onFocus(event);
  5820. }
  5821. });
  5822. const isNonNativeButton = () => {
  5823. const button = buttonRef.current;
  5824. return component && component !== "button" && !(button.tagName === "A" && button.href);
  5825. };
  5826. const handleKeyDown = useEventCallback((event) => {
  5827. if (focusRipple && !event.repeat && focusVisible && event.key === " ") {
  5828. ripple.stop(event, () => {
  5829. ripple.start(event);
  5830. });
  5831. }
  5832. if (event.target === event.currentTarget && isNonNativeButton() && event.key === " ") {
  5833. event.preventDefault();
  5834. }
  5835. if (onKeyDown) {
  5836. onKeyDown(event);
  5837. }
  5838. if (event.target === event.currentTarget && isNonNativeButton() && event.key === "Enter" && !disabled) {
  5839. event.preventDefault();
  5840. if (onClick) {
  5841. onClick(event);
  5842. }
  5843. }
  5844. });
  5845. const handleKeyUp = useEventCallback((event) => {
  5846. if (focusRipple && event.key === " " && focusVisible && !event.defaultPrevented) {
  5847. ripple.stop(event, () => {
  5848. ripple.pulsate(event);
  5849. });
  5850. }
  5851. if (onKeyUp) {
  5852. onKeyUp(event);
  5853. }
  5854. if (onClick && event.target === event.currentTarget && isNonNativeButton() && event.key === " " && !event.defaultPrevented) {
  5855. onClick(event);
  5856. }
  5857. });
  5858. let ComponentProp = component;
  5859. if (ComponentProp === "button" && (other.href || other.to)) {
  5860. ComponentProp = LinkComponent;
  5861. }
  5862. const buttonProps = {};
  5863. if (ComponentProp === "button") {
  5864. buttonProps.type = type === void 0 ? "button" : type;
  5865. buttonProps.disabled = disabled;
  5866. } else {
  5867. if (!other.href && !other.to) {
  5868. buttonProps.role = "button";
  5869. }
  5870. if (disabled) {
  5871. buttonProps["aria-disabled"] = disabled;
  5872. }
  5873. }
  5874. const handleRef = useForkRef(ref, buttonRef);
  5875. const ownerState = {
  5876. ...props,
  5877. centerRipple,
  5878. component,
  5879. disabled,
  5880. disableRipple,
  5881. disableTouchRipple,
  5882. focusRipple,
  5883. tabIndex,
  5884. focusVisible
  5885. };
  5886. const classes = useUtilityClasses$1(ownerState);
  5887. return /* @__PURE__ */ jsxRuntimeExports.jsxs(ButtonBaseRoot, {
  5888. as: ComponentProp,
  5889. className: clsx(classes.root, className),
  5890. ownerState,
  5891. onBlur: handleBlur,
  5892. onClick,
  5893. onContextMenu: handleContextMenu,
  5894. onFocus: handleFocus,
  5895. onKeyDown: handleKeyDown,
  5896. onKeyUp: handleKeyUp,
  5897. onMouseDown: handleMouseDown,
  5898. onMouseLeave: handleMouseLeave,
  5899. onMouseUp: handleMouseUp,
  5900. onDragLeave: handleDragLeave,
  5901. onTouchEnd: handleTouchEnd,
  5902. onTouchMove: handleTouchMove,
  5903. onTouchStart: handleTouchStart,
  5904. ref: handleRef,
  5905. tabIndex: disabled ? -1 : tabIndex,
  5906. type,
  5907. ...buttonProps,
  5908. ...other,
  5909. children: [children, enableTouchRipple ? /* @__PURE__ */ jsxRuntimeExports.jsx(TouchRipple, {
  5910. ref: handleRippleRef,
  5911. center: centerRipple,
  5912. ...TouchRippleProps
  5913. }) : null]
  5914. });
  5915. });
  5916. function hasCorrectMainProperty(obj) {
  5917. return typeof obj.main === "string";
  5918. }
  5919. function checkSimplePaletteColorValues(obj, additionalPropertiesToCheck = []) {
  5920. if (!hasCorrectMainProperty(obj)) {
  5921. return false;
  5922. }
  5923. for (const value of additionalPropertiesToCheck) {
  5924. if (!obj.hasOwnProperty(value) || typeof obj[value] !== "string") {
  5925. return false;
  5926. }
  5927. }
  5928. return true;
  5929. }
  5930. function createSimplePaletteValueFilter(additionalPropertiesToCheck = []) {
  5931. return ([, value]) => value && checkSimplePaletteColorValues(value, additionalPropertiesToCheck);
  5932. }
  5933. function getButtonUtilityClass(slot) {
  5934. return generateUtilityClass("MuiButton", slot);
  5935. }
  5936. const buttonClasses = generateUtilityClasses("MuiButton", ["root", "text", "textInherit", "textPrimary", "textSecondary", "textSuccess", "textError", "textInfo", "textWarning", "outlined", "outlinedInherit", "outlinedPrimary", "outlinedSecondary", "outlinedSuccess", "outlinedError", "outlinedInfo", "outlinedWarning", "contained", "containedInherit", "containedPrimary", "containedSecondary", "containedSuccess", "containedError", "containedInfo", "containedWarning", "disableElevation", "focusVisible", "disabled", "colorInherit", "colorPrimary", "colorSecondary", "colorSuccess", "colorError", "colorInfo", "colorWarning", "textSizeSmall", "textSizeMedium", "textSizeLarge", "outlinedSizeSmall", "outlinedSizeMedium", "outlinedSizeLarge", "containedSizeSmall", "containedSizeMedium", "containedSizeLarge", "sizeMedium", "sizeSmall", "sizeLarge", "fullWidth", "startIcon", "endIcon", "icon", "iconSizeSmall", "iconSizeMedium", "iconSizeLarge"]);
  5937. const ButtonGroupContext = /* @__PURE__ */ React__namespace.createContext({});
  5938. const ButtonGroupButtonContext = /* @__PURE__ */ React__namespace.createContext(void 0);
  5939. const useUtilityClasses = (ownerState) => {
  5940. const {
  5941. color: color2,
  5942. disableElevation,
  5943. fullWidth,
  5944. size,
  5945. variant,
  5946. classes
  5947. } = ownerState;
  5948. const slots = {
  5949. root: ["root", variant, `${variant}${capitalize(color2)}`, `size${capitalize(size)}`, `${variant}Size${capitalize(size)}`, `color${capitalize(color2)}`, disableElevation && "disableElevation", fullWidth && "fullWidth"],
  5950. label: ["label"],
  5951. startIcon: ["icon", "startIcon", `iconSize${capitalize(size)}`],
  5952. endIcon: ["icon", "endIcon", `iconSize${capitalize(size)}`]
  5953. };
  5954. const composedClasses = composeClasses(slots, getButtonUtilityClass, classes);
  5955. return {
  5956. ...classes,
  5957. // forward the focused, disabled, etc. classes to the ButtonBase
  5958. ...composedClasses
  5959. };
  5960. };
  5961. const commonIconStyles = [{
  5962. props: {
  5963. size: "small"
  5964. },
  5965. style: {
  5966. "& > *:nth-of-type(1)": {
  5967. fontSize: 18
  5968. }
  5969. }
  5970. }, {
  5971. props: {
  5972. size: "medium"
  5973. },
  5974. style: {
  5975. "& > *:nth-of-type(1)": {
  5976. fontSize: 20
  5977. }
  5978. }
  5979. }, {
  5980. props: {
  5981. size: "large"
  5982. },
  5983. style: {
  5984. "& > *:nth-of-type(1)": {
  5985. fontSize: 22
  5986. }
  5987. }
  5988. }];
  5989. const ButtonRoot = styled(ButtonBase, {
  5990. shouldForwardProp: (prop) => rootShouldForwardProp(prop) || prop === "classes",
  5991. name: "MuiButton",
  5992. slot: "Root",
  5993. overridesResolver: (props, styles) => {
  5994. const {
  5995. ownerState
  5996. } = props;
  5997. return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize(ownerState.color)}`], styles[`size${capitalize(ownerState.size)}`], styles[`${ownerState.variant}Size${capitalize(ownerState.size)}`], ownerState.color === "inherit" && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth];
  5998. }
  5999. })(memoTheme(({
  6000. theme
  6001. }) => {
  6002. const inheritContainedBackgroundColor = theme.palette.mode === "light" ? theme.palette.grey[300] : theme.palette.grey[800];
  6003. const inheritContainedHoverBackgroundColor = theme.palette.mode === "light" ? theme.palette.grey.A100 : theme.palette.grey[700];
  6004. return {
  6005. ...theme.typography.button,
  6006. minWidth: 64,
  6007. padding: "6px 16px",
  6008. border: 0,
  6009. borderRadius: (theme.vars || theme).shape.borderRadius,
  6010. transition: theme.transitions.create(["background-color", "box-shadow", "border-color", "color"], {
  6011. duration: theme.transitions.duration.short
  6012. }),
  6013. "&:hover": {
  6014. textDecoration: "none"
  6015. },
  6016. [`&.${buttonClasses.disabled}`]: {
  6017. color: (theme.vars || theme).palette.action.disabled
  6018. },
  6019. variants: [{
  6020. props: {
  6021. variant: "contained"
  6022. },
  6023. style: {
  6024. color: `var(--variant-containedColor)`,
  6025. backgroundColor: `var(--variant-containedBg)`,
  6026. boxShadow: (theme.vars || theme).shadows[2],
  6027. "&:hover": {
  6028. boxShadow: (theme.vars || theme).shadows[4],
  6029. // Reset on touch devices, it doesn't add specificity
  6030. "@media (hover: none)": {
  6031. boxShadow: (theme.vars || theme).shadows[2]
  6032. }
  6033. },
  6034. "&:active": {
  6035. boxShadow: (theme.vars || theme).shadows[8]
  6036. },
  6037. [`&.${buttonClasses.focusVisible}`]: {
  6038. boxShadow: (theme.vars || theme).shadows[6]
  6039. },
  6040. [`&.${buttonClasses.disabled}`]: {
  6041. color: (theme.vars || theme).palette.action.disabled,
  6042. boxShadow: (theme.vars || theme).shadows[0],
  6043. backgroundColor: (theme.vars || theme).palette.action.disabledBackground
  6044. }
  6045. }
  6046. }, {
  6047. props: {
  6048. variant: "outlined"
  6049. },
  6050. style: {
  6051. padding: "5px 15px",
  6052. border: "1px solid currentColor",
  6053. borderColor: `var(--variant-outlinedBorder, currentColor)`,
  6054. backgroundColor: `var(--variant-outlinedBg)`,
  6055. color: `var(--variant-outlinedColor)`,
  6056. [`&.${buttonClasses.disabled}`]: {
  6057. border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
  6058. }
  6059. }
  6060. }, {
  6061. props: {
  6062. variant: "text"
  6063. },
  6064. style: {
  6065. padding: "6px 8px",
  6066. color: `var(--variant-textColor)`,
  6067. backgroundColor: `var(--variant-textBg)`
  6068. }
  6069. }, ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color2]) => ({
  6070. props: {
  6071. color: color2
  6072. },
  6073. style: {
  6074. "--variant-textColor": (theme.vars || theme).palette[color2].main,
  6075. "--variant-outlinedColor": (theme.vars || theme).palette[color2].main,
  6076. "--variant-outlinedBorder": theme.vars ? `rgba(${theme.vars.palette[color2].mainChannel} / 0.5)` : alpha(theme.palette[color2].main, 0.5),
  6077. "--variant-containedColor": (theme.vars || theme).palette[color2].contrastText,
  6078. "--variant-containedBg": (theme.vars || theme).palette[color2].main,
  6079. "@media (hover: hover)": {
  6080. "&:hover": {
  6081. "--variant-containedBg": (theme.vars || theme).palette[color2].dark,
  6082. "--variant-textBg": theme.vars ? `rgba(${theme.vars.palette[color2].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color2].main, theme.palette.action.hoverOpacity),
  6083. "--variant-outlinedBorder": (theme.vars || theme).palette[color2].main,
  6084. "--variant-outlinedBg": theme.vars ? `rgba(${theme.vars.palette[color2].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color2].main, theme.palette.action.hoverOpacity)
  6085. }
  6086. }
  6087. }
  6088. })), {
  6089. props: {
  6090. color: "inherit"
  6091. },
  6092. style: {
  6093. color: "inherit",
  6094. borderColor: "currentColor",
  6095. "--variant-containedBg": theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
  6096. "@media (hover: hover)": {
  6097. "&:hover": {
  6098. "--variant-containedBg": theme.vars ? theme.vars.palette.Button.inheritContainedHoverBg : inheritContainedHoverBackgroundColor,
  6099. "--variant-textBg": theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity),
  6100. "--variant-outlinedBg": theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity)
  6101. }
  6102. }
  6103. }
  6104. }, {
  6105. props: {
  6106. size: "small",
  6107. variant: "text"
  6108. },
  6109. style: {
  6110. padding: "4px 5px",
  6111. fontSize: theme.typography.pxToRem(13)
  6112. }
  6113. }, {
  6114. props: {
  6115. size: "large",
  6116. variant: "text"
  6117. },
  6118. style: {
  6119. padding: "8px 11px",
  6120. fontSize: theme.typography.pxToRem(15)
  6121. }
  6122. }, {
  6123. props: {
  6124. size: "small",
  6125. variant: "outlined"
  6126. },
  6127. style: {
  6128. padding: "3px 9px",
  6129. fontSize: theme.typography.pxToRem(13)
  6130. }
  6131. }, {
  6132. props: {
  6133. size: "large",
  6134. variant: "outlined"
  6135. },
  6136. style: {
  6137. padding: "7px 21px",
  6138. fontSize: theme.typography.pxToRem(15)
  6139. }
  6140. }, {
  6141. props: {
  6142. size: "small",
  6143. variant: "contained"
  6144. },
  6145. style: {
  6146. padding: "4px 10px",
  6147. fontSize: theme.typography.pxToRem(13)
  6148. }
  6149. }, {
  6150. props: {
  6151. size: "large",
  6152. variant: "contained"
  6153. },
  6154. style: {
  6155. padding: "8px 22px",
  6156. fontSize: theme.typography.pxToRem(15)
  6157. }
  6158. }, {
  6159. props: {
  6160. disableElevation: true
  6161. },
  6162. style: {
  6163. boxShadow: "none",
  6164. "&:hover": {
  6165. boxShadow: "none"
  6166. },
  6167. [`&.${buttonClasses.focusVisible}`]: {
  6168. boxShadow: "none"
  6169. },
  6170. "&:active": {
  6171. boxShadow: "none"
  6172. },
  6173. [`&.${buttonClasses.disabled}`]: {
  6174. boxShadow: "none"
  6175. }
  6176. }
  6177. }, {
  6178. props: {
  6179. fullWidth: true
  6180. },
  6181. style: {
  6182. width: "100%"
  6183. }
  6184. }]
  6185. };
  6186. }));
  6187. const ButtonStartIcon = styled("span", {
  6188. name: "MuiButton",
  6189. slot: "StartIcon",
  6190. overridesResolver: (props, styles) => {
  6191. const {
  6192. ownerState
  6193. } = props;
  6194. return [styles.startIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
  6195. }
  6196. })({
  6197. display: "inherit",
  6198. marginRight: 8,
  6199. marginLeft: -4,
  6200. variants: [{
  6201. props: {
  6202. size: "small"
  6203. },
  6204. style: {
  6205. marginLeft: -2
  6206. }
  6207. }, ...commonIconStyles]
  6208. });
  6209. const ButtonEndIcon = styled("span", {
  6210. name: "MuiButton",
  6211. slot: "EndIcon",
  6212. overridesResolver: (props, styles) => {
  6213. const {
  6214. ownerState
  6215. } = props;
  6216. return [styles.endIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
  6217. }
  6218. })({
  6219. display: "inherit",
  6220. marginRight: -4,
  6221. marginLeft: 8,
  6222. variants: [{
  6223. props: {
  6224. size: "small"
  6225. },
  6226. style: {
  6227. marginRight: -2
  6228. }
  6229. }, ...commonIconStyles]
  6230. });
  6231. const Button = /* @__PURE__ */ React__namespace.forwardRef(function Button2(inProps, ref) {
  6232. const contextProps = React__namespace.useContext(ButtonGroupContext);
  6233. const buttonGroupButtonContextPositionClassName = React__namespace.useContext(ButtonGroupButtonContext);
  6234. const resolvedProps = resolveProps(contextProps, inProps);
  6235. const props = useDefaultProps({
  6236. props: resolvedProps,
  6237. name: "MuiButton"
  6238. });
  6239. const {
  6240. children,
  6241. color: color2 = "primary",
  6242. component = "button",
  6243. className,
  6244. disabled = false,
  6245. disableElevation = false,
  6246. disableFocusRipple = false,
  6247. endIcon: endIconProp,
  6248. focusVisibleClassName,
  6249. fullWidth = false,
  6250. size = "medium",
  6251. startIcon: startIconProp,
  6252. type,
  6253. variant = "text",
  6254. ...other
  6255. } = props;
  6256. const ownerState = {
  6257. ...props,
  6258. color: color2,
  6259. component,
  6260. disabled,
  6261. disableElevation,
  6262. disableFocusRipple,
  6263. fullWidth,
  6264. size,
  6265. type,
  6266. variant
  6267. };
  6268. const classes = useUtilityClasses(ownerState);
  6269. const startIcon = startIconProp && /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonStartIcon, {
  6270. className: classes.startIcon,
  6271. ownerState,
  6272. children: startIconProp
  6273. });
  6274. const endIcon = endIconProp && /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonEndIcon, {
  6275. className: classes.endIcon,
  6276. ownerState,
  6277. children: endIconProp
  6278. });
  6279. const positionClassName = buttonGroupButtonContextPositionClassName || "";
  6280. return /* @__PURE__ */ jsxRuntimeExports.jsxs(ButtonRoot, {
  6281. ownerState,
  6282. className: clsx(contextProps.className, classes.root, className, positionClassName),
  6283. component,
  6284. disabled,
  6285. focusRipple: !disableFocusRipple,
  6286. focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),
  6287. ref,
  6288. type,
  6289. ...other,
  6290. classes,
  6291. children: [startIcon, children, endIcon]
  6292. });
  6293. });
  6294. function MpvButton({ onClick }) {
  6295. return /* @__PURE__ */ jsxRuntimeExports.jsx(
  6296. Box,
  6297. {
  6298. sx: {
  6299. color: "white",
  6300. backgroundColor: "black",
  6301. marginTop: "20px",
  6302. border: "2px solid white",
  6303. borderRadius: "5px",
  6304. fontSize: "20px",
  6305. "&:hover": {
  6306. backgroundColor: "#00B4D8"
  6307. }
  6308. },
  6309. children: /* @__PURE__ */ jsxRuntimeExports.jsx(
  6310. Button,
  6311. {
  6312. variant: "text",
  6313. onClick,
  6314. fullWidth: true,
  6315. sx: { padding: "10px 50px" },
  6316. children: "用 MPV 播放"
  6317. }
  6318. )
  6319. }
  6320. );
  6321. }
  6322. function MessageBox({ text }) {
  6323. return /* @__PURE__ */ jsxRuntimeExports.jsx(
  6324. Box,
  6325. {
  6326. sx: {
  6327. color: "white",
  6328. marginTop: "20px",
  6329. fontSize: "15px",
  6330. fontWeight: "bold",
  6331. whiteSpace: "nowrap"
  6332. },
  6333. children: text
  6334. }
  6335. );
  6336. }
  6337. function AnimePage({ onClick, text }) {
  6338. return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
  6339. /* @__PURE__ */ jsxRuntimeExports.jsx(MpvButton, { onClick }),
  6340. /* @__PURE__ */ jsxRuntimeExports.jsx(MessageBox, { text })
  6341. ] });
  6342. }
  6343. function bind(fn, thisArg) {
  6344. return function wrap() {
  6345. return fn.apply(thisArg, arguments);
  6346. };
  6347. }
  6348. const { toString } = Object.prototype;
  6349. const { getPrototypeOf } = Object;
  6350. const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
  6351. const str = toString.call(thing);
  6352. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  6353. })(/* @__PURE__ */ Object.create(null));
  6354. const kindOfTest = (type) => {
  6355. type = type.toLowerCase();
  6356. return (thing) => kindOf(thing) === type;
  6357. };
  6358. const typeOfTest = (type) => (thing) => typeof thing === type;
  6359. const { isArray } = Array;
  6360. const isUndefined = typeOfTest("undefined");
  6361. function isBuffer(val) {
  6362. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  6363. }
  6364. const isArrayBuffer = kindOfTest("ArrayBuffer");
  6365. function isArrayBufferView(val) {
  6366. let result;
  6367. if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
  6368. result = ArrayBuffer.isView(val);
  6369. } else {
  6370. result = val && val.buffer && isArrayBuffer(val.buffer);
  6371. }
  6372. return result;
  6373. }
  6374. const isString = typeOfTest("string");
  6375. const isFunction = typeOfTest("function");
  6376. const isNumber = typeOfTest("number");
  6377. const isObject = (thing) => thing !== null && typeof thing === "object";
  6378. const isBoolean = (thing) => thing === true || thing === false;
  6379. const isPlainObject = (val) => {
  6380. if (kindOf(val) !== "object") {
  6381. return false;
  6382. }
  6383. const prototype2 = getPrototypeOf(val);
  6384. return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
  6385. };
  6386. const isDate = kindOfTest("Date");
  6387. const isFile = kindOfTest("File");
  6388. const isBlob = kindOfTest("Blob");
  6389. const isFileList = kindOfTest("FileList");
  6390. const isStream = (val) => isObject(val) && isFunction(val.pipe);
  6391. const isFormData = (thing) => {
  6392. let kind;
  6393. return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
  6394. kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
  6395. };
  6396. const isURLSearchParams = kindOfTest("URLSearchParams");
  6397. const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
  6398. const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
  6399. function forEach(obj, fn, { allOwnKeys = false } = {}) {
  6400. if (obj === null || typeof obj === "undefined") {
  6401. return;
  6402. }
  6403. let i;
  6404. let l2;
  6405. if (typeof obj !== "object") {
  6406. obj = [obj];
  6407. }
  6408. if (isArray(obj)) {
  6409. for (i = 0, l2 = obj.length; i < l2; i++) {
  6410. fn.call(null, obj[i], i, obj);
  6411. }
  6412. } else {
  6413. const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  6414. const len = keys.length;
  6415. let key;
  6416. for (i = 0; i < len; i++) {
  6417. key = keys[i];
  6418. fn.call(null, obj[key], key, obj);
  6419. }
  6420. }
  6421. }
  6422. function findKey(obj, key) {
  6423. key = key.toLowerCase();
  6424. const keys = Object.keys(obj);
  6425. let i = keys.length;
  6426. let _key;
  6427. while (i-- > 0) {
  6428. _key = keys[i];
  6429. if (key === _key.toLowerCase()) {
  6430. return _key;
  6431. }
  6432. }
  6433. return null;
  6434. }
  6435. const _global = (() => {
  6436. if (typeof globalThis !== "undefined") return globalThis;
  6437. return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
  6438. })();
  6439. const isContextDefined = (context) => !isUndefined(context) && context !== _global;
  6440. function merge() {
  6441. const { caseless } = isContextDefined(this) && this || {};
  6442. const result = {};
  6443. const assignValue = (val, key) => {
  6444. const targetKey = caseless && findKey(result, key) || key;
  6445. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  6446. result[targetKey] = merge(result[targetKey], val);
  6447. } else if (isPlainObject(val)) {
  6448. result[targetKey] = merge({}, val);
  6449. } else if (isArray(val)) {
  6450. result[targetKey] = val.slice();
  6451. } else {
  6452. result[targetKey] = val;
  6453. }
  6454. };
  6455. for (let i = 0, l2 = arguments.length; i < l2; i++) {
  6456. arguments[i] && forEach(arguments[i], assignValue);
  6457. }
  6458. return result;
  6459. }
  6460. const extend = (a, b2, thisArg, { allOwnKeys } = {}) => {
  6461. forEach(b2, (val, key) => {
  6462. if (thisArg && isFunction(val)) {
  6463. a[key] = bind(val, thisArg);
  6464. } else {
  6465. a[key] = val;
  6466. }
  6467. }, { allOwnKeys });
  6468. return a;
  6469. };
  6470. const stripBOM = (content) => {
  6471. if (content.charCodeAt(0) === 65279) {
  6472. content = content.slice(1);
  6473. }
  6474. return content;
  6475. };
  6476. const inherits = (constructor, superConstructor, props, descriptors2) => {
  6477. constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
  6478. constructor.prototype.constructor = constructor;
  6479. Object.defineProperty(constructor, "super", {
  6480. value: superConstructor.prototype
  6481. });
  6482. props && Object.assign(constructor.prototype, props);
  6483. };
  6484. const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
  6485. let props;
  6486. let i;
  6487. let prop;
  6488. const merged = {};
  6489. destObj = destObj || {};
  6490. if (sourceObj == null) return destObj;
  6491. do {
  6492. props = Object.getOwnPropertyNames(sourceObj);
  6493. i = props.length;
  6494. while (i-- > 0) {
  6495. prop = props[i];
  6496. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  6497. destObj[prop] = sourceObj[prop];
  6498. merged[prop] = true;
  6499. }
  6500. }
  6501. sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
  6502. } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
  6503. return destObj;
  6504. };
  6505. const endsWith = (str, searchString, position2) => {
  6506. str = String(str);
  6507. if (position2 === void 0 || position2 > str.length) {
  6508. position2 = str.length;
  6509. }
  6510. position2 -= searchString.length;
  6511. const lastIndex = str.indexOf(searchString, position2);
  6512. return lastIndex !== -1 && lastIndex === position2;
  6513. };
  6514. const toArray = (thing) => {
  6515. if (!thing) return null;
  6516. if (isArray(thing)) return thing;
  6517. let i = thing.length;
  6518. if (!isNumber(i)) return null;
  6519. const arr = new Array(i);
  6520. while (i-- > 0) {
  6521. arr[i] = thing[i];
  6522. }
  6523. return arr;
  6524. };
  6525. const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
  6526. return (thing) => {
  6527. return TypedArray && thing instanceof TypedArray;
  6528. };
  6529. })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
  6530. const forEachEntry = (obj, fn) => {
  6531. const generator = obj && obj[Symbol.iterator];
  6532. const iterator = generator.call(obj);
  6533. let result;
  6534. while ((result = iterator.next()) && !result.done) {
  6535. const pair = result.value;
  6536. fn.call(obj, pair[0], pair[1]);
  6537. }
  6538. };
  6539. const matchAll = (regExp, str) => {
  6540. let matches;
  6541. const arr = [];
  6542. while ((matches = regExp.exec(str)) !== null) {
  6543. arr.push(matches);
  6544. }
  6545. return arr;
  6546. };
  6547. const isHTMLForm = kindOfTest("HTMLFormElement");
  6548. const toCamelCase = (str) => {
  6549. return str.toLowerCase().replace(
  6550. /[-_\s]([a-z\d])(\w*)/g,
  6551. function replacer(m2, p1, p2) {
  6552. return p1.toUpperCase() + p2;
  6553. }
  6554. );
  6555. };
  6556. const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
  6557. const isRegExp = kindOfTest("RegExp");
  6558. const reduceDescriptors = (obj, reducer) => {
  6559. const descriptors2 = Object.getOwnPropertyDescriptors(obj);
  6560. const reducedDescriptors = {};
  6561. forEach(descriptors2, (descriptor, name) => {
  6562. let ret;
  6563. if ((ret = reducer(descriptor, name, obj)) !== false) {
  6564. reducedDescriptors[name] = ret || descriptor;
  6565. }
  6566. });
  6567. Object.defineProperties(obj, reducedDescriptors);
  6568. };
  6569. const freezeMethods = (obj) => {
  6570. reduceDescriptors(obj, (descriptor, name) => {
  6571. if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
  6572. return false;
  6573. }
  6574. const value = obj[name];
  6575. if (!isFunction(value)) return;
  6576. descriptor.enumerable = false;
  6577. if ("writable" in descriptor) {
  6578. descriptor.writable = false;
  6579. return;
  6580. }
  6581. if (!descriptor.set) {
  6582. descriptor.set = () => {
  6583. throw Error("Can not rewrite read-only method '" + name + "'");
  6584. };
  6585. }
  6586. });
  6587. };
  6588. const toObjectSet = (arrayOrString, delimiter2) => {
  6589. const obj = {};
  6590. const define = (arr) => {
  6591. arr.forEach((value) => {
  6592. obj[value] = true;
  6593. });
  6594. };
  6595. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter2));
  6596. return obj;
  6597. };
  6598. const noop = () => {
  6599. };
  6600. const toFiniteNumber = (value, defaultValue) => {
  6601. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  6602. };
  6603. const ALPHA = "abcdefghijklmnopqrstuvwxyz";
  6604. const DIGIT = "0123456789";
  6605. const ALPHABET = {
  6606. DIGIT,
  6607. ALPHA,
  6608. ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
  6609. };
  6610. const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
  6611. let str = "";
  6612. const { length: length2 } = alphabet;
  6613. while (size--) {
  6614. str += alphabet[Math.random() * length2 | 0];
  6615. }
  6616. return str;
  6617. };
  6618. function isSpecCompliantForm(thing) {
  6619. return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
  6620. }
  6621. const toJSONObject = (obj) => {
  6622. const stack = new Array(10);
  6623. const visit = (source, i) => {
  6624. if (isObject(source)) {
  6625. if (stack.indexOf(source) >= 0) {
  6626. return;
  6627. }
  6628. if (!("toJSON" in source)) {
  6629. stack[i] = source;
  6630. const target = isArray(source) ? [] : {};
  6631. forEach(source, (value, key) => {
  6632. const reducedValue = visit(value, i + 1);
  6633. !isUndefined(reducedValue) && (target[key] = reducedValue);
  6634. });
  6635. stack[i] = void 0;
  6636. return target;
  6637. }
  6638. }
  6639. return source;
  6640. };
  6641. return visit(obj, 0);
  6642. };
  6643. const isAsyncFn = kindOfTest("AsyncFunction");
  6644. const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
  6645. const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  6646. if (setImmediateSupported) {
  6647. return setImmediate;
  6648. }
  6649. return postMessageSupported ? ((token2, callbacks) => {
  6650. _global.addEventListener("message", ({ source, data }) => {
  6651. if (source === _global && data === token2) {
  6652. callbacks.length && callbacks.shift()();
  6653. }
  6654. }, false);
  6655. return (cb) => {
  6656. callbacks.push(cb);
  6657. _global.postMessage(token2, "*");
  6658. };
  6659. })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
  6660. })(
  6661. typeof setImmediate === "function",
  6662. isFunction(_global.postMessage)
  6663. );
  6664. const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
  6665. const utils$1 = {
  6666. isArray,
  6667. isArrayBuffer,
  6668. isBuffer,
  6669. isFormData,
  6670. isArrayBufferView,
  6671. isString,
  6672. isNumber,
  6673. isBoolean,
  6674. isObject,
  6675. isPlainObject,
  6676. isReadableStream,
  6677. isRequest,
  6678. isResponse,
  6679. isHeaders,
  6680. isUndefined,
  6681. isDate,
  6682. isFile,
  6683. isBlob,
  6684. isRegExp,
  6685. isFunction,
  6686. isStream,
  6687. isURLSearchParams,
  6688. isTypedArray,
  6689. isFileList,
  6690. forEach,
  6691. merge,
  6692. extend,
  6693. trim,
  6694. stripBOM,
  6695. inherits,
  6696. toFlatObject,
  6697. kindOf,
  6698. kindOfTest,
  6699. endsWith,
  6700. toArray,
  6701. forEachEntry,
  6702. matchAll,
  6703. isHTMLForm,
  6704. hasOwnProperty,
  6705. hasOwnProp: hasOwnProperty,
  6706. // an alias to avoid ESLint no-prototype-builtins detection
  6707. reduceDescriptors,
  6708. freezeMethods,
  6709. toObjectSet,
  6710. toCamelCase,
  6711. noop,
  6712. toFiniteNumber,
  6713. findKey,
  6714. global: _global,
  6715. isContextDefined,
  6716. ALPHABET,
  6717. generateString,
  6718. isSpecCompliantForm,
  6719. toJSONObject,
  6720. isAsyncFn,
  6721. isThenable,
  6722. setImmediate: _setImmediate,
  6723. asap
  6724. };
  6725. function AxiosError(message, code, config, request, response) {
  6726. Error.call(this);
  6727. if (Error.captureStackTrace) {
  6728. Error.captureStackTrace(this, this.constructor);
  6729. } else {
  6730. this.stack = new Error().stack;
  6731. }
  6732. this.message = message;
  6733. this.name = "AxiosError";
  6734. code && (this.code = code);
  6735. config && (this.config = config);
  6736. request && (this.request = request);
  6737. if (response) {
  6738. this.response = response;
  6739. this.status = response.status ? response.status : null;
  6740. }
  6741. }
  6742. utils$1.inherits(AxiosError, Error, {
  6743. toJSON: function toJSON() {
  6744. return {
  6745. // Standard
  6746. message: this.message,
  6747. name: this.name,
  6748. // Microsoft
  6749. description: this.description,
  6750. number: this.number,
  6751. // Mozilla
  6752. fileName: this.fileName,
  6753. lineNumber: this.lineNumber,
  6754. columnNumber: this.columnNumber,
  6755. stack: this.stack,
  6756. // Axios
  6757. config: utils$1.toJSONObject(this.config),
  6758. code: this.code,
  6759. status: this.status
  6760. };
  6761. }
  6762. });
  6763. const prototype$1 = AxiosError.prototype;
  6764. const descriptors = {};
  6765. [
  6766. "ERR_BAD_OPTION_VALUE",
  6767. "ERR_BAD_OPTION",
  6768. "ECONNABORTED",
  6769. "ETIMEDOUT",
  6770. "ERR_NETWORK",
  6771. "ERR_FR_TOO_MANY_REDIRECTS",
  6772. "ERR_DEPRECATED",
  6773. "ERR_BAD_RESPONSE",
  6774. "ERR_BAD_REQUEST",
  6775. "ERR_CANCELED",
  6776. "ERR_NOT_SUPPORT",
  6777. "ERR_INVALID_URL"
  6778. // eslint-disable-next-line func-names
  6779. ].forEach((code) => {
  6780. descriptors[code] = { value: code };
  6781. });
  6782. Object.defineProperties(AxiosError, descriptors);
  6783. Object.defineProperty(prototype$1, "isAxiosError", { value: true });
  6784. AxiosError.from = (error, code, config, request, response, customProps) => {
  6785. const axiosError = Object.create(prototype$1);
  6786. utils$1.toFlatObject(error, axiosError, function filter2(obj) {
  6787. return obj !== Error.prototype;
  6788. }, (prop) => {
  6789. return prop !== "isAxiosError";
  6790. });
  6791. AxiosError.call(axiosError, error.message, code, config, request, response);
  6792. axiosError.cause = error;
  6793. axiosError.name = error.name;
  6794. customProps && Object.assign(axiosError, customProps);
  6795. return axiosError;
  6796. };
  6797. const httpAdapter = null;
  6798. function isVisitable(thing) {
  6799. return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
  6800. }
  6801. function removeBrackets(key) {
  6802. return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
  6803. }
  6804. function renderKey(path, key, dots) {
  6805. if (!path) return key;
  6806. return path.concat(key).map(function each(token2, i) {
  6807. token2 = removeBrackets(token2);
  6808. return !dots && i ? "[" + token2 + "]" : token2;
  6809. }).join(dots ? "." : "");
  6810. }
  6811. function isFlatArray(arr) {
  6812. return utils$1.isArray(arr) && !arr.some(isVisitable);
  6813. }
  6814. const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
  6815. return /^is[A-Z]/.test(prop);
  6816. });
  6817. function toFormData(obj, formData, options) {
  6818. if (!utils$1.isObject(obj)) {
  6819. throw new TypeError("target must be an object");
  6820. }
  6821. formData = formData || new FormData();
  6822. options = utils$1.toFlatObject(options, {
  6823. metaTokens: true,
  6824. dots: false,
  6825. indexes: false
  6826. }, false, function defined(option, source) {
  6827. return !utils$1.isUndefined(source[option]);
  6828. });
  6829. const metaTokens = options.metaTokens;
  6830. const visitor = options.visitor || defaultVisitor;
  6831. const dots = options.dots;
  6832. const indexes = options.indexes;
  6833. const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
  6834. const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  6835. if (!utils$1.isFunction(visitor)) {
  6836. throw new TypeError("visitor must be a function");
  6837. }
  6838. function convertValue(value) {
  6839. if (value === null) return "";
  6840. if (utils$1.isDate(value)) {
  6841. return value.toISOString();
  6842. }
  6843. if (!useBlob && utils$1.isBlob(value)) {
  6844. throw new AxiosError("Blob is not supported. Use a Buffer instead.");
  6845. }
  6846. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  6847. return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
  6848. }
  6849. return value;
  6850. }
  6851. function defaultVisitor(value, key, path) {
  6852. let arr = value;
  6853. if (value && !path && typeof value === "object") {
  6854. if (utils$1.endsWith(key, "{}")) {
  6855. key = metaTokens ? key : key.slice(0, -2);
  6856. value = JSON.stringify(value);
  6857. } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
  6858. key = removeBrackets(key);
  6859. arr.forEach(function each(el, index) {
  6860. !(utils$1.isUndefined(el) || el === null) && formData.append(
  6861. // eslint-disable-next-line no-nested-ternary
  6862. indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
  6863. convertValue(el)
  6864. );
  6865. });
  6866. return false;
  6867. }
  6868. }
  6869. if (isVisitable(value)) {
  6870. return true;
  6871. }
  6872. formData.append(renderKey(path, key, dots), convertValue(value));
  6873. return false;
  6874. }
  6875. const stack = [];
  6876. const exposedHelpers = Object.assign(predicates, {
  6877. defaultVisitor,
  6878. convertValue,
  6879. isVisitable
  6880. });
  6881. function build(value, path) {
  6882. if (utils$1.isUndefined(value)) return;
  6883. if (stack.indexOf(value) !== -1) {
  6884. throw Error("Circular reference detected in " + path.join("."));
  6885. }
  6886. stack.push(value);
  6887. utils$1.forEach(value, function each(el, key) {
  6888. const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
  6889. formData,
  6890. el,
  6891. utils$1.isString(key) ? key.trim() : key,
  6892. path,
  6893. exposedHelpers
  6894. );
  6895. if (result === true) {
  6896. build(el, path ? path.concat(key) : [key]);
  6897. }
  6898. });
  6899. stack.pop();
  6900. }
  6901. if (!utils$1.isObject(obj)) {
  6902. throw new TypeError("data must be an object");
  6903. }
  6904. build(obj);
  6905. return formData;
  6906. }
  6907. function encode$1(str) {
  6908. const charMap = {
  6909. "!": "%21",
  6910. "'": "%27",
  6911. "(": "%28",
  6912. ")": "%29",
  6913. "~": "%7E",
  6914. "%20": "+",
  6915. "%00": "\0"
  6916. };
  6917. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match2) {
  6918. return charMap[match2];
  6919. });
  6920. }
  6921. function AxiosURLSearchParams(params, options) {
  6922. this._pairs = [];
  6923. params && toFormData(params, this, options);
  6924. }
  6925. const prototype = AxiosURLSearchParams.prototype;
  6926. prototype.append = function append2(name, value) {
  6927. this._pairs.push([name, value]);
  6928. };
  6929. prototype.toString = function toString2(encoder) {
  6930. const _encode2 = encoder ? function(value) {
  6931. return encoder.call(this, value, encode$1);
  6932. } : encode$1;
  6933. return this._pairs.map(function each(pair) {
  6934. return _encode2(pair[0]) + "=" + _encode2(pair[1]);
  6935. }, "").join("&");
  6936. };
  6937. function encode(val) {
  6938. return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
  6939. }
  6940. function buildURL(url, params, options) {
  6941. if (!params) {
  6942. return url;
  6943. }
  6944. const _encode2 = options && options.encode || encode;
  6945. const serializeFn = options && options.serialize;
  6946. let serializedParams;
  6947. if (serializeFn) {
  6948. serializedParams = serializeFn(params, options);
  6949. } else {
  6950. serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode2);
  6951. }
  6952. if (serializedParams) {
  6953. const hashmarkIndex = url.indexOf("#");
  6954. if (hashmarkIndex !== -1) {
  6955. url = url.slice(0, hashmarkIndex);
  6956. }
  6957. url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
  6958. }
  6959. return url;
  6960. }
  6961. class InterceptorManager {
  6962. constructor() {
  6963. this.handlers = [];
  6964. }
  6965. /**
  6966. * Add a new interceptor to the stack
  6967. *
  6968. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  6969. * @param {Function} rejected The function to handle `reject` for a `Promise`
  6970. *
  6971. * @return {Number} An ID used to remove interceptor later
  6972. */
  6973. use(fulfilled, rejected, options) {
  6974. this.handlers.push({
  6975. fulfilled,
  6976. rejected,
  6977. synchronous: options ? options.synchronous : false,
  6978. runWhen: options ? options.runWhen : null
  6979. });
  6980. return this.handlers.length - 1;
  6981. }
  6982. /**
  6983. * Remove an interceptor from the stack
  6984. *
  6985. * @param {Number} id The ID that was returned by `use`
  6986. *
  6987. * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
  6988. */
  6989. eject(id) {
  6990. if (this.handlers[id]) {
  6991. this.handlers[id] = null;
  6992. }
  6993. }
  6994. /**
  6995. * Clear all interceptors from the stack
  6996. *
  6997. * @returns {void}
  6998. */
  6999. clear() {
  7000. if (this.handlers) {
  7001. this.handlers = [];
  7002. }
  7003. }
  7004. /**
  7005. * Iterate over all the registered interceptors
  7006. *
  7007. * This method is particularly useful for skipping over any
  7008. * interceptors that may have become `null` calling `eject`.
  7009. *
  7010. * @param {Function} fn The function to call for each interceptor
  7011. *
  7012. * @returns {void}
  7013. */
  7014. forEach(fn) {
  7015. utils$1.forEach(this.handlers, function forEachHandler(h2) {
  7016. if (h2 !== null) {
  7017. fn(h2);
  7018. }
  7019. });
  7020. }
  7021. }
  7022. const transitionalDefaults = {
  7023. silentJSONParsing: true,
  7024. forcedJSONParsing: true,
  7025. clarifyTimeoutError: false
  7026. };
  7027. const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
  7028. const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
  7029. const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
  7030. const platform$1 = {
  7031. isBrowser: true,
  7032. classes: {
  7033. URLSearchParams: URLSearchParams$1,
  7034. FormData: FormData$1,
  7035. Blob: Blob$1
  7036. },
  7037. protocols: ["http", "https", "file", "blob", "url", "data"]
  7038. };
  7039. const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
  7040. const _navigator = typeof navigator === "object" && navigator || void 0;
  7041. const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
  7042. const hasStandardBrowserWebWorkerEnv = (() => {
  7043. return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
  7044. self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
  7045. })();
  7046. const origin = hasBrowserEnv && window.location.href || "http://localhost";
  7047. const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  7048. __proto__: null,
  7049. hasBrowserEnv,
  7050. hasStandardBrowserEnv,
  7051. hasStandardBrowserWebWorkerEnv,
  7052. navigator: _navigator,
  7053. origin
  7054. }, Symbol.toStringTag, { value: "Module" }));
  7055. const platform = {
  7056. ...utils,
  7057. ...platform$1
  7058. };
  7059. function toURLEncodedForm(data, options) {
  7060. return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
  7061. visitor: function(value, key, path, helpers) {
  7062. if (platform.isNode && utils$1.isBuffer(value)) {
  7063. this.append(key, value.toString("base64"));
  7064. return false;
  7065. }
  7066. return helpers.defaultVisitor.apply(this, arguments);
  7067. }
  7068. }, options));
  7069. }
  7070. function parsePropPath(name) {
  7071. return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match2) => {
  7072. return match2[0] === "[]" ? "" : match2[1] || match2[0];
  7073. });
  7074. }
  7075. function arrayToObject(arr) {
  7076. const obj = {};
  7077. const keys = Object.keys(arr);
  7078. let i;
  7079. const len = keys.length;
  7080. let key;
  7081. for (i = 0; i < len; i++) {
  7082. key = keys[i];
  7083. obj[key] = arr[key];
  7084. }
  7085. return obj;
  7086. }
  7087. function formDataToJSON(formData) {
  7088. function buildPath(path, value, target, index) {
  7089. let name = path[index++];
  7090. if (name === "__proto__") return true;
  7091. const isNumericKey = Number.isFinite(+name);
  7092. const isLast = index >= path.length;
  7093. name = !name && utils$1.isArray(target) ? target.length : name;
  7094. if (isLast) {
  7095. if (utils$1.hasOwnProp(target, name)) {
  7096. target[name] = [target[name], value];
  7097. } else {
  7098. target[name] = value;
  7099. }
  7100. return !isNumericKey;
  7101. }
  7102. if (!target[name] || !utils$1.isObject(target[name])) {
  7103. target[name] = [];
  7104. }
  7105. const result = buildPath(path, value, target[name], index);
  7106. if (result && utils$1.isArray(target[name])) {
  7107. target[name] = arrayToObject(target[name]);
  7108. }
  7109. return !isNumericKey;
  7110. }
  7111. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  7112. const obj = {};
  7113. utils$1.forEachEntry(formData, (name, value) => {
  7114. buildPath(parsePropPath(name), value, obj, 0);
  7115. });
  7116. return obj;
  7117. }
  7118. return null;
  7119. }
  7120. function stringifySafely(rawValue, parser, encoder) {
  7121. if (utils$1.isString(rawValue)) {
  7122. try {
  7123. (parser || JSON.parse)(rawValue);
  7124. return utils$1.trim(rawValue);
  7125. } catch (e2) {
  7126. if (e2.name !== "SyntaxError") {
  7127. throw e2;
  7128. }
  7129. }
  7130. }
  7131. return (0, JSON.stringify)(rawValue);
  7132. }
  7133. const defaults = {
  7134. transitional: transitionalDefaults,
  7135. adapter: ["xhr", "http", "fetch"],
  7136. transformRequest: [function transformRequest(data, headers) {
  7137. const contentType = headers.getContentType() || "";
  7138. const hasJSONContentType = contentType.indexOf("application/json") > -1;
  7139. const isObjectPayload = utils$1.isObject(data);
  7140. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  7141. data = new FormData(data);
  7142. }
  7143. const isFormData2 = utils$1.isFormData(data);
  7144. if (isFormData2) {
  7145. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  7146. }
  7147. if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
  7148. return data;
  7149. }
  7150. if (utils$1.isArrayBufferView(data)) {
  7151. return data.buffer;
  7152. }
  7153. if (utils$1.isURLSearchParams(data)) {
  7154. headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
  7155. return data.toString();
  7156. }
  7157. let isFileList2;
  7158. if (isObjectPayload) {
  7159. if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
  7160. return toURLEncodedForm(data, this.formSerializer).toString();
  7161. }
  7162. if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
  7163. const _FormData = this.env && this.env.FormData;
  7164. return toFormData(
  7165. isFileList2 ? { "files[]": data } : data,
  7166. _FormData && new _FormData(),
  7167. this.formSerializer
  7168. );
  7169. }
  7170. }
  7171. if (isObjectPayload || hasJSONContentType) {
  7172. headers.setContentType("application/json", false);
  7173. return stringifySafely(data);
  7174. }
  7175. return data;
  7176. }],
  7177. transformResponse: [function transformResponse(data) {
  7178. const transitional2 = this.transitional || defaults.transitional;
  7179. const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
  7180. const JSONRequested = this.responseType === "json";
  7181. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  7182. return data;
  7183. }
  7184. if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
  7185. const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
  7186. const strictJSONParsing = !silentJSONParsing && JSONRequested;
  7187. try {
  7188. return JSON.parse(data);
  7189. } catch (e2) {
  7190. if (strictJSONParsing) {
  7191. if (e2.name === "SyntaxError") {
  7192. throw AxiosError.from(e2, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
  7193. }
  7194. throw e2;
  7195. }
  7196. }
  7197. }
  7198. return data;
  7199. }],
  7200. /**
  7201. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  7202. * timeout is not created.
  7203. */
  7204. timeout: 0,
  7205. xsrfCookieName: "XSRF-TOKEN",
  7206. xsrfHeaderName: "X-XSRF-TOKEN",
  7207. maxContentLength: -1,
  7208. maxBodyLength: -1,
  7209. env: {
  7210. FormData: platform.classes.FormData,
  7211. Blob: platform.classes.Blob
  7212. },
  7213. validateStatus: function validateStatus(status) {
  7214. return status >= 200 && status < 300;
  7215. },
  7216. headers: {
  7217. common: {
  7218. "Accept": "application/json, text/plain, */*",
  7219. "Content-Type": void 0
  7220. }
  7221. }
  7222. };
  7223. utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
  7224. defaults.headers[method] = {};
  7225. });
  7226. const ignoreDuplicateOf = utils$1.toObjectSet([
  7227. "age",
  7228. "authorization",
  7229. "content-length",
  7230. "content-type",
  7231. "etag",
  7232. "expires",
  7233. "from",
  7234. "host",
  7235. "if-modified-since",
  7236. "if-unmodified-since",
  7237. "last-modified",
  7238. "location",
  7239. "max-forwards",
  7240. "proxy-authorization",
  7241. "referer",
  7242. "retry-after",
  7243. "user-agent"
  7244. ]);
  7245. const parseHeaders = (rawHeaders) => {
  7246. const parsed = {};
  7247. let key;
  7248. let val;
  7249. let i;
  7250. rawHeaders && rawHeaders.split("\n").forEach(function parser(line2) {
  7251. i = line2.indexOf(":");
  7252. key = line2.substring(0, i).trim().toLowerCase();
  7253. val = line2.substring(i + 1).trim();
  7254. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  7255. return;
  7256. }
  7257. if (key === "set-cookie") {
  7258. if (parsed[key]) {
  7259. parsed[key].push(val);
  7260. } else {
  7261. parsed[key] = [val];
  7262. }
  7263. } else {
  7264. parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
  7265. }
  7266. });
  7267. return parsed;
  7268. };
  7269. const $internals = Symbol("internals");
  7270. function normalizeHeader(header) {
  7271. return header && String(header).trim().toLowerCase();
  7272. }
  7273. function normalizeValue(value) {
  7274. if (value === false || value == null) {
  7275. return value;
  7276. }
  7277. return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
  7278. }
  7279. function parseTokens(str) {
  7280. const tokens = /* @__PURE__ */ Object.create(null);
  7281. const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  7282. let match2;
  7283. while (match2 = tokensRE.exec(str)) {
  7284. tokens[match2[1]] = match2[2];
  7285. }
  7286. return tokens;
  7287. }
  7288. const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  7289. function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
  7290. if (utils$1.isFunction(filter2)) {
  7291. return filter2.call(this, value, header);
  7292. }
  7293. if (isHeaderNameFilter) {
  7294. value = header;
  7295. }
  7296. if (!utils$1.isString(value)) return;
  7297. if (utils$1.isString(filter2)) {
  7298. return value.indexOf(filter2) !== -1;
  7299. }
  7300. if (utils$1.isRegExp(filter2)) {
  7301. return filter2.test(value);
  7302. }
  7303. }
  7304. function formatHeader(header) {
  7305. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char2, str) => {
  7306. return char2.toUpperCase() + str;
  7307. });
  7308. }
  7309. function buildAccessors(obj, header) {
  7310. const accessorName = utils$1.toCamelCase(" " + header);
  7311. ["get", "set", "has"].forEach((methodName) => {
  7312. Object.defineProperty(obj, methodName + accessorName, {
  7313. value: function(arg1, arg2, arg3) {
  7314. return this[methodName].call(this, header, arg1, arg2, arg3);
  7315. },
  7316. configurable: true
  7317. });
  7318. });
  7319. }
  7320. class AxiosHeaders {
  7321. constructor(headers) {
  7322. headers && this.set(headers);
  7323. }
  7324. set(header, valueOrRewrite, rewrite) {
  7325. const self2 = this;
  7326. function setHeader(_value, _header, _rewrite) {
  7327. const lHeader = normalizeHeader(_header);
  7328. if (!lHeader) {
  7329. throw new Error("header name must be a non-empty string");
  7330. }
  7331. const key = utils$1.findKey(self2, lHeader);
  7332. if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
  7333. self2[key || _header] = normalizeValue(_value);
  7334. }
  7335. }
  7336. const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
  7337. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  7338. setHeaders(header, valueOrRewrite);
  7339. } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  7340. setHeaders(parseHeaders(header), valueOrRewrite);
  7341. } else if (utils$1.isHeaders(header)) {
  7342. for (const [key, value] of header.entries()) {
  7343. setHeader(value, key, rewrite);
  7344. }
  7345. } else {
  7346. header != null && setHeader(valueOrRewrite, header, rewrite);
  7347. }
  7348. return this;
  7349. }
  7350. get(header, parser) {
  7351. header = normalizeHeader(header);
  7352. if (header) {
  7353. const key = utils$1.findKey(this, header);
  7354. if (key) {
  7355. const value = this[key];
  7356. if (!parser) {
  7357. return value;
  7358. }
  7359. if (parser === true) {
  7360. return parseTokens(value);
  7361. }
  7362. if (utils$1.isFunction(parser)) {
  7363. return parser.call(this, value, key);
  7364. }
  7365. if (utils$1.isRegExp(parser)) {
  7366. return parser.exec(value);
  7367. }
  7368. throw new TypeError("parser must be boolean|regexp|function");
  7369. }
  7370. }
  7371. }
  7372. has(header, matcher) {
  7373. header = normalizeHeader(header);
  7374. if (header) {
  7375. const key = utils$1.findKey(this, header);
  7376. return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  7377. }
  7378. return false;
  7379. }
  7380. delete(header, matcher) {
  7381. const self2 = this;
  7382. let deleted = false;
  7383. function deleteHeader(_header) {
  7384. _header = normalizeHeader(_header);
  7385. if (_header) {
  7386. const key = utils$1.findKey(self2, _header);
  7387. if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
  7388. delete self2[key];
  7389. deleted = true;
  7390. }
  7391. }
  7392. }
  7393. if (utils$1.isArray(header)) {
  7394. header.forEach(deleteHeader);
  7395. } else {
  7396. deleteHeader(header);
  7397. }
  7398. return deleted;
  7399. }
  7400. clear(matcher) {
  7401. const keys = Object.keys(this);
  7402. let i = keys.length;
  7403. let deleted = false;
  7404. while (i--) {
  7405. const key = keys[i];
  7406. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  7407. delete this[key];
  7408. deleted = true;
  7409. }
  7410. }
  7411. return deleted;
  7412. }
  7413. normalize(format) {
  7414. const self2 = this;
  7415. const headers = {};
  7416. utils$1.forEach(this, (value, header) => {
  7417. const key = utils$1.findKey(headers, header);
  7418. if (key) {
  7419. self2[key] = normalizeValue(value);
  7420. delete self2[header];
  7421. return;
  7422. }
  7423. const normalized = format ? formatHeader(header) : String(header).trim();
  7424. if (normalized !== header) {
  7425. delete self2[header];
  7426. }
  7427. self2[normalized] = normalizeValue(value);
  7428. headers[normalized] = true;
  7429. });
  7430. return this;
  7431. }
  7432. concat(...targets) {
  7433. return this.constructor.concat(this, ...targets);
  7434. }
  7435. toJSON(asStrings) {
  7436. const obj = /* @__PURE__ */ Object.create(null);
  7437. utils$1.forEach(this, (value, header) => {
  7438. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
  7439. });
  7440. return obj;
  7441. }
  7442. [Symbol.iterator]() {
  7443. return Object.entries(this.toJSON())[Symbol.iterator]();
  7444. }
  7445. toString() {
  7446. return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
  7447. }
  7448. get [Symbol.toStringTag]() {
  7449. return "AxiosHeaders";
  7450. }
  7451. static from(thing) {
  7452. return thing instanceof this ? thing : new this(thing);
  7453. }
  7454. static concat(first, ...targets) {
  7455. const computed = new this(first);
  7456. targets.forEach((target) => computed.set(target));
  7457. return computed;
  7458. }
  7459. static accessor(header) {
  7460. const internals = this[$internals] = this[$internals] = {
  7461. accessors: {}
  7462. };
  7463. const accessors = internals.accessors;
  7464. const prototype2 = this.prototype;
  7465. function defineAccessor(_header) {
  7466. const lHeader = normalizeHeader(_header);
  7467. if (!accessors[lHeader]) {
  7468. buildAccessors(prototype2, _header);
  7469. accessors[lHeader] = true;
  7470. }
  7471. }
  7472. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  7473. return this;
  7474. }
  7475. }
  7476. AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
  7477. utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
  7478. let mapped = key[0].toUpperCase() + key.slice(1);
  7479. return {
  7480. get: () => value,
  7481. set(headerValue) {
  7482. this[mapped] = headerValue;
  7483. }
  7484. };
  7485. });
  7486. utils$1.freezeMethods(AxiosHeaders);
  7487. function transformData(fns, response) {
  7488. const config = this || defaults;
  7489. const context = response || config;
  7490. const headers = AxiosHeaders.from(context.headers);
  7491. let data = context.data;
  7492. utils$1.forEach(fns, function transform(fn) {
  7493. data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
  7494. });
  7495. headers.normalize();
  7496. return data;
  7497. }
  7498. function isCancel(value) {
  7499. return !!(value && value.__CANCEL__);
  7500. }
  7501. function CanceledError(message, config, request) {
  7502. AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request);
  7503. this.name = "CanceledError";
  7504. }
  7505. utils$1.inherits(CanceledError, AxiosError, {
  7506. __CANCEL__: true
  7507. });
  7508. function settle(resolve, reject, response) {
  7509. const validateStatus2 = response.config.validateStatus;
  7510. if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
  7511. resolve(response);
  7512. } else {
  7513. reject(new AxiosError(
  7514. "Request failed with status code " + response.status,
  7515. [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
  7516. response.config,
  7517. response.request,
  7518. response
  7519. ));
  7520. }
  7521. }
  7522. function parseProtocol(url) {
  7523. const match2 = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  7524. return match2 && match2[1] || "";
  7525. }
  7526. function speedometer(samplesCount, min) {
  7527. samplesCount = samplesCount || 10;
  7528. const bytes = new Array(samplesCount);
  7529. const timestamps = new Array(samplesCount);
  7530. let head = 0;
  7531. let tail = 0;
  7532. let firstSampleTS;
  7533. min = min !== void 0 ? min : 1e3;
  7534. return function push(chunkLength) {
  7535. const now = Date.now();
  7536. const startedAt = timestamps[tail];
  7537. if (!firstSampleTS) {
  7538. firstSampleTS = now;
  7539. }
  7540. bytes[head] = chunkLength;
  7541. timestamps[head] = now;
  7542. let i = tail;
  7543. let bytesCount = 0;
  7544. while (i !== head) {
  7545. bytesCount += bytes[i++];
  7546. i = i % samplesCount;
  7547. }
  7548. head = (head + 1) % samplesCount;
  7549. if (head === tail) {
  7550. tail = (tail + 1) % samplesCount;
  7551. }
  7552. if (now - firstSampleTS < min) {
  7553. return;
  7554. }
  7555. const passed = startedAt && now - startedAt;
  7556. return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
  7557. };
  7558. }
  7559. function throttle(fn, freq) {
  7560. let timestamp = 0;
  7561. let threshold = 1e3 / freq;
  7562. let lastArgs;
  7563. let timer;
  7564. const invoke = (args, now = Date.now()) => {
  7565. timestamp = now;
  7566. lastArgs = null;
  7567. if (timer) {
  7568. clearTimeout(timer);
  7569. timer = null;
  7570. }
  7571. fn.apply(null, args);
  7572. };
  7573. const throttled = (...args) => {
  7574. const now = Date.now();
  7575. const passed = now - timestamp;
  7576. if (passed >= threshold) {
  7577. invoke(args, now);
  7578. } else {
  7579. lastArgs = args;
  7580. if (!timer) {
  7581. timer = setTimeout(() => {
  7582. timer = null;
  7583. invoke(lastArgs);
  7584. }, threshold - passed);
  7585. }
  7586. }
  7587. };
  7588. const flush = () => lastArgs && invoke(lastArgs);
  7589. return [throttled, flush];
  7590. }
  7591. const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
  7592. let bytesNotified = 0;
  7593. const _speedometer = speedometer(50, 250);
  7594. return throttle((e2) => {
  7595. const loaded = e2.loaded;
  7596. const total = e2.lengthComputable ? e2.total : void 0;
  7597. const progressBytes = loaded - bytesNotified;
  7598. const rate = _speedometer(progressBytes);
  7599. const inRange = loaded <= total;
  7600. bytesNotified = loaded;
  7601. const data = {
  7602. loaded,
  7603. total,
  7604. progress: total ? loaded / total : void 0,
  7605. bytes: progressBytes,
  7606. rate: rate ? rate : void 0,
  7607. estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
  7608. event: e2,
  7609. lengthComputable: total != null,
  7610. [isDownloadStream ? "download" : "upload"]: true
  7611. };
  7612. listener(data);
  7613. }, freq);
  7614. };
  7615. const progressEventDecorator = (total, throttled) => {
  7616. const lengthComputable = total != null;
  7617. return [(loaded) => throttled[0]({
  7618. lengthComputable,
  7619. total,
  7620. loaded
  7621. }), throttled[1]];
  7622. };
  7623. const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
  7624. const isURLSameOrigin = platform.hasStandardBrowserEnv ? (
  7625. // Standard browser envs have full support of the APIs needed to test
  7626. // whether the request URL is of the same origin as current location.
  7627. function standardBrowserEnv() {
  7628. const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
  7629. const urlParsingNode = document.createElement("a");
  7630. let originURL;
  7631. function resolveURL(url) {
  7632. let href = url;
  7633. if (msie) {
  7634. urlParsingNode.setAttribute("href", href);
  7635. href = urlParsingNode.href;
  7636. }
  7637. urlParsingNode.setAttribute("href", href);
  7638. return {
  7639. href: urlParsingNode.href,
  7640. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
  7641. host: urlParsingNode.host,
  7642. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
  7643. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
  7644. hostname: urlParsingNode.hostname,
  7645. port: urlParsingNode.port,
  7646. pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
  7647. };
  7648. }
  7649. originURL = resolveURL(window.location.href);
  7650. return function isURLSameOrigin2(requestURL) {
  7651. const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
  7652. return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
  7653. };
  7654. }()
  7655. ) : (
  7656. // Non standard browser envs (web workers, react-native) lack needed support.
  7657. /* @__PURE__ */ function nonStandardBrowserEnv() {
  7658. return function isURLSameOrigin2() {
  7659. return true;
  7660. };
  7661. }()
  7662. );
  7663. const cookies = platform.hasStandardBrowserEnv ? (
  7664. // Standard browser envs support document.cookie
  7665. {
  7666. write(name, value, expires, path, domain, secure) {
  7667. const cookie = [name + "=" + encodeURIComponent(value)];
  7668. utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
  7669. utils$1.isString(path) && cookie.push("path=" + path);
  7670. utils$1.isString(domain) && cookie.push("domain=" + domain);
  7671. secure === true && cookie.push("secure");
  7672. document.cookie = cookie.join("; ");
  7673. },
  7674. read(name) {
  7675. const match2 = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
  7676. return match2 ? decodeURIComponent(match2[3]) : null;
  7677. },
  7678. remove(name) {
  7679. this.write(name, "", Date.now() - 864e5);
  7680. }
  7681. }
  7682. ) : (
  7683. // Non-standard browser env (web workers, react-native) lack needed support.
  7684. {
  7685. write() {
  7686. },
  7687. read() {
  7688. return null;
  7689. },
  7690. remove() {
  7691. }
  7692. }
  7693. );
  7694. function isAbsoluteURL(url) {
  7695. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  7696. }
  7697. function combineURLs(baseURL, relativeURL) {
  7698. return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
  7699. }
  7700. function buildFullPath(baseURL, requestedURL) {
  7701. if (baseURL && !isAbsoluteURL(requestedURL)) {
  7702. return combineURLs(baseURL, requestedURL);
  7703. }
  7704. return requestedURL;
  7705. }
  7706. const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
  7707. function mergeConfig(config1, config2) {
  7708. config2 = config2 || {};
  7709. const config = {};
  7710. function getMergedValue(target, source, caseless) {
  7711. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  7712. return utils$1.merge.call({ caseless }, target, source);
  7713. } else if (utils$1.isPlainObject(source)) {
  7714. return utils$1.merge({}, source);
  7715. } else if (utils$1.isArray(source)) {
  7716. return source.slice();
  7717. }
  7718. return source;
  7719. }
  7720. function mergeDeepProperties(a, b2, caseless) {
  7721. if (!utils$1.isUndefined(b2)) {
  7722. return getMergedValue(a, b2, caseless);
  7723. } else if (!utils$1.isUndefined(a)) {
  7724. return getMergedValue(void 0, a, caseless);
  7725. }
  7726. }
  7727. function valueFromConfig2(a, b2) {
  7728. if (!utils$1.isUndefined(b2)) {
  7729. return getMergedValue(void 0, b2);
  7730. }
  7731. }
  7732. function defaultToConfig2(a, b2) {
  7733. if (!utils$1.isUndefined(b2)) {
  7734. return getMergedValue(void 0, b2);
  7735. } else if (!utils$1.isUndefined(a)) {
  7736. return getMergedValue(void 0, a);
  7737. }
  7738. }
  7739. function mergeDirectKeys(a, b2, prop) {
  7740. if (prop in config2) {
  7741. return getMergedValue(a, b2);
  7742. } else if (prop in config1) {
  7743. return getMergedValue(void 0, a);
  7744. }
  7745. }
  7746. const mergeMap = {
  7747. url: valueFromConfig2,
  7748. method: valueFromConfig2,
  7749. data: valueFromConfig2,
  7750. baseURL: defaultToConfig2,
  7751. transformRequest: defaultToConfig2,
  7752. transformResponse: defaultToConfig2,
  7753. paramsSerializer: defaultToConfig2,
  7754. timeout: defaultToConfig2,
  7755. timeoutMessage: defaultToConfig2,
  7756. withCredentials: defaultToConfig2,
  7757. withXSRFToken: defaultToConfig2,
  7758. adapter: defaultToConfig2,
  7759. responseType: defaultToConfig2,
  7760. xsrfCookieName: defaultToConfig2,
  7761. xsrfHeaderName: defaultToConfig2,
  7762. onUploadProgress: defaultToConfig2,
  7763. onDownloadProgress: defaultToConfig2,
  7764. decompress: defaultToConfig2,
  7765. maxContentLength: defaultToConfig2,
  7766. maxBodyLength: defaultToConfig2,
  7767. beforeRedirect: defaultToConfig2,
  7768. transport: defaultToConfig2,
  7769. httpAgent: defaultToConfig2,
  7770. httpsAgent: defaultToConfig2,
  7771. cancelToken: defaultToConfig2,
  7772. socketPath: defaultToConfig2,
  7773. responseEncoding: defaultToConfig2,
  7774. validateStatus: mergeDirectKeys,
  7775. headers: (a, b2) => mergeDeepProperties(headersToObject(a), headersToObject(b2), true)
  7776. };
  7777. utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
  7778. const merge2 = mergeMap[prop] || mergeDeepProperties;
  7779. const configValue = merge2(config1[prop], config2[prop], prop);
  7780. utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
  7781. });
  7782. return config;
  7783. }
  7784. const resolveConfig = (config) => {
  7785. const newConfig = mergeConfig({}, config);
  7786. let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
  7787. newConfig.headers = headers = AxiosHeaders.from(headers);
  7788. newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
  7789. if (auth) {
  7790. headers.set(
  7791. "Authorization",
  7792. "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
  7793. );
  7794. }
  7795. let contentType;
  7796. if (utils$1.isFormData(data)) {
  7797. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  7798. headers.setContentType(void 0);
  7799. } else if ((contentType = headers.getContentType()) !== false) {
  7800. const [type, ...tokens] = contentType ? contentType.split(";").map((token2) => token2.trim()).filter(Boolean) : [];
  7801. headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
  7802. }
  7803. }
  7804. if (platform.hasStandardBrowserEnv) {
  7805. withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
  7806. if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
  7807. const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  7808. if (xsrfValue) {
  7809. headers.set(xsrfHeaderName, xsrfValue);
  7810. }
  7811. }
  7812. }
  7813. return newConfig;
  7814. };
  7815. const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
  7816. const xhrAdapter = isXHRAdapterSupported && function(config) {
  7817. return new Promise(function dispatchXhrRequest(resolve, reject) {
  7818. const _config = resolveConfig(config);
  7819. let requestData = _config.data;
  7820. const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
  7821. let { responseType, onUploadProgress, onDownloadProgress } = _config;
  7822. let onCanceled;
  7823. let uploadThrottled, downloadThrottled;
  7824. let flushUpload, flushDownload;
  7825. function done() {
  7826. flushUpload && flushUpload();
  7827. flushDownload && flushDownload();
  7828. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  7829. _config.signal && _config.signal.removeEventListener("abort", onCanceled);
  7830. }
  7831. let request = new XMLHttpRequest();
  7832. request.open(_config.method.toUpperCase(), _config.url, true);
  7833. request.timeout = _config.timeout;
  7834. function onloadend() {
  7835. if (!request) {
  7836. return;
  7837. }
  7838. const responseHeaders = AxiosHeaders.from(
  7839. "getAllResponseHeaders" in request && request.getAllResponseHeaders()
  7840. );
  7841. const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
  7842. const response = {
  7843. data: responseData,
  7844. status: request.status,
  7845. statusText: request.statusText,
  7846. headers: responseHeaders,
  7847. config,
  7848. request
  7849. };
  7850. settle(function _resolve(value) {
  7851. resolve(value);
  7852. done();
  7853. }, function _reject(err) {
  7854. reject(err);
  7855. done();
  7856. }, response);
  7857. request = null;
  7858. }
  7859. if ("onloadend" in request) {
  7860. request.onloadend = onloadend;
  7861. } else {
  7862. request.onreadystatechange = function handleLoad() {
  7863. if (!request || request.readyState !== 4) {
  7864. return;
  7865. }
  7866. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
  7867. return;
  7868. }
  7869. setTimeout(onloadend);
  7870. };
  7871. }
  7872. request.onabort = function handleAbort() {
  7873. if (!request) {
  7874. return;
  7875. }
  7876. reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
  7877. request = null;
  7878. };
  7879. request.onerror = function handleError() {
  7880. reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request));
  7881. request = null;
  7882. };
  7883. request.ontimeout = function handleTimeout() {
  7884. let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
  7885. const transitional2 = _config.transitional || transitionalDefaults;
  7886. if (_config.timeoutErrorMessage) {
  7887. timeoutErrorMessage = _config.timeoutErrorMessage;
  7888. }
  7889. reject(new AxiosError(
  7890. timeoutErrorMessage,
  7891. transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
  7892. config,
  7893. request
  7894. ));
  7895. request = null;
  7896. };
  7897. requestData === void 0 && requestHeaders.setContentType(null);
  7898. if ("setRequestHeader" in request) {
  7899. utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  7900. request.setRequestHeader(key, val);
  7901. });
  7902. }
  7903. if (!utils$1.isUndefined(_config.withCredentials)) {
  7904. request.withCredentials = !!_config.withCredentials;
  7905. }
  7906. if (responseType && responseType !== "json") {
  7907. request.responseType = _config.responseType;
  7908. }
  7909. if (onDownloadProgress) {
  7910. [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
  7911. request.addEventListener("progress", downloadThrottled);
  7912. }
  7913. if (onUploadProgress && request.upload) {
  7914. [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
  7915. request.upload.addEventListener("progress", uploadThrottled);
  7916. request.upload.addEventListener("loadend", flushUpload);
  7917. }
  7918. if (_config.cancelToken || _config.signal) {
  7919. onCanceled = (cancel) => {
  7920. if (!request) {
  7921. return;
  7922. }
  7923. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  7924. request.abort();
  7925. request = null;
  7926. };
  7927. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  7928. if (_config.signal) {
  7929. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
  7930. }
  7931. }
  7932. const protocol = parseProtocol(_config.url);
  7933. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  7934. reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
  7935. return;
  7936. }
  7937. request.send(requestData || null);
  7938. });
  7939. };
  7940. const composeSignals = (signals, timeout) => {
  7941. const { length: length2 } = signals = signals ? signals.filter(Boolean) : [];
  7942. if (timeout || length2) {
  7943. let controller = new AbortController();
  7944. let aborted;
  7945. const onabort = function(reason) {
  7946. if (!aborted) {
  7947. aborted = true;
  7948. unsubscribe();
  7949. const err = reason instanceof Error ? reason : this.reason;
  7950. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  7951. }
  7952. };
  7953. let timer = timeout && setTimeout(() => {
  7954. timer = null;
  7955. onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
  7956. }, timeout);
  7957. const unsubscribe = () => {
  7958. if (signals) {
  7959. timer && clearTimeout(timer);
  7960. timer = null;
  7961. signals.forEach((signal2) => {
  7962. signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
  7963. });
  7964. signals = null;
  7965. }
  7966. };
  7967. signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
  7968. const { signal } = controller;
  7969. signal.unsubscribe = () => utils$1.asap(unsubscribe);
  7970. return signal;
  7971. }
  7972. };
  7973. const streamChunk = function* (chunk, chunkSize) {
  7974. let len = chunk.byteLength;
  7975. if (len < chunkSize) {
  7976. yield chunk;
  7977. return;
  7978. }
  7979. let pos = 0;
  7980. let end;
  7981. while (pos < len) {
  7982. end = pos + chunkSize;
  7983. yield chunk.slice(pos, end);
  7984. pos = end;
  7985. }
  7986. };
  7987. const readBytes = async function* (iterable, chunkSize) {
  7988. for await (const chunk of readStream(iterable)) {
  7989. yield* streamChunk(chunk, chunkSize);
  7990. }
  7991. };
  7992. const readStream = async function* (stream) {
  7993. if (stream[Symbol.asyncIterator]) {
  7994. yield* stream;
  7995. return;
  7996. }
  7997. const reader = stream.getReader();
  7998. try {
  7999. for (; ; ) {
  8000. const { done, value } = await reader.read();
  8001. if (done) {
  8002. break;
  8003. }
  8004. yield value;
  8005. }
  8006. } finally {
  8007. await reader.cancel();
  8008. }
  8009. };
  8010. const trackStream = (stream, chunkSize, onProgress, onFinish) => {
  8011. const iterator = readBytes(stream, chunkSize);
  8012. let bytes = 0;
  8013. let done;
  8014. let _onFinish = (e2) => {
  8015. if (!done) {
  8016. done = true;
  8017. onFinish && onFinish(e2);
  8018. }
  8019. };
  8020. return new ReadableStream({
  8021. async pull(controller) {
  8022. try {
  8023. const { done: done2, value } = await iterator.next();
  8024. if (done2) {
  8025. _onFinish();
  8026. controller.close();
  8027. return;
  8028. }
  8029. let len = value.byteLength;
  8030. if (onProgress) {
  8031. let loadedBytes = bytes += len;
  8032. onProgress(loadedBytes);
  8033. }
  8034. controller.enqueue(new Uint8Array(value));
  8035. } catch (err) {
  8036. _onFinish(err);
  8037. throw err;
  8038. }
  8039. },
  8040. cancel(reason) {
  8041. _onFinish(reason);
  8042. return iterator.return();
  8043. }
  8044. }, {
  8045. highWaterMark: 2
  8046. });
  8047. };
  8048. const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
  8049. const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
  8050. const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
  8051. const test = (fn, ...args) => {
  8052. try {
  8053. return !!fn(...args);
  8054. } catch (e2) {
  8055. return false;
  8056. }
  8057. };
  8058. const supportsRequestStream = isReadableStreamSupported && test(() => {
  8059. let duplexAccessed = false;
  8060. const hasContentType = new Request(platform.origin, {
  8061. body: new ReadableStream(),
  8062. method: "POST",
  8063. get duplex() {
  8064. duplexAccessed = true;
  8065. return "half";
  8066. }
  8067. }).headers.has("Content-Type");
  8068. return duplexAccessed && !hasContentType;
  8069. });
  8070. const DEFAULT_CHUNK_SIZE = 64 * 1024;
  8071. const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
  8072. const resolvers = {
  8073. stream: supportsResponseStream && ((res) => res.body)
  8074. };
  8075. isFetchSupported && ((res) => {
  8076. ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
  8077. !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
  8078. throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
  8079. });
  8080. });
  8081. })(new Response());
  8082. const getBodyLength = async (body) => {
  8083. if (body == null) {
  8084. return 0;
  8085. }
  8086. if (utils$1.isBlob(body)) {
  8087. return body.size;
  8088. }
  8089. if (utils$1.isSpecCompliantForm(body)) {
  8090. const _request = new Request(platform.origin, {
  8091. method: "POST",
  8092. body
  8093. });
  8094. return (await _request.arrayBuffer()).byteLength;
  8095. }
  8096. if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
  8097. return body.byteLength;
  8098. }
  8099. if (utils$1.isURLSearchParams(body)) {
  8100. body = body + "";
  8101. }
  8102. if (utils$1.isString(body)) {
  8103. return (await encodeText(body)).byteLength;
  8104. }
  8105. };
  8106. const resolveBodyLength = async (headers, body) => {
  8107. const length2 = utils$1.toFiniteNumber(headers.getContentLength());
  8108. return length2 == null ? getBodyLength(body) : length2;
  8109. };
  8110. const fetchAdapter = isFetchSupported && (async (config) => {
  8111. let {
  8112. url,
  8113. method,
  8114. data,
  8115. signal,
  8116. cancelToken,
  8117. timeout,
  8118. onDownloadProgress,
  8119. onUploadProgress,
  8120. responseType,
  8121. headers,
  8122. withCredentials = "same-origin",
  8123. fetchOptions
  8124. } = resolveConfig(config);
  8125. responseType = responseType ? (responseType + "").toLowerCase() : "text";
  8126. let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  8127. let request;
  8128. const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
  8129. composedSignal.unsubscribe();
  8130. });
  8131. let requestContentLength;
  8132. try {
  8133. if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
  8134. let _request = new Request(url, {
  8135. method: "POST",
  8136. body: data,
  8137. duplex: "half"
  8138. });
  8139. let contentTypeHeader;
  8140. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
  8141. headers.setContentType(contentTypeHeader);
  8142. }
  8143. if (_request.body) {
  8144. const [onProgress, flush] = progressEventDecorator(
  8145. requestContentLength,
  8146. progressEventReducer(asyncDecorator(onUploadProgress))
  8147. );
  8148. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
  8149. }
  8150. }
  8151. if (!utils$1.isString(withCredentials)) {
  8152. withCredentials = withCredentials ? "include" : "omit";
  8153. }
  8154. const isCredentialsSupported = "credentials" in Request.prototype;
  8155. request = new Request(url, {
  8156. ...fetchOptions,
  8157. signal: composedSignal,
  8158. method: method.toUpperCase(),
  8159. headers: headers.normalize().toJSON(),
  8160. body: data,
  8161. duplex: "half",
  8162. credentials: isCredentialsSupported ? withCredentials : void 0
  8163. });
  8164. let response = await fetch(request);
  8165. const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
  8166. if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
  8167. const options = {};
  8168. ["status", "statusText", "headers"].forEach((prop) => {
  8169. options[prop] = response[prop];
  8170. });
  8171. const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
  8172. const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
  8173. responseContentLength,
  8174. progressEventReducer(asyncDecorator(onDownloadProgress), true)
  8175. ) || [];
  8176. response = new Response(
  8177. trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
  8178. flush && flush();
  8179. unsubscribe && unsubscribe();
  8180. }),
  8181. options
  8182. );
  8183. }
  8184. responseType = responseType || "text";
  8185. let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
  8186. !isStreamResponse && unsubscribe && unsubscribe();
  8187. return await new Promise((resolve, reject) => {
  8188. settle(resolve, reject, {
  8189. data: responseData,
  8190. headers: AxiosHeaders.from(response.headers),
  8191. status: response.status,
  8192. statusText: response.statusText,
  8193. config,
  8194. request
  8195. });
  8196. });
  8197. } catch (err) {
  8198. unsubscribe && unsubscribe();
  8199. if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
  8200. throw Object.assign(
  8201. new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
  8202. {
  8203. cause: err.cause || err
  8204. }
  8205. );
  8206. }
  8207. throw AxiosError.from(err, err && err.code, config, request);
  8208. }
  8209. });
  8210. const knownAdapters = {
  8211. http: httpAdapter,
  8212. xhr: xhrAdapter,
  8213. fetch: fetchAdapter
  8214. };
  8215. utils$1.forEach(knownAdapters, (fn, value) => {
  8216. if (fn) {
  8217. try {
  8218. Object.defineProperty(fn, "name", { value });
  8219. } catch (e2) {
  8220. }
  8221. Object.defineProperty(fn, "adapterName", { value });
  8222. }
  8223. });
  8224. const renderReason = (reason) => `- ${reason}`;
  8225. const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
  8226. const adapters = {
  8227. getAdapter: (adapters2) => {
  8228. adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
  8229. const { length: length2 } = adapters2;
  8230. let nameOrAdapter;
  8231. let adapter;
  8232. const rejectedReasons = {};
  8233. for (let i = 0; i < length2; i++) {
  8234. nameOrAdapter = adapters2[i];
  8235. let id;
  8236. adapter = nameOrAdapter;
  8237. if (!isResolvedHandle(nameOrAdapter)) {
  8238. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  8239. if (adapter === void 0) {
  8240. throw new AxiosError(`Unknown adapter '${id}'`);
  8241. }
  8242. }
  8243. if (adapter) {
  8244. break;
  8245. }
  8246. rejectedReasons[id || "#" + i] = adapter;
  8247. }
  8248. if (!adapter) {
  8249. const reasons = Object.entries(rejectedReasons).map(
  8250. ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
  8251. );
  8252. let s = length2 ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
  8253. throw new AxiosError(
  8254. `There is no suitable adapter to dispatch the request ` + s,
  8255. "ERR_NOT_SUPPORT"
  8256. );
  8257. }
  8258. return adapter;
  8259. },
  8260. adapters: knownAdapters
  8261. };
  8262. function throwIfCancellationRequested(config) {
  8263. if (config.cancelToken) {
  8264. config.cancelToken.throwIfRequested();
  8265. }
  8266. if (config.signal && config.signal.aborted) {
  8267. throw new CanceledError(null, config);
  8268. }
  8269. }
  8270. function dispatchRequest(config) {
  8271. throwIfCancellationRequested(config);
  8272. config.headers = AxiosHeaders.from(config.headers);
  8273. config.data = transformData.call(
  8274. config,
  8275. config.transformRequest
  8276. );
  8277. if (["post", "put", "patch"].indexOf(config.method) !== -1) {
  8278. config.headers.setContentType("application/x-www-form-urlencoded", false);
  8279. }
  8280. const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
  8281. return adapter(config).then(function onAdapterResolution(response) {
  8282. throwIfCancellationRequested(config);
  8283. response.data = transformData.call(
  8284. config,
  8285. config.transformResponse,
  8286. response
  8287. );
  8288. response.headers = AxiosHeaders.from(response.headers);
  8289. return response;
  8290. }, function onAdapterRejection(reason) {
  8291. if (!isCancel(reason)) {
  8292. throwIfCancellationRequested(config);
  8293. if (reason && reason.response) {
  8294. reason.response.data = transformData.call(
  8295. config,
  8296. config.transformResponse,
  8297. reason.response
  8298. );
  8299. reason.response.headers = AxiosHeaders.from(reason.response.headers);
  8300. }
  8301. }
  8302. return Promise.reject(reason);
  8303. });
  8304. }
  8305. const VERSION = "1.7.7";
  8306. const validators$1 = {};
  8307. ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
  8308. validators$1[type] = function validator2(thing) {
  8309. return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
  8310. };
  8311. });
  8312. const deprecatedWarnings = {};
  8313. validators$1.transitional = function transitional(validator2, version2, message) {
  8314. function formatMessage(opt, desc) {
  8315. return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
  8316. }
  8317. return (value, opt, opts) => {
  8318. if (validator2 === false) {
  8319. throw new AxiosError(
  8320. formatMessage(opt, " has been removed" + (version2 ? " in " + version2 : "")),
  8321. AxiosError.ERR_DEPRECATED
  8322. );
  8323. }
  8324. if (version2 && !deprecatedWarnings[opt]) {
  8325. deprecatedWarnings[opt] = true;
  8326. console.warn(
  8327. formatMessage(
  8328. opt,
  8329. " has been deprecated since v" + version2 + " and will be removed in the near future"
  8330. )
  8331. );
  8332. }
  8333. return validator2 ? validator2(value, opt, opts) : true;
  8334. };
  8335. };
  8336. function assertOptions(options, schema, allowUnknown) {
  8337. if (typeof options !== "object") {
  8338. throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
  8339. }
  8340. const keys = Object.keys(options);
  8341. let i = keys.length;
  8342. while (i-- > 0) {
  8343. const opt = keys[i];
  8344. const validator2 = schema[opt];
  8345. if (validator2) {
  8346. const value = options[opt];
  8347. const result = value === void 0 || validator2(value, opt, options);
  8348. if (result !== true) {
  8349. throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
  8350. }
  8351. continue;
  8352. }
  8353. if (allowUnknown !== true) {
  8354. throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
  8355. }
  8356. }
  8357. }
  8358. const validator = {
  8359. assertOptions,
  8360. validators: validators$1
  8361. };
  8362. const validators = validator.validators;
  8363. class Axios {
  8364. constructor(instanceConfig) {
  8365. this.defaults = instanceConfig;
  8366. this.interceptors = {
  8367. request: new InterceptorManager(),
  8368. response: new InterceptorManager()
  8369. };
  8370. }
  8371. /**
  8372. * Dispatch a request
  8373. *
  8374. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  8375. * @param {?Object} config
  8376. *
  8377. * @returns {Promise} The Promise to be fulfilled
  8378. */
  8379. async request(configOrUrl, config) {
  8380. try {
  8381. return await this._request(configOrUrl, config);
  8382. } catch (err) {
  8383. if (err instanceof Error) {
  8384. let dummy;
  8385. Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
  8386. const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
  8387. try {
  8388. if (!err.stack) {
  8389. err.stack = stack;
  8390. } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
  8391. err.stack += "\n" + stack;
  8392. }
  8393. } catch (e2) {
  8394. }
  8395. }
  8396. throw err;
  8397. }
  8398. }
  8399. _request(configOrUrl, config) {
  8400. if (typeof configOrUrl === "string") {
  8401. config = config || {};
  8402. config.url = configOrUrl;
  8403. } else {
  8404. config = configOrUrl || {};
  8405. }
  8406. config = mergeConfig(this.defaults, config);
  8407. const { transitional: transitional2, paramsSerializer, headers } = config;
  8408. if (transitional2 !== void 0) {
  8409. validator.assertOptions(transitional2, {
  8410. silentJSONParsing: validators.transitional(validators.boolean),
  8411. forcedJSONParsing: validators.transitional(validators.boolean),
  8412. clarifyTimeoutError: validators.transitional(validators.boolean)
  8413. }, false);
  8414. }
  8415. if (paramsSerializer != null) {
  8416. if (utils$1.isFunction(paramsSerializer)) {
  8417. config.paramsSerializer = {
  8418. serialize: paramsSerializer
  8419. };
  8420. } else {
  8421. validator.assertOptions(paramsSerializer, {
  8422. encode: validators.function,
  8423. serialize: validators.function
  8424. }, true);
  8425. }
  8426. }
  8427. config.method = (config.method || this.defaults.method || "get").toLowerCase();
  8428. let contextHeaders = headers && utils$1.merge(
  8429. headers.common,
  8430. headers[config.method]
  8431. );
  8432. headers && utils$1.forEach(
  8433. ["delete", "get", "head", "post", "put", "patch", "common"],
  8434. (method) => {
  8435. delete headers[method];
  8436. }
  8437. );
  8438. config.headers = AxiosHeaders.concat(contextHeaders, headers);
  8439. const requestInterceptorChain = [];
  8440. let synchronousRequestInterceptors = true;
  8441. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  8442. if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
  8443. return;
  8444. }
  8445. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  8446. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  8447. });
  8448. const responseInterceptorChain = [];
  8449. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  8450. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  8451. });
  8452. let promise;
  8453. let i = 0;
  8454. let len;
  8455. if (!synchronousRequestInterceptors) {
  8456. const chain = [dispatchRequest.bind(this), void 0];
  8457. chain.unshift.apply(chain, requestInterceptorChain);
  8458. chain.push.apply(chain, responseInterceptorChain);
  8459. len = chain.length;
  8460. promise = Promise.resolve(config);
  8461. while (i < len) {
  8462. promise = promise.then(chain[i++], chain[i++]);
  8463. }
  8464. return promise;
  8465. }
  8466. len = requestInterceptorChain.length;
  8467. let newConfig = config;
  8468. i = 0;
  8469. while (i < len) {
  8470. const onFulfilled = requestInterceptorChain[i++];
  8471. const onRejected = requestInterceptorChain[i++];
  8472. try {
  8473. newConfig = onFulfilled(newConfig);
  8474. } catch (error) {
  8475. onRejected.call(this, error);
  8476. break;
  8477. }
  8478. }
  8479. try {
  8480. promise = dispatchRequest.call(this, newConfig);
  8481. } catch (error) {
  8482. return Promise.reject(error);
  8483. }
  8484. i = 0;
  8485. len = responseInterceptorChain.length;
  8486. while (i < len) {
  8487. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  8488. }
  8489. return promise;
  8490. }
  8491. getUri(config) {
  8492. config = mergeConfig(this.defaults, config);
  8493. const fullPath = buildFullPath(config.baseURL, config.url);
  8494. return buildURL(fullPath, config.params, config.paramsSerializer);
  8495. }
  8496. }
  8497. utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
  8498. Axios.prototype[method] = function(url, config) {
  8499. return this.request(mergeConfig(config || {}, {
  8500. method,
  8501. url,
  8502. data: (config || {}).data
  8503. }));
  8504. };
  8505. });
  8506. utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
  8507. function generateHTTPMethod(isForm) {
  8508. return function httpMethod(url, data, config) {
  8509. return this.request(mergeConfig(config || {}, {
  8510. method,
  8511. headers: isForm ? {
  8512. "Content-Type": "multipart/form-data"
  8513. } : {},
  8514. url,
  8515. data
  8516. }));
  8517. };
  8518. }
  8519. Axios.prototype[method] = generateHTTPMethod();
  8520. Axios.prototype[method + "Form"] = generateHTTPMethod(true);
  8521. });
  8522. class CancelToken {
  8523. constructor(executor) {
  8524. if (typeof executor !== "function") {
  8525. throw new TypeError("executor must be a function.");
  8526. }
  8527. let resolvePromise;
  8528. this.promise = new Promise(function promiseExecutor(resolve) {
  8529. resolvePromise = resolve;
  8530. });
  8531. const token2 = this;
  8532. this.promise.then((cancel) => {
  8533. if (!token2._listeners) return;
  8534. let i = token2._listeners.length;
  8535. while (i-- > 0) {
  8536. token2._listeners[i](cancel);
  8537. }
  8538. token2._listeners = null;
  8539. });
  8540. this.promise.then = (onfulfilled) => {
  8541. let _resolve;
  8542. const promise = new Promise((resolve) => {
  8543. token2.subscribe(resolve);
  8544. _resolve = resolve;
  8545. }).then(onfulfilled);
  8546. promise.cancel = function reject() {
  8547. token2.unsubscribe(_resolve);
  8548. };
  8549. return promise;
  8550. };
  8551. executor(function cancel(message, config, request) {
  8552. if (token2.reason) {
  8553. return;
  8554. }
  8555. token2.reason = new CanceledError(message, config, request);
  8556. resolvePromise(token2.reason);
  8557. });
  8558. }
  8559. /**
  8560. * Throws a `CanceledError` if cancellation has been requested.
  8561. */
  8562. throwIfRequested() {
  8563. if (this.reason) {
  8564. throw this.reason;
  8565. }
  8566. }
  8567. /**
  8568. * Subscribe to the cancel signal
  8569. */
  8570. subscribe(listener) {
  8571. if (this.reason) {
  8572. listener(this.reason);
  8573. return;
  8574. }
  8575. if (this._listeners) {
  8576. this._listeners.push(listener);
  8577. } else {
  8578. this._listeners = [listener];
  8579. }
  8580. }
  8581. /**
  8582. * Unsubscribe from the cancel signal
  8583. */
  8584. unsubscribe(listener) {
  8585. if (!this._listeners) {
  8586. return;
  8587. }
  8588. const index = this._listeners.indexOf(listener);
  8589. if (index !== -1) {
  8590. this._listeners.splice(index, 1);
  8591. }
  8592. }
  8593. toAbortSignal() {
  8594. const controller = new AbortController();
  8595. const abort = (err) => {
  8596. controller.abort(err);
  8597. };
  8598. this.subscribe(abort);
  8599. controller.signal.unsubscribe = () => this.unsubscribe(abort);
  8600. return controller.signal;
  8601. }
  8602. /**
  8603. * Returns an object that contains a new `CancelToken` and a function that, when called,
  8604. * cancels the `CancelToken`.
  8605. */
  8606. static source() {
  8607. let cancel;
  8608. const token2 = new CancelToken(function executor(c2) {
  8609. cancel = c2;
  8610. });
  8611. return {
  8612. token: token2,
  8613. cancel
  8614. };
  8615. }
  8616. }
  8617. function spread(callback) {
  8618. return function wrap(arr) {
  8619. return callback.apply(null, arr);
  8620. };
  8621. }
  8622. function isAxiosError(payload) {
  8623. return utils$1.isObject(payload) && payload.isAxiosError === true;
  8624. }
  8625. const HttpStatusCode = {
  8626. Continue: 100,
  8627. SwitchingProtocols: 101,
  8628. Processing: 102,
  8629. EarlyHints: 103,
  8630. Ok: 200,
  8631. Created: 201,
  8632. Accepted: 202,
  8633. NonAuthoritativeInformation: 203,
  8634. NoContent: 204,
  8635. ResetContent: 205,
  8636. PartialContent: 206,
  8637. MultiStatus: 207,
  8638. AlreadyReported: 208,
  8639. ImUsed: 226,
  8640. MultipleChoices: 300,
  8641. MovedPermanently: 301,
  8642. Found: 302,
  8643. SeeOther: 303,
  8644. NotModified: 304,
  8645. UseProxy: 305,
  8646. Unused: 306,
  8647. TemporaryRedirect: 307,
  8648. PermanentRedirect: 308,
  8649. BadRequest: 400,
  8650. Unauthorized: 401,
  8651. PaymentRequired: 402,
  8652. Forbidden: 403,
  8653. NotFound: 404,
  8654. MethodNotAllowed: 405,
  8655. NotAcceptable: 406,
  8656. ProxyAuthenticationRequired: 407,
  8657. RequestTimeout: 408,
  8658. Conflict: 409,
  8659. Gone: 410,
  8660. LengthRequired: 411,
  8661. PreconditionFailed: 412,
  8662. PayloadTooLarge: 413,
  8663. UriTooLong: 414,
  8664. UnsupportedMediaType: 415,
  8665. RangeNotSatisfiable: 416,
  8666. ExpectationFailed: 417,
  8667. ImATeapot: 418,
  8668. MisdirectedRequest: 421,
  8669. UnprocessableEntity: 422,
  8670. Locked: 423,
  8671. FailedDependency: 424,
  8672. TooEarly: 425,
  8673. UpgradeRequired: 426,
  8674. PreconditionRequired: 428,
  8675. TooManyRequests: 429,
  8676. RequestHeaderFieldsTooLarge: 431,
  8677. UnavailableForLegalReasons: 451,
  8678. InternalServerError: 500,
  8679. NotImplemented: 501,
  8680. BadGateway: 502,
  8681. ServiceUnavailable: 503,
  8682. GatewayTimeout: 504,
  8683. HttpVersionNotSupported: 505,
  8684. VariantAlsoNegotiates: 506,
  8685. InsufficientStorage: 507,
  8686. LoopDetected: 508,
  8687. NotExtended: 510,
  8688. NetworkAuthenticationRequired: 511
  8689. };
  8690. Object.entries(HttpStatusCode).forEach(([key, value]) => {
  8691. HttpStatusCode[value] = key;
  8692. });
  8693. function createInstance(defaultConfig) {
  8694. const context = new Axios(defaultConfig);
  8695. const instance = bind(Axios.prototype.request, context);
  8696. utils$1.extend(instance, Axios.prototype, context, { allOwnKeys: true });
  8697. utils$1.extend(instance, context, null, { allOwnKeys: true });
  8698. instance.create = function create(instanceConfig) {
  8699. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  8700. };
  8701. return instance;
  8702. }
  8703. const axios = createInstance(defaults);
  8704. axios.Axios = Axios;
  8705. axios.CanceledError = CanceledError;
  8706. axios.CancelToken = CancelToken;
  8707. axios.isCancel = isCancel;
  8708. axios.VERSION = VERSION;
  8709. axios.toFormData = toFormData;
  8710. axios.AxiosError = AxiosError;
  8711. axios.Cancel = axios.CanceledError;
  8712. axios.all = function all(promises) {
  8713. return Promise.all(promises);
  8714. };
  8715. axios.spread = spread;
  8716. axios.isAxiosError = isAxiosError;
  8717. axios.mergeConfig = mergeConfig;
  8718. axios.AxiosHeaders = AxiosHeaders;
  8719. axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  8720. axios.getAdapter = adapters.getAdapter;
  8721. axios.HttpStatusCode = HttpStatusCode;
  8722. axios.default = axios;
  8723. function apiStartAd(callback) {
  8724. axios.get(`https://ani.gamer.com.tw/ajax/videoCastcishu.php?s=${ad}&sn=${sn}`).then((response) => {
  8725. callback();
  8726. });
  8727. }
  8728. function apiEndAd(callback) {
  8729. axios.get(`https://ani.gamer.com.tw/ajax/videoCastcishu.php?s=${ad}&sn=${sn}&ad=end`).then((response) => {
  8730. callback();
  8731. });
  8732. }
  8733. function apiGetM3U8(callback) {
  8734. axios.get(`https://ani.gamer.com.tw/ajax/m3u8.php?sn=${sn}&device=${device}`).then((response) => {
  8735. callback(response.data.src);
  8736. });
  8737. }
  8738. function apiIsVip(callback) {
  8739. axios.get(`https://ani.gamer.com.tw/ajax/token.php?sn=${sn}&device=${device}`).then((response) => {
  8740. callback(response.data.vip);
  8741. });
  8742. }
  8743. function MpvContainer() {
  8744. const [vip, setVip] = React.useState(null);
  8745. const [timer, setTimer] = React.useState(null);
  8746. const [videoUrl, setVideoUrl] = React.useState(null);
  8747. React.useEffect(() => {
  8748. apiIsVip((vip2) => {
  8749. setVip(vip2);
  8750. });
  8751. }, []);
  8752. React.useEffect(() => {
  8753. if (timer != null) {
  8754. if (timer > 0) {
  8755. setTimeout(() => {
  8756. setTimer(timer - 1);
  8757. }, 1e3);
  8758. } else {
  8759. apiEndAd(() => {
  8760. apiGetM3U8((videoUrl2) => {
  8761. setVideoUrl(videoUrl2);
  8762. });
  8763. });
  8764. }
  8765. }
  8766. }, [timer]);
  8767. React.useEffect(() => {
  8768. if (videoUrl != null) {
  8769. animeToMpv(videoUrl);
  8770. }
  8771. }, [videoUrl]);
  8772. function onClick() {
  8773. if (vip == true) {
  8774. apiGetM3U8((videoUrl2) => {
  8775. setVideoUrl(videoUrl2);
  8776. });
  8777. } else {
  8778. apiStartAd(() => {
  8779. setTimer(25);
  8780. });
  8781. }
  8782. }
  8783. if (vip == true) {
  8784. var text = `你是付費會員!`;
  8785. } else if (vip == false && timer == null) {
  8786. var text = `按下按鈕後自動觀看廣告`;
  8787. } else if (vip == false && timer > 0) {
  8788. var text = `廣告播放中,還剩下 ${timer} 秒`;
  8789. } else if (vip == false && timer == 0) {
  8790. var text = `廣告播放完畢`;
  8791. } else {
  8792. var text = `取得會員資訊中 ...`;
  8793. }
  8794. return /* @__PURE__ */ jsxRuntimeExports.jsx(AnimePage, { onClick, text });
  8795. }
  8796. function App() {
  8797. return /* @__PURE__ */ jsxRuntimeExports.jsx(MpvContainer, {});
  8798. }
  8799. const app = document.createElement("div");
  8800. const targetSelector = ".ncc-choose-btn";
  8801. const observer = new MutationObserver((mutations) => {
  8802. const target = document.querySelector(targetSelector);
  8803. if (target) {
  8804. target.after(app);
  8805. client.createRoot(app).render(/* @__PURE__ */ jsxRuntimeExports.jsx(App, {}));
  8806. observer.disconnect();
  8807. }
  8808. });
  8809. observer.observe(document.body, { childList: true, subtree: true });
  8810.  
  8811. })(React, ReactDOM);