@studiometa/ui 0.2.43 → 0.2.45

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 (45) hide show
  1. package/README.md +2 -0
  2. package/atoms/Action/Action.cjs +90 -0
  3. package/atoms/Action/Action.cjs.map +7 -0
  4. package/atoms/Action/Action.d.ts +28 -0
  5. package/atoms/Action/Action.js +63 -0
  6. package/atoms/Action/Action.js.map +7 -0
  7. package/atoms/Action/index.cjs +21 -0
  8. package/atoms/Action/index.cjs.map +7 -0
  9. package/atoms/Action/index.d.ts +1 -0
  10. package/atoms/Action/index.js +2 -0
  11. package/atoms/Action/index.js.map +7 -0
  12. package/atoms/CircularMarquee/CircularMarquee.cjs +74 -0
  13. package/atoms/CircularMarquee/CircularMarquee.cjs.map +7 -0
  14. package/atoms/CircularMarquee/CircularMarquee.d.ts +34 -0
  15. package/atoms/CircularMarquee/CircularMarquee.js +47 -0
  16. package/atoms/CircularMarquee/CircularMarquee.js.map +7 -0
  17. package/atoms/CircularMarquee/CircularMarquee.twig +55 -0
  18. package/atoms/CircularMarquee/index.cjs +21 -0
  19. package/atoms/CircularMarquee/index.cjs.map +7 -0
  20. package/atoms/CircularMarquee/index.d.ts +1 -0
  21. package/atoms/CircularMarquee/index.js +2 -0
  22. package/atoms/CircularMarquee/index.js.map +7 -0
  23. package/atoms/Figure/FigureTwicpics.cjs +22 -4
  24. package/atoms/Figure/FigureTwicpics.cjs.map +2 -2
  25. package/atoms/Figure/FigureTwicpics.d.ts +9 -1
  26. package/atoms/Figure/FigureTwicpics.js +22 -4
  27. package/atoms/Figure/FigureTwicpics.js.map +2 -2
  28. package/atoms/index.cjs +2 -0
  29. package/atoms/index.cjs.map +2 -2
  30. package/atoms/index.d.ts +2 -0
  31. package/atoms/index.js +2 -0
  32. package/atoms/index.js.map +2 -2
  33. package/molecules/MapboxStaticMap/MapboxStaticMap.twig +79 -0
  34. package/molecules/Reinsurance/Reinsurance.twig +63 -0
  35. package/molecules/Slider/Slider.cjs +8 -0
  36. package/molecules/Slider/Slider.cjs.map +2 -2
  37. package/molecules/Slider/Slider.d.ts +4 -0
  38. package/molecules/Slider/Slider.js +8 -0
  39. package/molecules/Slider/Slider.js.map +2 -2
  40. package/molecules/Slider/SliderItem.cjs +14 -3
  41. package/molecules/Slider/SliderItem.cjs.map +2 -2
  42. package/molecules/Slider/SliderItem.d.ts +8 -0
  43. package/molecules/Slider/SliderItem.js +14 -3
  44. package/molecules/Slider/SliderItem.js.map +2 -2
  45. package/package.json +1 -1
