@avs/go-react 0.12.71731 → 0.13.71740

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/demo/node_modules/.vite/deps/@polymer_iron-resizable-behavior_iron-resizable-behavior__js.js +2321 -0
  2. package/demo/node_modules/.vite/deps/@polymer_iron-resizable-behavior_iron-resizable-behavior__js.js.map +7 -0
  3. package/demo/node_modules/.vite/deps/@polymer_polymer_lib_legacy_class__js.js +13 -0
  4. package/demo/node_modules/.vite/deps/@polymer_polymer_lib_legacy_class__js.js.map +7 -0
  5. package/demo/node_modules/.vite/deps/@polymer_polymer_lib_utils_mixin__js.js +8 -0
  6. package/demo/node_modules/.vite/deps/@polymer_polymer_lib_utils_mixin__js.js.map +7 -0
  7. package/demo/node_modules/.vite/deps/@polymer_polymer_lib_utils_render-status__js.js +12 -0
  8. package/demo/node_modules/.vite/deps/@polymer_polymer_lib_utils_render-status__js.js.map +7 -0
  9. package/demo/node_modules/.vite/deps/@polymer_polymer_polymer-element__js.js +15 -0
  10. package/demo/node_modules/.vite/deps/@polymer_polymer_polymer-element__js.js.map +7 -0
  11. package/demo/node_modules/.vite/deps/_metadata.json +103 -0
  12. package/demo/node_modules/.vite/deps/chunk-6HI7N2AN.js +267 -0
  13. package/demo/node_modules/.vite/deps/chunk-6HI7N2AN.js.map +7 -0
  14. package/demo/node_modules/.vite/deps/chunk-BHAOVVTR.js +4597 -0
  15. package/demo/node_modules/.vite/deps/chunk-BHAOVVTR.js.map +7 -0
  16. package/demo/node_modules/.vite/deps/chunk-BSA4YZO6.js +83 -0
  17. package/demo/node_modules/.vite/deps/chunk-BSA4YZO6.js.map +7 -0
  18. package/demo/node_modules/.vite/deps/chunk-BUSYA2B4.js +8 -0
  19. package/demo/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +7 -0
  20. package/demo/node_modules/.vite/deps/chunk-CWUEONQP.js +991 -0
  21. package/demo/node_modules/.vite/deps/chunk-CWUEONQP.js.map +7 -0
  22. package/demo/node_modules/.vite/deps/chunk-I2HDYNON.js +46 -0
  23. package/demo/node_modules/.vite/deps/chunk-I2HDYNON.js.map +7 -0
  24. package/demo/node_modules/.vite/deps/chunk-MXBCLPIN.js +5 -0
  25. package/demo/node_modules/.vite/deps/chunk-MXBCLPIN.js.map +7 -0
  26. package/demo/node_modules/.vite/deps/chunk-PRUGAEYJ.js +4871 -0
  27. package/demo/node_modules/.vite/deps/chunk-PRUGAEYJ.js.map +7 -0
  28. package/demo/node_modules/.vite/deps/chunk-QQPVW2K2.js +62 -0
  29. package/demo/node_modules/.vite/deps/chunk-QQPVW2K2.js.map +7 -0
  30. package/demo/node_modules/.vite/deps/package.json +3 -0
  31. package/demo/node_modules/.vite/deps/react-dom.js +6 -0
  32. package/demo/node_modules/.vite/deps/react-dom.js.map +7 -0
  33. package/demo/node_modules/.vite/deps/react-dom_client.js +20193 -0
  34. package/demo/node_modules/.vite/deps/react-dom_client.js.map +7 -0
  35. package/demo/node_modules/.vite/deps/react.js +5 -0
  36. package/demo/node_modules/.vite/deps/react.js.map +7 -0
  37. package/demo/node_modules/.vite/deps/react_jsx-dev-runtime.js +265 -0
  38. package/demo/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +7 -0
  39. package/demo/node_modules/.vite/deps/react_jsx-runtime.js +276 -0
  40. package/demo/node_modules/.vite/deps/react_jsx-runtime.js.map +7 -0
  41. package/demo/node_modules/.vite/deps/three.js +41878 -0
  42. package/demo/node_modules/.vite/deps/three.js.map +7 -0
  43. package/demo/public/hydrogen.json +1 -1
  44. package/demo/src/App.tsx +17 -17
  45. package/package.json +3 -3
  46. package/src/AvsGoDataViz.jsx +2 -0
