chunk.DA3UDEH5.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {
  2. i,
  3. s,
  4. t
  5. } from "./chunk.VIWFLAGR.js";
  6. import {
  7. w
  8. } from "./chunk.5PIDMFOE.js";
  9. // node_modules/lit-html/directives/style-map.js
  10. var i2 = i(class extends s {
  11. constructor(t2) {
  12. var e;
  13. if (super(t2), t2.type !== t.ATTRIBUTE || t2.name !== "style" || ((e = t2.strings) === null || e === void 0 ? void 0 : e.length) > 2)
  14. throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
  15. }
  16. render(t2) {
  17. return Object.keys(t2).reduce((e, r) => {
  18. const s2 = t2[r];
  19. return s2 == null ? e : e + `${r = r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s2};`;
  20. }, "");
  21. }
  22. update(e, [r]) {
  23. const { style: s2 } = e.element;
  24. if (this.St === void 0) {
  25. this.St = new Set();
  26. for (const t2 in r)
  27. this.St.add(t2);
  28. return this.render(r);
  29. }
  30. this.St.forEach((t2) => {
  31. r[t2] == null && (this.St.delete(t2), t2.includes("-") ? s2.removeProperty(t2) : s2[t2] = "");
  32. });
  33. for (const t2 in r) {
  34. const e2 = r[t2];
  35. e2 != null && (this.St.add(t2), t2.includes("-") ? s2.setProperty(t2, e2) : s2[t2] = e2);
  36. }
  37. return w;
  38. }
  39. });
  40. export {
  41. i2 as i
  42. };
  43. /**
  44. * @license
  45. * Copyright 2018 Google LLC
  46. * SPDX-License-Identifier: BSD-3-Clause
  47. */