UNPKG

66.9 kBJavaScriptView Raw
1var MergeStyles =
2/******/ (function(modules) { // webpackBootstrap
3/******/ // The module cache
4/******/ var installedModules = {};
5/******/
6/******/ // The require function
7/******/ function __webpack_require__(moduleId) {
8/******/
9/******/ // Check if module is in cache
10/******/ if(installedModules[moduleId]) {
11/******/ return installedModules[moduleId].exports;
12/******/ }
13/******/ // Create a new module (and put it into the cache)
14/******/ var module = installedModules[moduleId] = {
15/******/ i: moduleId,
16/******/ l: false,
17/******/ exports: {}
18/******/ };
19/******/
20/******/ // Execute the module function
21/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22/******/
23/******/ // Flag the module as loaded
24/******/ module.l = true;
25/******/
26/******/ // Return the exports of the module
27/******/ return module.exports;
28/******/ }
29/******/
30/******/
31/******/ // expose the modules object (__webpack_modules__)
32/******/ __webpack_require__.m = modules;
33/******/
34/******/ // expose the module cache
35/******/ __webpack_require__.c = installedModules;
36/******/
37/******/ // define getter function for harmony exports
38/******/ __webpack_require__.d = function(exports, name, getter) {
39/******/ if(!__webpack_require__.o(exports, name)) {
40/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41/******/ }
42/******/ };
43/******/
44/******/ // define __esModule on exports
45/******/ __webpack_require__.r = function(exports) {
46/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48/******/ }
49/******/ Object.defineProperty(exports, '__esModule', { value: true });
50/******/ };
51/******/
52/******/ // create a fake namespace object
53/******/ // mode & 1: value is a module id, require it
54/******/ // mode & 2: merge all properties of value into the ns
55/******/ // mode & 4: return value when already ns object
56/******/ // mode & 8|1: behave like require
57/******/ __webpack_require__.t = function(value, mode) {
58/******/ if(mode & 1) value = __webpack_require__(value);
59/******/ if(mode & 8) return value;
60/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61/******/ var ns = Object.create(null);
62/******/ __webpack_require__.r(ns);
63/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65/******/ return ns;
66/******/ };
67/******/
68/******/ // getDefaultExport function for compatibility with non-harmony modules
69/******/ __webpack_require__.n = function(module) {
70/******/ var getter = module && module.__esModule ?
71/******/ function getDefault() { return module['default']; } :
72/******/ function getModuleExports() { return module; };
73/******/ __webpack_require__.d(getter, 'a', getter);
74/******/ return getter;
75/******/ };
76/******/
77/******/ // Object.prototype.hasOwnProperty.call
78/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79/******/
80/******/ // __webpack_public_path__
81/******/ __webpack_require__.p = "";
82/******/
83/******/
84/******/ // Load entry module and return exports
85/******/ return __webpack_require__(__webpack_require__.s = "./lib/index.js");
86/******/ })
87/************************************************************************/
88/******/ ({
89
90/***/ "../../node_modules/tslib/tslib.es6.js":
91/***/ (function(module, __webpack_exports__, __webpack_require__) {
92
93"use strict";
94__webpack_require__.r(__webpack_exports__);
95/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
96/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
97/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
98/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
99/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
100/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
101/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
102/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
103/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
104/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
105/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
106/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
107/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
108/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
109/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
110/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
111/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
112/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
113/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
114/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
115/*! *****************************************************************************
116Copyright (c) Microsoft Corporation. All rights reserved.
117Licensed under the Apache License, Version 2.0 (the "License"); you may not use
118this file except in compliance with the License. You may obtain a copy of the
119License at http://www.apache.org/licenses/LICENSE-2.0
120
121THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
122KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
123WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
124MERCHANTABLITY OR NON-INFRINGEMENT.
125
126See the Apache Version 2.0 License for specific language governing permissions
127and limitations under the License.
128***************************************************************************** */
129/* global Reflect, Promise */
130
131var extendStatics = function(d, b) {
132 extendStatics = Object.setPrototypeOf ||
133 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
134 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
135 return extendStatics(d, b);
136};
137
138function __extends(d, b) {
139 extendStatics(d, b);
140 function __() { this.constructor = d; }
141 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
142}
143
144var __assign = function() {
145 __assign = Object.assign || function __assign(t) {
146 for (var s, i = 1, n = arguments.length; i < n; i++) {
147 s = arguments[i];
148 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
149 }
150 return t;
151 }
152 return __assign.apply(this, arguments);
153}
154
155function __rest(s, e) {
156 var t = {};
157 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
158 t[p] = s[p];
159 if (s != null && typeof Object.getOwnPropertySymbols === "function")
160 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
161 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
162 t[p[i]] = s[p[i]];
163 }
164 return t;
165}
166
167function __decorate(decorators, target, key, desc) {
168 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
169 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
170 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
171 return c > 3 && r && Object.defineProperty(target, key, r), r;
172}
173
174function __param(paramIndex, decorator) {
175 return function (target, key) { decorator(target, key, paramIndex); }
176}
177
178function __metadata(metadataKey, metadataValue) {
179 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
180}
181
182function __awaiter(thisArg, _arguments, P, generator) {
183 return new (P || (P = Promise))(function (resolve, reject) {
184 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
185 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
186 function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
187 step((generator = generator.apply(thisArg, _arguments || [])).next());
188 });
189}
190
191function __generator(thisArg, body) {
192 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
193 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
194 function verb(n) { return function (v) { return step([n, v]); }; }
195 function step(op) {
196 if (f) throw new TypeError("Generator is already executing.");
197 while (_) try {
198 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
199 if (y = 0, t) op = [op[0] & 2, t.value];
200 switch (op[0]) {
201 case 0: case 1: t = op; break;
202 case 4: _.label++; return { value: op[1], done: false };
203 case 5: _.label++; y = op[1]; op = [0]; continue;
204 case 7: op = _.ops.pop(); _.trys.pop(); continue;
205 default:
206 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
207 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
208 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
209 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
210 if (t[2]) _.ops.pop();
211 _.trys.pop(); continue;
212 }
213 op = body.call(thisArg, _);
214 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
215 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
216 }
217}
218
219function __exportStar(m, exports) {
220 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
221}
222
223function __values(o) {
224 var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
225 if (m) return m.call(o);
226 return {
227 next: function () {
228 if (o && i >= o.length) o = void 0;
229 return { value: o && o[i++], done: !o };
230 }
231 };
232}
233
234function __read(o, n) {
235 var m = typeof Symbol === "function" && o[Symbol.iterator];
236 if (!m) return o;
237 var i = m.call(o), r, ar = [], e;
238 try {
239 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
240 }
241 catch (error) { e = { error: error }; }
242 finally {
243 try {
244 if (r && !r.done && (m = i["return"])) m.call(i);
245 }
246 finally { if (e) throw e.error; }
247 }
248 return ar;
249}
250
251function __spread() {
252 for (var ar = [], i = 0; i < arguments.length; i++)
253 ar = ar.concat(__read(arguments[i]));
254 return ar;
255}
256
257function __spreadArrays() {
258 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
259 for (var r = Array(s), k = 0, i = 0; i < il; i++)
260 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
261 r[k] = a[j];
262 return r;
263};
264
265function __await(v) {
266 return this instanceof __await ? (this.v = v, this) : new __await(v);
267}
268
269function __asyncGenerator(thisArg, _arguments, generator) {
270 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
271 var g = generator.apply(thisArg, _arguments || []), i, q = [];
272 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
273 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
274 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
275 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
276 function fulfill(value) { resume("next", value); }
277 function reject(value) { resume("throw", value); }
278 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
279}
280
281function __asyncDelegator(o) {
282 var i, p;
283 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
284 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
285}
286
287function __asyncValues(o) {
288 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
289 var m = o[Symbol.asyncIterator], i;
290 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
291 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
292 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
293}
294
295function __makeTemplateObject(cooked, raw) {
296 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
297 return cooked;
298};
299
300function __importStar(mod) {
301 if (mod && mod.__esModule) return mod;
302 var result = {};
303 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
304 result.default = mod;
305 return result;
306}
307
308function __importDefault(mod) {
309 return (mod && mod.__esModule) ? mod : { default: mod };
310}
311
312
313/***/ }),
314
315/***/ "../set-version/lib/index.js":
316/***/ (function(module, __webpack_exports__, __webpack_require__) {
317
318"use strict";
319__webpack_require__.r(__webpack_exports__);
320/* harmony import */ var _setVersion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../set-version/lib/setVersion.js");
321/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setVersion", function() { return _setVersion__WEBPACK_IMPORTED_MODULE_0__["setVersion"]; });
322
323
324
325Object(_setVersion__WEBPACK_IMPORTED_MODULE_0__["setVersion"])('@uifabric/set-version', '6.0.0');
326
327
328/***/ }),
329
330/***/ "../set-version/lib/setVersion.js":
331/***/ (function(module, __webpack_exports__, __webpack_require__) {
332
333"use strict";
334__webpack_require__.r(__webpack_exports__);
335/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setVersion", function() { return setVersion; });
336// A packages cache that makes sure that we don't inject the same packageName twice in the same bundle -
337// this cache is local to the module closure inside this bundle
338var packagesCache = {};
339// Cache access to window to avoid IE11 memory leak.
340var _win = undefined;
341try {
342 _win = window;
343}
344catch (e) {
345 /* no-op */
346}
347function setVersion(packageName, packageVersion) {
348 if (typeof _win !== 'undefined') {
349 // eslint-disable-next-line @typescript-eslint/no-explicit-any
350 var packages = (_win.__packages__ = _win.__packages__ || {});
351 // We allow either the global packages or local packages caches to invalidate so testing can
352 // just clear the global to set this state
353 if (!packages[packageName] || !packagesCache[packageName]) {
354 packagesCache[packageName] = packageVersion;
355 var versions = (packages[packageName] = packages[packageName] || []);
356 versions.push(packageVersion);
357 }
358 }
359}
360
361
362/***/ }),
363
364/***/ "./lib/StyleOptionsState.js":
365/***/ (function(module, __webpack_exports__, __webpack_require__) {
366
367"use strict";
368__webpack_require__.r(__webpack_exports__);
369/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setRTL", function() { return setRTL; });
370/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRTL", function() { return getRTL; });
371/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStyleOptions", function() { return getStyleOptions; });
372/**
373 * Sets the current RTL value.
374 */
375function setRTL(isRTL) {
376 if (_rtl !== isRTL) {
377 _rtl = isRTL;
378 }
379}
380/**
381 * Gets the current RTL value.
382 */
383function getRTL() {
384 if (_rtl === undefined) {
385 _rtl =
386 typeof document !== 'undefined' &&
387 !!document.documentElement &&
388 document.documentElement.getAttribute('dir') === 'rtl';
389 }
390 return _rtl;
391}
392// This has been split into 2 lines because it was working in Fabric due to the code being transpiled to es5, so this
393// was converted to var while not working in Fluent that uses babel to transpile the code to be es6-like. Splitting the
394// logic into two lines, however, allows it to work in both scenarios.
395var _rtl;
396_rtl = getRTL();
397function getStyleOptions() {
398 return {
399 rtl: getRTL(),
400 };
401}
402
403
404/***/ }),
405
406/***/ "./lib/Stylesheet.js":
407/***/ (function(module, __webpack_exports__, __webpack_require__) {
408
409"use strict";
410__webpack_require__.r(__webpack_exports__);
411/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InjectionMode", function() { return InjectionMode; });
412/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Stylesheet", function() { return Stylesheet; });
413/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/tslib/tslib.es6.js");
414
415var InjectionMode = {
416 /**
417 * Avoids style injection, use getRules() to read the styles.
418 */
419 none: 0,
420 /**
421 * Inserts rules using the insertRule api.
422 */
423 insertNode: 1,
424 /**
425 * Appends rules using appendChild.
426 */
427 appendChild: 2,
428};
429var STYLESHEET_SETTING = '__stylesheet__';
430/**
431 * MSIE 11 doesn't cascade styles based on DOM ordering, but rather on the order that each style node
432 * is created. As such, to maintain consistent priority, IE11 should reuse a single style node.
433 */
434var REUSE_STYLE_NODE = typeof navigator !== 'undefined' && /rv:11.0/.test(navigator.userAgent);
435var _global = {};
436// Grab window.
437try {
438 _global = window;
439}
440catch (_a) {
441 /* leave as blank object */
442}
443var _stylesheet;
444/**
445 * Represents the state of styles registered in the page. Abstracts
446 * the surface for adding styles to the stylesheet, exposes helpers
447 * for reading the styles registered in server rendered scenarios.
448 *
449 * @public
450 */
451var Stylesheet = /** @class */ (function () {
452 function Stylesheet(config) {
453 this._rules = [];
454 this._preservedRules = [];
455 this._rulesToInsert = [];
456 this._counter = 0;
457 this._keyToClassName = {};
458 this._onResetCallbacks = [];
459 this._classNameToArgs = {};
460 this._config = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ injectionMode: InjectionMode.insertNode, defaultPrefix: 'css', namespace: undefined, cspSettings: undefined }, config);
461 this._keyToClassName = this._config.classNameCache || {};
462 }
463 /**
464 * Gets the singleton instance.
465 */
466 Stylesheet.getInstance = function () {
467 var _a;
468 _stylesheet = _global[STYLESHEET_SETTING];
469 if (!_stylesheet || (_stylesheet._lastStyleElement && _stylesheet._lastStyleElement.ownerDocument !== document)) {
470 var fabricConfig = ((_a = _global) === null || _a === void 0 ? void 0 : _a.FabricConfig) || {};
471 _stylesheet = _global[STYLESHEET_SETTING] = new Stylesheet(fabricConfig.mergeStyles);
472 }
473 return _stylesheet;
474 };
475 /**
476 * Configures the stylesheet.
477 */
478 Stylesheet.prototype.setConfig = function (config) {
479 this._config = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this._config), config);
480 };
481 /**
482 * Configures a reset callback.
483 *
484 * @param callback - A callback which will be called when the Stylesheet is reset.
485 */
486 Stylesheet.prototype.onReset = function (callback) {
487 this._onResetCallbacks.push(callback);
488 };
489 /**
490 * Generates a unique classname.
491 *
492 * @param displayName - Optional value to use as a prefix.
493 */
494 Stylesheet.prototype.getClassName = function (displayName) {
495 var namespace = this._config.namespace;
496 var prefix = displayName || this._config.defaultPrefix;
497 return "" + (namespace ? namespace + '-' : '') + prefix + "-" + this._counter++;
498 };
499 /**
500 * Used internally to cache information about a class which was
501 * registered with the stylesheet.
502 */
503 Stylesheet.prototype.cacheClassName = function (className, key, args, rules) {
504 this._keyToClassName[key] = className;
505 this._classNameToArgs[className] = {
506 args: args,
507 rules: rules,
508 };
509 };
510 /**
511 * Gets the appropriate classname given a key which was previously
512 * registered using cacheClassName.
513 */
514 Stylesheet.prototype.classNameFromKey = function (key) {
515 return this._keyToClassName[key];
516 };
517 /**
518 * Gets all classnames cache with the stylesheet.
519 */
520 Stylesheet.prototype.getClassNameCache = function () {
521 return this._keyToClassName;
522 };
523 /**
524 * Gets the arguments associated with a given classname which was
525 * previously registered using cacheClassName.
526 */
527 Stylesheet.prototype.argsFromClassName = function (className) {
528 var entry = this._classNameToArgs[className];
529 return entry && entry.args;
530 };
531 /**
532 * Gets the arguments associated with a given classname which was
533 * previously registered using cacheClassName.
534 */
535 Stylesheet.prototype.insertedRulesFromClassName = function (className) {
536 var entry = this._classNameToArgs[className];
537 return entry && entry.rules;
538 };
539 /**
540 * Inserts a css rule into the stylesheet.
541 * @param preserve - Preserves the rule beyond a reset boundary.
542 */
543 Stylesheet.prototype.insertRule = function (rule, preserve) {
544 var injectionMode = this._config.injectionMode;
545 var element = injectionMode !== InjectionMode.none ? this._getStyleElement() : undefined;
546 if (preserve) {
547 this._preservedRules.push(rule);
548 }
549 if (element) {
550 switch (this._config.injectionMode) {
551 case InjectionMode.insertNode:
552 var sheet = element.sheet;
553 try {
554 sheet.insertRule(rule, sheet.cssRules.length);
555 }
556 catch (e) {
557 // The browser will throw exceptions on unsupported rules (such as a moz prefix in webkit.)
558 // We need to swallow the exceptions for this scenario, otherwise we'd need to filter
559 // which could be slower and bulkier.
560 }
561 break;
562 case InjectionMode.appendChild:
563 element.appendChild(document.createTextNode(rule));
564 break;
565 }
566 }
567 else {
568 this._rules.push(rule);
569 }
570 if (this._config.onInsertRule) {
571 this._config.onInsertRule(rule);
572 }
573 };
574 /**
575 * Gets all rules registered with the stylesheet; only valid when
576 * using InsertionMode.none.
577 */
578 Stylesheet.prototype.getRules = function (includePreservedRules) {
579 return ((includePreservedRules ? this._preservedRules.join('') : '') + this._rules.join('') + this._rulesToInsert.join(''));
580 };
581 /**
582 * Resets the internal state of the stylesheet. Only used in server
583 * rendered scenarios where we're using InsertionMode.none.
584 */
585 Stylesheet.prototype.reset = function () {
586 this._rules = [];
587 this._rulesToInsert = [];
588 this._counter = 0;
589 this._classNameToArgs = {};
590 this._keyToClassName = {};
591 this._onResetCallbacks.forEach(function (callback) { return callback(); });
592 };
593 // Forces the regeneration of incoming styles without totally resetting the stylesheet.
594 Stylesheet.prototype.resetKeys = function () {
595 this._keyToClassName = {};
596 };
597 Stylesheet.prototype._getStyleElement = function () {
598 var _this = this;
599 if (!this._styleElement && typeof document !== 'undefined') {
600 this._styleElement = this._createStyleElement();
601 if (!REUSE_STYLE_NODE) {
602 // Reset the style element on the next frame.
603 window.requestAnimationFrame(function () {
604 _this._styleElement = undefined;
605 });
606 }
607 }
608 return this._styleElement;
609 };
610 Stylesheet.prototype._createStyleElement = function () {
611 var head = document.head;
612 var styleElement = document.createElement('style');
613 var nodeToInsertBefore = null;
614 styleElement.setAttribute('data-merge-styles', 'true');
615 var cspSettings = this._config.cspSettings;
616 if (cspSettings) {
617 if (cspSettings.nonce) {
618 styleElement.setAttribute('nonce', cspSettings.nonce);
619 }
620 }
621 if (this._lastStyleElement) {
622 // If the `nextElementSibling` is null, then the insertBefore will act as a regular append.
623 // https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore#Syntax
624 nodeToInsertBefore = this._lastStyleElement.nextElementSibling;
625 }
626 else {
627 var placeholderStyleTag = this._findPlaceholderStyleTag();
628 if (placeholderStyleTag) {
629 nodeToInsertBefore = placeholderStyleTag.nextElementSibling;
630 }
631 else {
632 nodeToInsertBefore = head.childNodes[0];
633 }
634 }
635 head.insertBefore(styleElement, head.contains(nodeToInsertBefore) ? nodeToInsertBefore : null);
636 this._lastStyleElement = styleElement;
637 return styleElement;
638 };
639 Stylesheet.prototype._findPlaceholderStyleTag = function () {
640 var head = document.head;
641 if (head) {
642 return head.querySelector('style[data-merge-styles]');
643 }
644 return null;
645 };
646 return Stylesheet;
647}());
648
649
650
651/***/ }),
652
653/***/ "./lib/concatStyleSets.js":
654/***/ (function(module, __webpack_exports__, __webpack_require__) {
655
656"use strict";
657__webpack_require__.r(__webpack_exports__);
658/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatStyleSets", function() { return concatStyleSets; });
659/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/tslib/tslib.es6.js");
660
661/**
662 * Combine a set of styles together (but does not register css classes).
663 * @param styleSets - One or more stylesets to be merged (each param can also be falsy).
664 */
665function concatStyleSets() {
666 var styleSets = [];
667 for (var _i = 0; _i < arguments.length; _i++) {
668 styleSets[_i] = arguments[_i];
669 }
670 if (styleSets && styleSets.length === 1 && styleSets[0] && !styleSets[0].subComponentStyles) {
671 return styleSets[0];
672 }
673 var mergedSet = {};
674 // We process sub component styles in two phases. First we collect them, then we combine them into 1 style function.
675 var workingSubcomponentStyles = {};
676 for (var _a = 0, styleSets_1 = styleSets; _a < styleSets_1.length; _a++) {
677 var currentSet = styleSets_1[_a];
678 if (currentSet) {
679 for (var prop in currentSet) {
680 if (currentSet.hasOwnProperty(prop)) {
681 if (prop === 'subComponentStyles' && currentSet.subComponentStyles !== undefined) {
682 // subcomponent styles - style functions or objects
683 var currentComponentStyles = currentSet.subComponentStyles;
684 for (var subCompProp in currentComponentStyles) {
685 if (currentComponentStyles.hasOwnProperty(subCompProp)) {
686 if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) {
687 workingSubcomponentStyles[subCompProp].push(currentComponentStyles[subCompProp]);
688 }
689 else {
690 workingSubcomponentStyles[subCompProp] = [currentComponentStyles[subCompProp]];
691 }
692 }
693 }
694 continue;
695 }
696 // the as any casts below is a workaround for ts 2.8.
697 // todo: remove cast to any in ts 2.9.
698 var mergedValue = mergedSet[prop];
699 var currentValue = currentSet[prop];
700 if (mergedValue === undefined) {
701 mergedSet[prop] = currentValue;
702 }
703 else {
704 mergedSet[prop] = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArrays"])((Array.isArray(mergedValue) ? mergedValue : [mergedValue]), (Array.isArray(currentValue) ? currentValue : [currentValue]));
705 }
706 }
707 }
708 }
709 }
710 if (Object.keys(workingSubcomponentStyles).length > 0) {
711 mergedSet.subComponentStyles = {};
712 var mergedSubStyles = mergedSet.subComponentStyles;
713 var _loop_1 = function (subCompProp) {
714 if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) {
715 var workingSet_1 = workingSubcomponentStyles[subCompProp];
716 mergedSubStyles[subCompProp] = function (styleProps) {
717 return concatStyleSets.apply(void 0, workingSet_1.map(function (styleFunctionOrObject) {
718 return typeof styleFunctionOrObject === 'function' ? styleFunctionOrObject(styleProps) : styleFunctionOrObject;
719 }));
720 };
721 }
722 };
723 // now we process the subcomponent styles if there are any
724 for (var subCompProp in workingSubcomponentStyles) {
725 _loop_1(subCompProp);
726 }
727 }
728 return mergedSet;
729}
730
731
732/***/ }),
733
734/***/ "./lib/concatStyleSetsWithProps.js":
735/***/ (function(module, __webpack_exports__, __webpack_require__) {
736
737"use strict";
738__webpack_require__.r(__webpack_exports__);
739/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatStyleSetsWithProps", function() { return concatStyleSetsWithProps; });
740/* harmony import */ var _concatStyleSets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/concatStyleSets.js");
741
742/**
743 * Concatenates style sets into one, but resolves functional sets using the given props.
744 * @param styleProps - Props used to resolve functional sets.
745 * @param allStyles - Style sets, which can be functions or objects.
746 */
747function concatStyleSetsWithProps(styleProps) {
748 var allStyles = [];
749 for (var _i = 1; _i < arguments.length; _i++) {
750 allStyles[_i - 1] = arguments[_i];
751 }
752 var result = [];
753 for (var _a = 0, allStyles_1 = allStyles; _a < allStyles_1.length; _a++) {
754 var styles = allStyles_1[_a];
755 if (styles) {
756 result.push(typeof styles === 'function' ? styles(styleProps) : styles);
757 }
758 }
759 if (result.length === 1) {
760 return result[0];
761 }
762 else if (result.length) {
763 // cliffkoh: I cannot figure out how to avoid the cast to any here.
764 // It is something to do with the use of Omit in IStyleSet.
765 // It might not be necessary once Omit becomes part of lib.d.ts (when we remove our own Omit and rely on
766 // the official version).
767 return _concatStyleSets__WEBPACK_IMPORTED_MODULE_0__["concatStyleSets"].apply(void 0, result);
768 }
769 return {};
770}
771
772
773/***/ }),
774
775/***/ "./lib/extractStyleParts.js":
776/***/ (function(module, __webpack_exports__, __webpack_require__) {
777
778"use strict";
779__webpack_require__.r(__webpack_exports__);
780/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractStyleParts", function() { return extractStyleParts; });
781/* harmony import */ var _Stylesheet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/Stylesheet.js");
782
783/**
784 * Separates the classes and style objects. Any classes that are pre-registered
785 * args are auto expanded into objects.
786 */
787function extractStyleParts() {
788 var args = [];
789 for (var _i = 0; _i < arguments.length; _i++) {
790 args[_i] = arguments[_i];
791 }
792 var classes = [];
793 var objects = [];
794 var stylesheet = _Stylesheet__WEBPACK_IMPORTED_MODULE_0__["Stylesheet"].getInstance();
795 function _processArgs(argsList) {
796 for (var _i = 0, argsList_1 = argsList; _i < argsList_1.length; _i++) {
797 var arg = argsList_1[_i];
798 if (arg) {
799 if (typeof arg === 'string') {
800 if (arg.indexOf(' ') >= 0) {
801 _processArgs(arg.split(' '));
802 }
803 else {
804 var translatedArgs = stylesheet.argsFromClassName(arg);
805 if (translatedArgs) {
806 _processArgs(translatedArgs);
807 }
808 else {
809 // Avoid adding the same class twice.
810 if (classes.indexOf(arg) === -1) {
811 classes.push(arg);
812 }
813 }
814 }
815 }
816 else if (Array.isArray(arg)) {
817 _processArgs(arg);
818 }
819 else if (typeof arg === 'object') {
820 objects.push(arg);
821 }
822 }
823 }
824 }
825 _processArgs(args);
826 return {
827 classes: classes,
828 objects: objects,
829 };
830}
831
832
833/***/ }),
834
835/***/ "./lib/fontFace.js":
836/***/ (function(module, __webpack_exports__, __webpack_require__) {
837
838"use strict";
839__webpack_require__.r(__webpack_exports__);
840/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fontFace", function() { return fontFace; });
841/* harmony import */ var _StyleOptionsState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/StyleOptionsState.js");
842/* harmony import */ var _Stylesheet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./lib/Stylesheet.js");
843/* harmony import */ var _styleToClassName__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./lib/styleToClassName.js");
844
845
846
847/**
848 * Registers a font face.
849 * @public
850 */
851function fontFace(font) {
852 _Stylesheet__WEBPACK_IMPORTED_MODULE_1__["Stylesheet"].getInstance().insertRule("@font-face{" + Object(_styleToClassName__WEBPACK_IMPORTED_MODULE_2__["serializeRuleEntries"])(Object(_StyleOptionsState__WEBPACK_IMPORTED_MODULE_0__["getStyleOptions"])(), font) + "}", true);
853}
854
855
856/***/ }),
857
858/***/ "./lib/getVendorSettings.js":
859/***/ (function(module, __webpack_exports__, __webpack_require__) {
860
861"use strict";
862__webpack_require__.r(__webpack_exports__);
863/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVendorSettings", function() { return getVendorSettings; });
864/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setVendorSettings", function() { return setVendorSettings; });
865var _vendorSettings;
866function getVendorSettings() {
867 var _a, _b;
868 if (!_vendorSettings) {
869 var doc = typeof document !== 'undefined' ? document : undefined;
870 var nav = typeof navigator !== 'undefined' ? navigator : undefined;
871 var userAgent = (_b = (_a = nav) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.toLowerCase();
872 if (!doc) {
873 _vendorSettings = {
874 isWebkit: true,
875 isMoz: true,
876 isOpera: true,
877 isMs: true,
878 };
879 }
880 else {
881 _vendorSettings = {
882 isWebkit: !!(doc && 'WebkitAppearance' in doc.documentElement.style),
883 isMoz: !!(userAgent && userAgent.indexOf('firefox') > -1),
884 isOpera: !!(userAgent && userAgent.indexOf('opera') > -1),
885 isMs: !!(nav && (/rv:11.0/i.test(nav.userAgent) || /Edge\/\d./i.test(navigator.userAgent))),
886 };
887 }
888 }
889 return _vendorSettings;
890}
891/**
892 * Sets the vendor settings for prefixing and vendor specific operations.
893 */
894function setVendorSettings(vendorSettings) {
895 _vendorSettings = vendorSettings;
896}
897
898
899/***/ }),
900
901/***/ "./lib/index.js":
902/***/ (function(module, __webpack_exports__, __webpack_require__) {
903
904"use strict";
905__webpack_require__.r(__webpack_exports__);
906/* harmony import */ var _mergeStyles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/mergeStyles.js");
907/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeStyles", function() { return _mergeStyles__WEBPACK_IMPORTED_MODULE_0__["mergeStyles"]; });
908
909/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeCss", function() { return _mergeStyles__WEBPACK_IMPORTED_MODULE_0__["mergeCss"]; });
910
911/* harmony import */ var _mergeStyleSets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./lib/mergeStyleSets.js");
912/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeStyleSets", function() { return _mergeStyleSets__WEBPACK_IMPORTED_MODULE_1__["mergeStyleSets"]; });
913
914/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeCssSets", function() { return _mergeStyleSets__WEBPACK_IMPORTED_MODULE_1__["mergeCssSets"]; });
915
916/* harmony import */ var _concatStyleSets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./lib/concatStyleSets.js");
917/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatStyleSets", function() { return _concatStyleSets__WEBPACK_IMPORTED_MODULE_2__["concatStyleSets"]; });
918
919/* harmony import */ var _concatStyleSetsWithProps__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./lib/concatStyleSetsWithProps.js");
920/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatStyleSetsWithProps", function() { return _concatStyleSetsWithProps__WEBPACK_IMPORTED_MODULE_3__["concatStyleSetsWithProps"]; });
921
922/* harmony import */ var _fontFace__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./lib/fontFace.js");
923/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fontFace", function() { return _fontFace__WEBPACK_IMPORTED_MODULE_4__["fontFace"]; });
924
925/* harmony import */ var _keyframes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./lib/keyframes.js");
926/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "keyframes", function() { return _keyframes__WEBPACK_IMPORTED_MODULE_5__["keyframes"]; });
927
928/* harmony import */ var _Stylesheet__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./lib/Stylesheet.js");
929/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InjectionMode", function() { return _Stylesheet__WEBPACK_IMPORTED_MODULE_6__["InjectionMode"]; });
930
931/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Stylesheet", function() { return _Stylesheet__WEBPACK_IMPORTED_MODULE_6__["Stylesheet"]; });
932
933/* harmony import */ var _StyleOptionsState__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("./lib/StyleOptionsState.js");
934/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setRTL", function() { return _StyleOptionsState__WEBPACK_IMPORTED_MODULE_7__["setRTL"]; });
935
936/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("./lib/version.js");
937
938
939
940
941
942
943
944
945
946
947
948/***/ }),
949
950/***/ "./lib/keyframes.js":
951/***/ (function(module, __webpack_exports__, __webpack_require__) {
952
953"use strict";
954__webpack_require__.r(__webpack_exports__);
955/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyframes", function() { return keyframes; });
956/* harmony import */ var _StyleOptionsState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/StyleOptionsState.js");
957/* harmony import */ var _Stylesheet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./lib/Stylesheet.js");
958/* harmony import */ var _styleToClassName__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./lib/styleToClassName.js");
959
960
961
962/**
963 * Registers keyframe definitions.
964 *
965 * @public
966 */
967function keyframes(timeline) {
968 var stylesheet = _Stylesheet__WEBPACK_IMPORTED_MODULE_1__["Stylesheet"].getInstance();
969 var name = stylesheet.getClassName();
970 var rulesArray = [];
971 for (var prop in timeline) {
972 if (timeline.hasOwnProperty(prop)) {
973 rulesArray.push(prop, '{', Object(_styleToClassName__WEBPACK_IMPORTED_MODULE_2__["serializeRuleEntries"])(Object(_StyleOptionsState__WEBPACK_IMPORTED_MODULE_0__["getStyleOptions"])(), timeline[prop]), '}');
974 }
975 }
976 var rules = rulesArray.join('');
977 stylesheet.insertRule("@keyframes " + name + "{" + rules + "}", true);
978 stylesheet.cacheClassName(name, rules, [], ['keyframes', rules]);
979 return name;
980}
981
982
983/***/ }),
984
985/***/ "./lib/mergeStyleSets.js":
986/***/ (function(module, __webpack_exports__, __webpack_require__) {
987
988"use strict";
989__webpack_require__.r(__webpack_exports__);
990/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeStyleSets", function() { return mergeStyleSets; });
991/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeCssSets", function() { return mergeCssSets; });
992/* harmony import */ var _concatStyleSets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/concatStyleSets.js");
993/* harmony import */ var _extractStyleParts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./lib/extractStyleParts.js");
994/* harmony import */ var _StyleOptionsState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./lib/StyleOptionsState.js");
995/* harmony import */ var _styleToClassName__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./lib/styleToClassName.js");
996
997
998
999
1000/**
1001 * Takes in one or more style set objects, each consisting of a set of areas,
1002 * each which will produce a class name. Using this is analogous to calling
1003 * `mergeStyles` for each property in the object, but ensures we maintain the
1004 * set ordering when multiple style sets are merged.
1005 *
1006 * @param styleSets - One or more style sets to be merged.
1007 */
1008function mergeStyleSets() {
1009 var styleSets = [];
1010 for (var _i = 0; _i < arguments.length; _i++) {
1011 styleSets[_i] = arguments[_i];
1012 }
1013 return mergeCssSets(styleSets, Object(_StyleOptionsState__WEBPACK_IMPORTED_MODULE_2__["getStyleOptions"])());
1014}
1015/**
1016 * Takes in one or more style set objects, each1consisting of a set of areas,
1017 * each which will produce a class name. Using this is analogous to calling
1018 * `mergeCss` for each property in the object, but ensures the
1019 * set ordering when multiple style sets are merged.
1020 *
1021 * @param styleSets - One or more style sets to be merged.
1022 * @param options - (optional) Options to use when creating rules.
1023 */
1024function mergeCssSets(styleSets, options) {
1025 var _a, _b;
1026 var classNameSet = { subComponentStyles: {} };
1027 var styleSet = styleSets[0];
1028 if (!styleSet && styleSets.length <= 1) {
1029 return { subComponentStyles: {} };
1030 }
1031 var concatenatedStyleSet = _concatStyleSets__WEBPACK_IMPORTED_MODULE_0__["concatStyleSets"].apply(void 0, styleSets);
1032 var registrations = [];
1033 for (var styleSetArea in concatenatedStyleSet) {
1034 if (concatenatedStyleSet.hasOwnProperty(styleSetArea)) {
1035 if (styleSetArea === 'subComponentStyles') {
1036 classNameSet.subComponentStyles = concatenatedStyleSet.subComponentStyles || {};
1037 continue;
1038 }
1039 var styles = concatenatedStyleSet[styleSetArea];
1040 var _c = Object(_extractStyleParts__WEBPACK_IMPORTED_MODULE_1__["extractStyleParts"])(styles), classes = _c.classes, objects = _c.objects;
1041 if ((_a = objects) === null || _a === void 0 ? void 0 : _a.length) {
1042 var registration = Object(_styleToClassName__WEBPACK_IMPORTED_MODULE_3__["styleToRegistration"])(options || {}, { displayName: styleSetArea }, objects);
1043 if (registration) {
1044 registrations.push(registration);
1045 classNameSet[styleSetArea] = classes.concat([registration.className]).join(' ');
1046 }
1047 }
1048 else {
1049 classNameSet[styleSetArea] = classes.join(' ');
1050 }
1051 }
1052 }
1053 for (var _i = 0, registrations_1 = registrations; _i < registrations_1.length; _i++) {
1054 var registration = registrations_1[_i];
1055 if (registration) {
1056 Object(_styleToClassName__WEBPACK_IMPORTED_MODULE_3__["applyRegistration"])(registration, (_b = options) === null || _b === void 0 ? void 0 : _b.specificityMultiplier);
1057 }
1058 }
1059 return classNameSet;
1060}
1061
1062
1063/***/ }),
1064
1065/***/ "./lib/mergeStyles.js":
1066/***/ (function(module, __webpack_exports__, __webpack_require__) {
1067
1068"use strict";
1069__webpack_require__.r(__webpack_exports__);
1070/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeStyles", function() { return mergeStyles; });
1071/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeCss", function() { return mergeCss; });
1072/* harmony import */ var _extractStyleParts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/extractStyleParts.js");
1073/* harmony import */ var _StyleOptionsState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./lib/StyleOptionsState.js");
1074/* harmony import */ var _styleToClassName__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./lib/styleToClassName.js");
1075
1076
1077
1078/**
1079 * Concatenation helper, which can merge class names together. Skips over falsey values.
1080 *
1081 * @public
1082 */
1083function mergeStyles() {
1084 var args = [];
1085 for (var _i = 0; _i < arguments.length; _i++) {
1086 args[_i] = arguments[_i];
1087 }
1088 return mergeCss(args, Object(_StyleOptionsState__WEBPACK_IMPORTED_MODULE_1__["getStyleOptions"])());
1089}
1090/**
1091 * Concatenation helper, which can merge class names together. Skips over falsey values.
1092 * Accepts a set of options that will be used when calculating styles.
1093 *
1094 * @public
1095 */
1096function mergeCss(args, options) {
1097 var styleArgs = args instanceof Array ? args : [args];
1098 var _a = Object(_extractStyleParts__WEBPACK_IMPORTED_MODULE_0__["extractStyleParts"])(styleArgs), classes = _a.classes, objects = _a.objects;
1099 if (objects.length) {
1100 classes.push(Object(_styleToClassName__WEBPACK_IMPORTED_MODULE_2__["styleToClassName"])(options || {}, objects));
1101 }
1102 return classes.join(' ');
1103}
1104
1105
1106/***/ }),
1107
1108/***/ "./lib/styleToClassName.js":
1109/***/ (function(module, __webpack_exports__, __webpack_require__) {
1110
1111"use strict";
1112__webpack_require__.r(__webpack_exports__);
1113/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serializeRuleEntries", function() { return serializeRuleEntries; });
1114/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "styleToRegistration", function() { return styleToRegistration; });
1115/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyRegistration", function() { return applyRegistration; });
1116/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "styleToClassName", function() { return styleToClassName; });
1117/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/tslib/tslib.es6.js");
1118/* harmony import */ var _Stylesheet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./lib/Stylesheet.js");
1119/* harmony import */ var _transforms_kebabRules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./lib/transforms/kebabRules.js");
1120/* harmony import */ var _transforms_prefixRules__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./lib/transforms/prefixRules.js");
1121/* harmony import */ var _transforms_provideUnits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./lib/transforms/provideUnits.js");
1122/* harmony import */ var _transforms_rtlifyRules__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./lib/transforms/rtlifyRules.js");
1123
1124
1125
1126
1127
1128
1129var DISPLAY_NAME = 'displayName';
1130function getDisplayName(rules) {
1131 var rootStyle = rules && rules['&'];
1132 return rootStyle ? rootStyle.displayName : undefined;
1133}
1134var globalSelectorRegExp = /\:global\((.+?)\)/g;
1135/**
1136 * Finds comma separated selectors in a :global() e.g. ":global(.class1, .class2, .class3)"
1137 * and wraps them each in their own global ":global(.class1), :global(.class2), :global(.class3)"
1138 *
1139 * @param selectorWithGlobals The selector to process
1140 * @returns The updated selector
1141 */
1142function expandCommaSeparatedGlobals(selectorWithGlobals) {
1143 // We the selector does not have a :global() we can shortcut
1144 if (!globalSelectorRegExp.test(selectorWithGlobals)) {
1145 return selectorWithGlobals;
1146 }
1147 var replacementInfo = [];
1148 var findGlobal = /\:global\((.+?)\)/g;
1149 var match = null;
1150 // Create a result list for global selectors so we can replace them.
1151 while ((match = findGlobal.exec(selectorWithGlobals))) {
1152 // Only if the found selector is a comma separated list we'll process it.
1153 if (match[1].indexOf(',') > -1) {
1154 replacementInfo.push([
1155 match.index,
1156 match.index + match[0].length,
1157 // Wrap each of the found selectors in :global()
1158 match[1]
1159 .split(',')
1160 .map(function (v) { return ":global(" + v.trim() + ")"; })
1161 .join(', '),
1162 ]);
1163 }
1164 }
1165 // Replace the found selectors with their wrapped variants in reverse order
1166 return replacementInfo
1167 .reverse()
1168 .reduce(function (selector, _a) {
1169 var matchIndex = _a[0], matchEndIndex = _a[1], replacement = _a[2];
1170 var prefix = selector.slice(0, matchIndex);
1171 var suffix = selector.slice(matchEndIndex);
1172 return prefix + replacement + suffix;
1173 }, selectorWithGlobals);
1174}
1175function expandSelector(newSelector, currentSelector) {
1176 if (newSelector.indexOf(':global(') >= 0) {
1177 return newSelector.replace(globalSelectorRegExp, '$1');
1178 }
1179 else if (newSelector.indexOf(':') === 0) {
1180 return currentSelector + newSelector;
1181 }
1182 else if (newSelector.indexOf('&') < 0) {
1183 return currentSelector + ' ' + newSelector;
1184 }
1185 return newSelector;
1186}
1187function extractSelector(currentSelector, rules, selector, value) {
1188 if (rules === void 0) { rules = { __order: [] }; }
1189 if (selector.indexOf('@') === 0) {
1190 selector = selector + '{' + currentSelector;
1191 extractRules([value], rules, selector);
1192 }
1193 else if (selector.indexOf(',') > -1) {
1194 expandCommaSeparatedGlobals(selector)
1195 .split(',')
1196 .map(function (s) { return s.trim(); })
1197 .forEach(function (separatedSelector) {
1198 return extractRules([value], rules, expandSelector(separatedSelector, currentSelector));
1199 });
1200 }
1201 else {
1202 extractRules([value], rules, expandSelector(selector, currentSelector));
1203 }
1204}
1205function extractRules(args, rules, currentSelector) {
1206 if (rules === void 0) { rules = { __order: [] }; }
1207 if (currentSelector === void 0) { currentSelector = '&'; }
1208 var stylesheet = _Stylesheet__WEBPACK_IMPORTED_MODULE_1__["Stylesheet"].getInstance();
1209 var currentRules = rules[currentSelector];
1210 if (!currentRules) {
1211 currentRules = {};
1212 rules[currentSelector] = currentRules;
1213 rules.__order.push(currentSelector);
1214 }
1215 for (var _i = 0, args_1 = args; _i < args_1.length; _i++) {
1216 var arg = args_1[_i];
1217 // If the arg is a string, we need to look up the class map and merge.
1218 if (typeof arg === 'string') {
1219 var expandedRules = stylesheet.argsFromClassName(arg);
1220 if (expandedRules) {
1221 extractRules(expandedRules, rules, currentSelector);
1222 }
1223 // Else if the arg is an array, we need to recurse in.
1224 }
1225 else if (Array.isArray(arg)) {
1226 extractRules(arg, rules, currentSelector);
1227 }
1228 else {
1229 for (var prop in arg) {
1230 if (arg.hasOwnProperty(prop)) {
1231 var propValue = arg[prop];
1232 if (prop === 'selectors') {
1233 // every child is a selector.
1234 var selectors = arg.selectors;
1235 for (var newSelector in selectors) {
1236 if (selectors.hasOwnProperty(newSelector)) {
1237 extractSelector(currentSelector, rules, newSelector, selectors[newSelector]);
1238 }
1239 }
1240 }
1241 else if (typeof propValue === 'object') {
1242 // prop is a selector.
1243 if (propValue !== null) {
1244 extractSelector(currentSelector, rules, prop, propValue);
1245 }
1246 }
1247 else {
1248 if (propValue !== undefined) {
1249 // Else, add the rule to the currentSelector.
1250 if (prop === 'margin' || prop === 'padding') {
1251 expandQuads(currentRules, prop, propValue);
1252 }
1253 else {
1254 currentRules[prop] = propValue;
1255 }
1256 }
1257 }
1258 }
1259 }
1260 }
1261 }
1262 return rules;
1263}
1264function expandQuads(currentRules, name, value) {
1265 var parts = typeof value === 'string' ? value.split(' ') : [value];
1266 currentRules[name + 'Top'] = parts[0];
1267 currentRules[name + 'Right'] = parts[1] || parts[0];
1268 currentRules[name + 'Bottom'] = parts[2] || parts[0];
1269 currentRules[name + 'Left'] = parts[3] || parts[1] || parts[0];
1270}
1271function getKeyForRules(options, rules) {
1272 var serialized = [options.rtl ? 'rtl' : 'ltr'];
1273 var hasProps = false;
1274 for (var _i = 0, _a = rules.__order; _i < _a.length; _i++) {
1275 var selector = _a[_i];
1276 serialized.push(selector);
1277 var rulesForSelector = rules[selector];
1278 for (var propName in rulesForSelector) {
1279 if (rulesForSelector.hasOwnProperty(propName) && rulesForSelector[propName] !== undefined) {
1280 hasProps = true;
1281 serialized.push(propName, rulesForSelector[propName]);
1282 }
1283 }
1284 }
1285 return hasProps ? serialized.join('') : undefined;
1286}
1287function repeatString(target, count) {
1288 if (count <= 0) {
1289 return '';
1290 }
1291 if (count === 1) {
1292 return target;
1293 }
1294 return target + repeatString(target, count - 1);
1295}
1296function serializeRuleEntries(options, ruleEntries) {
1297 if (!ruleEntries) {
1298 return '';
1299 }
1300 var allEntries = [];
1301 for (var entry in ruleEntries) {
1302 if (ruleEntries.hasOwnProperty(entry) && entry !== DISPLAY_NAME && ruleEntries[entry] !== undefined) {
1303 allEntries.push(entry, ruleEntries[entry]);
1304 }
1305 }
1306 // Apply transforms.
1307 for (var i = 0; i < allEntries.length; i += 2) {
1308 Object(_transforms_kebabRules__WEBPACK_IMPORTED_MODULE_2__["kebabRules"])(allEntries, i);
1309 Object(_transforms_provideUnits__WEBPACK_IMPORTED_MODULE_4__["provideUnits"])(allEntries, i);
1310 Object(_transforms_rtlifyRules__WEBPACK_IMPORTED_MODULE_5__["rtlifyRules"])(options, allEntries, i);
1311 Object(_transforms_prefixRules__WEBPACK_IMPORTED_MODULE_3__["prefixRules"])(allEntries, i);
1312 }
1313 // Apply punctuation.
1314 for (var i = 1; i < allEntries.length; i += 4) {
1315 allEntries.splice(i, 1, ':', allEntries[i], ';');
1316 }
1317 return allEntries.join('');
1318}
1319function styleToRegistration(options) {
1320 var args = [];
1321 for (var _i = 1; _i < arguments.length; _i++) {
1322 args[_i - 1] = arguments[_i];
1323 }
1324 var rules = extractRules(args);
1325 var key = getKeyForRules(options, rules);
1326 if (key) {
1327 var stylesheet = _Stylesheet__WEBPACK_IMPORTED_MODULE_1__["Stylesheet"].getInstance();
1328 var registration = {
1329 className: stylesheet.classNameFromKey(key),
1330 key: key,
1331 args: args,
1332 };
1333 if (!registration.className) {
1334 registration.className = stylesheet.getClassName(getDisplayName(rules));
1335 var rulesToInsert = [];
1336 for (var _a = 0, _b = rules.__order; _a < _b.length; _a++) {
1337 var selector = _b[_a];
1338 rulesToInsert.push(selector, serializeRuleEntries(options, rules[selector]));
1339 }
1340 registration.rulesToInsert = rulesToInsert;
1341 }
1342 return registration;
1343 }
1344 return undefined;
1345}
1346/**
1347 * Insert style to stylesheet.
1348 * @param registration Style registration.
1349 * @param specificityMultiplier Number of times classname selector is repeated in the css rule.
1350 * This is to increase css specificity in case it's needed. Default to 1.
1351 */
1352function applyRegistration(registration, specificityMultiplier) {
1353 if (specificityMultiplier === void 0) { specificityMultiplier = 1; }
1354 var stylesheet = _Stylesheet__WEBPACK_IMPORTED_MODULE_1__["Stylesheet"].getInstance();
1355 var className = registration.className, key = registration.key, args = registration.args, rulesToInsert = registration.rulesToInsert;
1356 if (rulesToInsert) {
1357 // rulesToInsert is an ordered array of selector/rule pairs.
1358 for (var i = 0; i < rulesToInsert.length; i += 2) {
1359 var rules = rulesToInsert[i + 1];
1360 if (rules) {
1361 var selector = rulesToInsert[i];
1362 selector = selector.replace(/&/g, repeatString("." + registration.className, specificityMultiplier));
1363 // Insert. Note if a media query, we must close the query with a final bracket.
1364 var processedRule = selector + "{" + rules + "}" + (selector.indexOf('@') === 0 ? '}' : '');
1365 stylesheet.insertRule(processedRule);
1366 }
1367 }
1368 stylesheet.cacheClassName(className, key, args, rulesToInsert);
1369 }
1370}
1371function styleToClassName(options) {
1372 var args = [];
1373 for (var _i = 1; _i < arguments.length; _i++) {
1374 args[_i - 1] = arguments[_i];
1375 }
1376 var registration = styleToRegistration.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spreadArrays"])([options], args));
1377 if (registration) {
1378 applyRegistration(registration, options.specificityMultiplier);
1379 return registration.className;
1380 }
1381 return '';
1382}
1383
1384
1385/***/ }),
1386
1387/***/ "./lib/transforms/kebabRules.js":
1388/***/ (function(module, __webpack_exports__, __webpack_require__) {
1389
1390"use strict";
1391__webpack_require__.r(__webpack_exports__);
1392/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kebabRules", function() { return kebabRules; });
1393var rules = {};
1394function kebabRules(rulePairs, index) {
1395 var rule = rulePairs[index];
1396 if (rule.charAt(0) !== '-') {
1397 rulePairs[index] = rules[rule] = rules[rule] || rule.replace(/([A-Z])/g, '-$1').toLowerCase();
1398 }
1399}
1400
1401
1402/***/ }),
1403
1404/***/ "./lib/transforms/prefixRules.js":
1405/***/ (function(module, __webpack_exports__, __webpack_require__) {
1406
1407"use strict";
1408__webpack_require__.r(__webpack_exports__);
1409/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prefixRules", function() { return prefixRules; });
1410/* harmony import */ var _getVendorSettings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./lib/getVendorSettings.js");
1411
1412var autoPrefixNames = {
1413 'user-select': 1,
1414};
1415function prefixRules(rulePairs, index) {
1416 var vendorSettings = Object(_getVendorSettings__WEBPACK_IMPORTED_MODULE_0__["getVendorSettings"])();
1417 var name = rulePairs[index];
1418 if (autoPrefixNames[name]) {
1419 var value = rulePairs[index + 1];
1420 if (autoPrefixNames[name]) {
1421 if (vendorSettings.isWebkit) {
1422 rulePairs.push('-webkit-' + name, value);
1423 }
1424 if (vendorSettings.isMoz) {
1425 rulePairs.push('-moz-' + name, value);
1426 }
1427 if (vendorSettings.isMs) {
1428 rulePairs.push('-ms-' + name, value);
1429 }
1430 if (vendorSettings.isOpera) {
1431 rulePairs.push('-o-' + name, value);
1432 }
1433 }
1434 }
1435}
1436
1437
1438/***/ }),
1439
1440/***/ "./lib/transforms/provideUnits.js":
1441/***/ (function(module, __webpack_exports__, __webpack_require__) {
1442
1443"use strict";
1444__webpack_require__.r(__webpack_exports__);
1445/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "provideUnits", function() { return provideUnits; });
1446var NON_PIXEL_NUMBER_PROPS = [
1447 'column-count',
1448 'font-weight',
1449 'flex',
1450 'flex-grow',
1451 'flex-shrink',
1452 'fill-opacity',
1453 'opacity',
1454 'order',
1455 'z-index',
1456 'zoom',
1457];
1458function provideUnits(rulePairs, index) {
1459 var name = rulePairs[index];
1460 var value = rulePairs[index + 1];
1461 if (typeof value === 'number') {
1462 var isNonPixelProp = NON_PIXEL_NUMBER_PROPS.indexOf(name) > -1;
1463 var isVariableOrPrefixed = name.indexOf('--') > -1;
1464 var unit = isNonPixelProp || isVariableOrPrefixed ? '' : 'px';
1465 rulePairs[index + 1] = "" + value + unit;
1466 }
1467}
1468
1469
1470/***/ }),
1471
1472/***/ "./lib/transforms/rtlifyRules.js":
1473/***/ (function(module, __webpack_exports__, __webpack_require__) {
1474
1475"use strict";
1476__webpack_require__.r(__webpack_exports__);
1477/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rtlifyRules", function() { return rtlifyRules; });
1478var _a;
1479var LEFT = 'left';
1480var RIGHT = 'right';
1481var NO_FLIP = '@noflip';
1482var NAME_REPLACEMENTS = (_a = {},
1483 _a[LEFT] = RIGHT,
1484 _a[RIGHT] = LEFT,
1485 _a);
1486var VALUE_REPLACEMENTS = {
1487 'w-resize': 'e-resize',
1488 'sw-resize': 'se-resize',
1489 'nw-resize': 'ne-resize',
1490};
1491/**
1492 * RTLifies the rulePair in the array at the current index. This mutates the array for performance
1493 * reasons.
1494 */
1495function rtlifyRules(options, rulePairs, index) {
1496 if (options.rtl) {
1497 var name_1 = rulePairs[index];
1498 if (!name_1) {
1499 return;
1500 }
1501 var value = rulePairs[index + 1];
1502 if (typeof value === 'string' && value.indexOf(NO_FLIP) >= 0) {
1503 rulePairs[index + 1] = value.replace(/\s*(?:\/\*\s*)?\@noflip\b(?:\s*\*\/)?\s*?/g, '');
1504 }
1505 else if (name_1.indexOf(LEFT) >= 0) {
1506 rulePairs[index] = name_1.replace(LEFT, RIGHT);
1507 }
1508 else if (name_1.indexOf(RIGHT) >= 0) {
1509 rulePairs[index] = name_1.replace(RIGHT, LEFT);
1510 }
1511 else if (String(value).indexOf(LEFT) >= 0) {
1512 rulePairs[index + 1] = value.replace(LEFT, RIGHT);
1513 }
1514 else if (String(value).indexOf(RIGHT) >= 0) {
1515 rulePairs[index + 1] = value.replace(RIGHT, LEFT);
1516 }
1517 else if (NAME_REPLACEMENTS[name_1]) {
1518 rulePairs[index] = NAME_REPLACEMENTS[name_1];
1519 }
1520 else if (VALUE_REPLACEMENTS[value]) {
1521 rulePairs[index + 1] = VALUE_REPLACEMENTS[value];
1522 }
1523 else {
1524 switch (name_1) {
1525 case 'margin':
1526 case 'padding':
1527 rulePairs[index + 1] = flipQuad(value);
1528 break;
1529 case 'box-shadow':
1530 rulePairs[index + 1] = negateNum(value, 0);
1531 break;
1532 }
1533 }
1534 }
1535}
1536/**
1537 * Given a string value in a space delimited format (e.g. "1 2 3 4"), negates a particular value.
1538 */
1539function negateNum(value, partIndex) {
1540 var parts = value.split(' ');
1541 var numberVal = parseInt(parts[partIndex], 10);
1542 parts[0] = parts[0].replace(String(numberVal), String(numberVal * -1));
1543 return parts.join(' ');
1544}
1545/**
1546 * Given a string quad, flips the left and right values.
1547 */
1548function flipQuad(value) {
1549 if (typeof value === 'string') {
1550 var parts = value.split(' ');
1551 if (parts.length === 4) {
1552 return parts[0] + " " + parts[3] + " " + parts[2] + " " + parts[1];
1553 }
1554 }
1555 return value;
1556}
1557
1558
1559/***/ }),
1560
1561/***/ "./lib/version.js":
1562/***/ (function(module, __webpack_exports__, __webpack_require__) {
1563
1564"use strict";
1565__webpack_require__.r(__webpack_exports__);
1566/* harmony import */ var _uifabric_set_version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../set-version/lib/index.js");
1567// Do not modify this file; it is generated as part of publish.
1568// The checked in version is a placeholder only and will not be updated.
1569
1570Object(_uifabric_set_version__WEBPACK_IMPORTED_MODULE_0__["setVersion"])('@uifabric/merge-styles', '7.20.1');
1571
1572
1573/***/ })
1574
1575/******/ });
1576//# sourceMappingURL=merge-styles.js.map
\No newline at end of file