@@ -0,0 +1,4597 @@
1
+ import {
2
+ ElementMixin,
3
+ PropertyAccessors,
4
+ builtCSS,
5
+ cancelSyntheticClickEvents,
6
+ get,
7
+ legacyNoObservedAttributes,
8
+ legacyOptimizations,
9
+ microTask,
10
+ passiveTouchGestures,
11
+ register,
12
+ timeOut,
13
+ wrap
14
+ } from "./chunk-PRUGAEYJ.js";
15
+ import {
16
+ dedupingMixin
17
+ } from "./chunk-I2HDYNON.js";
18
+
19
+ // ../../../node_modules/@webcomponents/shadycss/src/style-settings.js
20
+ var nativeShadow = !(window["ShadyDOM"] && window["ShadyDOM"]["inUse"]);
21
+ var nativeCssVariables_;
22
+ function calcCssVariables(settings) {
23
+ if (settings && settings["shimcssproperties"]) {
24
+ nativeCssVariables_ = false;
25
+ } else {
26
+ nativeCssVariables_ = nativeShadow || Boolean(!navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/) && window.CSS && CSS.supports && CSS.supports("box-shadow", "0 0 0 var(--foo)"));
27
+ }
28
+ }
29
+ var cssBuild;
30
+ if (window.ShadyCSS && window.ShadyCSS.cssBuild !== void 0) {
31
+ cssBuild = window.ShadyCSS.cssBuild;
32
+ }
33
+ var disableRuntime = Boolean(window.ShadyCSS && window.ShadyCSS.disableRuntime);
34
+ if (window.ShadyCSS && window.ShadyCSS.nativeCss !== void 0) {
35
+ nativeCssVariables_ = window.ShadyCSS.nativeCss;
36
+ } else if (window.ShadyCSS) {
37
+ calcCssVariables(window.ShadyCSS);
38
+ window.ShadyCSS = void 0;
39
+ } else {
40
+ calcCssVariables(window["WebComponents"] && window["WebComponents"]["flags"]);
41
+ }
42
+ var nativeCssVariables = (
43
+ /** @type {boolean} */
44
+ nativeCssVariables_
45
+ );
46
+
47
+ // ../../../node_modules/@webcomponents/shadycss/src/css-parse.js
48
+ var StyleNode = class {
49
+ constructor() {
50
+ this["start"] = 0;
51
+ this["end"] = 0;
52
+ this["previous"] = null;
53
+ this["parent"] = null;
54
+ this["rules"] = null;
55
+ this["parsedCssText"] = "";
56
+ this["cssText"] = "";
57
+ this["atRule"] = false;
58
+ this["type"] = 0;
59
+ this["keyframesName"] = "";
60
+ this["selector"] = "";
61
+ this["parsedSelector"] = "";
62
+ }
63
+ };
64
+ function parse(text) {
65
+ text = clean(text);
66
+ return parseCss(lex(text), text);
67
+ }
68
+ function clean(cssText) {
69
+ return cssText.replace(RX.comments, "").replace(RX.port, "");
70
+ }
71
+ function lex(text) {
72
+ let root = new StyleNode();
73
+ root["start"] = 0;
74
+ root["end"] = text.length;
75
+ let n = root;
76
+ for (let i = 0, l = text.length; i < l; i++) {
77
+ if (text[i] === OPEN_BRACE) {
78
+ if (!n["rules"]) {
79
+ n["rules"] = [];
80
+ }
81
+ let p2 = n;
82
+ let previous = p2["rules"][p2["rules"].length - 1] || null;
83
+ n = new StyleNode();
84
+ n["start"] = i + 1;
85
+ n["parent"] = p2;
86
+ n["previous"] = previous;
87
+ p2["rules"].push(n);
88
+ } else if (text[i] === CLOSE_BRACE) {
89
+ n["end"] = i + 1;
90
+ n = n["parent"] || root;
91
+ }
92
+ }
93
+ return root;
94
+ }
95
+ function parseCss(node, text) {
96
+ let t = text.substring(node["start"], node["end"] - 1);
97
+ node["parsedCssText"] = node["cssText"] = t.trim();
98
+ if (node["parent"]) {
99
+ let ss = node["previous"] ? node["previous"]["end"] : node["parent"]["start"];
100
+ t = text.substring(ss, node["start"] - 1);
101
+ t = _expandUnicodeEscapes(t);
102
+ t = t.replace(RX.multipleSpaces, " ");
103
+ t = t.substring(t.lastIndexOf(";") + 1);
104
+ let s = node["parsedSelector"] = node["selector"] = t.trim();
105
+ node["atRule"] = s.indexOf(AT_START) === 0;
106
+ if (node["atRule"]) {
107
+ if (s.indexOf(MEDIA_START) === 0) {
108
+ node["type"] = types.MEDIA_RULE;
109
+ } else if (s.match(RX.keyframesRule)) {
110
+ node["type"] = types.KEYFRAMES_RULE;
111
+ node["keyframesName"] = node["selector"].split(RX.multipleSpaces).pop();
112
+ }
113
+ } else {
114
+ if (s.indexOf(VAR_START) === 0) {
115
+ node["type"] = types.MIXIN_RULE;
116
+ } else {
117
+ node["type"] = types.STYLE_RULE;
118
+ }
119
+ }
120
+ }
121
+ let r$ = node["rules"];
122
+ if (r$) {
123
+ for (let i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
124
+ parseCss(r, text);
125
+ }
126
+ }
127
+ return node;
128
+ }
129
+ function _expandUnicodeEscapes(s) {
130
+ return s.replace(/\\([0-9a-f]{1,6})\s/gi, function() {
131
+ let code = arguments[1], repeat = 6 - code.length;
132
+ while (repeat--) {
133
+ code = "0" + code;
134
+ }
135
+ return "\\" + code;
136
+ });
137
+ }
138
+ function stringify(node, preserveProperties, text = "") {
139
+ let cssText = "";
140
+ if (node["cssText"] || node["rules"]) {
141
+ let r$ = node["rules"];
142
+ if (r$ && !_hasMixinRules(r$)) {
143
+ for (let i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
144
+ cssText = stringify(r, preserveProperties, cssText);
145
+ }
146
+ } else {
147
+ cssText = preserveProperties ? node["cssText"] : removeCustomProps(node["cssText"]);
148
+ cssText = cssText.trim();
149
+ if (cssText) {
150
+ cssText = " " + cssText + "\n";
151
+ }
152
+ }
153
+ }
154
+ if (cssText) {
155
+ if (node["selector"]) {
156
+ text += node["selector"] + " " + OPEN_BRACE + "\n";
157
+ }
158
+ text += cssText;
159
+ if (node["selector"]) {
160
+ text += CLOSE_BRACE + "\n\n";
161
+ }
162
+ }
163
+ return text;
164
+ }
165
+ function _hasMixinRules(rules) {
166
+ let r = rules[0];
167
+ return Boolean(r) && Boolean(r["selector"]) && r["selector"].indexOf(VAR_START) === 0;
168
+ }
169
+ function removeCustomProps(cssText) {
170
+ cssText = removeCustomPropAssignment(cssText);
171
+ return removeCustomPropApply(cssText);
172
+ }
173
+ function removeCustomPropAssignment(cssText) {
174
+ return cssText.replace(RX.customProp, "").replace(RX.mixinProp, "");
175
+ }
176
+ function removeCustomPropApply(cssText) {
177
+ return cssText.replace(RX.mixinApply, "").replace(RX.varApply, "");
178
+ }
179
+ var types = {
180
+ STYLE_RULE: 1,
181
+ KEYFRAMES_RULE: 7,
182
+ MEDIA_RULE: 4,
183
+ MIXIN_RULE: 1e3
184
+ };
185
+ var OPEN_BRACE = "{";
186
+ var CLOSE_BRACE = "}";
187
+ var RX = {
188
+ comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
189
+ port: /@import[^;]*;/gim,
190
+ customProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,
191
+ mixinProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,
192
+ mixinApply: /@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,
193
+ varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,
194
+ keyframesRule: /^@[^\s]*keyframes/,
195
+ multipleSpaces: /\s+/g
196
+ };
197
+ var VAR_START = "--";
198
+ var MEDIA_START = "@media";
199
+ var AT_START = "@";
200
+
201
+ // ../../../node_modules/@webcomponents/shadycss/src/common-regex.js
202
+ var VAR_ASSIGN = /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi;
203
+ var MIXIN_MATCH = /(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi;
204
+ var MEDIA_MATCH = /@media\s(.*)/;
205
+
206
+ // ../../../node_modules/@webcomponents/shadycss/src/unscoped-style-handler.js
207
+ var styleTextSet = /* @__PURE__ */ new Set();
208
+ var scopingAttribute = "shady-unscoped";
209
+ function processUnscopedStyle(style) {
210
+ const text = style.textContent;
211
+ if (!styleTextSet.has(text)) {
212
+ styleTextSet.add(text);
213
+ const newStyle = document.createElement("style");
214
+ newStyle.setAttribute("shady-unscoped", "");
215
+ newStyle.textContent = text;
216
+ document.head.appendChild(newStyle);
217
+ }
218
+ }
219
+ function isUnscopedStyle(style) {
220
+ return style.hasAttribute(scopingAttribute);
221
+ }
222
+
223
+ // ../../../node_modules/@webcomponents/shadycss/src/style-util.js
224
+ function toCssText(rules, callback) {
225
+ if (!rules) {
226
+ return "";
227
+ }
228
+ if (typeof rules === "string") {
229
+ rules = parse(rules);
230
+ }
231
+ if (callback) {
232
+ forEachRule(rules, callback);
233
+ }
234
+ return stringify(rules, nativeCssVariables);
235
+ }
236
+ function rulesForStyle(style) {
237
+ if (!style["__cssRules"] && style.textContent) {
238
+ style["__cssRules"] = parse(style.textContent);
239
+ }
240
+ return style["__cssRules"] || null;
241
+ }
242
+ function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) {
243
+ if (!node) {
244
+ return;
245
+ }
246
+ let skipRules = false;
247
+ let type = node["type"];
248
+ if (onlyActiveRules) {
249
+ if (type === types.MEDIA_RULE) {
250
+ let matchMedia = node["selector"].match(MEDIA_MATCH);
251
+ if (matchMedia) {
252
+ if (!window.matchMedia(matchMedia[1]).matches) {
253
+ skipRules = true;
254
+ }
255
+ }
256
+ }
257
+ }
258
+ if (type === types.STYLE_RULE) {
259
+ styleRuleCallback(node);
260
+ } else if (keyframesRuleCallback && type === types.KEYFRAMES_RULE) {
261
+ keyframesRuleCallback(node);
262
+ } else if (type === types.MIXIN_RULE) {
263
+ skipRules = true;
264
+ }
265
+ let r$ = node["rules"];
266
+ if (r$ && !skipRules) {
267
+ for (let i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
268
+ forEachRule(r, styleRuleCallback, keyframesRuleCallback, onlyActiveRules);
269
+ }
270
+ }
271
+ }
272
+ function findMatchingParen(text, start) {
273
+ let level = 0;
274
+ for (let i = start, l = text.length; i < l; i++) {
275
+ if (text[i] === "(") {
276
+ level++;
277
+ } else if (text[i] === ")") {
278
+ if (--level === 0) {
279
+ return i;
280
+ }
281
+ }
282
+ }
283
+ return -1;
284
+ }
285
+ function processVariableAndFallback(str, callback) {
286
+ let start = str.indexOf("var(");
287
+ if (start === -1) {
288
+ return callback(str, "", "", "");
289
+ }
290
+ let end = findMatchingParen(str, start + 3);
291
+ let inner = str.substring(start + 4, end);
292
+ let prefix = str.substring(0, start);
293
+ let suffix = processVariableAndFallback(str.substring(end + 1), callback);
294
+ let comma = inner.indexOf(",");
295
+ if (comma === -1) {
296
+ return callback(prefix, inner.trim(), "", suffix);
297
+ }
298
+ let value = inner.substring(0, comma).trim();
299
+ let fallback = inner.substring(comma + 1).trim();
300
+ return callback(prefix, value, fallback, suffix);
301
+ }
302
+ var wrap2 = window["ShadyDOM"] && window["ShadyDOM"]["wrap"] || ((node) => node);
303
+ function getIsExtends(element) {
304
+ let localName = element["localName"];
305
+ let is = "", typeExtension = "";
306
+ if (localName) {
307
+ if (localName.indexOf("-") > -1) {
308
+ is = localName;
309
+ } else {
310
+ typeExtension = localName;
311
+ is = element.getAttribute && element.getAttribute("is") || "";
312
+ }
313
+ } else {
314
+ is = /** @type {?} */
315
+ element.is;
316
+ typeExtension = /** @type {?} */
317
+ element.extends;
318
+ }
319
+ return { is, typeExtension };
320
+ }
321
+ function gatherStyleText(element) {
322
+ const styleTextParts = [];
323
+ const styles = (
324
+ /** @type {!NodeList<!HTMLStyleElement>} */
325
+ element.querySelectorAll("style")
326
+ );
327
+ for (let i = 0; i < styles.length; i++) {
328
+ const style = styles[i];
329
+ if (isUnscopedStyle(style)) {
330
+ if (!nativeShadow) {
331
+ processUnscopedStyle(style);
332
+ style.parentNode.removeChild(style);
333
+ }
334
+ } else {
335
+ styleTextParts.push(style.textContent);
336
+ style.parentNode.removeChild(style);
337
+ }
338
+ }
339
+ return styleTextParts.join("").trim();
340
+ }
341
+ var CSS_BUILD_ATTR = "css-build";
342
+ function getCssBuild(element) {
343
+ if (cssBuild !== void 0) {
344
+ return (
345
+ /** @type {string} */
346
+ cssBuild
347
+ );
348
+ }
349
+ if (element.__cssBuild === void 0) {
350
+ const attrValue = element.getAttribute(CSS_BUILD_ATTR);
351
+ if (attrValue) {
352
+ element.__cssBuild = attrValue;
353
+ } else {
354
+ const buildComment = getBuildComment(element);
355
+ if (buildComment !== "") {
356
+ removeBuildComment(element);
357
+ }
358
+ element.__cssBuild = buildComment;
359
+ }
360
+ }
361
+ return element.__cssBuild || "";
362
+ }
363
+ function elementHasBuiltCss(element) {
364
+ return getCssBuild(element) !== "";
365
+ }
366
+ function getBuildComment(element) {
367
+ const buildComment = element.localName === "template" ? (
368
+ /** @type {!HTMLTemplateElement} */
369
+ element.content.firstChild
370
+ ) : element.firstChild;
371
+ if (buildComment instanceof Comment) {
372
+ const commentParts = buildComment.textContent.trim().split(":");
373
+ if (commentParts[0] === CSS_BUILD_ATTR) {
374
+ return commentParts[1];
375
+ }
376
+ }
377
+ return "";
378
+ }
379
+ function removeBuildComment(element) {
380
+ const buildComment = element.localName === "template" ? (
381
+ /** @type {!HTMLTemplateElement} */
382
+ element.content.firstChild
383
+ ) : element.firstChild;
384
+ buildComment.parentNode.removeChild(buildComment);
385
+ }
386
+
387
+ // ../../../node_modules/@webcomponents/shadycss/src/common-utils.js
388
+ function updateNativeProperties(element, properties) {
389
+ for (let p2 in properties) {
390
+ if (p2 === null) {
391
+ element.style.removeProperty(p2);
392
+ } else {
393
+ element.style.setProperty(p2, properties[p2]);
394
+ }
395
+ }
396
+ }
397
+ function getComputedStyleValue(element, property) {
398
+ const value = window.getComputedStyle(element).getPropertyValue(property);
399
+ if (!value) {
400
+ return "";
401
+ } else {
402
+ return value.trim();
403
+ }
404
+ }
405
+ function detectMixin(cssText) {
406
+ const has = MIXIN_MATCH.test(cssText) || VAR_ASSIGN.test(cssText);
407
+ MIXIN_MATCH.lastIndex = 0;
408
+ VAR_ASSIGN.lastIndex = 0;
409
+ return has;
410
+ }
411
+
412
+ // ../../../node_modules/@webcomponents/shadycss/src/apply-shim.js
413
+ var APPLY_NAME_CLEAN = /;\s*/m;
414
+ var INITIAL_INHERIT = /^\s*(initial)|(inherit)\s*$/;
415
+ var IMPORTANT = /\s*!important/;
416
+ var MIXIN_VAR_SEP = "_-_";
417
+ var MixinMap = class {
418
+ constructor() {
419
+ this._map = {};
420
+ }
421
+ /**
422
+ * @param {string} name
423
+ * @param {!PropertyEntry} props
424
+ */
425
+ set(name, props) {
426
+ name = name.trim();
427
+ this._map[name] = {
428
+ properties: props,
429
+ dependants: {}
430
+ };
431
+ }
432
+ /**
433
+ * @param {string} name
434
+ * @return {MixinMapEntry}
435
+ */
436
+ get(name) {
437
+ name = name.trim();
438
+ return this._map[name] || null;
439
+ }
440
+ };
441
+ var invalidCallback = null;
442
+ var ApplyShim = class {
443
+ constructor() {
444
+ this._currentElement = null;
445
+ this._measureElement = null;
446
+ this._map = new MixinMap();
447
+ }
448
+ /**
449
+ * return true if `cssText` contains a mixin definition or consumption
450
+ * @param {string} cssText
451
+ * @return {boolean}
452
+ */
453
+ detectMixin(cssText) {
454
+ return detectMixin(cssText);
455
+ }
456
+ /**
457
+ * Gather styles into one style for easier processing
458
+ * @param {!HTMLTemplateElement} template
459
+ * @return {HTMLStyleElement}
460
+ */
461
+ gatherStyles(template) {
462
+ const styleText = gatherStyleText(template.content);
463
+ if (styleText) {
464
+ const style = (
465
+ /** @type {!HTMLStyleElement} */
466
+ document.createElement("style")
467
+ );
468
+ style.textContent = styleText;
469
+ template.content.insertBefore(style, template.content.firstChild);
470
+ return style;
471
+ }
472
+ return null;
473
+ }
474
+ /**
475
+ * @param {!HTMLTemplateElement} template
476
+ * @param {string} elementName
477
+ * @return {StyleNode}
478
+ */
479
+ transformTemplate(template, elementName) {
480
+ if (template._gatheredStyle === void 0) {
481
+ template._gatheredStyle = this.gatherStyles(template);
482
+ }
483
+ const style = template._gatheredStyle;
484
+ return style ? this.transformStyle(style, elementName) : null;
485
+ }
486
+ /**
487
+ * @param {!HTMLStyleElement} style
488
+ * @param {string} elementName
489
+ * @return {StyleNode}
490
+ */
491
+ transformStyle(style, elementName = "") {
492
+ let ast = rulesForStyle(style);
493
+ this.transformRules(ast, elementName);
494
+ style.textContent = toCssText(ast);
495
+ return ast;
496
+ }
497
+ /**
498
+ * @param {!HTMLStyleElement} style
499
+ * @return {StyleNode}
500
+ */
501
+ transformCustomStyle(style) {
502
+ let ast = rulesForStyle(style);
503
+ forEachRule(ast, (rule) => {
504
+ if (rule["selector"] === ":root") {
505
+ rule["selector"] = "html";
506
+ }
507
+ this.transformRule(rule);
508
+ });
509
+ style.textContent = toCssText(ast);
510
+ return ast;
511
+ }
512
+ /**
513
+ * @param {StyleNode} rules
514
+ * @param {string} elementName
515
+ */
516
+ transformRules(rules, elementName) {
517
+ this._currentElement = elementName;
518
+ forEachRule(rules, (r) => {
519
+ this.transformRule(r);
520
+ });
521
+ this._currentElement = null;
522
+ }
523
+ /**
524
+ * @param {!StyleNode} rule
525
+ */
526
+ transformRule(rule) {
527
+ rule["cssText"] = this.transformCssText(rule["parsedCssText"], rule);
528
+ if (rule["selector"] === ":root") {
529
+ rule["selector"] = ":host > *";
530
+ }
531
+ }
532
+ /**
533
+ * @param {string} cssText
534
+ * @param {!StyleNode} rule
535
+ * @return {string}
536
+ */
537
+ transformCssText(cssText, rule) {
538
+ cssText = cssText.replace(VAR_ASSIGN, (matchText, propertyName, valueProperty, valueMixin) => this._produceCssProperties(matchText, propertyName, valueProperty, valueMixin, rule));
539
+ return this._consumeCssProperties(cssText, rule);
540
+ }
541
+ /**
542
+ * @param {string} property
543
+ * @return {string}
544
+ */
545
+ _getInitialValueForProperty(property) {
546
+ if (!this._measureElement) {
547
+ this._measureElement = /** @type {HTMLMetaElement} */
548
+ document.createElement("meta");
549
+ this._measureElement.setAttribute("apply-shim-measure", "");
550
+ this._measureElement.style.all = "initial";
551
+ document.head.appendChild(this._measureElement);
552
+ }
553
+ return window.getComputedStyle(this._measureElement).getPropertyValue(property);
554
+ }
555
+ /**
556
+ * Walk over all rules before this rule to find fallbacks for mixins
557
+ *
558
+ * @param {!StyleNode} startRule
559
+ * @return {!Object}
560
+ */
561
+ _fallbacksFromPreviousRules(startRule) {
562
+ let topRule = startRule;
563
+ while (topRule["parent"]) {
564
+ topRule = topRule["parent"];
565
+ }
566
+ const fallbacks = {};
567
+ let seenStartRule = false;
568
+ forEachRule(topRule, (r) => {
569
+ seenStartRule = seenStartRule || r === startRule;
570
+ if (seenStartRule) {
571
+ return;
572
+ }
573
+ if (r["selector"] === startRule["selector"]) {
574
+ Object.assign(fallbacks, this._cssTextToMap(r["parsedCssText"]));
575
+ }
576
+ });
577
+ return fallbacks;
578
+ }
579
+ /**
580
+ * replace mixin consumption with variable consumption
581
+ * @param {string} text
582
+ * @param {!StyleNode=} rule
583
+ * @return {string}
584
+ */
585
+ _consumeCssProperties(text, rule) {
586
+ let m = null;
587
+ while (m = MIXIN_MATCH.exec(text)) {
588
+ let matchText = m[0];
589
+ let mixinName = m[1];
590
+ let idx = m.index;
591
+ let applyPos = idx + matchText.indexOf("@apply");
592
+ let afterApplyPos = idx + matchText.length;
593
+ let textBeforeApply = text.slice(0, applyPos);
594
+ let textAfterApply = text.slice(afterApplyPos);
595
+ let defaults = rule ? this._fallbacksFromPreviousRules(rule) : {};
596
+ Object.assign(defaults, this._cssTextToMap(textBeforeApply));
597
+ let replacement = this._atApplyToCssProperties(mixinName, defaults);
598
+ text = `${textBeforeApply}${replacement}${textAfterApply}`;
599
+ MIXIN_MATCH.lastIndex = idx + replacement.length;
600
+ }
601
+ return text;
602
+ }
603
+ /**
604
+ * produce variable consumption at the site of mixin consumption
605
+ * `@apply` --foo; -> for all props (${propname}: var(--foo_-_${propname}, ${fallback[propname]}}))
606
+ * Example:
607
+ * border: var(--foo_-_border); padding: var(--foo_-_padding, 2px)
608
+ *
609
+ * @param {string} mixinName
610
+ * @param {Object} fallbacks
611
+ * @return {string}
612
+ */
613
+ _atApplyToCssProperties(mixinName, fallbacks) {
614
+ mixinName = mixinName.replace(APPLY_NAME_CLEAN, "");
615
+ let vars = [];
616
+ let mixinEntry = this._map.get(mixinName);
617
+ if (!mixinEntry) {
618
+ this._map.set(mixinName, {});
619
+ mixinEntry = this._map.get(mixinName);
620
+ }
621
+ if (mixinEntry) {
622
+ if (this._currentElement) {
623
+ mixinEntry.dependants[this._currentElement] = true;
624
+ }
625
+ let p2, parts, f;
626
+ const properties = mixinEntry.properties;
627
+ for (p2 in properties) {
628
+ f = fallbacks && fallbacks[p2];
629
+ parts = [p2, ": var(", mixinName, MIXIN_VAR_SEP, p2];
630
+ if (f) {
631
+ parts.push(",", f.replace(IMPORTANT, ""));
632
+ }
633
+ parts.push(")");
634
+ if (IMPORTANT.test(properties[p2])) {
635
+ parts.push(" !important");
636
+ }
637
+ vars.push(parts.join(""));
638
+ }
639
+ }
640
+ return vars.join("; ");
641
+ }
642
+ /**
643
+ * @param {string} property
644
+ * @param {string} value
645
+ * @return {string}
646
+ */
647
+ _replaceInitialOrInherit(property, value) {
648
+ let match = INITIAL_INHERIT.exec(value);
649
+ if (match) {
650
+ if (match[1]) {
651
+ value = this._getInitialValueForProperty(property);
652
+ } else {
653
+ value = "apply-shim-inherit";
654
+ }
655
+ }
656
+ return value;
657
+ }
658
+ /**
659
+ * "parse" a mixin definition into a map of properties and values
660
+ * cssTextToMap('border: 2px solid black') -> ('border', '2px solid black')
661
+ * @param {string} text
662
+ * @param {boolean=} replaceInitialOrInherit
663
+ * @return {!Object<string, string>}
664
+ */
665
+ _cssTextToMap(text, replaceInitialOrInherit = false) {
666
+ let props = text.split(";");
667
+ let property, value;
668
+ let out = {};
669
+ for (let i = 0, p2, sp; i < props.length; i++) {
670
+ p2 = props[i];
671
+ if (p2) {
672
+ sp = p2.split(":");
673
+ if (sp.length > 1) {
674
+ property = sp[0].trim();
675
+ value = sp.slice(1).join(":");
676
+ if (replaceInitialOrInherit) {
677
+ value = this._replaceInitialOrInherit(property, value);
678
+ }
679
+ out[property] = value;
680
+ }
681
+ }
682
+ }
683
+ return out;
684
+ }
685
+ /**
686
+ * @param {MixinMapEntry} mixinEntry
687
+ */
688
+ _invalidateMixinEntry(mixinEntry) {
689
+ if (!invalidCallback) {
690
+ return;
691
+ }
692
+ for (let elementName in mixinEntry.dependants) {
693
+ if (elementName !== this._currentElement) {
694
+ invalidCallback(elementName);
695
+ }
696
+ }
697
+ }
698
+ /**
699
+ * @param {string} matchText
700
+ * @param {string} propertyName
701
+ * @param {?string} valueProperty
702
+ * @param {?string} valueMixin
703
+ * @param {!StyleNode} rule
704
+ * @return {string}
705
+ */
706
+ _produceCssProperties(matchText, propertyName, valueProperty, valueMixin, rule) {
707
+ if (valueProperty) {
708
+ processVariableAndFallback(valueProperty, (prefix2, value) => {
709
+ if (value && this._map.get(value)) {
710
+ valueMixin = `@apply ${value};`;
711
+ }
712
+ });
713
+ }
714
+ if (!valueMixin) {
715
+ return matchText;
716
+ }
717
+ let mixinAsProperties = this._consumeCssProperties("" + valueMixin, rule);
718
+ let prefix = matchText.slice(0, matchText.indexOf("--"));
719
+ let mixinValues = this._cssTextToMap(mixinAsProperties, true);
720
+ let combinedProps = mixinValues;
721
+ let mixinEntry = this._map.get(propertyName);
722
+ let oldProps = mixinEntry && mixinEntry.properties;
723
+ if (oldProps) {
724
+ combinedProps = Object.assign(Object.create(oldProps), mixinValues);
725
+ } else {
726
+ this._map.set(propertyName, combinedProps);
727
+ }
728
+ let out = [];
729
+ let p2, v;
730
+ let needToInvalidate = false;
731
+ for (p2 in combinedProps) {
732
+ v = mixinValues[p2];
733
+ if (v === void 0) {
734
+ v = "initial";
735
+ }
736
+ if (oldProps && !(p2 in oldProps)) {
737
+ needToInvalidate = true;
738
+ }
739
+ out.push(`${propertyName}${MIXIN_VAR_SEP}${p2}: ${v}`);
740
+ }
741
+ if (needToInvalidate) {
742
+ this._invalidateMixinEntry(mixinEntry);
743
+ }
744
+ if (mixinEntry) {
745
+ mixinEntry.properties = combinedProps;
746
+ }
747
+ if (valueProperty) {
748
+ prefix = `${matchText};${prefix}`;
749
+ }
750
+ return `${prefix}${out.join("; ")};`;
751
+ }
752
+ };
753
+ ApplyShim.prototype["detectMixin"] = ApplyShim.prototype.detectMixin;
754
+ ApplyShim.prototype["transformStyle"] = ApplyShim.prototype.transformStyle;
755
+ ApplyShim.prototype["transformCustomStyle"] = ApplyShim.prototype.transformCustomStyle;
756
+ ApplyShim.prototype["transformRules"] = ApplyShim.prototype.transformRules;
757
+ ApplyShim.prototype["transformRule"] = ApplyShim.prototype.transformRule;
758
+ ApplyShim.prototype["transformTemplate"] = ApplyShim.prototype.transformTemplate;
759
+ ApplyShim.prototype["_separator"] = MIXIN_VAR_SEP;
760
+ Object.defineProperty(ApplyShim.prototype, "invalidCallback", {
761
+ /** @return {?function(string)} */
762
+ get() {
763
+ return invalidCallback;
764
+ },
765
+ /** @param {?function(string)} cb */
766
+ set(cb) {
767
+ invalidCallback = cb;
768
+ }
769
+ });
770
+ var apply_shim_default = ApplyShim;
771
+
772
+ // ../../../node_modules/@webcomponents/shadycss/src/template-map.js
773
+ var templateMap = {};
774
+ var template_map_default = templateMap;
775
+
776
+ // ../../../node_modules/@webcomponents/shadycss/src/apply-shim-utils.js
777
+ var CURRENT_VERSION = "_applyShimCurrentVersion";
778
+ var NEXT_VERSION = "_applyShimNextVersion";
779
+ var VALIDATING_VERSION = "_applyShimValidatingVersion";
780
+ var promise = Promise.resolve();
781
+ function invalidate(elementName) {
782
+ let template = template_map_default[elementName];
783
+ if (template) {
784
+ invalidateTemplate(template);
785
+ }
786
+ }
787
+ function invalidateTemplate(template) {
788
+ template[CURRENT_VERSION] = template[CURRENT_VERSION] || 0;
789
+ template[VALIDATING_VERSION] = template[VALIDATING_VERSION] || 0;
790
+ template[NEXT_VERSION] = (template[NEXT_VERSION] || 0) + 1;
791
+ }
792
+ function templateIsValid(template) {
793
+ return template[CURRENT_VERSION] === template[NEXT_VERSION];
794
+ }
795
+ function templateIsValidating(template) {
796
+ return !templateIsValid(template) && template[VALIDATING_VERSION] === template[NEXT_VERSION];
797
+ }
798
+ function startValidatingTemplate(template) {
799
+ template[VALIDATING_VERSION] = template[NEXT_VERSION];
800
+ if (!template._validating) {
801
+ template._validating = true;
802
+ promise.then(function() {
803
+ template[CURRENT_VERSION] = template[NEXT_VERSION];
804
+ template._validating = false;
805
+ });
806
+ }
807
+ }
808
+
809
+ // ../../../node_modules/@webcomponents/shadycss/src/document-wait.js
810
+ var readyPromise = null;
811
+ var whenReady = window["HTMLImports"] && window["HTMLImports"]["whenReady"] || null;
812
+ var resolveFn;
813
+ function documentWait(callback) {
814
+ requestAnimationFrame(function() {
815
+ if (whenReady) {
816
+ whenReady(callback);
817
+ } else {
818
+ if (!readyPromise) {
819
+ readyPromise = new Promise((resolve2) => {
820
+ resolveFn = resolve2;
821
+ });
822
+ if (document.readyState === "complete") {
823
+ resolveFn();
824
+ } else {
825
+ document.addEventListener("readystatechange", () => {
826
+ if (document.readyState === "complete") {
827
+ resolveFn();
828
+ }
829
+ });
830
+ }
831
+ }
832
+ readyPromise.then(function() {
833
+ callback && callback();
834
+ });
835
+ }
836
+ });
837
+ }
838
+
839
+ // ../../../node_modules/@webcomponents/shadycss/src/custom-style-interface.js
840
+ var SEEN_MARKER = "__seenByShadyCSS";
841
+ var CACHED_STYLE = "__shadyCSSCachedStyle";
842
+ var transformFn = null;
843
+ var validateFn = null;
844
+ var CustomStyleInterface = class {
845
+ constructor() {
846
+ this["customStyles"] = [];
847
+ this["enqueued"] = false;
848
+ documentWait(() => {
849
+ if (window["ShadyCSS"]["flushCustomStyles"]) {
850
+ window["ShadyCSS"]["flushCustomStyles"]();
851
+ }
852
+ });
853
+ }
854
+ /**
855
+ * Queue a validation for new custom styles to batch style recalculations
856
+ */
857
+ enqueueDocumentValidation() {
858
+ if (this["enqueued"] || !validateFn) {
859
+ return;
860
+ }
861
+ this["enqueued"] = true;
862
+ documentWait(validateFn);
863
+ }
864
+ /**
865
+ * @param {!HTMLStyleElement} style
866
+ */
867
+ addCustomStyle(style) {
868
+ if (!style[SEEN_MARKER]) {
869
+ style[SEEN_MARKER] = true;
870
+ this["customStyles"].push(style);
871
+ this.enqueueDocumentValidation();
872
+ }
873
+ }
874
+ /**
875
+ * @param {!CustomStyleProvider} customStyle
876
+ * @return {HTMLStyleElement}
877
+ */
878
+ getStyleForCustomStyle(customStyle) {
879
+ if (customStyle[CACHED_STYLE]) {
880
+ return customStyle[CACHED_STYLE];
881
+ }
882
+ let style;
883
+ if (customStyle["getStyle"]) {
884
+ style = customStyle["getStyle"]();
885
+ } else {
886
+ style = customStyle;
887
+ }
888
+ return style;
889
+ }
890
+ /**
891
+ * @return {!Array<!CustomStyleProvider>}
892
+ */
893
+ processStyles() {
894
+ const cs = this["customStyles"];
895
+ for (let i = 0; i < cs.length; i++) {
896
+ const customStyle = cs[i];
897
+ if (customStyle[CACHED_STYLE]) {
898
+ continue;
899
+ }
900
+ const style = this.getStyleForCustomStyle(customStyle);
901
+ if (style) {
902
+ const styleToTransform = (
903
+ /** @type {!HTMLStyleElement} */
904
+ style["__appliedElement"] || style
905
+ );
906
+ if (transformFn) {
907
+ transformFn(styleToTransform);
908
+ }
909
+ customStyle[CACHED_STYLE] = styleToTransform;
910
+ }
911
+ }
912
+ return cs;
913
+ }
914
+ };
915
+ CustomStyleInterface.prototype["addCustomStyle"] = CustomStyleInterface.prototype.addCustomStyle;
916
+ CustomStyleInterface.prototype["getStyleForCustomStyle"] = CustomStyleInterface.prototype.getStyleForCustomStyle;
917
+ CustomStyleInterface.prototype["processStyles"] = CustomStyleInterface.prototype.processStyles;
918
+ Object.defineProperties(CustomStyleInterface.prototype, {
919
+ "transformCallback": {
920
+ /** @return {?function(!HTMLStyleElement)} */
921
+ get() {
922
+ return transformFn;
923
+ },
924
+ /** @param {?function(!HTMLStyleElement)} fn */
925
+ set(fn) {
926
+ transformFn = fn;
927
+ }
928
+ },
929
+ "validateCallback": {
930
+ /** @return {?function()} */
931
+ get() {
932
+ return validateFn;
933
+ },
934
+ /**
935
+ * @param {?function()} fn
936
+ * @this {CustomStyleInterface}
937
+ */
938
+ set(fn) {
939
+ let needsEnqueue = false;
940
+ if (!validateFn) {
941
+ needsEnqueue = true;
942
+ }
943
+ validateFn = fn;
944
+ if (needsEnqueue) {
945
+ this.enqueueDocumentValidation();
946
+ }
947
+ }
948
+ }
949
+ });
950
+
951
+ // ../../../node_modules/@webcomponents/shadycss/entrypoints/apply-shim.js
952
+ var applyShim = new apply_shim_default();
953
+ var ApplyShimInterface = class {
954
+ constructor() {
955
+ this.customStyleInterface = null;
956
+ applyShim["invalidCallback"] = invalidate;
957
+ }
958
+ ensure() {
959
+ if (this.customStyleInterface) {
960
+ return;
961
+ }
962
+ if (window.ShadyCSS.CustomStyleInterface) {
963
+ this.customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */
964
+ window.ShadyCSS.CustomStyleInterface;
965
+ this.customStyleInterface["transformCallback"] = (style) => {
966
+ applyShim.transformCustomStyle(style);
967
+ };
968
+ this.customStyleInterface["validateCallback"] = () => {
969
+ requestAnimationFrame(() => {
970
+ if (this.customStyleInterface["enqueued"]) {
971
+ this.flushCustomStyles();
972
+ }
973
+ });
974
+ };
975
+ }
976
+ }
977
+ /**
978
+ * @param {!HTMLTemplateElement} template
979
+ * @param {string} elementName
980
+ */
981
+ prepareTemplate(template, elementName) {
982
+ this.ensure();
983
+ if (elementHasBuiltCss(template)) {
984
+ return;
985
+ }
986
+ template_map_default[elementName] = template;
987
+ let ast = applyShim.transformTemplate(template, elementName);
988
+ template["_styleAst"] = ast;
989
+ }
990
+ flushCustomStyles() {
991
+ this.ensure();
992
+ if (!this.customStyleInterface) {
993
+ return;
994
+ }
995
+ let styles = this.customStyleInterface["processStyles"]();
996
+ if (!this.customStyleInterface["enqueued"]) {
997
+ return;
998
+ }
999
+ for (let i = 0; i < styles.length; i++) {
1000
+ let cs = styles[i];
1001
+ let style = this.customStyleInterface["getStyleForCustomStyle"](cs);
1002
+ if (style) {
1003
+ applyShim.transformCustomStyle(style);
1004
+ }
1005
+ }
1006
+ this.customStyleInterface["enqueued"] = false;
1007
+ }
1008
+ /**
1009
+ * @param {HTMLElement} element
1010
+ * @param {Object=} properties
1011
+ */
1012
+ styleSubtree(element, properties) {
1013
+ this.ensure();
1014
+ if (properties) {
1015
+ updateNativeProperties(element, properties);
1016
+ }
1017
+ if (element.shadowRoot) {
1018
+ this.styleElement(element);
1019
+ let shadowChildren = (
1020
+ /** @type {!ParentNode} */
1021
+ element.shadowRoot.children || element.shadowRoot.childNodes
1022
+ );
1023
+ for (let i = 0; i < shadowChildren.length; i++) {
1024
+ this.styleSubtree(
1025
+ /** @type {HTMLElement} */
1026
+ shadowChildren[i]
1027
+ );
1028
+ }
1029
+ } else {
1030
+ let children = element.children || element.childNodes;
1031
+ for (let i = 0; i < children.length; i++) {
1032
+ this.styleSubtree(
1033
+ /** @type {HTMLElement} */
1034
+ children[i]
1035
+ );
1036
+ }
1037
+ }
1038
+ }
1039
+ /**
1040
+ * @param {HTMLElement} element
1041
+ */
1042
+ styleElement(element) {
1043
+ this.ensure();
1044
+ let { is } = getIsExtends(element);
1045
+ let template = template_map_default[is];
1046
+ if (template && elementHasBuiltCss(template)) {
1047
+ return;
1048
+ }
1049
+ if (template && !templateIsValid(template)) {
1050
+ if (!templateIsValidating(template)) {
1051
+ this.prepareTemplate(template, is);
1052
+ startValidatingTemplate(template);
1053
+ }
1054
+ let root = element.shadowRoot;
1055
+ if (root) {
1056
+ let style = (
1057
+ /** @type {HTMLStyleElement} */
1058
+ root.querySelector("style")
1059
+ );
1060
+ if (style) {
1061
+ style["__cssRules"] = template["_styleAst"];
1062
+ style.textContent = toCssText(template["_styleAst"]);
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1067
+ /**
1068
+ * @param {Object=} properties
1069
+ */
1070
+ styleDocument(properties) {
1071
+ this.ensure();
1072
+ this.styleSubtree(document.body, properties);
1073
+ }
1074
+ };
1075
+ if (!window.ShadyCSS || !window.ShadyCSS.ScopingShim) {
1076
+ const applyShimInterface = new ApplyShimInterface();
1077
+ let CustomStyleInterface2 = window.ShadyCSS && window.ShadyCSS.CustomStyleInterface;
1078
+ window.ShadyCSS = {
1079
+ /**
1080
+ * @param {!HTMLTemplateElement} template
1081
+ * @param {string} elementName
1082
+ * @param {string=} elementExtends
1083
+ */
1084
+ prepareTemplate(template, elementName, elementExtends) {
1085
+ applyShimInterface.flushCustomStyles();
1086
+ applyShimInterface.prepareTemplate(template, elementName);
1087
+ },
1088
+ /**
1089
+ * @param {!HTMLTemplateElement} template
1090
+ * @param {string} elementName
1091
+ * @param {string=} elementExtends
1092
+ */
1093
+ prepareTemplateStyles(template, elementName, elementExtends) {
1094
+ window.ShadyCSS.prepareTemplate(template, elementName, elementExtends);
1095
+ },
1096
+ /**
1097
+ * @param {!HTMLTemplateElement} template
1098
+ * @param {string} elementName
1099
+ */
1100
+ prepareTemplateDom(template, elementName) {
1101
+ },
1102
+ // eslint-disable-line no-unused-vars
1103
+ /**
1104
+ * @param {!HTMLElement} element
1105
+ * @param {Object=} properties
1106
+ */
1107
+ styleSubtree(element, properties) {
1108
+ applyShimInterface.flushCustomStyles();
1109
+ applyShimInterface.styleSubtree(element, properties);
1110
+ },
1111
+ /**
1112
+ * @param {!HTMLElement} element
1113
+ */
1114
+ styleElement(element) {
1115
+ applyShimInterface.flushCustomStyles();
1116
+ applyShimInterface.styleElement(element);
1117
+ },
1118
+ /**
1119
+ * @param {Object=} properties
1120
+ */
1121
+ styleDocument(properties) {
1122
+ applyShimInterface.flushCustomStyles();
1123
+ applyShimInterface.styleDocument(properties);
1124
+ },
1125
+ /**
1126
+ * @param {Element} element
1127
+ * @param {string} property
1128
+ * @return {string}
1129
+ */
1130
+ getComputedStyleValue(element, property) {
1131
+ return getComputedStyleValue(element, property);
1132
+ },
1133
+ flushCustomStyles() {
1134
+ applyShimInterface.flushCustomStyles();
1135
+ },
1136
+ nativeCss: nativeCssVariables,
1137
+ nativeShadow,
1138
+ cssBuild,
1139
+ disableRuntime
1140
+ };
1141
+ if (CustomStyleInterface2) {
1142
+ window.ShadyCSS.CustomStyleInterface = CustomStyleInterface2;
1143
+ }
1144
+ }
1145
+ window.ShadyCSS.ApplyShim = applyShim;
1146
+
1147
+ // ../../../node_modules/@polymer/polymer/lib/utils/debounce.js
1148
+ var Debouncer = class _Debouncer {
1149
+ constructor() {
1150
+ this._asyncModule = null;
1151
+ this._callback = null;
1152
+ this._timer = null;
1153
+ }
1154
+ /**
1155
+ * Sets the scheduler; that is, a module with the Async interface,
1156
+ * a callback and optional arguments to be passed to the run function
1157
+ * from the async module.
1158
+ *
1159
+ * @param {!AsyncInterface} asyncModule Object with Async interface.
1160
+ * @param {function()} callback Callback to run.
1161
+ * @return {void}
1162
+ */
1163
+ setConfig(asyncModule, callback) {
1164
+ this._asyncModule = asyncModule;
1165
+ this._callback = callback;
1166
+ this._timer = this._asyncModule.run(() => {
1167
+ this._timer = null;
1168
+ debouncerQueue.delete(this);
1169
+ this._callback();
1170
+ });
1171
+ }
1172
+ /**
1173
+ * Cancels an active debouncer and returns a reference to itself.
1174
+ *
1175
+ * @return {void}
1176
+ */
1177
+ cancel() {
1178
+ if (this.isActive()) {
1179
+ this._cancelAsync();
1180
+ debouncerQueue.delete(this);
1181
+ }
1182
+ }
1183
+ /**
1184
+ * Cancels a debouncer's async callback.
1185
+ *
1186
+ * @return {void}
1187
+ */
1188
+ _cancelAsync() {
1189
+ if (this.isActive()) {
1190
+ this._asyncModule.cancel(
1191
+ /** @type {number} */
1192
+ this._timer
1193
+ );
1194
+ this._timer = null;
1195
+ }
1196
+ }
1197
+ /**
1198
+ * Flushes an active debouncer and returns a reference to itself.
1199
+ *
1200
+ * @return {void}
1201
+ */
1202
+ flush() {
1203
+ if (this.isActive()) {
1204
+ this.cancel();
1205
+ this._callback();
1206
+ }
1207
+ }
1208
+ /**
1209
+ * Returns true if the debouncer is active.
1210
+ *
1211
+ * @return {boolean} True if active.
1212
+ */
1213
+ isActive() {
1214
+ return this._timer != null;
1215
+ }
1216
+ /**
1217
+ * Creates a debouncer if no debouncer is passed as a parameter
1218
+ * or it cancels an active debouncer otherwise. The following
1219
+ * example shows how a debouncer can be called multiple times within a
1220
+ * microtask and "debounced" such that the provided callback function is
1221
+ * called once. Add this method to a custom element:
1222
+ *
1223
+ * ```js
1224
+ * import {microTask} from '@polymer/polymer/lib/utils/async.js';
1225
+ * import {Debouncer} from '@polymer/polymer/lib/utils/debounce.js';
1226
+ * // ...
1227
+ *
1228
+ * _debounceWork() {
1229
+ * this._debounceJob = Debouncer.debounce(this._debounceJob,
1230
+ * microTask, () => this._doWork());
1231
+ * }
1232
+ * ```
1233
+ *
1234
+ * If the `_debounceWork` method is called multiple times within the same
1235
+ * microtask, the `_doWork` function will be called only once at the next
1236
+ * microtask checkpoint.
1237
+ *
1238
+ * Note: In testing it is often convenient to avoid asynchrony. To accomplish
1239
+ * this with a debouncer, you can use `enqueueDebouncer` and
1240
+ * `flush`. For example, extend the above example by adding
1241
+ * `enqueueDebouncer(this._debounceJob)` at the end of the
1242
+ * `_debounceWork` method. Then in a test, call `flush` to ensure
1243
+ * the debouncer has completed.
1244
+ *
1245
+ * @param {Debouncer?} debouncer Debouncer object.
1246
+ * @param {!AsyncInterface} asyncModule Object with Async interface
1247
+ * @param {function()} callback Callback to run.
1248
+ * @return {!Debouncer} Returns a debouncer object.
1249
+ */
1250
+ static debounce(debouncer, asyncModule, callback) {
1251
+ if (debouncer instanceof _Debouncer) {
1252
+ debouncer._cancelAsync();
1253
+ } else {
1254
+ debouncer = new _Debouncer();
1255
+ }
1256
+ debouncer.setConfig(asyncModule, callback);
1257
+ return debouncer;
1258
+ }
1259
+ };
1260
+ var debouncerQueue = /* @__PURE__ */ new Set();
1261
+ var enqueueDebouncer = function(debouncer) {
1262
+ debouncerQueue.add(debouncer);
1263
+ };
1264
+ var flushDebouncers = function() {
1265
+ const didFlush = Boolean(debouncerQueue.size);
1266
+ debouncerQueue.forEach((debouncer) => {
1267
+ try {
1268
+ debouncer.flush();
1269
+ } catch (e) {
1270
+ setTimeout(() => {
1271
+ throw e;
1272
+ });
1273
+ }
1274
+ });
1275
+ return didFlush;
1276
+ };
1277
+
1278
+ // ../../../node_modules/@polymer/polymer/lib/utils/gestures.js
1279
+ var HAS_NATIVE_TA = typeof document.head.style.touchAction === "string";
1280
+ var GESTURE_KEY = "__polymerGestures";
1281
+ var HANDLED_OBJ = "__polymerGesturesHandled";
1282
+ var TOUCH_ACTION = "__polymerGesturesTouchAction";
1283
+ var TAP_DISTANCE = 25;
1284
+ var TRACK_DISTANCE = 5;
1285
+ var TRACK_LENGTH = 2;
1286
+ var MOUSE_TIMEOUT = 2500;
1287
+ var MOUSE_EVENTS = ["mousedown", "mousemove", "mouseup", "click"];
1288
+ var MOUSE_WHICH_TO_BUTTONS = [0, 1, 4, 2];
1289
+ var MOUSE_HAS_BUTTONS = (function() {
1290
+ try {
1291
+ return new MouseEvent("test", { buttons: 1 }).buttons === 1;
1292
+ } catch (e) {
1293
+ return false;
1294
+ }
1295
+ })();
1296
+ function isMouseEvent(name) {
1297
+ return MOUSE_EVENTS.indexOf(name) > -1;
1298
+ }
1299
+ var supportsPassive = false;
1300
+ (function() {
1301
+ try {
1302
+ let opts = Object.defineProperty({}, "passive", { get() {
1303
+ supportsPassive = true;
1304
+ } });
1305
+ window.addEventListener("test", null, opts);
1306
+ window.removeEventListener("test", null, opts);
1307
+ } catch (e) {
1308
+ }
1309
+ })();
1310
+ function PASSIVE_TOUCH(eventName) {
1311
+ if (isMouseEvent(eventName) || eventName === "touchend") {
1312
+ return;
1313
+ }
1314
+ if (HAS_NATIVE_TA && supportsPassive && passiveTouchGestures) {
1315
+ return { passive: true };
1316
+ } else {
1317
+ return;
1318
+ }
1319
+ }
1320
+ var IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);
1321
+ var clickedLabels = [];
1322
+ var labellable = {
1323
+ "button": true,
1324
+ "input": true,
1325
+ "keygen": true,
1326
+ "meter": true,
1327
+ "output": true,
1328
+ "textarea": true,
1329
+ "progress": true,
1330
+ "select": true
1331
+ };
1332
+ var canBeDisabled = {
1333
+ "button": true,
1334
+ "command": true,
1335
+ "fieldset": true,
1336
+ "input": true,
1337
+ "keygen": true,
1338
+ "optgroup": true,
1339
+ "option": true,
1340
+ "select": true,
1341
+ "textarea": true
1342
+ };
1343
+ function canBeLabelled(el) {
1344
+ return labellable[el.localName] || false;
1345
+ }
1346
+ function matchingLabels(el) {
1347
+ let labels = Array.prototype.slice.call(
1348
+ /** @type {HTMLInputElement} */
1349
+ el.labels || []
1350
+ );
1351
+ if (!labels.length) {
1352
+ labels = [];
1353
+ try {
1354
+ let root = el.getRootNode();
1355
+ if (el.id) {
1356
+ let matching = root.querySelectorAll(`label[for = '${el.id}']`);
1357
+ for (let i = 0; i < matching.length; i++) {
1358
+ labels.push(
1359
+ /** @type {!HTMLLabelElement} */
1360
+ matching[i]
1361
+ );
1362
+ }
1363
+ }
1364
+ } catch (e) {
1365
+ }
1366
+ }
1367
+ return labels;
1368
+ }
1369
+ var mouseCanceller = function(mouseEvent) {
1370
+ let sc = mouseEvent.sourceCapabilities;
1371
+ if (sc && !sc.firesTouchEvents) {
1372
+ return;
1373
+ }
1374
+ mouseEvent[HANDLED_OBJ] = { skip: true };
1375
+ if (mouseEvent.type === "click") {
1376
+ let clickFromLabel = false;
1377
+ let path = getComposedPath(mouseEvent);
1378
+ for (let i = 0; i < path.length; i++) {
1379
+ if (path[i].nodeType === Node.ELEMENT_NODE) {
1380
+ if (path[i].localName === "label") {
1381
+ clickedLabels.push(
1382
+ /** @type {!HTMLLabelElement} */
1383
+ path[i]
1384
+ );
1385
+ } else if (canBeLabelled(
1386
+ /** @type {!HTMLElement} */
1387
+ path[i]
1388
+ )) {
1389
+ let ownerLabels = matchingLabels(
1390
+ /** @type {!HTMLElement} */
1391
+ path[i]
1392
+ );
1393
+ for (let j = 0; j < ownerLabels.length; j++) {
1394
+ clickFromLabel = clickFromLabel || clickedLabels.indexOf(ownerLabels[j]) > -1;
1395
+ }
1396
+ }
1397
+ }
1398
+ if (path[i] === POINTERSTATE.mouse.target) {
1399
+ return;
1400
+ }
1401
+ }
1402
+ if (clickFromLabel) {
1403
+ return;
1404
+ }
1405
+ mouseEvent.preventDefault();
1406
+ mouseEvent.stopPropagation();
1407
+ }
1408
+ };
1409
+ function setupTeardownMouseCanceller(setup) {
1410
+ let events = IS_TOUCH_ONLY ? ["click"] : MOUSE_EVENTS;
1411
+ for (let i = 0, en; i < events.length; i++) {
1412
+ en = events[i];
1413
+ if (setup) {
1414
+ clickedLabels.length = 0;
1415
+ document.addEventListener(en, mouseCanceller, true);
1416
+ } else {
1417
+ document.removeEventListener(en, mouseCanceller, true);
1418
+ }
1419
+ }
1420
+ }
1421
+ function ignoreMouse(e) {
1422
+ if (!cancelSyntheticClickEvents) {
1423
+ return;
1424
+ }
1425
+ if (!POINTERSTATE.mouse.mouseIgnoreJob) {
1426
+ setupTeardownMouseCanceller(true);
1427
+ }
1428
+ let unset = function() {
1429
+ setupTeardownMouseCanceller();
1430
+ POINTERSTATE.mouse.target = null;
1431
+ POINTERSTATE.mouse.mouseIgnoreJob = null;
1432
+ };
1433
+ POINTERSTATE.mouse.target = getComposedPath(e)[0];
1434
+ POINTERSTATE.mouse.mouseIgnoreJob = Debouncer.debounce(
1435
+ POINTERSTATE.mouse.mouseIgnoreJob,
1436
+ timeOut.after(MOUSE_TIMEOUT),
1437
+ unset
1438
+ );
1439
+ }
1440
+ function hasLeftMouseButton(ev) {
1441
+ let type = ev.type;
1442
+ if (!isMouseEvent(type)) {
1443
+ return false;
1444
+ }
1445
+ if (type === "mousemove") {
1446
+ let buttons = ev.buttons === void 0 ? 1 : ev.buttons;
1447
+ if (ev instanceof window.MouseEvent && !MOUSE_HAS_BUTTONS) {
1448
+ buttons = MOUSE_WHICH_TO_BUTTONS[ev.which] || 0;
1449
+ }
1450
+ return Boolean(buttons & 1);
1451
+ } else {
1452
+ let button = ev.button === void 0 ? 0 : ev.button;
1453
+ return button === 0;
1454
+ }
1455
+ }
1456
+ function isSyntheticClick(ev) {
1457
+ if (ev.type === "click") {
1458
+ if (ev.detail === 0) {
1459
+ return true;
1460
+ }
1461
+ let t = _findOriginalTarget(ev);
1462
+ if (!t.nodeType || /** @type {Element} */
1463
+ t.nodeType !== Node.ELEMENT_NODE) {
1464
+ return true;
1465
+ }
1466
+ let bcr = (
1467
+ /** @type {Element} */
1468
+ t.getBoundingClientRect()
1469
+ );
1470
+ let x = ev.pageX, y = ev.pageY;
1471
+ return !(x >= bcr.left && x <= bcr.right && (y >= bcr.top && y <= bcr.bottom));
1472
+ }
1473
+ return false;
1474
+ }
1475
+ var POINTERSTATE = {
1476
+ mouse: {
1477
+ target: null,
1478
+ mouseIgnoreJob: null
1479
+ },
1480
+ touch: {
1481
+ x: 0,
1482
+ y: 0,
1483
+ id: -1,
1484
+ scrollDecided: false
1485
+ }
1486
+ };
1487
+ function firstTouchAction(ev) {
1488
+ let ta = "auto";
1489
+ let path = getComposedPath(ev);
1490
+ for (let i = 0, n; i < path.length; i++) {
1491
+ n = path[i];
1492
+ if (n[TOUCH_ACTION]) {
1493
+ ta = n[TOUCH_ACTION];
1494
+ break;
1495
+ }
1496
+ }
1497
+ return ta;
1498
+ }
1499
+ function trackDocument(stateObj, movefn, upfn) {
1500
+ stateObj.movefn = movefn;
1501
+ stateObj.upfn = upfn;
1502
+ document.addEventListener("mousemove", movefn);
1503
+ document.addEventListener("mouseup", upfn);
1504
+ }
1505
+ function untrackDocument(stateObj) {
1506
+ document.removeEventListener("mousemove", stateObj.movefn);
1507
+ document.removeEventListener("mouseup", stateObj.upfn);
1508
+ stateObj.movefn = null;
1509
+ stateObj.upfn = null;
1510
+ }
1511
+ if (cancelSyntheticClickEvents) {
1512
+ document.addEventListener("touchend", ignoreMouse, supportsPassive ? { passive: true } : false);
1513
+ }
1514
+ var getComposedPath = window.ShadyDOM && window.ShadyDOM.noPatch ? window.ShadyDOM.composedPath : (event) => event.composedPath && event.composedPath() || [];
1515
+ var gestures = {};
1516
+ var recognizers = [];
1517
+ function deepTargetFind(x, y) {
1518
+ let node = document.elementFromPoint(x, y);
1519
+ let next = node;
1520
+ while (next && next.shadowRoot && !window.ShadyDOM) {
1521
+ let oldNext = next;
1522
+ next = next.shadowRoot.elementFromPoint(x, y);
1523
+ if (oldNext === next) {
1524
+ break;
1525
+ }
1526
+ if (next) {
1527
+ node = next;
1528
+ }
1529
+ }
1530
+ return node;
1531
+ }
1532
+ function _findOriginalTarget(ev) {
1533
+ const path = getComposedPath(
1534
+ /** @type {?Event} */
1535
+ ev
1536
+ );
1537
+ return path.length > 0 ? path[0] : ev.target;
1538
+ }
1539
+ function _handleNative(ev) {
1540
+ let handled;
1541
+ let type = ev.type;
1542
+ let node = ev.currentTarget;
1543
+ let gobj = node[GESTURE_KEY];
1544
+ if (!gobj) {
1545
+ return;
1546
+ }
1547
+ let gs = gobj[type];
1548
+ if (!gs) {
1549
+ return;
1550
+ }
1551
+ if (!ev[HANDLED_OBJ]) {
1552
+ ev[HANDLED_OBJ] = {};
1553
+ if (type.slice(0, 5) === "touch") {
1554
+ ev = /** @type {TouchEvent} */
1555
+ ev;
1556
+ let t = ev.changedTouches[0];
1557
+ if (type === "touchstart") {
1558
+ if (ev.touches.length === 1) {
1559
+ POINTERSTATE.touch.id = t.identifier;
1560
+ }
1561
+ }
1562
+ if (POINTERSTATE.touch.id !== t.identifier) {
1563
+ return;
1564
+ }
1565
+ if (!HAS_NATIVE_TA) {
1566
+ if (type === "touchstart" || type === "touchmove") {
1567
+ _handleTouchAction(ev);
1568
+ }
1569
+ }
1570
+ }
1571
+ }
1572
+ handled = ev[HANDLED_OBJ];
1573
+ if (handled.skip) {
1574
+ return;
1575
+ }
1576
+ for (let i = 0, r; i < recognizers.length; i++) {
1577
+ r = recognizers[i];
1578
+ if (gs[r.name] && !handled[r.name]) {
1579
+ if (r.flow && r.flow.start.indexOf(ev.type) > -1 && r.reset) {
1580
+ r.reset();
1581
+ }
1582
+ }
1583
+ }
1584
+ for (let i = 0, r; i < recognizers.length; i++) {
1585
+ r = recognizers[i];
1586
+ if (gs[r.name] && !handled[r.name]) {
1587
+ handled[r.name] = true;
1588
+ r[type](ev);
1589
+ }
1590
+ }
1591
+ }
1592
+ function _handleTouchAction(ev) {
1593
+ let t = ev.changedTouches[0];
1594
+ let type = ev.type;
1595
+ if (type === "touchstart") {
1596
+ POINTERSTATE.touch.x = t.clientX;
1597
+ POINTERSTATE.touch.y = t.clientY;
1598
+ POINTERSTATE.touch.scrollDecided = false;
1599
+ } else if (type === "touchmove") {
1600
+ if (POINTERSTATE.touch.scrollDecided) {
1601
+ return;
1602
+ }
1603
+ POINTERSTATE.touch.scrollDecided = true;
1604
+ let ta = firstTouchAction(ev);
1605
+ let shouldPrevent = false;
1606
+ let dx = Math.abs(POINTERSTATE.touch.x - t.clientX);
1607
+ let dy = Math.abs(POINTERSTATE.touch.y - t.clientY);
1608
+ if (!ev.cancelable) {
1609
+ } else if (ta === "none") {
1610
+ shouldPrevent = true;
1611
+ } else if (ta === "pan-x") {
1612
+ shouldPrevent = dy > dx;
1613
+ } else if (ta === "pan-y") {
1614
+ shouldPrevent = dx > dy;
1615
+ }
1616
+ if (shouldPrevent) {
1617
+ ev.preventDefault();
1618
+ } else {
1619
+ prevent("track");
1620
+ }
1621
+ }
1622
+ }
1623
+ function addListener(node, evType, handler) {
1624
+ if (gestures[evType]) {
1625
+ _add(node, evType, handler);
1626
+ return true;
1627
+ }
1628
+ return false;
1629
+ }
1630
+ function removeListener(node, evType, handler) {
1631
+ if (gestures[evType]) {
1632
+ _remove(node, evType, handler);
1633
+ return true;
1634
+ }
1635
+ return false;
1636
+ }
1637
+ function _add(node, evType, handler) {
1638
+ let recognizer = gestures[evType];
1639
+ let deps = recognizer.deps;
1640
+ let name = recognizer.name;
1641
+ let gobj = node[GESTURE_KEY];
1642
+ if (!gobj) {
1643
+ node[GESTURE_KEY] = gobj = {};
1644
+ }
1645
+ for (let i = 0, dep, gd; i < deps.length; i++) {
1646
+ dep = deps[i];
1647
+ if (IS_TOUCH_ONLY && isMouseEvent(dep) && dep !== "click") {
1648
+ continue;
1649
+ }
1650
+ gd = gobj[dep];
1651
+ if (!gd) {
1652
+ gobj[dep] = gd = { _count: 0 };
1653
+ }
1654
+ if (gd._count === 0) {
1655
+ node.addEventListener(dep, _handleNative, PASSIVE_TOUCH(dep));
1656
+ }
1657
+ gd[name] = (gd[name] || 0) + 1;
1658
+ gd._count = (gd._count || 0) + 1;
1659
+ }
1660
+ node.addEventListener(evType, handler);
1661
+ if (recognizer.touchAction) {
1662
+ setTouchAction(node, recognizer.touchAction);
1663
+ }
1664
+ }
1665
+ function _remove(node, evType, handler) {
1666
+ let recognizer = gestures[evType];
1667
+ let deps = recognizer.deps;
1668
+ let name = recognizer.name;
1669
+ let gobj = node[GESTURE_KEY];
1670
+ if (gobj) {
1671
+ for (let i = 0, dep, gd; i < deps.length; i++) {
1672
+ dep = deps[i];
1673
+ gd = gobj[dep];
1674
+ if (gd && gd[name]) {
1675
+ gd[name] = (gd[name] || 1) - 1;
1676
+ gd._count = (gd._count || 1) - 1;
1677
+ if (gd._count === 0) {
1678
+ node.removeEventListener(dep, _handleNative, PASSIVE_TOUCH(dep));
1679
+ }
1680
+ }
1681
+ }
1682
+ }
1683
+ node.removeEventListener(evType, handler);
1684
+ }
1685
+ function register2(recog) {
1686
+ recognizers.push(recog);
1687
+ for (let i = 0; i < recog.emits.length; i++) {
1688
+ gestures[recog.emits[i]] = recog;
1689
+ }
1690
+ }
1691
+ function _findRecognizerByEvent(evName) {
1692
+ for (let i = 0, r; i < recognizers.length; i++) {
1693
+ r = recognizers[i];
1694
+ for (let j = 0, n; j < r.emits.length; j++) {
1695
+ n = r.emits[j];
1696
+ if (n === evName) {
1697
+ return r;
1698
+ }
1699
+ }
1700
+ }
1701
+ return null;
1702
+ }
1703
+ function setTouchAction(node, value) {
1704
+ if (HAS_NATIVE_TA && node instanceof HTMLElement) {
1705
+ microTask.run(() => {
1706
+ node.style.touchAction = value;
1707
+ });
1708
+ }
1709
+ node[TOUCH_ACTION] = value;
1710
+ }
1711
+ function _fire(target, type, detail) {
1712
+ let ev = new Event(type, { bubbles: true, cancelable: true, composed: true });
1713
+ ev.detail = detail;
1714
+ wrap(
1715
+ /** @type {!Node} */
1716
+ target
1717
+ ).dispatchEvent(ev);
1718
+ if (ev.defaultPrevented) {
1719
+ let preventer = detail.preventer || detail.sourceEvent;
1720
+ if (preventer && preventer.preventDefault) {
1721
+ preventer.preventDefault();
1722
+ }
1723
+ }
1724
+ }
1725
+ function prevent(evName) {
1726
+ let recognizer = _findRecognizerByEvent(evName);
1727
+ if (recognizer.info) {
1728
+ recognizer.info.prevent = true;
1729
+ }
1730
+ }
1731
+ register2({
1732
+ name: "downup",
1733
+ deps: ["mousedown", "touchstart", "touchend"],
1734
+ flow: {
1735
+ start: ["mousedown", "touchstart"],
1736
+ end: ["mouseup", "touchend"]
1737
+ },
1738
+ emits: ["down", "up"],
1739
+ info: {
1740
+ movefn: null,
1741
+ upfn: null
1742
+ },
1743
+ /**
1744
+ * @this {GestureRecognizer}
1745
+ * @return {void}
1746
+ */
1747
+ reset: function() {
1748
+ untrackDocument(this.info);
1749
+ },
1750
+ /**
1751
+ * @this {GestureRecognizer}
1752
+ * @param {MouseEvent} e
1753
+ * @return {void}
1754
+ */
1755
+ mousedown: function(e) {
1756
+ if (!hasLeftMouseButton(e)) {
1757
+ return;
1758
+ }
1759
+ let t = _findOriginalTarget(e);
1760
+ let self = this;
1761
+ let movefn = function movefn2(e2) {
1762
+ if (!hasLeftMouseButton(e2)) {
1763
+ downupFire("up", t, e2);
1764
+ untrackDocument(self.info);
1765
+ }
1766
+ };
1767
+ let upfn = function upfn2(e2) {
1768
+ if (hasLeftMouseButton(e2)) {
1769
+ downupFire("up", t, e2);
1770
+ }
1771
+ untrackDocument(self.info);
1772
+ };
1773
+ trackDocument(this.info, movefn, upfn);
1774
+ downupFire("down", t, e);
1775
+ },
1776
+ /**
1777
+ * @this {GestureRecognizer}
1778
+ * @param {TouchEvent} e
1779
+ * @return {void}
1780
+ */
1781
+ touchstart: function(e) {
1782
+ downupFire("down", _findOriginalTarget(e), e.changedTouches[0], e);
1783
+ },
1784
+ /**
1785
+ * @this {GestureRecognizer}
1786
+ * @param {TouchEvent} e
1787
+ * @return {void}
1788
+ */
1789
+ touchend: function(e) {
1790
+ downupFire("up", _findOriginalTarget(e), e.changedTouches[0], e);
1791
+ }
1792
+ });
1793
+ function downupFire(type, target, event, preventer) {
1794
+ if (!target) {
1795
+ return;
1796
+ }
1797
+ _fire(target, type, {
1798
+ x: event.clientX,
1799
+ y: event.clientY,
1800
+ sourceEvent: event,
1801
+ preventer,
1802
+ prevent: function(e) {
1803
+ return prevent(e);
1804
+ }
1805
+ });
1806
+ }
1807
+ register2({
1808
+ name: "track",
1809
+ touchAction: "none",
1810
+ deps: ["mousedown", "touchstart", "touchmove", "touchend"],
1811
+ flow: {
1812
+ start: ["mousedown", "touchstart"],
1813
+ end: ["mouseup", "touchend"]
1814
+ },
1815
+ emits: ["track"],
1816
+ info: {
1817
+ x: 0,
1818
+ y: 0,
1819
+ state: "start",
1820
+ started: false,
1821
+ moves: [],
1822
+ /** @this {GestureInfo} */
1823
+ addMove: function(move) {
1824
+ if (this.moves.length > TRACK_LENGTH) {
1825
+ this.moves.shift();
1826
+ }
1827
+ this.moves.push(move);
1828
+ },
1829
+ movefn: null,
1830
+ upfn: null,
1831
+ prevent: false
1832
+ },
1833
+ /**
1834
+ * @this {GestureRecognizer}
1835
+ * @return {void}
1836
+ */
1837
+ reset: function() {
1838
+ this.info.state = "start";
1839
+ this.info.started = false;
1840
+ this.info.moves = [];
1841
+ this.info.x = 0;
1842
+ this.info.y = 0;
1843
+ this.info.prevent = false;
1844
+ untrackDocument(this.info);
1845
+ },
1846
+ /**
1847
+ * @this {GestureRecognizer}
1848
+ * @param {MouseEvent} e
1849
+ * @return {void}
1850
+ */
1851
+ mousedown: function(e) {
1852
+ if (!hasLeftMouseButton(e)) {
1853
+ return;
1854
+ }
1855
+ let t = _findOriginalTarget(e);
1856
+ let self = this;
1857
+ let movefn = function movefn2(e2) {
1858
+ let x = e2.clientX, y = e2.clientY;
1859
+ if (trackHasMovedEnough(self.info, x, y)) {
1860
+ self.info.state = self.info.started ? e2.type === "mouseup" ? "end" : "track" : "start";
1861
+ if (self.info.state === "start") {
1862
+ prevent("tap");
1863
+ }
1864
+ self.info.addMove({ x, y });
1865
+ if (!hasLeftMouseButton(e2)) {
1866
+ self.info.state = "end";
1867
+ untrackDocument(self.info);
1868
+ }
1869
+ if (t) {
1870
+ trackFire(self.info, t, e2);
1871
+ }
1872
+ self.info.started = true;
1873
+ }
1874
+ };
1875
+ let upfn = function upfn2(e2) {
1876
+ if (self.info.started) {
1877
+ movefn(e2);
1878
+ }
1879
+ untrackDocument(self.info);
1880
+ };
1881
+ trackDocument(this.info, movefn, upfn);
1882
+ this.info.x = e.clientX;
1883
+ this.info.y = e.clientY;
1884
+ },
1885
+ /**
1886
+ * @this {GestureRecognizer}
1887
+ * @param {TouchEvent} e
1888
+ * @return {void}
1889
+ */
1890
+ touchstart: function(e) {
1891
+ let ct = e.changedTouches[0];
1892
+ this.info.x = ct.clientX;
1893
+ this.info.y = ct.clientY;
1894
+ },
1895
+ /**
1896
+ * @this {GestureRecognizer}
1897
+ * @param {TouchEvent} e
1898
+ * @return {void}
1899
+ */
1900
+ touchmove: function(e) {
1901
+ let t = _findOriginalTarget(e);
1902
+ let ct = e.changedTouches[0];
1903
+ let x = ct.clientX, y = ct.clientY;
1904
+ if (trackHasMovedEnough(this.info, x, y)) {
1905
+ if (this.info.state === "start") {
1906
+ prevent("tap");
1907
+ }
1908
+ this.info.addMove({ x, y });
1909
+ trackFire(this.info, t, ct);
1910
+ this.info.state = "track";
1911
+ this.info.started = true;
1912
+ }
1913
+ },
1914
+ /**
1915
+ * @this {GestureRecognizer}
1916
+ * @param {TouchEvent} e
1917
+ * @return {void}
1918
+ */
1919
+ touchend: function(e) {
1920
+ let t = _findOriginalTarget(e);
1921
+ let ct = e.changedTouches[0];
1922
+ if (this.info.started) {
1923
+ this.info.state = "end";
1924
+ this.info.addMove({ x: ct.clientX, y: ct.clientY });
1925
+ trackFire(this.info, t, ct);
1926
+ }
1927
+ }
1928
+ });
1929
+ function trackHasMovedEnough(info, x, y) {
1930
+ if (info.prevent) {
1931
+ return false;
1932
+ }
1933
+ if (info.started) {
1934
+ return true;
1935
+ }
1936
+ let dx = Math.abs(info.x - x);
1937
+ let dy = Math.abs(info.y - y);
1938
+ return dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE;
1939
+ }
1940
+ function trackFire(info, target, touch) {
1941
+ if (!target) {
1942
+ return;
1943
+ }
1944
+ let secondlast = info.moves[info.moves.length - 2];
1945
+ let lastmove = info.moves[info.moves.length - 1];
1946
+ let dx = lastmove.x - info.x;
1947
+ let dy = lastmove.y - info.y;
1948
+ let ddx, ddy = 0;
1949
+ if (secondlast) {
1950
+ ddx = lastmove.x - secondlast.x;
1951
+ ddy = lastmove.y - secondlast.y;
1952
+ }
1953
+ _fire(target, "track", {
1954
+ state: info.state,
1955
+ x: touch.clientX,
1956
+ y: touch.clientY,
1957
+ dx,
1958
+ dy,
1959
+ ddx,
1960
+ ddy,
1961
+ sourceEvent: touch,
1962
+ hover: function() {
1963
+ return deepTargetFind(touch.clientX, touch.clientY);
1964
+ }
1965
+ });
1966
+ }
1967
+ register2({
1968
+ name: "tap",
1969
+ deps: ["mousedown", "click", "touchstart", "touchend"],
1970
+ flow: {
1971
+ start: ["mousedown", "touchstart"],
1972
+ end: ["click", "touchend"]
1973
+ },
1974
+ emits: ["tap"],
1975
+ info: {
1976
+ x: NaN,
1977
+ y: NaN,
1978
+ prevent: false
1979
+ },
1980
+ /**
1981
+ * @this {GestureRecognizer}
1982
+ * @return {void}
1983
+ */
1984
+ reset: function() {
1985
+ this.info.x = NaN;
1986
+ this.info.y = NaN;
1987
+ this.info.prevent = false;
1988
+ },
1989
+ /**
1990
+ * @this {GestureRecognizer}
1991
+ * @param {MouseEvent} e
1992
+ * @return {void}
1993
+ */
1994
+ mousedown: function(e) {
1995
+ if (hasLeftMouseButton(e)) {
1996
+ this.info.x = e.clientX;
1997
+ this.info.y = e.clientY;
1998
+ }
1999
+ },
2000
+ /**
2001
+ * @this {GestureRecognizer}
2002
+ * @param {MouseEvent} e
2003
+ * @return {void}
2004
+ */
2005
+ click: function(e) {
2006
+ if (hasLeftMouseButton(e)) {
2007
+ trackForward(this.info, e);
2008
+ }
2009
+ },
2010
+ /**
2011
+ * @this {GestureRecognizer}
2012
+ * @param {TouchEvent} e
2013
+ * @return {void}
2014
+ */
2015
+ touchstart: function(e) {
2016
+ const touch = e.changedTouches[0];
2017
+ this.info.x = touch.clientX;
2018
+ this.info.y = touch.clientY;
2019
+ },
2020
+ /**
2021
+ * @this {GestureRecognizer}
2022
+ * @param {TouchEvent} e
2023
+ * @return {void}
2024
+ */
2025
+ touchend: function(e) {
2026
+ trackForward(this.info, e.changedTouches[0], e);
2027
+ }
2028
+ });
2029
+ function trackForward(info, e, preventer) {
2030
+ let dx = Math.abs(e.clientX - info.x);
2031
+ let dy = Math.abs(e.clientY - info.y);
2032
+ let t = _findOriginalTarget(preventer || e);
2033
+ if (!t || canBeDisabled[
2034
+ /** @type {!HTMLElement} */
2035
+ t.localName
2036
+ ] && t.hasAttribute("disabled")) {
2037
+ return;
2038
+ }
2039
+ if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE || isSyntheticClick(e)) {
2040
+ if (!info.prevent) {
2041
+ _fire(t, "tap", {
2042
+ x: e.clientX,
2043
+ y: e.clientY,
2044
+ sourceEvent: e,
2045
+ preventer
2046
+ });
2047
+ }
2048
+ }
2049
+ }
2050
+
2051
+ // ../../../node_modules/@polymer/polymer/lib/mixins/gesture-event-listeners.js
2052
+ var GestureEventListeners = dedupingMixin((superClass) => {
2053
+ class GestureEventListeners2 extends superClass {
2054
+ /**
2055
+ * Add the event listener to the node if it is a gestures event.
2056
+ *
2057
+ * @param {!EventTarget} node Node to add event listener to
2058
+ * @param {string} eventName Name of event
2059
+ * @param {function(!Event):void} handler Listener function to add
2060
+ * @return {void}
2061
+ * @override
2062
+ */
2063
+ _addEventListenerToNode(node, eventName, handler) {
2064
+ if (!addListener(node, eventName, handler)) {
2065
+ super._addEventListenerToNode(node, eventName, handler);
2066
+ }
2067
+ }
2068
+ /**
2069
+ * Remove the event listener to the node if it is a gestures event.
2070
+ *
2071
+ * @param {!EventTarget} node Node to remove event listener from
2072
+ * @param {string} eventName Name of event
2073
+ * @param {function(!Event):void} handler Listener function to remove
2074
+ * @return {void}
2075
+ * @override
2076
+ */
2077
+ _removeEventListenerFromNode(node, eventName, handler) {
2078
+ if (!removeListener(node, eventName, handler)) {
2079
+ super._removeEventListenerFromNode(node, eventName, handler);
2080
+ }
2081
+ }
2082
+ }
2083
+ return GestureEventListeners2;
2084
+ });
2085
+
2086
+ // ../../../node_modules/@polymer/polymer/lib/mixins/dir-mixin.js
2087
+ var HOST_DIR = /:host\(:dir\((ltr|rtl)\)\)/g;
2088
+ var HOST_DIR_REPLACMENT = ':host([dir="$1"])';
2089
+ var EL_DIR = /([\s\w-#\.\[\]\*]*):dir\((ltr|rtl)\)/g;
2090
+ var EL_DIR_REPLACMENT = ':host([dir="$2"]) $1';
2091
+ var DIR_CHECK = /:dir\((?:ltr|rtl)\)/;
2092
+ var SHIM_SHADOW = Boolean(window["ShadyDOM"] && window["ShadyDOM"]["inUse"]);
2093
+ var DIR_INSTANCES = [];
2094
+ var observer = null;
2095
+ var documentDir = "";
2096
+ function getRTL() {
2097
+ documentDir = document.documentElement.getAttribute("dir");
2098
+ }
2099
+ function setRTL(instance) {
2100
+ if (!instance.__autoDirOptOut) {
2101
+ const el = (
2102
+ /** @type {!HTMLElement} */
2103
+ instance
2104
+ );
2105
+ el.setAttribute("dir", documentDir);
2106
+ }
2107
+ }
2108
+ function updateDirection() {
2109
+ getRTL();
2110
+ documentDir = document.documentElement.getAttribute("dir");
2111
+ for (let i = 0; i < DIR_INSTANCES.length; i++) {
2112
+ setRTL(DIR_INSTANCES[i]);
2113
+ }
2114
+ }
2115
+ function takeRecords() {
2116
+ if (observer && observer.takeRecords().length) {
2117
+ updateDirection();
2118
+ }
2119
+ }
2120
+ var DirMixin = dedupingMixin((base) => {
2121
+ if (!SHIM_SHADOW) {
2122
+ if (!observer) {
2123
+ getRTL();
2124
+ observer = new MutationObserver(updateDirection);
2125
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ["dir"] });
2126
+ }
2127
+ }
2128
+ const elementBase = PropertyAccessors(base);
2129
+ class Dir extends elementBase {
2130
+ /**
2131
+ * @param {string} cssText .
2132
+ * @param {string} baseURI .
2133
+ * @return {string} .
2134
+ * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
2135
+ * @nocollapse
2136
+ */
2137
+ static _processStyleText(cssText, baseURI) {
2138
+ cssText = elementBase._processStyleText.call(this, cssText, baseURI);
2139
+ if (!SHIM_SHADOW && DIR_CHECK.test(cssText)) {
2140
+ cssText = this._replaceDirInCssText(cssText);
2141
+ this.__activateDir = true;
2142
+ }
2143
+ return cssText;
2144
+ }
2145
+ /**
2146
+ * Replace `:dir` in the given CSS text
2147
+ *
2148
+ * @param {string} text CSS text to replace DIR
2149
+ * @return {string} Modified CSS
2150
+ * @nocollapse
2151
+ */
2152
+ static _replaceDirInCssText(text) {
2153
+ let replacedText = text;
2154
+ replacedText = replacedText.replace(HOST_DIR, HOST_DIR_REPLACMENT);
2155
+ replacedText = replacedText.replace(EL_DIR, EL_DIR_REPLACMENT);
2156
+ return replacedText;
2157
+ }
2158
+ constructor() {
2159
+ super();
2160
+ this.__autoDirOptOut = false;
2161
+ }
2162
+ /**
2163
+ * @override
2164
+ * @suppress {invalidCasts} Closure doesn't understand that `this` is an
2165
+ * HTMLElement
2166
+ * @return {void}
2167
+ */
2168
+ ready() {
2169
+ super.ready();
2170
+ this.__autoDirOptOut = /** @type {!HTMLElement} */
2171
+ this.hasAttribute("dir");
2172
+ }
2173
+ /**
2174
+ * @override
2175
+ * @suppress {missingProperties} If it exists on elementBase, it can be
2176
+ * super'd
2177
+ * @return {void}
2178
+ */
2179
+ connectedCallback() {
2180
+ if (elementBase.prototype.connectedCallback) {
2181
+ super.connectedCallback();
2182
+ }
2183
+ if (this.constructor.__activateDir) {
2184
+ takeRecords();
2185
+ DIR_INSTANCES.push(this);
2186
+ setRTL(this);
2187
+ }
2188
+ }
2189
+ /**
2190
+ * @override
2191
+ * @suppress {missingProperties} If it exists on elementBase, it can be
2192
+ * super'd
2193
+ * @return {void}
2194
+ */
2195
+ disconnectedCallback() {
2196
+ if (elementBase.prototype.disconnectedCallback) {
2197
+ super.disconnectedCallback();
2198
+ }
2199
+ if (this.constructor.__activateDir) {
2200
+ const idx = DIR_INSTANCES.indexOf(this);
2201
+ if (idx > -1) {
2202
+ DIR_INSTANCES.splice(idx, 1);
2203
+ }
2204
+ }
2205
+ }
2206
+ }
2207
+ Dir.__activateDir = false;
2208
+ return Dir;
2209
+ });
2210
+
2211
+ // ../../../node_modules/@polymer/polymer/lib/utils/unresolved.js
2212
+ function resolve() {
2213
+ document.body.removeAttribute("unresolved");
2214
+ }
2215
+ if (document.readyState === "interactive" || document.readyState === "complete") {
2216
+ resolve();
2217
+ } else {
2218
+ window.addEventListener("DOMContentLoaded", resolve);
2219
+ }
2220
+
2221
+ // ../../../node_modules/@polymer/polymer/lib/utils/array-splice.js
2222
+ function newSplice(index, removed, addedCount) {
2223
+ return {
2224
+ index,
2225
+ removed,
2226
+ addedCount
2227
+ };
2228
+ }
2229
+ var EDIT_LEAVE = 0;
2230
+ var EDIT_UPDATE = 1;
2231
+ var EDIT_ADD = 2;
2232
+ var EDIT_DELETE = 3;
2233
+ function calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) {
2234
+ let rowCount = oldEnd - oldStart + 1;
2235
+ let columnCount = currentEnd - currentStart + 1;
2236
+ let distances = new Array(rowCount);
2237
+ for (let i = 0; i < rowCount; i++) {
2238
+ distances[i] = new Array(columnCount);
2239
+ distances[i][0] = i;
2240
+ }
2241
+ for (let j = 0; j < columnCount; j++)
2242
+ distances[0][j] = j;
2243
+ for (let i = 1; i < rowCount; i++) {
2244
+ for (let j = 1; j < columnCount; j++) {
2245
+ if (equals(current[currentStart + j - 1], old[oldStart + i - 1]))
2246
+ distances[i][j] = distances[i - 1][j - 1];
2247
+ else {
2248
+ let north = distances[i - 1][j] + 1;
2249
+ let west = distances[i][j - 1] + 1;
2250
+ distances[i][j] = north < west ? north : west;
2251
+ }
2252
+ }
2253
+ }
2254
+ return distances;
2255
+ }
2256
+ function spliceOperationsFromEditDistances(distances) {
2257
+ let i = distances.length - 1;
2258
+ let j = distances[0].length - 1;
2259
+ let current = distances[i][j];
2260
+ let edits = [];
2261
+ while (i > 0 || j > 0) {
2262
+ if (i == 0) {
2263
+ edits.push(EDIT_ADD);
2264
+ j--;
2265
+ continue;
2266
+ }
2267
+ if (j == 0) {
2268
+ edits.push(EDIT_DELETE);
2269
+ i--;
2270
+ continue;
2271
+ }
2272
+ let northWest = distances[i - 1][j - 1];
2273
+ let west = distances[i - 1][j];
2274
+ let north = distances[i][j - 1];
2275
+ let min;
2276
+ if (west < north)
2277
+ min = west < northWest ? west : northWest;
2278
+ else
2279
+ min = north < northWest ? north : northWest;
2280
+ if (min == northWest) {
2281
+ if (northWest == current) {
2282
+ edits.push(EDIT_LEAVE);
2283
+ } else {
2284
+ edits.push(EDIT_UPDATE);
2285
+ current = northWest;
2286
+ }
2287
+ i--;
2288
+ j--;
2289
+ } else if (min == west) {
2290
+ edits.push(EDIT_DELETE);
2291
+ i--;
2292
+ current = west;
2293
+ } else {
2294
+ edits.push(EDIT_ADD);
2295
+ j--;
2296
+ current = north;
2297
+ }
2298
+ }
2299
+ edits.reverse();
2300
+ return edits;
2301
+ }
2302
+ function calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd) {
2303
+ let prefixCount = 0;
2304
+ let suffixCount = 0;
2305
+ let splice;
2306
+ let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
2307
+ if (currentStart == 0 && oldStart == 0)
2308
+ prefixCount = sharedPrefix(current, old, minLength);
2309
+ if (currentEnd == current.length && oldEnd == old.length)
2310
+ suffixCount = sharedSuffix(current, old, minLength - prefixCount);
2311
+ currentStart += prefixCount;
2312
+ oldStart += prefixCount;
2313
+ currentEnd -= suffixCount;
2314
+ oldEnd -= suffixCount;
2315
+ if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)
2316
+ return [];
2317
+ if (currentStart == currentEnd) {
2318
+ splice = newSplice(currentStart, [], 0);
2319
+ while (oldStart < oldEnd)
2320
+ splice.removed.push(old[oldStart++]);
2321
+ return [splice];
2322
+ } else if (oldStart == oldEnd)
2323
+ return [newSplice(currentStart, [], currentEnd - currentStart)];
2324
+ let ops = spliceOperationsFromEditDistances(
2325
+ calcEditDistances(
2326
+ current,
2327
+ currentStart,
2328
+ currentEnd,
2329
+ old,
2330
+ oldStart,
2331
+ oldEnd
2332
+ )
2333
+ );
2334
+ splice = void 0;
2335
+ let splices = [];
2336
+ let index = currentStart;
2337
+ let oldIndex = oldStart;
2338
+ for (let i = 0; i < ops.length; i++) {
2339
+ switch (ops[i]) {
2340
+ case EDIT_LEAVE:
2341
+ if (splice) {
2342
+ splices.push(splice);
2343
+ splice = void 0;
2344
+ }
2345
+ index++;
2346
+ oldIndex++;
2347
+ break;
2348
+ case EDIT_UPDATE:
2349
+ if (!splice)
2350
+ splice = newSplice(index, [], 0);
2351
+ splice.addedCount++;
2352
+ index++;
2353
+ splice.removed.push(old[oldIndex]);
2354
+ oldIndex++;
2355
+ break;
2356
+ case EDIT_ADD:
2357
+ if (!splice)
2358
+ splice = newSplice(index, [], 0);
2359
+ splice.addedCount++;
2360
+ index++;
2361
+ break;
2362
+ case EDIT_DELETE:
2363
+ if (!splice)
2364
+ splice = newSplice(index, [], 0);
2365
+ splice.removed.push(old[oldIndex]);
2366
+ oldIndex++;
2367
+ break;
2368
+ }
2369
+ }
2370
+ if (splice) {
2371
+ splices.push(splice);
2372
+ }
2373
+ return splices;
2374
+ }
2375
+ function sharedPrefix(current, old, searchLength) {
2376
+ for (let i = 0; i < searchLength; i++)
2377
+ if (!equals(current[i], old[i]))
2378
+ return i;
2379
+ return searchLength;
2380
+ }
2381
+ function sharedSuffix(current, old, searchLength) {
2382
+ let index1 = current.length;
2383
+ let index2 = old.length;
2384
+ let count = 0;
2385
+ while (count < searchLength && equals(current[--index1], old[--index2]))
2386
+ count++;
2387
+ return count;
2388
+ }
2389
+ function calculateSplices(current, previous) {
2390
+ return calcSplices(
2391
+ current,
2392
+ 0,
2393
+ current.length,
2394
+ previous,
2395
+ 0,
2396
+ previous.length
2397
+ );
2398
+ }
2399
+ function equals(currentValue, previousValue) {
2400
+ return currentValue === previousValue;
2401
+ }
2402
+
2403
+ // ../../../node_modules/@polymer/polymer/lib/utils/flattened-nodes-observer.js
2404
+ function isSlot(node) {
2405
+ return node.localName === "slot";
2406
+ }
2407
+ var FlattenedNodesObserver = class {
2408
+ /**
2409
+ * Returns the list of flattened nodes for the given `node`.
2410
+ * This list consists of a node's children and, for any children
2411
+ * that are `<slot>` elements, the expanded flattened list of `assignedNodes`.
2412
+ * For example, if the observed node has children `<a></a><slot></slot><b></b>`
2413
+ * and the `<slot>` has one `<div>` assigned to it, then the flattened
2414
+ * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other
2415
+ * `<slot>` elements assigned to it, these are flattened as well.
2416
+ *
2417
+ * @param {!HTMLElement|!HTMLSlotElement} node The node for which to
2418
+ * return the list of flattened nodes.
2419
+ * @return {!Array<!Node>} The list of flattened nodes for the given `node`.
2420
+ * @nocollapse See https://github.com/google/closure-compiler/issues/2763
2421
+ */
2422
+ // eslint-disable-next-line
2423
+ static getFlattenedNodes(node) {
2424
+ const wrapped = wrap(node);
2425
+ if (isSlot(node)) {
2426
+ node = /** @type {!HTMLSlotElement} */
2427
+ node;
2428
+ return wrapped.assignedNodes({ flatten: true });
2429
+ } else {
2430
+ const results = [];
2431
+ for (let i = 0; i < wrapped.childNodes.length; i++) {
2432
+ const node2 = wrapped.childNodes[i];
2433
+ if (isSlot(node2)) {
2434
+ const slotNode = (
2435
+ /** @type {!HTMLSlotElement} */
2436
+ node2
2437
+ );
2438
+ results.push(...wrap(slotNode).assignedNodes({ flatten: true }));
2439
+ } else {
2440
+ results.push(node2);
2441
+ }
2442
+ }
2443
+ return results;
2444
+ }
2445
+ }
2446
+ /**
2447
+ * @param {!HTMLElement} target Node on which to listen for changes.
2448
+ * @param {?function(this: Element, { target: !HTMLElement, addedNodes: !Array<!Element>, removedNodes: !Array<!Element> }):void} callback Function called when there are additions
2449
+ * or removals from the target's list of flattened nodes.
2450
+ */
2451
+ // eslint-disable-next-line
2452
+ constructor(target, callback) {
2453
+ this._shadyChildrenObserver = null;
2454
+ this._nativeChildrenObserver = null;
2455
+ this._connected = false;
2456
+ this._target = target;
2457
+ this.callback = callback;
2458
+ this._effectiveNodes = [];
2459
+ this._observer = null;
2460
+ this._scheduled = false;
2461
+ this._boundSchedule = () => {
2462
+ this._schedule();
2463
+ };
2464
+ this.connect();
2465
+ this._schedule();
2466
+ }
2467
+ /**
2468
+ * Activates an observer. This method is automatically called when
2469
+ * a `FlattenedNodesObserver` is created. It should only be called to
2470
+ * re-activate an observer that has been deactivated via the `disconnect` method.
2471
+ *
2472
+ * @return {void}
2473
+ */
2474
+ connect() {
2475
+ if (isSlot(this._target)) {
2476
+ this._listenSlots([this._target]);
2477
+ } else if (wrap(this._target).children) {
2478
+ this._listenSlots(
2479
+ /** @type {!NodeList<!Node>} */
2480
+ wrap(this._target).children
2481
+ );
2482
+ if (window.ShadyDOM) {
2483
+ this._shadyChildrenObserver = window.ShadyDOM.observeChildren(this._target, (mutations) => {
2484
+ this._processMutations(mutations);
2485
+ });
2486
+ } else {
2487
+ this._nativeChildrenObserver = new MutationObserver((mutations) => {
2488
+ this._processMutations(mutations);
2489
+ });
2490
+ this._nativeChildrenObserver.observe(this._target, { childList: true });
2491
+ }
2492
+ }
2493
+ this._connected = true;
2494
+ }
2495
+ /**
2496
+ * Deactivates the flattened nodes observer. After calling this method
2497
+ * the observer callback will not be called when changes to flattened nodes
2498
+ * occur. The `connect` method may be subsequently called to reactivate
2499
+ * the observer.
2500
+ *
2501
+ * @return {void}
2502
+ * @override
2503
+ */
2504
+ disconnect() {
2505
+ if (isSlot(this._target)) {
2506
+ this._unlistenSlots([this._target]);
2507
+ } else if (wrap(this._target).children) {
2508
+ this._unlistenSlots(
2509
+ /** @type {!NodeList<!Node>} */
2510
+ wrap(this._target).children
2511
+ );
2512
+ if (window.ShadyDOM && this._shadyChildrenObserver) {
2513
+ window.ShadyDOM.unobserveChildren(this._shadyChildrenObserver);
2514
+ this._shadyChildrenObserver = null;
2515
+ } else if (this._nativeChildrenObserver) {
2516
+ this._nativeChildrenObserver.disconnect();
2517
+ this._nativeChildrenObserver = null;
2518
+ }
2519
+ }
2520
+ this._connected = false;
2521
+ }
2522
+ /**
2523
+ * @return {void}
2524
+ * @private
2525
+ */
2526
+ _schedule() {
2527
+ if (!this._scheduled) {
2528
+ this._scheduled = true;
2529
+ microTask.run(() => this.flush());
2530
+ }
2531
+ }
2532
+ /**
2533
+ * @param {Array<MutationRecord>} mutations Mutations signaled by the mutation observer
2534
+ * @return {void}
2535
+ * @private
2536
+ */
2537
+ _processMutations(mutations) {
2538
+ this._processSlotMutations(mutations);
2539
+ this.flush();
2540
+ }
2541
+ /**
2542
+ * @param {Array<MutationRecord>} mutations Mutations signaled by the mutation observer
2543
+ * @return {void}
2544
+ * @private
2545
+ */
2546
+ _processSlotMutations(mutations) {
2547
+ if (mutations) {
2548
+ for (let i = 0; i < mutations.length; i++) {
2549
+ let mutation = mutations[i];
2550
+ if (mutation.addedNodes) {
2551
+ this._listenSlots(mutation.addedNodes);
2552
+ }
2553
+ if (mutation.removedNodes) {
2554
+ this._unlistenSlots(mutation.removedNodes);
2555
+ }
2556
+ }
2557
+ }
2558
+ }
2559
+ /**
2560
+ * Flushes the observer causing any pending changes to be immediately
2561
+ * delivered the observer callback. By default these changes are delivered
2562
+ * asynchronously at the next microtask checkpoint.
2563
+ *
2564
+ * @return {boolean} Returns true if any pending changes caused the observer
2565
+ * callback to run.
2566
+ */
2567
+ flush() {
2568
+ if (!this._connected) {
2569
+ return false;
2570
+ }
2571
+ if (window.ShadyDOM) {
2572
+ ShadyDOM.flush();
2573
+ }
2574
+ if (this._nativeChildrenObserver) {
2575
+ this._processSlotMutations(this._nativeChildrenObserver.takeRecords());
2576
+ } else if (this._shadyChildrenObserver) {
2577
+ this._processSlotMutations(this._shadyChildrenObserver.takeRecords());
2578
+ }
2579
+ this._scheduled = false;
2580
+ let info = {
2581
+ target: this._target,
2582
+ addedNodes: [],
2583
+ removedNodes: []
2584
+ };
2585
+ let newNodes = this.constructor.getFlattenedNodes(this._target);
2586
+ let splices = calculateSplices(
2587
+ newNodes,
2588
+ this._effectiveNodes
2589
+ );
2590
+ for (let i = 0, s; i < splices.length && (s = splices[i]); i++) {
2591
+ for (let j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
2592
+ info.removedNodes.push(n);
2593
+ }
2594
+ }
2595
+ for (let i = 0, s; i < splices.length && (s = splices[i]); i++) {
2596
+ for (let j = s.index; j < s.index + s.addedCount; j++) {
2597
+ info.addedNodes.push(newNodes[j]);
2598
+ }
2599
+ }
2600
+ this._effectiveNodes = newNodes;
2601
+ let didFlush = false;
2602
+ if (info.addedNodes.length || info.removedNodes.length) {
2603
+ didFlush = true;
2604
+ this.callback.call(this._target, info);
2605
+ }
2606
+ return didFlush;
2607
+ }
2608
+ /**
2609
+ * @param {!Array<!Node>|!NodeList<!Node>} nodeList Nodes that could change
2610
+ * @return {void}
2611
+ * @private
2612
+ */
2613
+ _listenSlots(nodeList) {
2614
+ for (let i = 0; i < nodeList.length; i++) {
2615
+ let n = nodeList[i];
2616
+ if (isSlot(n)) {
2617
+ n.addEventListener("slotchange", this._boundSchedule);
2618
+ }
2619
+ }
2620
+ }
2621
+ /**
2622
+ * @param {!Array<!Node>|!NodeList<!Node>} nodeList Nodes that could change
2623
+ * @return {void}
2624
+ * @private
2625
+ */
2626
+ _unlistenSlots(nodeList) {
2627
+ for (let i = 0; i < nodeList.length; i++) {
2628
+ let n = nodeList[i];
2629
+ if (isSlot(n)) {
2630
+ n.removeEventListener("slotchange", this._boundSchedule);
2631
+ }
2632
+ }
2633
+ }
2634
+ };
2635
+
2636
+ // ../../../node_modules/@polymer/polymer/lib/utils/flush.js
2637
+ var flush = function() {
2638
+ let shadyDOM, debouncers;
2639
+ do {
2640
+ shadyDOM = window.ShadyDOM && ShadyDOM.flush();
2641
+ if (window.ShadyCSS && window.ShadyCSS.ScopingShim) {
2642
+ window.ShadyCSS.ScopingShim.flush();
2643
+ }
2644
+ debouncers = flushDebouncers();
2645
+ } while (shadyDOM || debouncers);
2646
+ };
2647
+
2648
+ // ../../../node_modules/@polymer/polymer/lib/legacy/polymer.dom.js
2649
+ var p = Element.prototype;
2650
+ var normalizedMatchesSelector = p.matches || p.matchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector;
2651
+ var matchesSelector = function(node, selector) {
2652
+ return normalizedMatchesSelector.call(node, selector);
2653
+ };
2654
+ var DomApiNative = class {
2655
+ /**
2656
+ * @param {!Node} node Node for which to create a Polymer.dom helper object.
2657
+ */
2658
+ constructor(node) {
2659
+ if (window["ShadyDOM"] && window["ShadyDOM"]["inUse"]) {
2660
+ window["ShadyDOM"]["patch"](node);
2661
+ }
2662
+ this.node = node;
2663
+ }
2664
+ /**
2665
+ * Returns an instance of `FlattenedNodesObserver` that
2666
+ * listens for node changes on this element.
2667
+ *
2668
+ * @param {function(this:HTMLElement, { target: !HTMLElement, addedNodes: !Array<!Element>, removedNodes: !Array<!Element> }):void} callback Called when direct or distributed children
2669
+ * of this element changes
2670
+ * @return {!PolymerDomApi.ObserveHandle} Observer instance
2671
+ * @override
2672
+ */
2673
+ observeNodes(callback) {
2674
+ return new FlattenedNodesObserver(
2675
+ /** @type {!HTMLElement} */
2676
+ this.node,
2677
+ callback
2678
+ );
2679
+ }
2680
+ /**
2681
+ * Disconnects an observer previously created via `observeNodes`
2682
+ *
2683
+ * @param {!PolymerDomApi.ObserveHandle} observerHandle Observer instance
2684
+ * to disconnect.
2685
+ * @return {void}
2686
+ * @override
2687
+ */
2688
+ unobserveNodes(observerHandle) {
2689
+ observerHandle.disconnect();
2690
+ }
2691
+ /**
2692
+ * Provided as a backwards-compatible API only. This method does nothing.
2693
+ * @return {void}
2694
+ */
2695
+ notifyObserver() {
2696
+ }
2697
+ /**
2698
+ * Returns true if the provided node is contained with this element's
2699
+ * light-DOM children or shadow root, including any nested shadow roots
2700
+ * of children therein.
2701
+ *
2702
+ * @param {Node} node Node to test
2703
+ * @return {boolean} Returns true if the given `node` is contained within
2704
+ * this element's light or shadow DOM.
2705
+ * @override
2706
+ */
2707
+ deepContains(node) {
2708
+ if (wrap(this.node).contains(node)) {
2709
+ return true;
2710
+ }
2711
+ let n = node;
2712
+ let doc = node.ownerDocument;
2713
+ while (n && n !== doc && n !== this.node) {
2714
+ n = wrap(n).parentNode || wrap(n).host;
2715
+ }
2716
+ return n === this.node;
2717
+ }
2718
+ /**
2719
+ * Returns the root node of this node. Equivalent to `getRootNode()`.
2720
+ *
2721
+ * @return {!Node} Top most element in the dom tree in which the node
2722
+ * exists. If the node is connected to a document this is either a
2723
+ * shadowRoot or the document; otherwise, it may be the node
2724
+ * itself or a node or document fragment containing it.
2725
+ * @override
2726
+ */
2727
+ getOwnerRoot() {
2728
+ return wrap(this.node).getRootNode();
2729
+ }
2730
+ /**
2731
+ * For slot elements, returns the nodes assigned to the slot; otherwise
2732
+ * an empty array. It is equivalent to `<slot>.addignedNodes({flatten:true})`.
2733
+ *
2734
+ * @return {!Array<!Node>} Array of assigned nodes
2735
+ * @override
2736
+ */
2737
+ getDistributedNodes() {
2738
+ return this.node.localName === "slot" ? wrap(this.node).assignedNodes({ flatten: true }) : [];
2739
+ }
2740
+ /**
2741
+ * Returns an array of all slots this element was distributed to.
2742
+ *
2743
+ * @return {!Array<!HTMLSlotElement>} Description
2744
+ * @override
2745
+ */
2746
+ getDestinationInsertionPoints() {
2747
+ let ip$ = [];
2748
+ let n = wrap(this.node).assignedSlot;
2749
+ while (n) {
2750
+ ip$.push(n);
2751
+ n = wrap(n).assignedSlot;
2752
+ }
2753
+ return ip$;
2754
+ }
2755
+ /**
2756
+ * Calls `importNode` on the `ownerDocument` for this node.
2757
+ *
2758
+ * @param {!Node} node Node to import
2759
+ * @param {boolean} deep True if the node should be cloned deeply during
2760
+ * import
2761
+ * @return {Node} Clone of given node imported to this owner document
2762
+ */
2763
+ importNode(node, deep) {
2764
+ let doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
2765
+ return wrap(doc).importNode(node, deep);
2766
+ }
2767
+ /**
2768
+ * @return {!Array<!Node>} Returns a flattened list of all child nodes and
2769
+ * nodes assigned to child slots.
2770
+ * @override
2771
+ */
2772
+ getEffectiveChildNodes() {
2773
+ return FlattenedNodesObserver.getFlattenedNodes(
2774
+ /** @type {!HTMLElement} */
2775
+ this.node
2776
+ );
2777
+ }
2778
+ /**
2779
+ * Returns a filtered list of flattened child elements for this element based
2780
+ * on the given selector.
2781
+ *
2782
+ * @param {string} selector Selector to filter nodes against
2783
+ * @return {!Array<!HTMLElement>} List of flattened child elements
2784
+ * @override
2785
+ */
2786
+ queryDistributedElements(selector) {
2787
+ let c$ = this.getEffectiveChildNodes();
2788
+ let list = [];
2789
+ for (let i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
2790
+ if (c.nodeType === Node.ELEMENT_NODE && matchesSelector(c, selector)) {
2791
+ list.push(c);
2792
+ }
2793
+ }
2794
+ return list;
2795
+ }
2796
+ /**
2797
+ * For shadow roots, returns the currently focused element within this
2798
+ * shadow root.
2799
+ *
2800
+ * return {Node|undefined} Currently focused element
2801
+ * @override
2802
+ */
2803
+ get activeElement() {
2804
+ let node = this.node;
2805
+ return node._activeElement !== void 0 ? node._activeElement : node.activeElement;
2806
+ }
2807
+ };
2808
+ function forwardMethods(proto, methods) {
2809
+ for (let i = 0; i < methods.length; i++) {
2810
+ let method = methods[i];
2811
+ proto[method] = /** @this {DomApiNative} */
2812
+ function() {
2813
+ return this.node[method].apply(this.node, arguments);
2814
+ };
2815
+ }
2816
+ }
2817
+ function forwardReadOnlyProperties(proto, properties) {
2818
+ for (let i = 0; i < properties.length; i++) {
2819
+ let name = properties[i];
2820
+ Object.defineProperty(proto, name, {
2821
+ get: function() {
2822
+ const domApi = (
2823
+ /** @type {DomApiNative} */
2824
+ this
2825
+ );
2826
+ return domApi.node[name];
2827
+ },
2828
+ configurable: true
2829
+ });
2830
+ }
2831
+ }
2832
+ function forwardProperties(proto, properties) {
2833
+ for (let i = 0; i < properties.length; i++) {
2834
+ let name = properties[i];
2835
+ Object.defineProperty(proto, name, {
2836
+ /**
2837
+ * @this {DomApiNative}
2838
+ * @return {*} .
2839
+ */
2840
+ get: function() {
2841
+ return this.node[name];
2842
+ },
2843
+ /**
2844
+ * @this {DomApiNative}
2845
+ * @param {*} value .
2846
+ */
2847
+ set: function(value) {
2848
+ this.node[name] = value;
2849
+ },
2850
+ configurable: true
2851
+ });
2852
+ }
2853
+ }
2854
+ var EventApi = class {
2855
+ constructor(event) {
2856
+ this.event = event;
2857
+ }
2858
+ /**
2859
+ * Returns the first node on the `composedPath` of this event.
2860
+ *
2861
+ * @return {!EventTarget} The node this event was dispatched to
2862
+ */
2863
+ get rootTarget() {
2864
+ return this.path[0];
2865
+ }
2866
+ /**
2867
+ * Returns the local (re-targeted) target for this event.
2868
+ *
2869
+ * @return {!EventTarget} The local (re-targeted) target for this event.
2870
+ */
2871
+ get localTarget() {
2872
+ return this.event.target;
2873
+ }
2874
+ /**
2875
+ * Returns the `composedPath` for this event.
2876
+ * @return {!Array<!EventTarget>} The nodes this event propagated through
2877
+ */
2878
+ get path() {
2879
+ return this.event.composedPath();
2880
+ }
2881
+ };
2882
+ DomApiNative.prototype.cloneNode;
2883
+ DomApiNative.prototype.appendChild;
2884
+ DomApiNative.prototype.insertBefore;
2885
+ DomApiNative.prototype.removeChild;
2886
+ DomApiNative.prototype.replaceChild;
2887
+ DomApiNative.prototype.setAttribute;
2888
+ DomApiNative.prototype.removeAttribute;
2889
+ DomApiNative.prototype.querySelector;
2890
+ DomApiNative.prototype.querySelectorAll;
2891
+ DomApiNative.prototype.parentNode;
2892
+ DomApiNative.prototype.firstChild;
2893
+ DomApiNative.prototype.lastChild;
2894
+ DomApiNative.prototype.nextSibling;
2895
+ DomApiNative.prototype.previousSibling;
2896
+ DomApiNative.prototype.firstElementChild;
2897
+ DomApiNative.prototype.lastElementChild;
2898
+ DomApiNative.prototype.nextElementSibling;
2899
+ DomApiNative.prototype.previousElementSibling;
2900
+ DomApiNative.prototype.childNodes;
2901
+ DomApiNative.prototype.children;
2902
+ DomApiNative.prototype.classList;
2903
+ DomApiNative.prototype.textContent;
2904
+ DomApiNative.prototype.innerHTML;
2905
+ var DomApiImpl = DomApiNative;
2906
+ if (window["ShadyDOM"] && window["ShadyDOM"]["inUse"] && window["ShadyDOM"]["noPatch"] && window["ShadyDOM"]["Wrapper"]) {
2907
+ class Wrapper extends window["ShadyDOM"]["Wrapper"] {
2908
+ }
2909
+ Object.getOwnPropertyNames(DomApiNative.prototype).forEach((prop) => {
2910
+ if (prop != "activeElement") {
2911
+ Wrapper.prototype[prop] = DomApiNative.prototype[prop];
2912
+ }
2913
+ });
2914
+ forwardReadOnlyProperties(Wrapper.prototype, [
2915
+ "classList"
2916
+ ]);
2917
+ DomApiImpl = Wrapper;
2918
+ Object.defineProperties(EventApi.prototype, {
2919
+ // Returns the "lowest" node in the same root as the event's currentTarget.
2920
+ // When in `noPatch` mode, this must be calculated by walking the event's
2921
+ // path.
2922
+ localTarget: {
2923
+ get() {
2924
+ const current = this.event.currentTarget;
2925
+ const currentRoot = current && dom(current).getOwnerRoot();
2926
+ const p$ = this.path;
2927
+ for (let i = 0; i < p$.length; i++) {
2928
+ const e = p$[i];
2929
+ if (dom(e).getOwnerRoot() === currentRoot) {
2930
+ return e;
2931
+ }
2932
+ }
2933
+ },
2934
+ configurable: true
2935
+ },
2936
+ path: {
2937
+ get() {
2938
+ return window["ShadyDOM"]["composedPath"](this.event);
2939
+ },
2940
+ configurable: true
2941
+ }
2942
+ });
2943
+ } else {
2944
+ forwardMethods(DomApiNative.prototype, [
2945
+ "cloneNode",
2946
+ "appendChild",
2947
+ "insertBefore",
2948
+ "removeChild",
2949
+ "replaceChild",
2950
+ "setAttribute",
2951
+ "removeAttribute",
2952
+ "querySelector",
2953
+ "querySelectorAll",
2954
+ "attachShadow"
2955
+ ]);
2956
+ forwardReadOnlyProperties(DomApiNative.prototype, [
2957
+ "parentNode",
2958
+ "firstChild",
2959
+ "lastChild",
2960
+ "nextSibling",
2961
+ "previousSibling",
2962
+ "firstElementChild",
2963
+ "lastElementChild",
2964
+ "nextElementSibling",
2965
+ "previousElementSibling",
2966
+ "childNodes",
2967
+ "children",
2968
+ "classList",
2969
+ "shadowRoot"
2970
+ ]);
2971
+ forwardProperties(DomApiNative.prototype, [
2972
+ "textContent",
2973
+ "innerHTML",
2974
+ "className"
2975
+ ]);
2976
+ }
2977
+ var dom = function(obj) {
2978
+ obj = obj || document;
2979
+ if (obj instanceof DomApiImpl) {
2980
+ return (
2981
+ /** @type {!DomApi} */
2982
+ obj
2983
+ );
2984
+ }
2985
+ if (obj instanceof EventApi) {
2986
+ return (
2987
+ /** @type {!EventApi} */
2988
+ obj
2989
+ );
2990
+ }
2991
+ let helper = obj["__domApi"];
2992
+ if (!helper) {
2993
+ if (obj instanceof Event) {
2994
+ helper = new EventApi(obj);
2995
+ } else {
2996
+ helper = new DomApiImpl(
2997
+ /** @type {Node} */
2998
+ obj
2999
+ );
3000
+ }
3001
+ obj["__domApi"] = helper;
3002
+ }
3003
+ return helper;
3004
+ };
3005
+
3006
+ // ../../../node_modules/@polymer/polymer/lib/utils/scope-subtree.js
3007
+ var ShadyDOM2 = window.ShadyDOM;
3008
+ var ShadyCSS = window.ShadyCSS;
3009
+ function sameScope(node, scope) {
3010
+ return wrap(node).getRootNode() === scope;
3011
+ }
3012
+ function scopeSubtree(container, shouldObserve = false) {
3013
+ if (!ShadyDOM2 || !ShadyCSS) {
3014
+ return null;
3015
+ }
3016
+ if (!ShadyDOM2["handlesDynamicScoping"]) {
3017
+ return null;
3018
+ }
3019
+ const ScopingShim = ShadyCSS["ScopingShim"];
3020
+ if (!ScopingShim) {
3021
+ return null;
3022
+ }
3023
+ const containerScope = ScopingShim["scopeForNode"](container);
3024
+ const root = wrap(container).getRootNode();
3025
+ const scopify = (node) => {
3026
+ if (!sameScope(node, root)) {
3027
+ return;
3028
+ }
3029
+ const elements = Array.from(ShadyDOM2["nativeMethods"]["querySelectorAll"].call(node, "*"));
3030
+ elements.push(node);
3031
+ for (let i = 0; i < elements.length; i++) {
3032
+ const el = elements[i];
3033
+ if (!sameScope(el, root)) {
3034
+ continue;
3035
+ }
3036
+ const currentScope = ScopingShim["currentScopeForNode"](el);
3037
+ if (currentScope !== containerScope) {
3038
+ if (currentScope !== "") {
3039
+ ScopingShim["unscopeNode"](el, currentScope);
3040
+ }
3041
+ ScopingShim["scopeNode"](el, containerScope);
3042
+ }
3043
+ }
3044
+ };
3045
+ scopify(container);
3046
+ if (shouldObserve) {
3047
+ const mo = new MutationObserver((mxns) => {
3048
+ for (let i = 0; i < mxns.length; i++) {
3049
+ const mxn = mxns[i];
3050
+ for (let j = 0; j < mxn.addedNodes.length; j++) {
3051
+ const addedNode = mxn.addedNodes[j];
3052
+ if (addedNode.nodeType === Node.ELEMENT_NODE) {
3053
+ scopify(addedNode);
3054
+ }
3055
+ }
3056
+ }
3057
+ });
3058
+ mo.observe(container, { childList: true, subtree: true });
3059
+ return mo;
3060
+ } else {
3061
+ return null;
3062
+ }
3063
+ }
3064
+
3065
+ // ../../../node_modules/@polymer/polymer/lib/mixins/disable-upgrade-mixin.js
3066
+ var DISABLED_ATTR = "disable-upgrade";
3067
+ var findObservedAttributesGetter = (ctor) => {
3068
+ while (ctor) {
3069
+ const desc = Object.getOwnPropertyDescriptor(ctor, "observedAttributes");
3070
+ if (desc) {
3071
+ return desc.get;
3072
+ }
3073
+ ctor = Object.getPrototypeOf(ctor.prototype).constructor;
3074
+ }
3075
+ return () => [];
3076
+ };
3077
+ var DisableUpgradeMixin = dedupingMixin((base) => {
3078
+ const superClass = ElementMixin(base);
3079
+ let observedAttributesGetter = findObservedAttributesGetter(superClass);
3080
+ class DisableUpgradeClass extends superClass {
3081
+ constructor() {
3082
+ super();
3083
+ this.__isUpgradeDisabled;
3084
+ }
3085
+ static get observedAttributes() {
3086
+ return observedAttributesGetter.call(this).concat(DISABLED_ATTR);
3087
+ }
3088
+ // Prevent element from initializing properties when it's upgrade disabled.
3089
+ /** @override */
3090
+ _initializeProperties() {
3091
+ if (this.hasAttribute(DISABLED_ATTR)) {
3092
+ this.__isUpgradeDisabled = true;
3093
+ } else {
3094
+ super._initializeProperties();
3095
+ }
3096
+ }
3097
+ // Prevent element from enabling properties when it's upgrade disabled.
3098
+ // Normally overriding connectedCallback would be enough, but dom-* elements
3099
+ /** @override */
3100
+ _enableProperties() {
3101
+ if (!this.__isUpgradeDisabled) {
3102
+ super._enableProperties();
3103
+ }
3104
+ }
3105
+ // If the element starts upgrade-disabled and a property is set for
3106
+ // which an accessor exists, the default should not be applied.
3107
+ // This additional check is needed because defaults are applied via
3108
+ // `_initializeProperties` which is called after initial properties
3109
+ // have been set when the element starts upgrade-disabled.
3110
+ /** @override */
3111
+ _canApplyPropertyDefault(property) {
3112
+ return super._canApplyPropertyDefault(property) && !(this.__isUpgradeDisabled && this._isPropertyPending(property));
3113
+ }
3114
+ /**
3115
+ * @override
3116
+ * @param {string} name Attribute name.
3117
+ * @param {?string} old The previous value for the attribute.
3118
+ * @param {?string} value The new value for the attribute.
3119
+ * @param {?string} namespace The XML namespace for the attribute.
3120
+ * @return {void}
3121
+ */
3122
+ attributeChangedCallback(name, old, value, namespace) {
3123
+ if (name == DISABLED_ATTR) {
3124
+ if (this.__isUpgradeDisabled && value == null) {
3125
+ super._initializeProperties();
3126
+ this.__isUpgradeDisabled = false;
3127
+ if (wrap(this).isConnected) {
3128
+ super.connectedCallback();
3129
+ }
3130
+ }
3131
+ } else {
3132
+ super.attributeChangedCallback(
3133
+ name,
3134
+ old,
3135
+ value,
3136
+ /** @type {null|string} */
3137
+ namespace
3138
+ );
3139
+ }
3140
+ }
3141
+ // Prevent element from connecting when it's upgrade disabled.
3142
+ // This prevents user code in `attached` from being called.
3143
+ /** @override */
3144
+ connectedCallback() {
3145
+ if (!this.__isUpgradeDisabled) {
3146
+ super.connectedCallback();
3147
+ }
3148
+ }
3149
+ // Prevent element from disconnecting when it's upgrade disabled.
3150
+ // This avoids allowing user code `detached` from being called without a
3151
+ // paired call to `attached`.
3152
+ /** @override */
3153
+ disconnectedCallback() {
3154
+ if (!this.__isUpgradeDisabled) {
3155
+ super.disconnectedCallback();
3156
+ }
3157
+ }
3158
+ }
3159
+ return DisableUpgradeClass;
3160
+ });
3161
+
3162
+ // ../../../node_modules/@polymer/polymer/lib/legacy/legacy-element-mixin.js
3163
+ var DISABLED_ATTR2 = "disable-upgrade";
3164
+ var styleInterface = window.ShadyCSS;
3165
+ var LegacyElementMixin = dedupingMixin((base) => {
3166
+ const GesturesElement = GestureEventListeners(ElementMixin(base));
3167
+ const legacyElementBase = builtCSS ? GesturesElement : DirMixin(GesturesElement);
3168
+ const observedAttributesGetter = findObservedAttributesGetter(legacyElementBase);
3169
+ const DIRECTION_MAP = {
3170
+ "x": "pan-x",
3171
+ "y": "pan-y",
3172
+ "none": "none",
3173
+ "all": "auto"
3174
+ };
3175
+ class LegacyElement2 extends legacyElementBase {
3176
+ constructor() {
3177
+ super();
3178
+ this.isAttached;
3179
+ this.__boundListeners;
3180
+ this._debouncers;
3181
+ this.__isUpgradeDisabled;
3182
+ this.__needsAttributesAtConnected;
3183
+ this._legacyForceObservedAttributes;
3184
+ }
3185
+ /**
3186
+ * Forwards `importMeta` from the prototype (i.e. from the info object
3187
+ * passed to `Polymer({...})`) to the static API.
3188
+ *
3189
+ * @return {!Object} The `import.meta` object set on the prototype
3190
+ * @suppress {missingProperties} `this` is always in the instance in
3191
+ * closure for some reason even in a static method, rather than the class
3192
+ * @nocollapse
3193
+ */
3194
+ static get importMeta() {
3195
+ return this.prototype.importMeta;
3196
+ }
3197
+ /**
3198
+ * Legacy callback called during the `constructor`, for overriding
3199
+ * by the user.
3200
+ * @override
3201
+ * @return {void}
3202
+ */
3203
+ created() {
3204
+ }
3205
+ /**
3206
+ * Processes an attribute reaction when the `legacyNoObservedAttributes`
3207
+ * setting is in use.
3208
+ * @param {string} name Name of attribute that changed
3209
+ * @param {?string} old Old attribute value
3210
+ * @param {?string} value New attribute value
3211
+ * @return {void}
3212
+ */
3213
+ __attributeReaction(name, old, value) {
3214
+ if (this.__dataAttributes && this.__dataAttributes[name] || name === DISABLED_ATTR2) {
3215
+ this.attributeChangedCallback(name, old, value, null);
3216
+ }
3217
+ }
3218
+ /**
3219
+ * Sets the value of an attribute.
3220
+ * @override
3221
+ */
3222
+ setAttribute(name, value) {
3223
+ if (legacyNoObservedAttributes && !this._legacyForceObservedAttributes) {
3224
+ const oldValue = this.getAttribute(name);
3225
+ super.setAttribute(name, value);
3226
+ this.__attributeReaction(name, oldValue, String(value));
3227
+ } else {
3228
+ super.setAttribute(name, value);
3229
+ }
3230
+ }
3231
+ /**
3232
+ * Removes an attribute.
3233
+ * @override
3234
+ */
3235
+ removeAttribute(name) {
3236
+ if (legacyNoObservedAttributes && !this._legacyForceObservedAttributes) {
3237
+ const oldValue = this.getAttribute(name);
3238
+ super.removeAttribute(name);
3239
+ this.__attributeReaction(name, oldValue, null);
3240
+ } else {
3241
+ super.removeAttribute(name);
3242
+ }
3243
+ }
3244
+ // NOTE: Inlined for perf from version of DisableUpgradeMixin.
3245
+ static get observedAttributes() {
3246
+ if (legacyNoObservedAttributes && !this.prototype._legacyForceObservedAttributes) {
3247
+ if (!this.hasOwnProperty(JSCompiler_renameProperty("__observedAttributes", this))) {
3248
+ this.__observedAttributes = [];
3249
+ register(this.prototype);
3250
+ }
3251
+ return this.__observedAttributes;
3252
+ } else {
3253
+ return observedAttributesGetter.call(this).concat(DISABLED_ATTR2);
3254
+ }
3255
+ }
3256
+ // NOTE: Inlined for perf from version of DisableUpgradeMixin.
3257
+ // Prevent element from enabling properties when it's upgrade disabled.
3258
+ // Normally overriding connectedCallback would be enough, but dom-* elements
3259
+ /** @override */
3260
+ _enableProperties() {
3261
+ if (!this.__isUpgradeDisabled) {
3262
+ super._enableProperties();
3263
+ }
3264
+ }
3265
+ // NOTE: Inlined for perf from version of DisableUpgradeMixin.
3266
+ // If the element starts upgrade-disabled and a property is set for
3267
+ // which an accessor exists, the default should not be applied.
3268
+ // This additional check is needed because defaults are applied via
3269
+ // `_initializeProperties` which is called after initial properties
3270
+ // have been set when the element starts upgrade-disabled.
3271
+ /** @override */
3272
+ _canApplyPropertyDefault(property) {
3273
+ return super._canApplyPropertyDefault(property) && !(this.__isUpgradeDisabled && this._isPropertyPending(property));
3274
+ }
3275
+ /**
3276
+ * Provides an implementation of `connectedCallback`
3277
+ * which adds Polymer legacy API's `attached` method.
3278
+ * @return {void}
3279
+ * @override
3280
+ */
3281
+ connectedCallback() {
3282
+ if (this.__needsAttributesAtConnected) {
3283
+ this._takeAttributes();
3284
+ }
3285
+ if (!this.__isUpgradeDisabled) {
3286
+ super.connectedCallback();
3287
+ this.isAttached = true;
3288
+ this.attached();
3289
+ }
3290
+ }
3291
+ /**
3292
+ * Legacy callback called during `connectedCallback`, for overriding
3293
+ * by the user.
3294
+ * @override
3295
+ * @return {void}
3296
+ */
3297
+ attached() {
3298
+ }
3299
+ /**
3300
+ * Provides an implementation of `disconnectedCallback`
3301
+ * which adds Polymer legacy API's `detached` method.
3302
+ * @return {void}
3303
+ * @override
3304
+ */
3305
+ disconnectedCallback() {
3306
+ if (!this.__isUpgradeDisabled) {
3307
+ super.disconnectedCallback();
3308
+ this.isAttached = false;
3309
+ this.detached();
3310
+ }
3311
+ }
3312
+ /**
3313
+ * Legacy callback called during `disconnectedCallback`, for overriding
3314
+ * by the user.
3315
+ * @override
3316
+ * @return {void}
3317
+ */
3318
+ detached() {
3319
+ }
3320
+ /**
3321
+ * Provides an override implementation of `attributeChangedCallback`
3322
+ * which adds the Polymer legacy API's `attributeChanged` method.
3323
+ * @param {string} name Name of attribute.
3324
+ * @param {?string} old Old value of attribute.
3325
+ * @param {?string} value Current value of attribute.
3326
+ * @param {?string} namespace Attribute namespace.
3327
+ * @return {void}
3328
+ * @override
3329
+ */
3330
+ attributeChangedCallback(name, old, value, namespace) {
3331
+ if (old !== value) {
3332
+ if (name == DISABLED_ATTR2) {
3333
+ if (this.__isUpgradeDisabled && value == null) {
3334
+ this._initializeProperties();
3335
+ this.__isUpgradeDisabled = false;
3336
+ if (wrap(this).isConnected) {
3337
+ this.connectedCallback();
3338
+ }
3339
+ }
3340
+ } else {
3341
+ super.attributeChangedCallback(name, old, value, namespace);
3342
+ this.attributeChanged(name, old, value);
3343
+ }
3344
+ }
3345
+ }
3346
+ /**
3347
+ * Legacy callback called during `attributeChangedChallback`, for overriding
3348
+ * by the user.
3349
+ * @param {string} name Name of attribute.
3350
+ * @param {?string} old Old value of attribute.
3351
+ * @param {?string} value Current value of attribute.
3352
+ * @return {void}
3353
+ * @override
3354
+ */
3355
+ attributeChanged(name, old, value) {
3356
+ }
3357
+ // eslint-disable-line no-unused-vars
3358
+ /**
3359
+ * Overrides the default `Polymer.PropertyEffects` implementation to
3360
+ * add support for class initialization via the `_registered` callback.
3361
+ * This is called only when the first instance of the element is created.
3362
+ *
3363
+ * @return {void}
3364
+ * @override
3365
+ * @suppress {invalidCasts}
3366
+ */
3367
+ _initializeProperties() {
3368
+ if (legacyOptimizations && this.hasAttribute(DISABLED_ATTR2)) {
3369
+ this.__isUpgradeDisabled = true;
3370
+ } else {
3371
+ let proto = Object.getPrototypeOf(this);
3372
+ if (!proto.hasOwnProperty(JSCompiler_renameProperty("__hasRegisterFinished", proto))) {
3373
+ this._registered();
3374
+ proto.__hasRegisterFinished = true;
3375
+ }
3376
+ super._initializeProperties();
3377
+ this.root = /** @type {HTMLElement} */
3378
+ this;
3379
+ this.created();
3380
+ if (legacyNoObservedAttributes && !this._legacyForceObservedAttributes) {
3381
+ if (this.hasAttributes()) {
3382
+ this._takeAttributes();
3383
+ } else if (!this.parentNode) {
3384
+ this.__needsAttributesAtConnected = true;
3385
+ }
3386
+ }
3387
+ this._applyListeners();
3388
+ }
3389
+ }
3390
+ _takeAttributes() {
3391
+ const a = this.attributes;
3392
+ for (let i = 0, l = a.length; i < l; i++) {
3393
+ const attr = a[i];
3394
+ this.__attributeReaction(attr.name, null, attr.value);
3395
+ }
3396
+ }
3397
+ /**
3398
+ * Called automatically when an element is initializing.
3399
+ * Users may override this method to perform class registration time
3400
+ * work. The implementation should ensure the work is performed
3401
+ * only once for the class.
3402
+ * @protected
3403
+ * @return {void}
3404
+ * @override
3405
+ */
3406
+ _registered() {
3407
+ }
3408
+ /**
3409
+ * Overrides the default `Polymer.PropertyEffects` implementation to
3410
+ * add support for installing `hostAttributes` and `listeners`.
3411
+ *
3412
+ * @return {void}
3413
+ * @override
3414
+ */
3415
+ ready() {
3416
+ this._ensureAttributes();
3417
+ super.ready();
3418
+ }
3419
+ /**
3420
+ * Ensures an element has required attributes. Called when the element
3421
+ * is being readied via `ready`. Users should override to set the
3422
+ * element's required attributes. The implementation should be sure
3423
+ * to check and not override existing attributes added by
3424
+ * the user of the element. Typically, setting attributes should be left
3425
+ * to the element user and not done here; reasonable exceptions include
3426
+ * setting aria roles and focusability.
3427
+ * @protected
3428
+ * @return {void}
3429
+ * @override
3430
+ */
3431
+ _ensureAttributes() {
3432
+ }
3433
+ /**
3434
+ * Adds element event listeners. Called when the element
3435
+ * is being readied via `ready`. Users should override to
3436
+ * add any required element event listeners.
3437
+ * In performance critical elements, the work done here should be kept
3438
+ * to a minimum since it is done before the element is rendered. In
3439
+ * these elements, consider adding listeners asynchronously so as not to
3440
+ * block render.
3441
+ * @protected
3442
+ * @return {void}
3443
+ * @override
3444
+ */
3445
+ _applyListeners() {
3446
+ }
3447
+ /**
3448
+ * Converts a typed JavaScript value to a string.
3449
+ *
3450
+ * Note this method is provided as backward-compatible legacy API
3451
+ * only. It is not directly called by any Polymer features. To customize
3452
+ * how properties are serialized to attributes for attribute bindings and
3453
+ * `reflectToAttribute: true` properties as well as this method, override
3454
+ * the `_serializeValue` method provided by `Polymer.PropertyAccessors`.
3455
+ *
3456
+ * @param {*} value Value to deserialize
3457
+ * @return {string | undefined} Serialized value
3458
+ * @override
3459
+ */
3460
+ serialize(value) {
3461
+ return this._serializeValue(value);
3462
+ }
3463
+ /**
3464
+ * Converts a string to a typed JavaScript value.
3465
+ *
3466
+ * Note this method is provided as backward-compatible legacy API
3467
+ * only. It is not directly called by any Polymer features. To customize
3468
+ * how attributes are deserialized to properties for in
3469
+ * `attributeChangedCallback`, override `_deserializeValue` method
3470
+ * provided by `Polymer.PropertyAccessors`.
3471
+ *
3472
+ * @param {string} value String to deserialize
3473
+ * @param {*} type Type to deserialize the string to
3474
+ * @return {*} Returns the deserialized value in the `type` given.
3475
+ * @override
3476
+ */
3477
+ deserialize(value, type) {
3478
+ return this._deserializeValue(value, type);
3479
+ }
3480
+ /**
3481
+ * Serializes a property to its associated attribute.
3482
+ *
3483
+ * Note this method is provided as backward-compatible legacy API
3484
+ * only. It is not directly called by any Polymer features.
3485
+ *
3486
+ * @param {string} property Property name to reflect.
3487
+ * @param {string=} attribute Attribute name to reflect.
3488
+ * @param {*=} value Property value to reflect.
3489
+ * @return {void}
3490
+ * @override
3491
+ */
3492
+ reflectPropertyToAttribute(property, attribute, value) {
3493
+ this._propertyToAttribute(property, attribute, value);
3494
+ }
3495
+ /**
3496
+ * Sets a typed value to an HTML attribute on a node.
3497
+ *
3498
+ * Note this method is provided as backward-compatible legacy API
3499
+ * only. It is not directly called by any Polymer features.
3500
+ *
3501
+ * @param {*} value Value to serialize.
3502
+ * @param {string} attribute Attribute name to serialize to.
3503
+ * @param {Element} node Element to set attribute to.
3504
+ * @return {void}
3505
+ * @override
3506
+ */
3507
+ serializeValueToAttribute(value, attribute, node) {
3508
+ this._valueToNodeAttribute(
3509
+ /** @type {Element} */
3510
+ node || this,
3511
+ value,
3512
+ attribute
3513
+ );
3514
+ }
3515
+ /**
3516
+ * Copies own properties (including accessor descriptors) from a source
3517
+ * object to a target object.
3518
+ *
3519
+ * @param {Object} prototype Target object to copy properties to.
3520
+ * @param {Object} api Source object to copy properties from.
3521
+ * @return {Object} prototype object that was passed as first argument.
3522
+ * @override
3523
+ */
3524
+ extend(prototype, api) {
3525
+ if (!(prototype && api)) {
3526
+ return prototype || api;
3527
+ }
3528
+ let n$ = Object.getOwnPropertyNames(api);
3529
+ for (let i = 0, n; i < n$.length && (n = n$[i]); i++) {
3530
+ let pd = Object.getOwnPropertyDescriptor(api, n);
3531
+ if (pd) {
3532
+ Object.defineProperty(prototype, n, pd);
3533
+ }
3534
+ }
3535
+ return prototype;
3536
+ }
3537
+ /**
3538
+ * Copies props from a source object to a target object.
3539
+ *
3540
+ * Note, this method uses a simple `for...in` strategy for enumerating
3541
+ * properties. To ensure only `ownProperties` are copied from source
3542
+ * to target and that accessor implementations are copied, use `extend`.
3543
+ *
3544
+ * @param {!Object} target Target object to copy properties to.
3545
+ * @param {!Object} source Source object to copy properties from.
3546
+ * @return {!Object} Target object that was passed as first argument.
3547
+ * @override
3548
+ */
3549
+ mixin(target, source) {
3550
+ for (let i in source) {
3551
+ target[i] = source[i];
3552
+ }
3553
+ return target;
3554
+ }
3555
+ /**
3556
+ * Sets the prototype of an object.
3557
+ *
3558
+ * Note this method is provided as backward-compatible legacy API
3559
+ * only. It is not directly called by any Polymer features.
3560
+ * @param {Object} object The object on which to set the prototype.
3561
+ * @param {Object} prototype The prototype that will be set on the given
3562
+ * `object`.
3563
+ * @return {Object} Returns the given `object` with its prototype set
3564
+ * to the given `prototype` object.
3565
+ * @override
3566
+ */
3567
+ chainObject(object, prototype) {
3568
+ if (object && prototype && object !== prototype) {
3569
+ object.__proto__ = prototype;
3570
+ }
3571
+ return object;
3572
+ }
3573
+ /* **** Begin Template **** */
3574
+ /**
3575
+ * Calls `importNode` on the `content` of the `template` specified and
3576
+ * returns a document fragment containing the imported content.
3577
+ *
3578
+ * @param {HTMLTemplateElement} template HTML template element to instance.
3579
+ * @return {!DocumentFragment} Document fragment containing the imported
3580
+ * template content.
3581
+ * @override
3582
+ * @suppress {missingProperties} go/missingfnprops
3583
+ */
3584
+ instanceTemplate(template) {
3585
+ let content = this.constructor._contentForTemplate(template);
3586
+ let dom2 = (
3587
+ /** @type {!DocumentFragment} */
3588
+ document.importNode(content, true)
3589
+ );
3590
+ return dom2;
3591
+ }
3592
+ /* **** Begin Events **** */
3593
+ /**
3594
+ * Dispatches a custom event with an optional detail value.
3595
+ *
3596
+ * @param {string} type Name of event type.
3597
+ * @param {*=} detail Detail value containing event-specific
3598
+ * payload.
3599
+ * @param {{ bubbles: (boolean|undefined), cancelable: (boolean|undefined),
3600
+ * composed: (boolean|undefined) }=}
3601
+ * options Object specifying options. These may include:
3602
+ * `bubbles` (boolean, defaults to `true`),
3603
+ * `cancelable` (boolean, defaults to false), and
3604
+ * `node` on which to fire the event (HTMLElement, defaults to `this`).
3605
+ * @return {!Event} The new event that was fired.
3606
+ * @override
3607
+ */
3608
+ fire(type, detail, options) {
3609
+ options = options || {};
3610
+ detail = detail === null || detail === void 0 ? {} : detail;
3611
+ let event = new Event(type, {
3612
+ bubbles: options.bubbles === void 0 ? true : options.bubbles,
3613
+ cancelable: Boolean(options.cancelable),
3614
+ composed: options.composed === void 0 ? true : options.composed
3615
+ });
3616
+ event.detail = detail;
3617
+ let node = options.node || this;
3618
+ wrap(node).dispatchEvent(event);
3619
+ return event;
3620
+ }
3621
+ /**
3622
+ * Convenience method to add an event listener on a given element,
3623
+ * late bound to a named method on this element.
3624
+ *
3625
+ * @param {?EventTarget} node Element to add event listener to.
3626
+ * @param {string} eventName Name of event to listen for.
3627
+ * @param {string} methodName Name of handler method on `this` to call.
3628
+ * @return {void}
3629
+ * @override
3630
+ */
3631
+ listen(node, eventName, methodName) {
3632
+ node = /** @type {!EventTarget} */
3633
+ node || this;
3634
+ let hbl = this.__boundListeners || (this.__boundListeners = /* @__PURE__ */ new WeakMap());
3635
+ let bl = hbl.get(node);
3636
+ if (!bl) {
3637
+ bl = {};
3638
+ hbl.set(node, bl);
3639
+ }
3640
+ let key = eventName + methodName;
3641
+ if (!bl[key]) {
3642
+ bl[key] = this._addMethodEventListenerToNode(
3643
+ /** @type {!Node} */
3644
+ node,
3645
+ eventName,
3646
+ methodName,
3647
+ this
3648
+ );
3649
+ }
3650
+ }
3651
+ /**
3652
+ * Convenience method to remove an event listener from a given element,
3653
+ * late bound to a named method on this element.
3654
+ *
3655
+ * @param {?EventTarget} node Element to remove event listener from.
3656
+ * @param {string} eventName Name of event to stop listening to.
3657
+ * @param {string} methodName Name of handler method on `this` to not call
3658
+ anymore.
3659
+ * @return {void}
3660
+ * @override
3661
+ */
3662
+ unlisten(node, eventName, methodName) {
3663
+ node = /** @type {!EventTarget} */
3664
+ node || this;
3665
+ let bl = this.__boundListeners && this.__boundListeners.get(
3666
+ /** @type {!Element} */
3667
+ node
3668
+ );
3669
+ let key = eventName + methodName;
3670
+ let handler = bl && bl[key];
3671
+ if (handler) {
3672
+ this._removeEventListenerFromNode(
3673
+ /** @type {!Node} */
3674
+ node,
3675
+ eventName,
3676
+ handler
3677
+ );
3678
+ bl[key] = /** @type {?} */
3679
+ null;
3680
+ }
3681
+ }
3682
+ /**
3683
+ * Override scrolling behavior to all direction, one direction, or none.
3684
+ *
3685
+ * Valid scroll directions:
3686
+ * - 'all': scroll in any direction
3687
+ * - 'x': scroll only in the 'x' direction
3688
+ * - 'y': scroll only in the 'y' direction
3689
+ * - 'none': disable scrolling for this node
3690
+ *
3691
+ * @param {string=} direction Direction to allow scrolling
3692
+ * Defaults to `all`.
3693
+ * @param {Element=} node Element to apply scroll direction setting.
3694
+ * Defaults to `this`.
3695
+ * @return {void}
3696
+ * @override
3697
+ */
3698
+ setScrollDirection(direction, node) {
3699
+ setTouchAction(
3700
+ /** @type {!Element} */
3701
+ node || this,
3702
+ DIRECTION_MAP[direction] || "auto"
3703
+ );
3704
+ }
3705
+ /* **** End Events **** */
3706
+ /**
3707
+ * Convenience method to run `querySelector` on this local DOM scope.
3708
+ *
3709
+ * This function calls `Polymer.dom(this.root).querySelector(slctr)`.
3710
+ *
3711
+ * @param {string} slctr Selector to run on this local DOM scope
3712
+ * @return {Element} Element found by the selector, or null if not found.
3713
+ * @override
3714
+ */
3715
+ $$(slctr) {
3716
+ return this.root.querySelector(slctr);
3717
+ }
3718
+ /**
3719
+ * Return the element whose local dom within which this element
3720
+ * is contained. This is a shorthand for
3721
+ * `this.getRootNode().host`.
3722
+ * @this {Element}
3723
+ * @return {?Node} The element whose local dom within which this element is
3724
+ * contained.
3725
+ * @override
3726
+ */
3727
+ get domHost() {
3728
+ let root = wrap(this).getRootNode();
3729
+ return root instanceof DocumentFragment ? (
3730
+ /** @type {ShadowRoot} */
3731
+ root.host
3732
+ ) : root;
3733
+ }
3734
+ /**
3735
+ * Force this element to distribute its children to its local dom.
3736
+ * This should not be necessary as of Polymer 2.0.2 and is provided only
3737
+ * for backwards compatibility.
3738
+ * @return {void}
3739
+ * @override
3740
+ */
3741
+ distributeContent() {
3742
+ const thisEl = (
3743
+ /** @type {Element} */
3744
+ this
3745
+ );
3746
+ const domApi = (
3747
+ /** @type {PolymerDomApi} */
3748
+ dom(thisEl)
3749
+ );
3750
+ if (window.ShadyDOM && domApi.shadowRoot) {
3751
+ ShadyDOM.flush();
3752
+ }
3753
+ }
3754
+ /**
3755
+ * Returns a list of nodes that are the effective childNodes. The effective
3756
+ * childNodes list is the same as the element's childNodes except that
3757
+ * any `<content>` elements are replaced with the list of nodes distributed
3758
+ * to the `<content>`, the result of its `getDistributedNodes` method.
3759
+ * @return {!Array<!Node>} List of effective child nodes.
3760
+ * @suppress {invalidCasts} LegacyElementMixin must be applied to an
3761
+ * HTMLElement
3762
+ * @override
3763
+ */
3764
+ getEffectiveChildNodes() {
3765
+ const thisEl = (
3766
+ /** @type {Element} */
3767
+ this
3768
+ );
3769
+ const domApi = (
3770
+ /** @type {PolymerDomApi} */
3771
+ dom(thisEl)
3772
+ );
3773
+ return domApi.getEffectiveChildNodes();
3774
+ }
3775
+ /**
3776
+ * Returns a list of nodes distributed within this element that match
3777
+ * `selector`. These can be dom children or elements distributed to
3778
+ * children that are insertion points.
3779
+ * @param {string} selector Selector to run.
3780
+ * @return {!Array<!Node>} List of distributed elements that match selector.
3781
+ * @suppress {invalidCasts} LegacyElementMixin must be applied to an
3782
+ * HTMLElement
3783
+ * @override
3784
+ */
3785
+ queryDistributedElements(selector) {
3786
+ const thisEl = (
3787
+ /** @type {Element} */
3788
+ this
3789
+ );
3790
+ const domApi = (
3791
+ /** @type {PolymerDomApi} */
3792
+ dom(thisEl)
3793
+ );
3794
+ return domApi.queryDistributedElements(selector);
3795
+ }
3796
+ /**
3797
+ * Returns a list of elements that are the effective children. The effective
3798
+ * children list is the same as the element's children except that
3799
+ * any `<content>` elements are replaced with the list of elements
3800
+ * distributed to the `<content>`.
3801
+ *
3802
+ * @return {!Array<!Node>} List of effective children.
3803
+ * @override
3804
+ */
3805
+ getEffectiveChildren() {
3806
+ let list = this.getEffectiveChildNodes();
3807
+ return list.filter(function(n) {
3808
+ return n.nodeType === Node.ELEMENT_NODE;
3809
+ });
3810
+ }
3811
+ /**
3812
+ * Returns a string of text content that is the concatenation of the
3813
+ * text content's of the element's effective childNodes (the elements
3814
+ * returned by <a href="#getEffectiveChildNodes>getEffectiveChildNodes</a>.
3815
+ *
3816
+ * @return {string} List of effective children.
3817
+ * @override
3818
+ */
3819
+ getEffectiveTextContent() {
3820
+ let cn = this.getEffectiveChildNodes();
3821
+ let tc = [];
3822
+ for (let i = 0, c; c = cn[i]; i++) {
3823
+ if (c.nodeType !== Node.COMMENT_NODE) {
3824
+ tc.push(c.textContent);
3825
+ }
3826
+ }
3827
+ return tc.join("");
3828
+ }
3829
+ /**
3830
+ * Returns the first effective childNode within this element that
3831
+ * match `selector`. These can be dom child nodes or elements distributed
3832
+ * to children that are insertion points.
3833
+ * @param {string} selector Selector to run.
3834
+ * @return {Node} First effective child node that matches selector.
3835
+ * @override
3836
+ */
3837
+ queryEffectiveChildren(selector) {
3838
+ let e$ = this.queryDistributedElements(selector);
3839
+ return e$ && e$[0];
3840
+ }
3841
+ /**
3842
+ * Returns a list of effective childNodes within this element that
3843
+ * match `selector`. These can be dom child nodes or elements distributed
3844
+ * to children that are insertion points.
3845
+ * @param {string} selector Selector to run.
3846
+ * @return {!Array<!Node>} List of effective child nodes that match
3847
+ * selector.
3848
+ * @override
3849
+ */
3850
+ queryAllEffectiveChildren(selector) {
3851
+ return this.queryDistributedElements(selector);
3852
+ }
3853
+ /**
3854
+ * Returns a list of nodes distributed to this element's `<slot>`.
3855
+ *
3856
+ * If this element contains more than one `<slot>` in its local DOM,
3857
+ * an optional selector may be passed to choose the desired content.
3858
+ *
3859
+ * @param {string=} slctr CSS selector to choose the desired
3860
+ * `<slot>`. Defaults to `content`.
3861
+ * @return {!Array<!Node>} List of distributed nodes for the `<slot>`.
3862
+ * @override
3863
+ */
3864
+ getContentChildNodes(slctr) {
3865
+ let content = this.root.querySelector(slctr || "slot");
3866
+ return content ? (
3867
+ /** @type {PolymerDomApi} */
3868
+ dom(content).getDistributedNodes()
3869
+ ) : [];
3870
+ }
3871
+ /**
3872
+ * Returns a list of element children distributed to this element's
3873
+ * `<slot>`.
3874
+ *
3875
+ * If this element contains more than one `<slot>` in its
3876
+ * local DOM, an optional selector may be passed to choose the desired
3877
+ * content. This method differs from `getContentChildNodes` in that only
3878
+ * elements are returned.
3879
+ *
3880
+ * @param {string=} slctr CSS selector to choose the desired
3881
+ * `<content>`. Defaults to `content`.
3882
+ * @return {!Array<!HTMLElement>} List of distributed nodes for the
3883
+ * `<slot>`.
3884
+ * @suppress {invalidCasts}
3885
+ * @override
3886
+ */
3887
+ getContentChildren(slctr) {
3888
+ let children = (
3889
+ /** @type {!Array<!HTMLElement>} */
3890
+ this.getContentChildNodes(slctr).filter(function(n) {
3891
+ return n.nodeType === Node.ELEMENT_NODE;
3892
+ })
3893
+ );
3894
+ return children;
3895
+ }
3896
+ /**
3897
+ * Checks whether an element is in this element's light DOM tree.
3898
+ *
3899
+ * @param {?Node} node The element to be checked.
3900
+ * @return {boolean} true if node is in this element's light DOM tree.
3901
+ * @suppress {invalidCasts} LegacyElementMixin must be applied to an
3902
+ * HTMLElement
3903
+ * @override
3904
+ */
3905
+ isLightDescendant(node) {
3906
+ const thisNode = (
3907
+ /** @type {Node} */
3908
+ this
3909
+ );
3910
+ return thisNode !== node && wrap(thisNode).contains(node) && wrap(thisNode).getRootNode() === wrap(node).getRootNode();
3911
+ }
3912
+ /**
3913
+ * Checks whether an element is in this element's local DOM tree.
3914
+ *
3915
+ * @param {!Element} node The element to be checked.
3916
+ * @return {boolean} true if node is in this element's local DOM tree.
3917
+ * @override
3918
+ */
3919
+ isLocalDescendant(node) {
3920
+ return this.root === wrap(node).getRootNode();
3921
+ }
3922
+ /**
3923
+ * No-op for backwards compatibility. This should now be handled by
3924
+ * ShadyCss library.
3925
+ * @param {!Element} container Container element to scope
3926
+ * @param {boolean=} shouldObserve if true, start a mutation observer for added nodes to the container
3927
+ * @return {?MutationObserver} Returns a new MutationObserver on `container` if `shouldObserve` is true.
3928
+ * @override
3929
+ */
3930
+ scopeSubtree(container, shouldObserve = false) {
3931
+ return scopeSubtree(container, shouldObserve);
3932
+ }
3933
+ /**
3934
+ * Returns the computed style value for the given property.
3935
+ * @param {string} property The css property name.
3936
+ * @return {string} Returns the computed css property value for the given
3937
+ * `property`.
3938
+ * @suppress {invalidCasts} LegacyElementMixin must be applied to an
3939
+ * HTMLElement
3940
+ * @override
3941
+ */
3942
+ getComputedStyleValue(property) {
3943
+ return styleInterface.getComputedStyleValue(
3944
+ /** @type {!Element} */
3945
+ this,
3946
+ property
3947
+ );
3948
+ }
3949
+ // debounce
3950
+ /**
3951
+ * Call `debounce` to collapse multiple requests for a named task into
3952
+ * one invocation which is made after the wait time has elapsed with
3953
+ * no new request. If no wait time is given, the callback will be called
3954
+ * at microtask timing (guaranteed before paint).
3955
+ *
3956
+ * debouncedClickAction(e) {
3957
+ * // will not call `processClick` more than once per 100ms
3958
+ * this.debounce('click', function() {
3959
+ * this.processClick();
3960
+ * } 100);
3961
+ * }
3962
+ *
3963
+ * @param {string} jobName String to identify the debounce job.
3964
+ * @param {function():void} callback Function that is called (with `this`
3965
+ * context) when the wait time elapses.
3966
+ * @param {number=} wait Optional wait time in milliseconds (ms) after the
3967
+ * last signal that must elapse before invoking `callback`
3968
+ * @return {!Object} Returns a debouncer object on which exists the
3969
+ * following methods: `isActive()` returns true if the debouncer is
3970
+ * active; `cancel()` cancels the debouncer if it is active;
3971
+ * `flush()` immediately invokes the debounced callback if the debouncer
3972
+ * is active.
3973
+ * @override
3974
+ */
3975
+ debounce(jobName, callback, wait) {
3976
+ this._debouncers = this._debouncers || {};
3977
+ return this._debouncers[jobName] = Debouncer.debounce(
3978
+ this._debouncers[jobName],
3979
+ wait > 0 ? timeOut.after(wait) : microTask,
3980
+ callback.bind(this)
3981
+ );
3982
+ }
3983
+ /**
3984
+ * Returns whether a named debouncer is active.
3985
+ *
3986
+ * @param {string} jobName The name of the debouncer started with `debounce`
3987
+ * @return {boolean} Whether the debouncer is active (has not yet fired).
3988
+ * @override
3989
+ */
3990
+ isDebouncerActive(jobName) {
3991
+ this._debouncers = this._debouncers || {};
3992
+ let debouncer = this._debouncers[jobName];
3993
+ return !!(debouncer && debouncer.isActive());
3994
+ }
3995
+ /**
3996
+ * Immediately calls the debouncer `callback` and inactivates it.
3997
+ *
3998
+ * @param {string} jobName The name of the debouncer started with `debounce`
3999
+ * @return {void}
4000
+ * @override
4001
+ */
4002
+ flushDebouncer(jobName) {
4003
+ this._debouncers = this._debouncers || {};
4004
+ let debouncer = this._debouncers[jobName];
4005
+ if (debouncer) {
4006
+ debouncer.flush();
4007
+ }
4008
+ }
4009
+ /**
4010
+ * Cancels an active debouncer. The `callback` will not be called.
4011
+ *
4012
+ * @param {string} jobName The name of the debouncer started with `debounce`
4013
+ * @return {void}
4014
+ * @override
4015
+ */
4016
+ cancelDebouncer(jobName) {
4017
+ this._debouncers = this._debouncers || {};
4018
+ let debouncer = this._debouncers[jobName];
4019
+ if (debouncer) {
4020
+ debouncer.cancel();
4021
+ }
4022
+ }
4023
+ /**
4024
+ * Runs a callback function asynchronously.
4025
+ *
4026
+ * By default (if no waitTime is specified), async callbacks are run at
4027
+ * microtask timing, which will occur before paint.
4028
+ *
4029
+ * @param {!Function} callback The callback function to run, bound to
4030
+ * `this`.
4031
+ * @param {number=} waitTime Time to wait before calling the
4032
+ * `callback`. If unspecified or 0, the callback will be run at microtask
4033
+ * timing (before paint).
4034
+ * @return {number} Handle that may be used to cancel the async job.
4035
+ * @override
4036
+ */
4037
+ async(callback, waitTime) {
4038
+ return waitTime > 0 ? timeOut.run(callback.bind(this), waitTime) : ~microTask.run(callback.bind(this));
4039
+ }
4040
+ /**
4041
+ * Cancels an async operation started with `async`.
4042
+ *
4043
+ * @param {number} handle Handle returned from original `async` call to
4044
+ * cancel.
4045
+ * @return {void}
4046
+ * @override
4047
+ */
4048
+ cancelAsync(handle) {
4049
+ handle < 0 ? microTask.cancel(~handle) : timeOut.cancel(handle);
4050
+ }
4051
+ // other
4052
+ /**
4053
+ * Convenience method for creating an element and configuring it.
4054
+ *
4055
+ * @param {string} tag HTML element tag to create.
4056
+ * @param {Object=} props Object of properties to configure on the
4057
+ * instance.
4058
+ * @return {!Element} Newly created and configured element.
4059
+ * @override
4060
+ */
4061
+ create(tag, props) {
4062
+ let elt = document.createElement(tag);
4063
+ if (props) {
4064
+ if (elt.setProperties) {
4065
+ elt.setProperties(props);
4066
+ } else {
4067
+ for (let n in props) {
4068
+ elt[n] = props[n];
4069
+ }
4070
+ }
4071
+ }
4072
+ return elt;
4073
+ }
4074
+ /**
4075
+ * Polyfill for Element.prototype.matches, which is sometimes still
4076
+ * prefixed.
4077
+ *
4078
+ * @param {string} selector Selector to test.
4079
+ * @param {!Element=} node Element to test the selector against.
4080
+ * @return {boolean} Whether the element matches the selector.
4081
+ * @override
4082
+ */
4083
+ elementMatches(selector, node) {
4084
+ return matchesSelector(node || this, selector);
4085
+ }
4086
+ /**
4087
+ * Toggles an HTML attribute on or off.
4088
+ *
4089
+ * @param {string} name HTML attribute name
4090
+ * @param {boolean=} bool Boolean to force the attribute on or off.
4091
+ * When unspecified, the state of the attribute will be reversed.
4092
+ * @return {boolean} true if the attribute now exists
4093
+ * @override
4094
+ */
4095
+ toggleAttribute(name, bool) {
4096
+ let node = (
4097
+ /** @type {Element} */
4098
+ this
4099
+ );
4100
+ if (arguments.length === 3) {
4101
+ node = /** @type {Element} */
4102
+ arguments[2];
4103
+ }
4104
+ if (arguments.length == 1) {
4105
+ bool = !node.hasAttribute(name);
4106
+ }
4107
+ if (bool) {
4108
+ wrap(node).setAttribute(name, "");
4109
+ return true;
4110
+ } else {
4111
+ wrap(node).removeAttribute(name);
4112
+ return false;
4113
+ }
4114
+ }
4115
+ /**
4116
+ * Toggles a CSS class on or off.
4117
+ *
4118
+ * @param {string} name CSS class name
4119
+ * @param {boolean=} bool Boolean to force the class on or off.
4120
+ * When unspecified, the state of the class will be reversed.
4121
+ * @param {Element=} node Node to target. Defaults to `this`.
4122
+ * @return {void}
4123
+ * @override
4124
+ */
4125
+ toggleClass(name, bool, node) {
4126
+ node = /** @type {Element} */
4127
+ node || this;
4128
+ if (arguments.length == 1) {
4129
+ bool = !node.classList.contains(name);
4130
+ }
4131
+ if (bool) {
4132
+ node.classList.add(name);
4133
+ } else {
4134
+ node.classList.remove(name);
4135
+ }
4136
+ }
4137
+ /**
4138
+ * Cross-platform helper for setting an element's CSS `transform` property.
4139
+ *
4140
+ * @param {string} transformText Transform setting.
4141
+ * @param {Element=} node Element to apply the transform to.
4142
+ * Defaults to `this`
4143
+ * @return {void}
4144
+ * @override
4145
+ */
4146
+ transform(transformText, node) {
4147
+ node = /** @type {Element} */
4148
+ node || this;
4149
+ node.style.webkitTransform = transformText;
4150
+ node.style.transform = transformText;
4151
+ }
4152
+ /**
4153
+ * Cross-platform helper for setting an element's CSS `translate3d`
4154
+ * property.
4155
+ *
4156
+ * @param {number|string} x X offset.
4157
+ * @param {number|string} y Y offset.
4158
+ * @param {number|string} z Z offset.
4159
+ * @param {Element=} node Element to apply the transform to.
4160
+ * Defaults to `this`.
4161
+ * @return {void}
4162
+ * @override
4163
+ */
4164
+ translate3d(x, y, z, node) {
4165
+ node = /** @type {Element} */
4166
+ node || this;
4167
+ this.transform("translate3d(" + x + "," + y + "," + z + ")", node);
4168
+ }
4169
+ /**
4170
+ * Removes an item from an array, if it exists.
4171
+ *
4172
+ * If the array is specified by path, a change notification is
4173
+ * generated, so that observers, data bindings and computed
4174
+ * properties watching that path can update.
4175
+ *
4176
+ * If the array is passed directly, **no change
4177
+ * notification is generated**.
4178
+ *
4179
+ * @param {string | !Array<number|string>} arrayOrPath Path to array from
4180
+ * which to remove the item
4181
+ * (or the array itself).
4182
+ * @param {*} item Item to remove.
4183
+ * @return {Array} Array containing item removed.
4184
+ * @override
4185
+ */
4186
+ arrayDelete(arrayOrPath, item) {
4187
+ let index;
4188
+ if (Array.isArray(arrayOrPath)) {
4189
+ index = arrayOrPath.indexOf(item);
4190
+ if (index >= 0) {
4191
+ return arrayOrPath.splice(index, 1);
4192
+ }
4193
+ } else {
4194
+ let arr = get(this, arrayOrPath);
4195
+ index = arr.indexOf(item);
4196
+ if (index >= 0) {
4197
+ return this.splice(arrayOrPath, index, 1);
4198
+ }
4199
+ }
4200
+ return null;
4201
+ }
4202
+ // logging
4203
+ /**
4204
+ * Facades `console.log`/`warn`/`error` as override point.
4205
+ *
4206
+ * @param {string} level One of 'log', 'warn', 'error'
4207
+ * @param {Array} args Array of strings or objects to log
4208
+ * @return {void}
4209
+ * @override
4210
+ */
4211
+ _logger(level, args) {
4212
+ if (Array.isArray(args) && args.length === 1 && Array.isArray(args[0])) {
4213
+ args = args[0];
4214
+ }
4215
+ switch (level) {
4216
+ case "log":
4217
+ case "warn":
4218
+ case "error":
4219
+ console[level](...args);
4220
+ }
4221
+ }
4222
+ /**
4223
+ * Facades `console.log` as an override point.
4224
+ *
4225
+ * @param {...*} args Array of strings or objects to log
4226
+ * @return {void}
4227
+ * @override
4228
+ */
4229
+ _log(...args) {
4230
+ this._logger("log", args);
4231
+ }
4232
+ /**
4233
+ * Facades `console.warn` as an override point.
4234
+ *
4235
+ * @param {...*} args Array of strings or objects to log
4236
+ * @return {void}
4237
+ * @override
4238
+ */
4239
+ _warn(...args) {
4240
+ this._logger("warn", args);
4241
+ }
4242
+ /**
4243
+ * Facades `console.error` as an override point.
4244
+ *
4245
+ * @param {...*} args Array of strings or objects to log
4246
+ * @return {void}
4247
+ * @override
4248
+ */
4249
+ _error(...args) {
4250
+ this._logger("error", args);
4251
+ }
4252
+ /**
4253
+ * Formats a message using the element type an a method name.
4254
+ *
4255
+ * @param {string} methodName Method name to associate with message
4256
+ * @param {...*} args Array of strings or objects to log
4257
+ * @return {!Array} Array with formatting information for `console`
4258
+ * logging.
4259
+ * @override
4260
+ */
4261
+ _logf(methodName, ...args) {
4262
+ return ["[%s::%s]", this.is, methodName, ...args];
4263
+ }
4264
+ }
4265
+ LegacyElement2.prototype.is = "";
4266
+ return LegacyElement2;
4267
+ });
4268
+
4269
+ // ../../../node_modules/@polymer/polymer/lib/legacy/class.js
4270
+ var lifecycleProps = {
4271
+ attached: true,
4272
+ detached: true,
4273
+ ready: true,
4274
+ created: true,
4275
+ beforeRegister: true,
4276
+ registered: true,
4277
+ attributeChanged: true,
4278
+ listeners: true,
4279
+ hostAttributes: true
4280
+ };
4281
+ var excludeOnInfo = {
4282
+ attached: true,
4283
+ detached: true,
4284
+ ready: true,
4285
+ created: true,
4286
+ beforeRegister: true,
4287
+ registered: true,
4288
+ attributeChanged: true,
4289
+ behaviors: true,
4290
+ _noAccessors: true
4291
+ };
4292
+ var excludeOnBehaviors = Object.assign({
4293
+ listeners: true,
4294
+ hostAttributes: true,
4295
+ properties: true,
4296
+ observers: true
4297
+ }, excludeOnInfo);
4298
+ function copyProperties(source, target, excludeProps) {
4299
+ const noAccessors = source._noAccessors;
4300
+ const propertyNames = Object.getOwnPropertyNames(source);
4301
+ for (let i = 0; i < propertyNames.length; i++) {
4302
+ let p2 = propertyNames[i];
4303
+ if (p2 in excludeProps) {
4304
+ continue;
4305
+ }
4306
+ if (noAccessors) {
4307
+ target[p2] = source[p2];
4308
+ } else {
4309
+ let pd = Object.getOwnPropertyDescriptor(source, p2);
4310
+ if (pd) {
4311
+ pd.configurable = true;
4312
+ Object.defineProperty(target, p2, pd);
4313
+ }
4314
+ }
4315
+ }
4316
+ }
4317
+ function mixinBehaviors(behaviors, klass) {
4318
+ return GenerateClassFromInfo({}, LegacyElementMixin(klass), behaviors);
4319
+ }
4320
+ function applyBehaviors(proto, behaviors, lifecycle) {
4321
+ for (let i = 0; i < behaviors.length; i++) {
4322
+ applyInfo(proto, behaviors[i], lifecycle, excludeOnBehaviors);
4323
+ }
4324
+ }
4325
+ function applyInfo(proto, info, lifecycle, excludeProps) {
4326
+ copyProperties(info, proto, excludeProps);
4327
+ for (let p2 in lifecycleProps) {
4328
+ if (info[p2]) {
4329
+ lifecycle[p2] = lifecycle[p2] || [];
4330
+ lifecycle[p2].push(info[p2]);
4331
+ }
4332
+ }
4333
+ }
4334
+ function flattenBehaviors(behaviors, list, exclude) {
4335
+ list = list || [];
4336
+ for (let i = behaviors.length - 1; i >= 0; i--) {
4337
+ let b = behaviors[i];
4338
+ if (b) {
4339
+ if (Array.isArray(b)) {
4340
+ flattenBehaviors(b, list);
4341
+ } else {
4342
+ if (list.indexOf(b) < 0 && (!exclude || exclude.indexOf(b) < 0)) {
4343
+ list.unshift(b);
4344
+ }
4345
+ }
4346
+ } else {
4347
+ console.warn("behavior is null, check for missing or 404 import");
4348
+ }
4349
+ }
4350
+ return list;
4351
+ }
4352
+ function mergeProperties(target, source) {
4353
+ for (const p2 in source) {
4354
+ const targetInfo = target[p2];
4355
+ const sourceInfo = source[p2];
4356
+ if (!("value" in sourceInfo) && targetInfo && "value" in targetInfo) {
4357
+ target[p2] = Object.assign({ value: targetInfo.value }, sourceInfo);
4358
+ } else {
4359
+ target[p2] = sourceInfo;
4360
+ }
4361
+ }
4362
+ }
4363
+ var LegacyElement = LegacyElementMixin(HTMLElement);
4364
+ function GenerateClassFromInfo(info, Base, behaviors) {
4365
+ let behaviorList;
4366
+ const lifecycle = {};
4367
+ class PolymerGenerated extends Base {
4368
+ // explicitly not calling super._finalizeClass
4369
+ /** @nocollapse */
4370
+ static _finalizeClass() {
4371
+ if (!this.hasOwnProperty(JSCompiler_renameProperty("generatedFrom", this))) {
4372
+ Base._finalizeClass.call(this);
4373
+ } else {
4374
+ if (behaviorList) {
4375
+ for (let i = 0, b; i < behaviorList.length; i++) {
4376
+ b = behaviorList[i];
4377
+ if (b.properties) {
4378
+ this.createProperties(b.properties);
4379
+ }
4380
+ if (b.observers) {
4381
+ this.createObservers(b.observers, b.properties);
4382
+ }
4383
+ }
4384
+ }
4385
+ if (info.properties) {
4386
+ this.createProperties(info.properties);
4387
+ }
4388
+ if (info.observers) {
4389
+ this.createObservers(info.observers, info.properties);
4390
+ }
4391
+ this._prepareTemplate();
4392
+ }
4393
+ }
4394
+ /** @nocollapse */
4395
+ static get properties() {
4396
+ const properties = {};
4397
+ if (behaviorList) {
4398
+ for (let i = 0; i < behaviorList.length; i++) {
4399
+ mergeProperties(properties, behaviorList[i].properties);
4400
+ }
4401
+ }
4402
+ mergeProperties(properties, info.properties);
4403
+ return properties;
4404
+ }
4405
+ /** @nocollapse */
4406
+ static get observers() {
4407
+ let observers = [];
4408
+ if (behaviorList) {
4409
+ for (let i = 0, b; i < behaviorList.length; i++) {
4410
+ b = behaviorList[i];
4411
+ if (b.observers) {
4412
+ observers = observers.concat(b.observers);
4413
+ }
4414
+ }
4415
+ }
4416
+ if (info.observers) {
4417
+ observers = observers.concat(info.observers);
4418
+ }
4419
+ return observers;
4420
+ }
4421
+ /**
4422
+ * @return {void}
4423
+ */
4424
+ created() {
4425
+ super.created();
4426
+ const list = lifecycle.created;
4427
+ if (list) {
4428
+ for (let i = 0; i < list.length; i++) {
4429
+ list[i].call(this);
4430
+ }
4431
+ }
4432
+ }
4433
+ /**
4434
+ * @return {void}
4435
+ */
4436
+ _registered() {
4437
+ const generatedProto = PolymerGenerated.prototype;
4438
+ if (!generatedProto.hasOwnProperty(JSCompiler_renameProperty("__hasRegisterFinished", generatedProto))) {
4439
+ generatedProto.__hasRegisterFinished = true;
4440
+ super._registered();
4441
+ if (legacyOptimizations) {
4442
+ copyPropertiesToProto(generatedProto);
4443
+ }
4444
+ const proto = Object.getPrototypeOf(this);
4445
+ let list = lifecycle.beforeRegister;
4446
+ if (list) {
4447
+ for (let i = 0; i < list.length; i++) {
4448
+ list[i].call(proto);
4449
+ }
4450
+ }
4451
+ list = lifecycle.registered;
4452
+ if (list) {
4453
+ for (let i = 0; i < list.length; i++) {
4454
+ list[i].call(proto);
4455
+ }
4456
+ }
4457
+ }
4458
+ }
4459
+ /**
4460
+ * @return {void}
4461
+ */
4462
+ _applyListeners() {
4463
+ super._applyListeners();
4464
+ const list = lifecycle.listeners;
4465
+ if (list) {
4466
+ for (let i = 0; i < list.length; i++) {
4467
+ const listeners = list[i];
4468
+ if (listeners) {
4469
+ for (let l in listeners) {
4470
+ this._addMethodEventListenerToNode(this, l, listeners[l]);
4471
+ }
4472
+ }
4473
+ }
4474
+ }
4475
+ }
4476
+ // note: exception to "super then me" rule;
4477
+ // do work before calling super so that super attributes
4478
+ // only apply if not already set.
4479
+ /**
4480
+ * @return {void}
4481
+ */
4482
+ _ensureAttributes() {
4483
+ const list = lifecycle.hostAttributes;
4484
+ if (list) {
4485
+ for (let i = list.length - 1; i >= 0; i--) {
4486
+ const hostAttributes = list[i];
4487
+ for (let a in hostAttributes) {
4488
+ this._ensureAttribute(a, hostAttributes[a]);
4489
+ }
4490
+ }
4491
+ }
4492
+ super._ensureAttributes();
4493
+ }
4494
+ /**
4495
+ * @return {void}
4496
+ */
4497
+ ready() {
4498
+ super.ready();
4499
+ let list = lifecycle.ready;
4500
+ if (list) {
4501
+ for (let i = 0; i < list.length; i++) {
4502
+ list[i].call(this);
4503
+ }
4504
+ }
4505
+ }
4506
+ /**
4507
+ * @return {void}
4508
+ */
4509
+ attached() {
4510
+ super.attached();
4511
+ let list = lifecycle.attached;
4512
+ if (list) {
4513
+ for (let i = 0; i < list.length; i++) {
4514
+ list[i].call(this);
4515
+ }
4516
+ }
4517
+ }
4518
+ /**
4519
+ * @return {void}
4520
+ */
4521
+ detached() {
4522
+ super.detached();
4523
+ let list = lifecycle.detached;
4524
+ if (list) {
4525
+ for (let i = 0; i < list.length; i++) {
4526
+ list[i].call(this);
4527
+ }
4528
+ }
4529
+ }
4530
+ /**
4531
+ * Implements native Custom Elements `attributeChangedCallback` to
4532
+ * set an attribute value to a property via `_attributeToProperty`.
4533
+ *
4534
+ * @param {string} name Name of attribute that changed
4535
+ * @param {?string} old Old attribute value
4536
+ * @param {?string} value New attribute value
4537
+ * @return {void}
4538
+ */
4539
+ attributeChanged(name, old, value) {
4540
+ super.attributeChanged();
4541
+ let list = lifecycle.attributeChanged;
4542
+ if (list) {
4543
+ for (let i = 0; i < list.length; i++) {
4544
+ list[i].call(this, name, old, value);
4545
+ }
4546
+ }
4547
+ }
4548
+ }
4549
+ if (behaviors) {
4550
+ if (!Array.isArray(behaviors)) {
4551
+ behaviors = [behaviors];
4552
+ }
4553
+ let superBehaviors = Base.prototype.behaviors;
4554
+ behaviorList = flattenBehaviors(behaviors, null, superBehaviors);
4555
+ PolymerGenerated.prototype.behaviors = superBehaviors ? superBehaviors.concat(behaviors) : behaviorList;
4556
+ }
4557
+ const copyPropertiesToProto = (proto) => {
4558
+ if (behaviorList) {
4559
+ applyBehaviors(proto, behaviorList, lifecycle);
4560
+ }
4561
+ applyInfo(proto, info, lifecycle, excludeOnInfo);
4562
+ };
4563
+ if (!legacyOptimizations) {
4564
+ copyPropertiesToProto(PolymerGenerated.prototype);
4565
+ }
4566
+ PolymerGenerated.generatedFrom = info;
4567
+ return PolymerGenerated;
4568
+ }
4569
+ var Class = function(info, mixin) {
4570
+ if (!info) {
4571
+ console.warn("Polymer.Class requires `info` argument");
4572
+ }
4573
+ let klass = mixin ? mixin(LegacyElement) : LegacyElement;
4574
+ klass = GenerateClassFromInfo(info, klass, info.behaviors);
4575
+ klass.is = klass.prototype.is = info.is;
4576
+ return klass;
4577
+ };
4578
+
4579
+ export {
4580
+ nativeShadow,
4581
+ cssBuild,
4582
+ disableRuntime,
4583
+ nativeCssVariables,
4584
+ updateNativeProperties,
4585
+ getComputedStyleValue,
4586
+ CustomStyleInterface,
4587
+ Debouncer,
4588
+ enqueueDebouncer,
4589
+ GestureEventListeners,
4590
+ calculateSplices,
4591
+ flush,
4592
+ dom,
4593
+ LegacyElementMixin,
4594
+ mixinBehaviors,
4595
+ Class
4596
+ };
4597
+ //# sourceMappingURL=chunk-BHAOVVTR.js.map