package/README.md CHANGED
@@ -46,3 +46,5 @@ Heads up to [ui.studiometa.dev](https://ui.studiometa.dev) for more informations
46
46
  ## Contributing
47
47
 
48
48
  Please read the [contribution docs](https://ui.studiometa.dev/-/guide/contributing/).
49
+
50
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/studiometa/ui)
@@ -0,0 +1,90 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __publicField = (obj, key, value) => {
20
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+ return value;
22
+ };
23
+
24
+ // packages/ui/atoms/Action/Action.ts
25
+ var Action_exports = {};
26
+ __export(Action_exports, {
27
+ Action: () => Action
28
+ });
29
+ module.exports = __toCommonJS(Action_exports);
30
+ var import_js_toolkit = require("@studiometa/js-toolkit");
31
+ var import_utils = require("@studiometa/js-toolkit/utils");
32
+ var Action = class extends import_js_toolkit.Base {
33
+ /**
34
+ * Run method on targeted components
35
+ */
36
+ handleEvent() {
37
+ const { target: componentNames, method, selector } = this.$options;
38
+ let targets = componentNames.includes(" ") ? componentNames.split(" ").flatMap((componentName) => this.$root.$children?.[componentName]) : this.$root.$children?.[componentNames];
39
+ if (!targets || !targets.length) {
40
+ this.$warn("Target not found.");
41
+ return;
42
+ }
43
+ if (selector || selector.length > 0) {
44
+ targets = targets.filter((target) => target.$el.matches(selector));
45
+ }
46
+ if (!targets || !targets.length) {
47
+ this.$warn(`Target with selector "${selector}" not found.`);
48
+ return;
49
+ }
50
+ targets.forEach((target) => {
51
+ if (!(0, import_utils.isFunction)(target[method])) {
52
+ this.$warn(`Method "${method}()" not found on target.`, target);
53
+ return;
54
+ }
55
+ target[method]();
56
+ });
57
+ }
58
+ /**
59
+ * Mounted
60
+ */
61
+ mounted() {
62
+ const { on: eventName, target, method } = this.$options;
63
+ if (!target || !method || target.length <= 0 || method.length <= 0) {
64
+ this.$warn("No target or method specified.");
65
+ this.$terminate();
66
+ return;
67
+ }
68
+ this.$el.addEventListener(eventName, this);
69
+ }
70
+ /**
71
+ * Destroyed
72
+ */
73
+ destroyed() {
74
+ this.$el.removeEventListener(this.$options.on, this);
75
+ }
76
+ };
77
+ __publicField(Action, "config", {
78
+ name: "Action",
79
+ options: {
80
+ on: {
81
+ type: String,
82
+ default: "click"
83
+ },
84
+ target: String,
85
+ method: String,
86
+ selector: String
87
+ }
88
+ });
89
+ if (module.exports.default) module.exports = module.exports.default;
90
+ //# sourceMappingURL=Action.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/Action/Action.ts"],
4
+ "sourcesContent": ["import { Base } from '@studiometa/js-toolkit';\nimport { isFunction } from '@studiometa/js-toolkit/utils';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\n\nexport interface ActionProps extends BaseProps {\n $options: {\n on: string;\n target: string;\n method: string;\n selector: string;\n };\n}\n\n/**\n * Action class.\n */\nexport class Action<T extends BaseProps = BaseProps> extends Base<ActionProps & T> {\n static config: BaseConfig = {\n name: 'Action',\n options: {\n on: {\n type: String,\n default: 'click',\n },\n target: String,\n method: String,\n selector: String,\n },\n };\n\n /**\n * Run method on targeted components\n */\n handleEvent() {\n const { target: componentNames, method, selector } = this.$options;\n\n let targets = componentNames.includes(' ')\n ? componentNames\n .split(' ')\n .flatMap((componentName) => this.$root.$children?.[componentName] as Base[])\n : (this.$root.$children?.[componentNames] as Base[]);\n\n if (!targets || !targets.length) {\n this.$warn('Target not found.');\n return;\n }\n\n if (selector || selector.length > 0) {\n targets = targets.filter((target) => target.$el.matches(selector));\n }\n\n if (!targets || !targets.length) {\n this.$warn(`Target with selector \"${selector}\" not found.`);\n return;\n }\n\n targets.forEach((target) => {\n if (!isFunction(target[method])) {\n this.$warn(`Method \"${method}()\" not found on target.`, target);\n return;\n }\n\n target[method]();\n });\n }\n\n /**\n * Mounted\n */\n mounted() {\n const { on: eventName, target, method } = this.$options;\n\n if (!target || !method || target.length <= 0 || method.length <= 0) {\n this.$warn('No target or method specified.');\n this.$terminate();\n return;\n }\n\n this.$el.addEventListener(eventName, this);\n }\n\n /**\n * Destroyed\n */\n destroyed() {\n this.$el.removeEventListener(this.$options.on, this);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAqB;AACrB,mBAA2B;AAepB,IAAM,SAAN,cAAsD,uBAAsB;AAAA;AAAA;AAAA;AAAA,EAiBjF,cAAc;AACZ,UAAM,EAAE,QAAQ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ACR,UAAU;AAAA,EACZ;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,28 @@
1
+ import { Base } from '@studiometa/js-toolkit';
2
+ import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
3
+ export interface ActionProps extends BaseProps {
4
+ $options: {
5
+ on: string;
6
+ target: string;
7
+ method: string;
8
+ selector: string;
9
+ };
10
+ }
11
+ /**
12
+ * Action class.
13
+ */
14
+ export declare class Action<T extends BaseProps = BaseProps> extends Base<ActionProps & T> {
15
+ static config: BaseConfig;
16
+ /**
17
+ * Run method on targeted components
18
+ */
19
+ handleEvent(): void;
20
+ /**
21
+ * Mounted
22
+ */
23
+ mounted(): void;
24
+ /**
25
+ * Destroyed
26
+ */
27
+ destroyed(): void;
28
+ }
@@ -0,0 +1,63 @@
1
+ import { Base } from "@studiometa/js-toolkit";
2
+ import { isFunction } from "@studiometa/js-toolkit/utils";
3
+ class Action extends Base {
4
+ static config = {
5
+ name: "Action",
6
+ options: {
7
+ on: {
8
+ type: String,
9
+ default: "click"
10
+ },
11
+ target: String,
12
+ method: String,
13
+ selector: String
14
+ }
15
+ };
16
+ /**
17
+ * Run method on targeted components
18
+ */
19
+ handleEvent() {
20
+ const { target: componentNames, method, selector } = this.$options;
21
+ let targets = componentNames.includes(" ") ? componentNames.split(" ").flatMap((componentName) => this.$root.$children?.[componentName]) : this.$root.$children?.[componentNames];
22
+ if (!targets || !targets.length) {
23
+ this.$warn("Target not found.");
24
+ return;
25
+ }
26
+ if (selector || selector.length > 0) {
27
+ targets = targets.filter((target) => target.$el.matches(selector));
28
+ }
29
+ if (!targets || !targets.length) {
30
+ this.$warn(`Target with selector "${selector}" not found.`);
31
+ return;
32
+ }
33
+ targets.forEach((target) => {
34
+ if (!isFunction(target[method])) {
35
+ this.$warn(`Method "${method}()" not found on target.`, target);
36
+ return;
37
+ }
38
+ target[method]();
39
+ });
40
+ }
41
+ /**
42
+ * Mounted
43
+ */
44
+ mounted() {
45
+ const { on: eventName, target, method } = this.$options;
46
+ if (!target || !method || target.length <= 0 || method.length <= 0) {
47
+ this.$warn("No target or method specified.");
48
+ this.$terminate();
49
+ return;
50
+ }
51
+ this.$el.addEventListener(eventName, this);
52
+ }
53
+ /**
54
+ * Destroyed
55
+ */
56
+ destroyed() {
57
+ this.$el.removeEventListener(this.$options.on, this);
58
+ }
59
+ }
60
+ export {
61
+ Action
62
+ };
63
+ //# sourceMappingURL=Action.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/Action/Action.ts"],
4
+ "sourcesContent": ["import { Base } from '@studiometa/js-toolkit';\nimport { isFunction } from '@studiometa/js-toolkit/utils';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\n\nexport interface ActionProps extends BaseProps {\n $options: {\n on: string;\n target: string;\n method: string;\n selector: string;\n };\n}\n\n/**\n * Action class.\n */\nexport class Action<T extends BaseProps = BaseProps> extends Base<ActionProps & T> {\n static config: BaseConfig = {\n name: 'Action',\n options: {\n on: {\n type: String,\n default: 'click',\n },\n target: String,\n method: String,\n selector: String,\n },\n };\n\n /**\n * Run method on targeted components\n */\n handleEvent() {\n const { target: componentNames, method, selector } = this.$options;\n\n let targets = componentNames.includes(' ')\n ? componentNames\n .split(' ')\n .flatMap((componentName) => this.$root.$children?.[componentName] as Base[])\n : (this.$root.$children?.[componentNames] as Base[]);\n\n if (!targets || !targets.length) {\n this.$warn('Target not found.');\n return;\n }\n\n if (selector || selector.length > 0) {\n targets = targets.filter((target) => target.$el.matches(selector));\n }\n\n if (!targets || !targets.length) {\n this.$warn(`Target with selector \"${selector}\" not found.`);\n return;\n }\n\n targets.forEach((target) => {\n if (!isFunction(target[method])) {\n this.$warn(`Method \"${method}()\" not found on target.`, target);\n return;\n }\n\n target[method]();\n });\n }\n\n /**\n * Mounted\n */\n mounted() {\n const { on: eventName, target, method } = this.$options;\n\n if (!target || !method || target.length <= 0 || method.length <= 0) {\n this.$warn('No target or method specified.');\n this.$terminate();\n return;\n }\n\n this.$el.addEventListener(eventName, this);\n }\n\n /**\n * Destroyed\n */\n destroyed() {\n this.$el.removeEventListener(this.$options.on, this);\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAepB,MAAM,eAAgD,KAAsB;AAAA,EACjF,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,SAAS;AAAA,MACP,IAAI;AAAA,QACF,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,IACZ;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,cAAc;AACZ,UAAM,EAAE,QAAQ,gBAAgB,QAAQ,SAAS,IAAI,KAAK;AAE1D,QAAI,UAAU,eAAe,SAAS,GAAG,IACrC,eACG,MAAM,GAAG,EACT,QAAQ,CAAC,kBAAkB,KAAK,MAAM,YAAY,aAAa,CAAW,IAC5E,KAAK,MAAM,YAAY,cAAc;AAE1C,QAAI,CAAC,WAAW,CAAC,QAAQ,QAAQ;AAC/B,WAAK,MAAM,mBAAmB;AAC9B;AAAA,IACF;AAEA,QAAI,YAAY,SAAS,SAAS,GAAG;AACnC,gBAAU,QAAQ,OAAO,CAAC,WAAW,OAAO,IAAI,QAAQ,QAAQ,CAAC;AAAA,IACnE;AAEA,QAAI,CAAC,WAAW,CAAC,QAAQ,QAAQ;AAC/B,WAAK,MAAM,yBAAyB,sBAAsB;AAC1D;AAAA,IACF;AAEA,YAAQ,QAAQ,CAAC,WAAW;AAC1B,UAAI,CAAC,WAAW,OAAO,MAAM,CAAC,GAAG;AAC/B,aAAK,MAAM,WAAW,kCAAkC,MAAM;AAC9D;AAAA,MACF;AAEA,aAAO,MAAM,EAAE;AAAA,IACjB,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AACR,UAAM,EAAE,IAAI,WAAW,QAAQ,OAAO,IAAI,KAAK;AAE/C,QAAI,CAAC,UAAU,CAAC,UAAU,OAAO,UAAU,KAAK,OAAO,UAAU,GAAG;AAClE,WAAK,MAAM,gCAAgC;AAC3C,WAAK,WAAW;AAChB;AAAA,IACF;AAEA,SAAK,IAAI,iBAAiB,WAAW,IAAI;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AACV,SAAK,IAAI,oBAAoB,KAAK,SAAS,IAAI,IAAI;AAAA,EACrD;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/ui/atoms/Action/index.ts
17
+ var Action_exports = {};
18
+ module.exports = __toCommonJS(Action_exports);
19
+ __reExport(Action_exports, require("./Action.cjs"), module.exports);
20
+ if (module.exports.default) module.exports = module.exports.default;
21
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/Action/index.ts"],
4
+ "sourcesContent": ["export * from './Action.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,yBAAd;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export * from './Action.js';
@@ -0,0 +1,2 @@
1
+ export * from "./Action.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/Action/index.ts"],
4
+ "sourcesContent": ["export * from './Action.js';\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,74 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __publicField = (obj, key, value) => {
20
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+ return value;
22
+ };
23
+
24
+ // packages/ui/atoms/CircularMarquee/CircularMarquee.ts
25
+ var CircularMarquee_exports = {};
26
+ __export(CircularMarquee_exports, {
27
+ CircularMarquee: () => CircularMarquee
28
+ });
29
+ module.exports = __toCommonJS(CircularMarquee_exports);
30
+ var import_js_toolkit = require("@studiometa/js-toolkit");
31
+ var import_utils = require("@studiometa/js-toolkit/utils");
32
+ var CircularMarquee = class extends import_js_toolkit.Base {
33
+ /**
34
+ * Rotate value.
35
+ * @type {number}
36
+ */
37
+ rotate = 0;
38
+ /**
39
+ * Scroll delta Y.
40
+ * @type {number}
41
+ */
42
+ deltaY = 0;
43
+ /**
44
+ * Transform values.
45
+ * @type {object}
46
+ */
47
+ transform = {
48
+ rotate: 0
49
+ };
50
+ scrolled(props) {
51
+ this.deltaY = props.delta.y;
52
+ }
53
+ ticked() {
54
+ this.rotate -= (Math.abs(this.deltaY) + 1) * this.$options.sensitivity;
55
+ this.transform.rotate = (0, import_utils.damp)(this.rotate, this.transform.rotate, 0.25);
56
+ return () => {
57
+ (0, import_utils.transform)(this.$el, this.transform);
58
+ };
59
+ }
60
+ };
61
+ /**
62
+ * CircularMarquee Configuration
63
+ */
64
+ __publicField(CircularMarquee, "config", {
65
+ name: "CircularMarquee",
66
+ options: {
67
+ sensitivity: {
68
+ type: Number,
69
+ default: 0.1
70
+ }
71
+ }
72
+ });
73
+ if (module.exports.default) module.exports = module.exports.default;
74
+ //# sourceMappingURL=CircularMarquee.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/CircularMarquee/CircularMarquee.ts"],
4
+ "sourcesContent": ["import { Base, BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport { damp, transform } from '@studiometa/js-toolkit/utils';\n\nexport interface CircularMarqueeProps extends BaseProps {\n $options: {\n sensitivity: number;\n };\n}\n\n/**\n * CircularMarquee component\n */\nexport class CircularMarquee extends Base<CircularMarqueeProps> {\n /**\n * CircularMarquee Configuration\n */\n static config: BaseConfig = {\n name: 'CircularMarquee',\n options: {\n sensitivity: {\n type: Number,\n default: 0.1,\n },\n },\n };\n\n /**\n * Rotate value.\n * @type {number}\n */\n rotate = 0;\n\n /**\n * Scroll delta Y.\n * @type {number}\n */\n deltaY = 0;\n\n /**\n * Transform values.\n * @type {object}\n */\n transform = {\n rotate: 0,\n };\n\n scrolled(props) {\n this.deltaY = props.delta.y;\n }\n\n ticked() {\n this.rotate -= (Math.abs(this.deltaY) + 1) * this.$options.sensitivity;\n\n this.transform.rotate = damp(this.rotate, this.transform.rotate, 0.25);\n\n return () => {\n transform(this.$el, this.transform);\n };\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA4C;AAC5C,mBAAgC;AAWzB,IAAM,kBAAN,cAA8B,uBAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,EAkB9D,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,YAAY;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,SAAS,OAAO;AACd,SAAK,SAAS,MAAM,MAAM;AAAA,EAC5B;AAAA,EAEA,SAAS;AACP,SAAK,WAAW,KAAK,IAAI,KAAK,MAAM,IAAI,KAAK,KAAK,SAAS;AAE3D,SAAK,UAAU,aAAS,mBAAK,KAAK,QAAQ,KAAK,UAAU,QAAQ,IAAI;AAErE,WAAO,MAAM;AACX,kCAAU,KAAK,KAAK,KAAK,SAAS;AAAA,IACpC;AAAA,EACF;AACF;AAAA;AAAA;AAAA;AA3CE,cAJW,iBAIJ,UAAqB;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,IACP,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,34 @@
1
+ import { Base, BaseConfig, BaseProps } from '@studiometa/js-toolkit';
2
+ export interface CircularMarqueeProps extends BaseProps {
3
+ $options: {
4
+ sensitivity: number;
5
+ };
6
+ }
7
+ /**
8
+ * CircularMarquee component
9
+ */
10
+ export declare class CircularMarquee extends Base<CircularMarqueeProps> {
11
+ /**
12
+ * CircularMarquee Configuration
13
+ */
14
+ static config: BaseConfig;
15
+ /**
16
+ * Rotate value.
17
+ * @type {number}
18
+ */
19
+ rotate: number;
20
+ /**
21
+ * Scroll delta Y.
22
+ * @type {number}
23
+ */
24
+ deltaY: number;
25
+ /**
26
+ * Transform values.
27
+ * @type {object}
28
+ */
29
+ transform: {
30
+ rotate: number;
31
+ };
32
+ scrolled(props: any): void;
33
+ ticked(): () => void;
34
+ }
@@ -0,0 +1,47 @@
1
+ import { Base } from "@studiometa/js-toolkit";
2
+ import { damp, transform } from "@studiometa/js-toolkit/utils";
3
+ class CircularMarquee extends Base {
4
+ /**
5
+ * CircularMarquee Configuration
6
+ */
7
+ static config = {
8
+ name: "CircularMarquee",
9
+ options: {
10
+ sensitivity: {
11
+ type: Number,
12
+ default: 0.1
13
+ }
14
+ }
15
+ };
16
+ /**
17
+ * Rotate value.
18
+ * @type {number}
19
+ */
20
+ rotate = 0;
21
+ /**
22
+ * Scroll delta Y.
23
+ * @type {number}
24
+ */
25
+ deltaY = 0;
26
+ /**
27
+ * Transform values.
28
+ * @type {object}
29
+ */
30
+ transform = {
31
+ rotate: 0
32
+ };
33
+ scrolled(props) {
34
+ this.deltaY = props.delta.y;
35
+ }
36
+ ticked() {
37
+ this.rotate -= (Math.abs(this.deltaY) + 1) * this.$options.sensitivity;
38
+ this.transform.rotate = damp(this.rotate, this.transform.rotate, 0.25);
39
+ return () => {
40
+ transform(this.$el, this.transform);
41
+ };
42
+ }
43
+ }
44
+ export {
45
+ CircularMarquee
46
+ };
47
+ //# sourceMappingURL=CircularMarquee.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/CircularMarquee/CircularMarquee.ts"],
4
+ "sourcesContent": ["import { Base, BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport { damp, transform } from '@studiometa/js-toolkit/utils';\n\nexport interface CircularMarqueeProps extends BaseProps {\n $options: {\n sensitivity: number;\n };\n}\n\n/**\n * CircularMarquee component\n */\nexport class CircularMarquee extends Base<CircularMarqueeProps> {\n /**\n * CircularMarquee Configuration\n */\n static config: BaseConfig = {\n name: 'CircularMarquee',\n options: {\n sensitivity: {\n type: Number,\n default: 0.1,\n },\n },\n };\n\n /**\n * Rotate value.\n * @type {number}\n */\n rotate = 0;\n\n /**\n * Scroll delta Y.\n * @type {number}\n */\n deltaY = 0;\n\n /**\n * Transform values.\n * @type {object}\n */\n transform = {\n rotate: 0,\n };\n\n scrolled(props) {\n this.deltaY = props.delta.y;\n }\n\n ticked() {\n this.rotate -= (Math.abs(this.deltaY) + 1) * this.$options.sensitivity;\n\n this.transform.rotate = damp(this.rotate, this.transform.rotate, 0.25);\n\n return () => {\n transform(this.$el, this.transform);\n };\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,YAAmC;AAC5C,SAAS,MAAM,iBAAiB;AAWzB,MAAM,wBAAwB,KAA2B;AAAA;AAAA;AAAA;AAAA,EAI9D,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,SAAS;AAAA,MACP,aAAa;AAAA,QACX,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,YAAY;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,SAAS,OAAO;AACd,SAAK,SAAS,MAAM,MAAM;AAAA,EAC5B;AAAA,EAEA,SAAS;AACP,SAAK,WAAW,KAAK,IAAI,KAAK,MAAM,IAAI,KAAK,KAAK,SAAS;AAE3D,SAAK,UAAU,SAAS,KAAK,KAAK,QAAQ,KAAK,UAAU,QAAQ,IAAI;AAErE,WAAO,MAAM;AACX,gBAAU,KAAK,KAAK,KAAK,SAAS;AAAA,IACpC;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,55 @@
1
+ {#
2
+ /**
3
+ * @file
4
+ * Circular Marquee
5
+ *
6
+ * @param {String} id - *required
7
+ * @param {Number} outer_radius
8
+ * @param {Number} radius
9
+ * @param {Number} cx
10
+ * @param {Number} cy
11
+ * @param {String} content
12
+ * @param {Object} content_attr
13
+ * @param {Number} sensitivity
14
+ */
15
+ #}
16
+
17
+ {# Outer radius is svg size radius #}
18
+ {% set outer_radius = outer_radius|default(250) %}
19
+ {% set outer_diameter = outer_radius * 2 %}
20
+
21
+ {# Inner radius is the circle size inside the svg (need to be smaller to not cut text with svg viewbox) #}
22
+ {% set radius = radius|default(220) %}
23
+ {% set diameter = radius * 2 %}
24
+ {% set cx = cx|default(radius) %}
25
+ {% set cy = cy|default(radius) %}
26
+ {% set perimeter = 3.1413 * diameter %}
27
+
28
+ {% set first = 'M ' ~ (outer_radius - cx) ~ ',' ~ outer_radius %}
29
+ {% set second = 'a ' ~ radius ~ ',' ~ radius ~ ' 0 1,1 ' ~ diameter ~ ',0' %}
30
+ {% set third = 'a ' ~ radius ~ ',' ~ radius ~ ' 0 1,1 -' ~ diameter ~ ',0' %}
31
+ {% set d = [first, second, third]|join(' ') %}
32
+
33
+ {% set default_content_attributes = { 'xlink:href': '#' ~ id } %}
34
+ {% set content_attributes =
35
+ merge_html_attributes(default_content_attributes, content_attr|default({}))
36
+ %}
37
+
38
+ <div data-component="CircularMarquee"
39
+ {{ html_attributes({ data_option_sensitivity: sensitivity }) }}>
40
+ <svg aria-hidden="true"
41
+ xmlns="http://www.w3.org/2000/svg"
42
+ viewBox="0 0 {{ outer_diameter }} {{ outer_diameter }}"
43
+ width="{{ outer_diameter }}"
44
+ height="{{ outer_diameter }}"
45
+ class="z-default relative left-1/2 -translate-x-1/2">
46
+ <defs>
47
+ <path d="{{ d }}" id="{{ id }}" />
48
+ </defs>
49
+ <text dy="0" textLength="{{ perimeter }}">
50
+ <textPath {{ html_attributes(content_attributes) }}>
51
+ {{ content|raw }}
52
+ </textPath>
53
+ </text>
54
+ </svg>
55
+ </div>
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/ui/atoms/CircularMarquee/index.ts
17
+ var CircularMarquee_exports = {};
18
+ module.exports = __toCommonJS(CircularMarquee_exports);
19
+ __reExport(CircularMarquee_exports, require("./CircularMarquee.cjs"), module.exports);
20
+ if (module.exports.default) module.exports = module.exports.default;
21
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/CircularMarquee/index.ts"],
4
+ "sourcesContent": ["export * from './CircularMarquee.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,oCAAc,kCAAd;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export * from './CircularMarquee.js';
@@ -0,0 +1,2 @@
1
+ export * from "./CircularMarquee.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/CircularMarquee/index.ts"],
4
+ "sourcesContent": ["export * from './CircularMarquee.js';\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -33,6 +33,7 @@ function normalizeSize(that, prop) {
33
33
  const { step } = that.$options;
34
34
  return Math.ceil(that.$refs.img[prop] / step) * step;
35
35
  }
36
+ var isBot = /bot|crawl|slurp|spider/i.test(navigator.userAgent);
36
37
  var FigureTwicpics = class extends import_Figure.Figure {
37
38
  /**
38
39
  * Get the Twicpics path.
@@ -48,10 +49,22 @@ var FigureTwicpics = class extends import_Figure.Figure {
48
49
  return url.host;
49
50
  }
50
51
  /**
51
- * Get formattted original source.
52
+ * Get formatted original source.
53
+ * If `disable` option is `true` returns the original src.
52
54
  */
53
55
  get original() {
54
- return this.formatSrc(super.original);
56
+ return this.$options.disable ? super.original : this.formatSrc(super.original);
57
+ }
58
+ /**
59
+ * Get the current device pixel ratio
60
+ * Returns 1 if user agent is considered as a bot.
61
+ * Returns 1 if disabled by the `data-option-no-dpr` attribute.
62
+ */
63
+ get devicePixelRatio() {
64
+ if (!this.$options.dpr || isBot) {
65
+ return 1;
66
+ }
67
+ return window.devicePixelRatio;
55
68
  }
56
69
  /**
57
70
  * Format the source for Twicpics.
@@ -63,8 +76,8 @@ var FigureTwicpics = class extends import_Figure.Figure {
63
76
  if (this.path && !url.pathname.startsWith((0, import_utils.withLeadingSlash)(this.path))) {
64
77
  url.pathname = `/${this.path}${url.pathname}`;
65
78
  }
66
- const width = normalizeSize(this, "offsetWidth");
67
- const height = normalizeSize(this, "offsetHeight");
79
+ const width = normalizeSize(this, "offsetWidth") * this.devicePixelRatio;
80
+ const height = normalizeSize(this, "offsetHeight") * this.devicePixelRatio;
68
81
  url.searchParams.set(
69
82
  "twic",
70
83
  ["v1", this.$options.transform, `${this.$options.mode}=${width}x${height}`].filter(Boolean).join("/")
@@ -96,6 +109,7 @@ __publicField(FigureTwicpics, "config", {
96
109
  transform: String,
97
110
  domain: String,
98
111
  path: String,
112
+ disable: Boolean,
99
113
  step: {
100
114
  type: Number,
101
115
  default: 50
@@ -103,6 +117,10 @@ __publicField(FigureTwicpics, "config", {
103
117
  mode: {
104
118
  type: String,
105
119
  default: "cover"
120
+ },
121
+ dpr: {
122
+ type: Boolean,
123
+ default: true
106
124
  }
107
125
  }
108
126
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/ui/atoms/Figure/FigureTwicpics.ts"],
4
- "sourcesContent": ["import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport {\n withLeadingSlash,\n withoutLeadingSlash,\n withoutTrailingSlash,\n} from '@studiometa/js-toolkit/utils';\nimport { Figure, loadImage } from './Figure.js';\n\nexport interface FigureTwicpicsProps extends BaseProps {\n $options: {\n transform: string;\n domain: string;\n path: string;\n step: number;\n mode: string;\n };\n}\n\n/**\n * Normalize the given size to the step option.\n */\n// eslint-disable-next-line no-use-before-define\nfunction normalizeSize(that: FigureTwicpics, prop: string): number {\n const { step } = that.$options;\n return Math.ceil(that.$refs.img[prop] / step) * step;\n}\n\n/**\n * Figure class.\n *\n * Manager lazyloading image sources.\n */\nexport class FigureTwicpics<T extends BaseProps = BaseProps> extends Figure<\n T & FigureTwicpicsProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n ...Figure.config,\n name: 'FigureTwicpics',\n options: {\n ...Figure.config.options,\n transform: String,\n domain: String,\n path: String,\n step: {\n type: Number,\n default: 50,\n },\n mode: {\n type: String,\n default: 'cover',\n },\n },\n };\n\n /**\n * Get the Twicpics path.\n */\n get path(): string {\n return withoutTrailingSlash(withoutLeadingSlash(this.$options.path));\n }\n\n /**\n * Get the Twicpics domain.\n */\n get domain(): string {\n const url = new URL(this.$refs.img.dataset.src);\n return url.host;\n }\n\n /**\n * Get formattted original source.\n */\n get original() {\n return this.formatSrc(super.original);\n }\n\n /**\n * Format the source for Twicpics.\n */\n formatSrc(src: string): string {\n const url = new URL(src, 'https://localhost');\n url.host = this.domain;\n url.port = '';\n\n if (this.path && !url.pathname.startsWith(withLeadingSlash(this.path))) {\n url.pathname = `/${this.path}${url.pathname}`;\n }\n\n const width = normalizeSize(this, 'offsetWidth');\n const height = normalizeSize(this, 'offsetHeight');\n\n url.searchParams.set(\n 'twic',\n ['v1', this.$options.transform, `${this.$options.mode}=${width}x${height}`]\n .filter(Boolean)\n .join('/'),\n );\n\n url.search = decodeURIComponent(url.search);\n\n return url.toString();\n }\n\n /**\n * Reassign the source from the original on resize.\n */\n async resized() {\n const { src } = await loadImage(this.original);\n this.src = src;\n }\n\n /**\n * Do not terminate on image load as we need to set the src on resize.\n */\n onLoad() {\n // Do not terminate on image load as we need.\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAIO;AACP,oBAAkC;AAgBlC,SAAS,cAAc,MAAsB,MAAsB;AACjE,QAAM,EAAE,KAAK,IAAI,KAAK;AACtB,SAAO,KAAK,KAAK,KAAK,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI;AAClD;AAOO,IAAM,iBAAN,cAA8D,qBAEnE;AAAA;AAAA;AAAA;AAAA,EA0BA,IAAI,OAAe;AACjB,eAAO,uCAAqB,kCAAoB,KAAK,SAAS,IAAI,CAAC;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,SAAiB;AACnB,UAAM,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,QAAQ,GAAG;AAC9C,WAAO,IAAI;AAAA,EACb;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,WAAW;AACb,WAAO,KAAK,UAAU,MAAM,QAAQ;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,KAAqB;AAC7B,UAAM,MAAM,IAAI,IAAI,KAAK,mBAAmB;AAC5C,QAAI,OAAO,KAAK;AAChB,QAAI,OAAO;AAEX,QAAI,KAAK,QAAQ,CAAC,IAAI,SAAS,eAAW,+BAAiB,KAAK,IAAI,CAAC,GAAG;AACtE,UAAI,WAAW,IAAI,KAAK,OAAO,IAAI;AAAA,IACrC;AAEA,UAAM,QAAQ,cAAc,MAAM,aAAa;AAC/C,UAAM,SAAS,cAAc,MAAM,cAAc;AAEjD,QAAI,aAAa;AAAA,MACf;AAAA,MACA,CAAC,MAAM,KAAK,SAAS,WAAW,GAAG,KAAK,SAAS,QAAQ,SAAS,QAAQ,EACvE,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,IACb;AAEA,QAAI,SAAS,mBAAmB,IAAI,MAAM;AAE1C,WAAO,IAAI,SAAS;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAAU;AACd,UAAM,EAAE,IAAI,IAAI,UAAM,yBAAU,KAAK,QAAQ;AAC7C,SAAK,MAAM;AAAA,EACb;AAAA;AAAA;AAAA;AAAA,EAKA,SAAS;AAAA,EAET;AACF;AAAA;AAAA;AAAA;AAlFE,cANW,gBAMJ,UAAqB;AAAA,EAC1B,GAAG,qBAAO;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,IACP,GAAG,qBAAO,OAAO;AAAA,IACjB,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport {\n withLeadingSlash,\n withoutLeadingSlash,\n withoutTrailingSlash,\n} from '@studiometa/js-toolkit/utils';\nimport { Figure, loadImage } from './Figure.js';\n\nexport interface FigureTwicpicsProps extends BaseProps {\n $options: {\n transform: string;\n domain: string;\n path: string;\n step: number;\n mode: string;\n dpr: boolean;\n };\n}\n\n/**\n * Normalize the given size to the step option.\n */\n// eslint-disable-next-line no-use-before-define\nfunction normalizeSize(that: FigureTwicpics, prop: string): number {\n const { step } = that.$options;\n return Math.ceil(that.$refs.img[prop] / step) * step;\n}\n\n/**\n * Determine if the user agent is a bot or not.\n */\nconst isBot = /bot|crawl|slurp|spider/i.test(navigator.userAgent);\n\n/**\n * Figure class.\n *\n * Manager lazyloading image sources.\n */\nexport class FigureTwicpics<T extends BaseProps = BaseProps> extends Figure<\n T & FigureTwicpicsProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n ...Figure.config,\n name: 'FigureTwicpics',\n options: {\n ...Figure.config.options,\n transform: String,\n domain: String,\n path: String,\n disable: Boolean,\n step: {\n type: Number,\n default: 50,\n },\n mode: {\n type: String,\n default: 'cover',\n },\n dpr: {\n type: Boolean,\n default: true,\n },\n },\n };\n\n /**\n * Get the Twicpics path.\n */\n get path(): string {\n return withoutTrailingSlash(withoutLeadingSlash(this.$options.path));\n }\n\n /**\n * Get the Twicpics domain.\n */\n get domain(): string {\n const url = new URL(this.$refs.img.dataset.src);\n return url.host;\n }\n\n /**\n * Get formatted original source.\n * If `disable` option is `true` returns the original src.\n */\n get original() {\n return this.$options.disable ? super.original : this.formatSrc(super.original);\n }\n\n /**\n * Get the current device pixel ratio\n * Returns 1 if user agent is considered as a bot.\n * Returns 1 if disabled by the `data-option-no-dpr` attribute.\n */\n get devicePixelRatio() {\n if (!this.$options.dpr || isBot) {\n return 1;\n }\n\n return window.devicePixelRatio;\n }\n\n /**\n * Format the source for Twicpics.\n */\n formatSrc(src: string): string {\n const url = new URL(src, 'https://localhost');\n url.host = this.domain;\n url.port = '';\n\n if (this.path && !url.pathname.startsWith(withLeadingSlash(this.path))) {\n url.pathname = `/${this.path}${url.pathname}`;\n }\n\n const width = normalizeSize(this, 'offsetWidth') * this.devicePixelRatio;\n const height = normalizeSize(this, 'offsetHeight') * this.devicePixelRatio;\n\n url.searchParams.set(\n 'twic',\n ['v1', this.$options.transform, `${this.$options.mode}=${width}x${height}`]\n .filter(Boolean)\n .join('/'),\n );\n\n url.search = decodeURIComponent(url.search);\n\n return url.toString();\n }\n\n /**\n * Reassign the source from the original on resize.\n */\n async resized() {\n const { src } = await loadImage(this.original);\n this.src = src;\n }\n\n /**\n * Do not terminate on image load as we need to set the src on resize.\n */\n onLoad() {\n // Do not terminate on image load as we need.\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAIO;AACP,oBAAkC;AAiBlC,SAAS,cAAc,MAAsB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