@fluidattacks/design 3.1.11 → 3.1.13
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.
- package/dist/_commonjsHelpers-C6fGbg64.mjs +6 -0
- package/dist/components/@core/index.js +18 -1
- package/dist/components/accordion/accordion-content/index.js +22 -1
- package/dist/components/accordion/index.js +78 -1
- package/dist/components/alert/index.js +162 -4
- package/dist/components/button/index.js +69 -1
- package/dist/components/card/card-header/index.js +83 -1
- package/dist/components/card/card-with-image/index.js +93 -1
- package/dist/components/card/card-with-input/index.js +106 -3
- package/dist/components/card/card-with-selector/index.js +71 -1
- package/dist/components/card/card-with-switch/index.js +50 -1
- package/dist/components/card/index.js +12 -1
- package/dist/components/carousel/index.js +62 -10
- package/dist/components/checkbox/index.js +118 -3
- package/dist/components/cloud-image/index.js +8 -1
- package/dist/components/code-snippet/index.js +72 -1
- package/dist/components/code-snippet/location-code/index.js +171 -1
- package/dist/components/colors/index.js +224 -1
- package/dist/components/confirm-dialog/index.js +46 -1
- package/dist/components/container/index.js +51 -3
- package/dist/components/content-card/category-tag/index.js +42 -1
- package/dist/components/content-card/event-date/index.js +61 -1
- package/dist/components/content-card/index.js +168 -3
- package/dist/components/content-card-carousel/index.js +95 -1
- package/dist/components/content-card-carousel/scroll-buttons/index.js +9 -1
- package/dist/components/divider/index.js +25 -1
- package/dist/components/empty-state/empty-button/index.js +6 -1
- package/dist/components/empty-state/index.js +58 -8
- package/dist/components/file-preview/index.js +31 -3
- package/dist/components/form/index.js +63 -3
- package/dist/components/grid-container/index.js +46 -5
- package/dist/components/group-selector/index.js +135 -1
- package/dist/components/group-selector/option-container/index.js +12 -1
- package/dist/components/icon/index.js +102 -4
- package/dist/components/icon-button/index.js +76 -3
- package/dist/components/indicator-card/index.js +74 -1
- package/dist/components/info-sidebar/index.js +116 -1
- package/dist/components/inputs/fields/combobox/index.js +146 -1
- package/dist/components/inputs/fields/combobox/option/index.js +8 -1
- package/dist/components/inputs/fields/date/calendar/cell/index.js +27 -1
- package/dist/components/inputs/fields/date/calendar/grid/index.js +26 -1
- package/dist/components/inputs/fields/date/calendar/header/index.js +38 -1
- package/dist/components/inputs/fields/date/calendar/index.js +30 -1
- package/dist/components/inputs/fields/date/index.js +68 -1
- package/dist/components/inputs/fields/date-range/calendar/index.js +35 -1
- package/dist/components/inputs/fields/date-range/index.js +108 -3
- package/dist/components/inputs/fields/date-time/calendar/index.js +60 -5
- package/dist/components/inputs/fields/date-time/index.js +69 -1
- package/dist/components/inputs/fields/editable/index.js +28 -1
- package/dist/components/inputs/fields/input/index.js +77 -1
- package/dist/components/inputs/fields/input-file/index.js +117 -4
- package/dist/components/inputs/fields/input-tags/index.js +63 -2
- package/dist/components/inputs/fields/number/index.js +57 -1
- package/dist/components/inputs/fields/number-range/index.js +49 -1
- package/dist/components/inputs/fields/phone/index.js +574 -11
- package/dist/components/inputs/fields/text-area/index.js +81 -1
- package/dist/components/inputs/index.js +28 -1
- package/dist/components/inputs/label/index.js +38 -1
- package/dist/components/inputs/outline-container/index.js +104 -1
- package/dist/components/inputs/utils/action-button/index.js +31 -1
- package/dist/components/inputs/utils/calendar-button/index.js +37 -1
- package/dist/components/inputs/utils/date-selector/index.js +62 -1
- package/dist/components/inputs/utils/date-time-field/index.js +133 -1
- package/dist/components/inputs/utils/dialog/index.js +14 -1
- package/dist/components/inputs/utils/number-field/index.js +86 -1
- package/dist/components/inputs/utils/popover/index.js +44 -1
- package/dist/components/interactive-card/icon/index.js +7 -1
- package/dist/components/interactive-card/index.js +118 -1
- package/dist/components/language-selector/index.js +37 -1
- package/dist/components/language-selector/item-list/index.js +8 -1
- package/dist/components/link/index.js +106 -7
- package/dist/components/list-item/index.js +67 -1
- package/dist/components/little-flag/index.js +32 -3
- package/dist/components/loading/index.js +55 -14
- package/dist/components/logo/index.js +13 -1
- package/dist/components/logo-carousel/index.js +45 -4
- package/dist/components/lottie/index.js +20 -3
- package/dist/components/menu/index.js +67 -1
- package/dist/components/message-banner/index.js +87 -4
- package/dist/components/modal/index.js +65 -1
- package/dist/components/modal/modal-confirm/index.js +51 -1
- package/dist/components/modal/modal-footer/index.js +25 -1
- package/dist/components/modal/modal-header/index.js +51 -1
- package/dist/components/notification/index.js +113 -5
- package/dist/components/notification-sign/index.js +43 -6
- package/dist/components/number-input/index.js +62 -7
- package/dist/components/oauth-selector/index.js +100 -1
- package/dist/components/oauth-selector/option-container/index.js +76 -1
- package/dist/components/plan-card/index.js +155 -5
- package/dist/components/plan-card/recommended-tag/index.js +31 -1
- package/dist/components/pop-up/description/index.js +51 -1
- package/dist/components/pop-up/index.js +152 -1
- package/dist/components/premium-feature/index.js +85 -3
- package/dist/components/priority-score/index.js +29 -1
- package/dist/components/progress/index.js +36 -3
- package/dist/components/progress-bar/index.js +153 -5
- package/dist/components/radio-button/index.js +125 -3
- package/dist/components/scroll-button/index.js +38 -2
- package/dist/components/search/index.js +105 -7
- package/dist/components/search-bar/index.js +219 -1
- package/dist/components/search-bar/item-searching/index.js +10 -1
- package/dist/components/severity-badge/index.js +74 -1
- package/dist/components/severity-overview/badge/index.js +69 -1
- package/dist/components/severity-overview/index.js +17 -1
- package/dist/components/show-on-hover/index.js +31 -3
- package/dist/components/slide-out-menu/index.js +3456 -3
- package/dist/components/slide-out-menu/menu-item/index.js +67 -1
- package/dist/components/slider/index.js +124 -7
- package/dist/components/slider/thumb/index.js +17 -1
- package/dist/components/step-lapse/index.js +153 -9
- package/dist/components/table-button/index.js +97 -3
- package/dist/components/tabs/fixed-tabs/index.js +29 -1
- package/dist/components/tabs/index.js +57 -1
- package/dist/components/tabs/tab/index.js +39 -1
- package/dist/components/tag/index.js +184 -3
- package/dist/components/timeline/card/index.js +9 -1
- package/dist/components/timeline/index.js +17 -1
- package/dist/components/toggle/index.js +85 -14
- package/dist/components/toggle-buttons/index.js +103 -5
- package/dist/components/tooltip/index.js +13 -1
- package/dist/components/tour/index.js +4549 -4
- package/dist/components/typography/heading/index.js +47 -1
- package/dist/components/typography/index.js +8 -1
- package/dist/components/typography/span/index.js +41 -1
- package/dist/components/typography/text/index.js +47 -1
- package/dist/components/web-form/index.js +68 -7
- package/dist/hooks/index.js +13 -1
- package/dist/index-BMHVi812.mjs +234 -0
- package/dist/index-BzAniA2J.mjs +135 -0
- package/dist/index-C6LbClYh.mjs +146 -0
- package/dist/index-CAIe8hBv.mjs +130 -0
- package/dist/index-CUQBAqt_.mjs +75 -0
- package/dist/index-CWlrSlUk.mjs +68 -0
- package/dist/index-Ckmu1TfV.mjs +86 -0
- package/dist/index-DwznImvK.mjs +1678 -0
- package/dist/index-maWH3JYC.mjs +3561 -0
- package/dist/index.js +206 -1
- package/dist/styles-B2N0JLw1.mjs +114 -0
- package/dist/styles-B64DVBIF.mjs +115 -0
- package/dist/{styles-BAhpqi6C.mjs → styles-BXFVwnWT.mjs} +28 -28
- package/dist/styles-BZQOqe8p.mjs +141 -0
- package/dist/styles-Bdque9TT.mjs +65 -0
- package/dist/styles-BlHspTrz.mjs +144 -0
- package/dist/styles-CROOwXEH.mjs +76 -0
- package/dist/styles-CplEd2kw.mjs +228 -0
- package/dist/styles-D1eTIklB.mjs +110 -0
- package/dist/styles-ePGii_9g.mjs +74 -0
- package/dist/use-carousel-CgAF78h3.mjs +23 -0
- package/dist/use-click-outside-BUll8Ag-.mjs +18 -0
- package/dist/use-cloudinary-image-BCxwj15o.mjs +1176 -0
- package/dist/use-modal-CtgexKnf.mjs +14 -0
- package/dist/use-search-Dj47QDw9.mjs +15 -0
- package/dist/utils-V0EumEPM.mjs +6 -0
- package/package.json +1 -3
- package/dist/_commonjsHelpers-C37NGDzP.js +0 -1
- package/dist/_commonjsHelpers-D6CrkqQz.mjs +0 -6
- package/dist/index-BH27NQKA.mjs +0 -2311
- package/dist/index-Bcw2vW_n.mjs +0 -75
- package/dist/index-C0_LPuYU.mjs +0 -106
- package/dist/index-C8zdgAVH.mjs +0 -82
- package/dist/index-CA_9DXWd.js +0 -5
- package/dist/index-CmylnDrF.js +0 -14
- package/dist/index-DUMgwAbO.js +0 -26
- package/dist/index-DpQYiwGu.js +0 -5
- package/dist/index-Dy8ZUIYs.js +0 -5
- package/dist/index-JPf5Yzg6.js +0 -17
- package/dist/index-OBZtKZuT.mjs +0 -1021
- package/dist/index-SsXlDjK4.mjs +0 -122
- package/dist/index-TKLFHcRp.js +0 -18
- package/dist/index-TnyKqJHo.mjs +0 -61
- package/dist/index-Yr95Cb7Z.mjs +0 -54
- package/dist/index-h9-U5wxq.mjs +0 -209
- package/dist/index-qCiUU4sZ.js +0 -9
- package/dist/index-qe0nJwzl.js +0 -15
- package/dist/styles--Elze-LV.js +0 -3
- package/dist/styles-3pR4Xdvy.js +0 -33
- package/dist/styles-59h91S9m.mjs +0 -65
- package/dist/styles-BCwLWpC3.mjs +0 -126
- package/dist/styles-BJ7-0I5X.mjs +0 -74
- package/dist/styles-BKObp9bh.mjs +0 -76
- package/dist/styles-BWVdbvFu.js +0 -5
- package/dist/styles-Bl-CstrT.js +0 -5
- package/dist/styles-Bn42XCW5.js +0 -7
- package/dist/styles-C2CoGJl7.js +0 -33
- package/dist/styles-CNzziAXG.js +0 -5
- package/dist/styles-CdD9waPD.js +0 -29
- package/dist/styles-CnKTwnFk.mjs +0 -110
- package/dist/styles-D4R-eerv.mjs +0 -77
- package/dist/styles-DNIIhyRC.mjs +0 -144
- package/dist/styles-DV8yOaqV.mjs +0 -131
- package/dist/styles-DYoftbd3.js +0 -42
- package/dist/styles-DlmKLhPh.js +0 -7
- package/dist/styles-be8gOdgy.mjs +0 -106
- package/dist/use-carousel-64dKFW4E.js +0 -1
- package/dist/use-carousel-D7xeL3YZ.mjs +0 -17
- package/dist/use-click-outside-BqkLISED.js +0 -1
- package/dist/use-click-outside-C4Z4pdiW.mjs +0 -18
- package/dist/use-cloudinary-image-DKMl7jbx.mjs +0 -612
- package/dist/use-cloudinary-image-YMMafagv.js +0 -1
- package/dist/use-modal-CNbLSSQb.mjs +0 -14
- package/dist/use-modal-_bYY6M_n.js +0 -1
- package/dist/use-search-75ip5xR-.mjs +0 -12
- package/dist/use-search-DeL4UDMh.js +0 -1
- package/dist/utils-C2whpEd3.js +0 -1
- package/dist/utils-Da0qL35u.mjs +0 -4
|
@@ -0,0 +1,1176 @@
|
|
|
1
|
+
import { useMemo as S } from "react";
|
|
2
|
+
function P(e) {
|
|
3
|
+
return !(typeof e != "object" || e instanceof Array);
|
|
4
|
+
}
|
|
5
|
+
class R {
|
|
6
|
+
filterOutNonSupportedKeys(t, r) {
|
|
7
|
+
const s = /* @__PURE__ */ Object.create({});
|
|
8
|
+
return P(t) ? (Object.keys(t).forEach((n) => {
|
|
9
|
+
r.indexOf(n) >= 0 ? s[n] = t[n] : console.warn("Warning - unsupported key provided to configuration: ", n);
|
|
10
|
+
}), s) : /* @__PURE__ */ Object.create({});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const v = [
|
|
14
|
+
"cname",
|
|
15
|
+
"secureDistribution",
|
|
16
|
+
"privateCdn",
|
|
17
|
+
"signUrl",
|
|
18
|
+
"longUrlSignature",
|
|
19
|
+
"shorten",
|
|
20
|
+
"useRootPath",
|
|
21
|
+
"secure",
|
|
22
|
+
"forceVersion",
|
|
23
|
+
"analytics",
|
|
24
|
+
"queryParams"
|
|
25
|
+
];
|
|
26
|
+
class _ extends R {
|
|
27
|
+
/**
|
|
28
|
+
* @param {IURLConfig} userURLConfig
|
|
29
|
+
*/
|
|
30
|
+
constructor(t) {
|
|
31
|
+
super();
|
|
32
|
+
const r = this.filterOutNonSupportedKeys(t, v);
|
|
33
|
+
Object.assign(this, {
|
|
34
|
+
secure: !0
|
|
35
|
+
}, r);
|
|
36
|
+
}
|
|
37
|
+
extend(t) {
|
|
38
|
+
const r = this.filterOutNonSupportedKeys(t, v);
|
|
39
|
+
return new _(Object.assign({}, this, r));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @param {string} value Sets the cname
|
|
43
|
+
*/
|
|
44
|
+
setCname(t) {
|
|
45
|
+
return this.cname = t, this;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} value Sets the secureDistribution
|
|
49
|
+
*/
|
|
50
|
+
setSecureDistribution(t) {
|
|
51
|
+
return this.secureDistribution = t, this;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @param {boolean} value Sets whether to use a private CDN (Removes cloudName from URL)
|
|
55
|
+
*/
|
|
56
|
+
setPrivateCdn(t) {
|
|
57
|
+
return this.privateCdn = t, this;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @param value Sets whether or not to sign the URL
|
|
61
|
+
*/
|
|
62
|
+
setSignUrl(t) {
|
|
63
|
+
return this.signUrl = t, this;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @param value Sets whether or not to use a long signature
|
|
67
|
+
*/
|
|
68
|
+
setLongUrlSignature(t) {
|
|
69
|
+
return this.longUrlSignature = t, this;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @param value Sets whether or not to shorten the URL
|
|
73
|
+
*/
|
|
74
|
+
setShorten(t) {
|
|
75
|
+
return this.shorten = t, this;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @param value Sets whether or not to use a root path
|
|
79
|
+
*/
|
|
80
|
+
setUseRootPath(t) {
|
|
81
|
+
return this.useRootPath = t, this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @param value Sets whether or not to deliver the asset through https
|
|
85
|
+
*/
|
|
86
|
+
setSecure(t) {
|
|
87
|
+
return this.secure = t, this;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @param value Sets whether to force a version in the URL
|
|
91
|
+
*/
|
|
92
|
+
setForceVersion(t) {
|
|
93
|
+
return this.forceVersion = t, this;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @param params Sets additional params
|
|
97
|
+
*/
|
|
98
|
+
setQueryParams(t) {
|
|
99
|
+
return this.queryParams = t, this;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
class f {
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param {QualifierValue | QualifierValue[] | any[] | string | number}qualifierValue
|
|
106
|
+
*/
|
|
107
|
+
constructor(t) {
|
|
108
|
+
this.values = [], this.delimiter = ":", this.hasValue(t) && this.addValue(t);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @description Joins the provided values with the provided delimiter
|
|
112
|
+
*/
|
|
113
|
+
toString() {
|
|
114
|
+
return this.values.join(this.delimiter);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @description Checks if the provided argument has a value
|
|
118
|
+
* @param {any} v
|
|
119
|
+
* @private
|
|
120
|
+
* @return {boolean}
|
|
121
|
+
*/
|
|
122
|
+
hasValue(t) {
|
|
123
|
+
return typeof t < "u" && t !== null && t !== "";
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @desc Adds a value for the this qualifier instance
|
|
127
|
+
* @param {any} value
|
|
128
|
+
* @return {this}
|
|
129
|
+
*/
|
|
130
|
+
addValue(t) {
|
|
131
|
+
return Array.isArray(t) ? this.values = this.values.concat(t) : this.values.push(t), this.values = this.values.filter((r) => this.hasValue(r)), this;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* @description Sets the delimiter for this instance
|
|
135
|
+
* @param delimiter
|
|
136
|
+
*/
|
|
137
|
+
setDelimiter(t) {
|
|
138
|
+
return this.delimiter = t, this;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
class x extends Error {
|
|
142
|
+
constructor(t = "Unsupported") {
|
|
143
|
+
super(t);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function T(e) {
|
|
147
|
+
return new x(e);
|
|
148
|
+
}
|
|
149
|
+
function j() {
|
|
150
|
+
return this._qualifierModel || { error: T(`unsupported qualifier ${this.constructor.name}`) };
|
|
151
|
+
}
|
|
152
|
+
class D {
|
|
153
|
+
constructor() {
|
|
154
|
+
this._qualifierModel = {};
|
|
155
|
+
}
|
|
156
|
+
toJson() {
|
|
157
|
+
return j.apply(this);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
class m extends D {
|
|
161
|
+
constructor(t, r) {
|
|
162
|
+
super(), this.delimiter = "_", this.key = t, r instanceof f ? this.qualifierValue = r : (this.qualifierValue = new f(), this.qualifierValue.addValue(r));
|
|
163
|
+
}
|
|
164
|
+
toString() {
|
|
165
|
+
const { key: t, delimiter: r, qualifierValue: s } = this;
|
|
166
|
+
return `${t}${r}${s.toString()}`;
|
|
167
|
+
}
|
|
168
|
+
addValue(t) {
|
|
169
|
+
return this.qualifierValue.addValue(t), this;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
class d extends m {
|
|
173
|
+
constructor(t, r) {
|
|
174
|
+
let s;
|
|
175
|
+
r ? s = new f([t, `${r}`]).setDelimiter(":") : s = t, super("fl", s), this.flagValue = r;
|
|
176
|
+
}
|
|
177
|
+
toString() {
|
|
178
|
+
return super.toString().replace(/\./g, "%2E");
|
|
179
|
+
}
|
|
180
|
+
getFlagValue() {
|
|
181
|
+
return this.flagValue;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function $(e, t) {
|
|
185
|
+
const r = Array.from(e.entries());
|
|
186
|
+
return t.forEach((s) => {
|
|
187
|
+
r.push(["fl", s]);
|
|
188
|
+
}), r.sort().map((s) => s[1]);
|
|
189
|
+
}
|
|
190
|
+
function k() {
|
|
191
|
+
var e, t, r;
|
|
192
|
+
const s = this._actionModel && Object.keys(this._actionModel).length, n = (r = (t = (e = this._actionModel) === null || e === void 0 ? void 0 : e.source) === null || t === void 0 ? void 0 : t.transformation) === null || r === void 0 ? void 0 : r.error;
|
|
193
|
+
return n && n instanceof Error ? { error: n } : s ? this._actionModel : { error: T(`unsupported action ${this.constructor.name}`) };
|
|
194
|
+
}
|
|
195
|
+
class U {
|
|
196
|
+
constructor() {
|
|
197
|
+
this._actionModel = {};
|
|
198
|
+
}
|
|
199
|
+
toJson() {
|
|
200
|
+
return k.apply(this);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
class C extends U {
|
|
204
|
+
constructor() {
|
|
205
|
+
super(...arguments), this.qualifiers = /* @__PURE__ */ new Map(), this.flags = [], this.delimiter = ",", this.actionTag = "";
|
|
206
|
+
}
|
|
207
|
+
prepareQualifiers() {
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* @description Returns the custom name tag that was given to this action
|
|
211
|
+
* @return {string}
|
|
212
|
+
*/
|
|
213
|
+
getActionTag() {
|
|
214
|
+
return this.actionTag;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @description Sets the custom name tag for this action
|
|
218
|
+
* @return {this}
|
|
219
|
+
*/
|
|
220
|
+
setActionTag(t) {
|
|
221
|
+
return this.actionTag = t, this;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* @description Calls toString() on all child qualifiers (implicitly by using .join()).
|
|
225
|
+
* @return {string}
|
|
226
|
+
*/
|
|
227
|
+
toString() {
|
|
228
|
+
return this.prepareQualifiers(), $(this.qualifiers, this.flags).join(this.delimiter);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* @description Adds the parameter to the action.
|
|
232
|
+
* @param {SDK.Qualifier} qualifier
|
|
233
|
+
* @return {this}
|
|
234
|
+
*/
|
|
235
|
+
addQualifier(t) {
|
|
236
|
+
if (typeof t == "string") {
|
|
237
|
+
const [r, s] = t.toLowerCase().split("_");
|
|
238
|
+
r === "fl" ? this.flags.push(new d(s)) : this.qualifiers.set(r, new m(r, s));
|
|
239
|
+
} else
|
|
240
|
+
this.qualifiers.set(t.key, t);
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* @description Adds a flag to the current action.
|
|
245
|
+
* @param {Qualifiers.Flag} flag
|
|
246
|
+
* @return {this}
|
|
247
|
+
*/
|
|
248
|
+
addFlag(t) {
|
|
249
|
+
return typeof t == "string" ? this.flags.push(new d(t)) : t instanceof d && this.flags.push(t), this;
|
|
250
|
+
}
|
|
251
|
+
addValueToQualifier(t, r) {
|
|
252
|
+
return this.qualifiers.get(t).addValue(r), this;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function L(e) {
|
|
256
|
+
return e && (e.match(/^#/) ? `rgb:${e.substr(1)}` : e);
|
|
257
|
+
}
|
|
258
|
+
class F extends C {
|
|
259
|
+
constructor(t) {
|
|
260
|
+
super(), this._actionModel = {}, this.addQualifier(new m("b", new f(L(t)).setDelimiter("_"))), this._actionModel.color = t, this._actionModel.actionType = "backgroundColor";
|
|
261
|
+
}
|
|
262
|
+
static fromJson(t) {
|
|
263
|
+
const { color: r } = t;
|
|
264
|
+
return new this(r);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
class O {
|
|
268
|
+
constructor(t) {
|
|
269
|
+
this.raw = t;
|
|
270
|
+
}
|
|
271
|
+
toString() {
|
|
272
|
+
return this.raw;
|
|
273
|
+
}
|
|
274
|
+
toJson() {
|
|
275
|
+
return { error: T(`unsupported action ${this.constructor.name}`) };
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function I(e) {
|
|
279
|
+
const t = e;
|
|
280
|
+
return "error" in t && !!t.error;
|
|
281
|
+
}
|
|
282
|
+
function q() {
|
|
283
|
+
return new d("lossy");
|
|
284
|
+
}
|
|
285
|
+
function N() {
|
|
286
|
+
return new d("preserve_transparency");
|
|
287
|
+
}
|
|
288
|
+
function Q(e) {
|
|
289
|
+
return new d("progressive", e);
|
|
290
|
+
}
|
|
291
|
+
class Y extends f {
|
|
292
|
+
constructor(t) {
|
|
293
|
+
super(t), this.val = t;
|
|
294
|
+
}
|
|
295
|
+
getValue() {
|
|
296
|
+
return this.val;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function h(e) {
|
|
300
|
+
const t = {};
|
|
301
|
+
return Object.keys(e).forEach((r) => {
|
|
302
|
+
t[e[r]] = r;
|
|
303
|
+
}), t;
|
|
304
|
+
}
|
|
305
|
+
const J = {
|
|
306
|
+
limitFit: "limit",
|
|
307
|
+
limitFill: "lfill",
|
|
308
|
+
minimumFit: "mfit",
|
|
309
|
+
thumbnail: "thumb",
|
|
310
|
+
limitPad: "lpad",
|
|
311
|
+
minimumPad: "mpad",
|
|
312
|
+
autoPad: "auto_pad"
|
|
313
|
+
}, H = {
|
|
314
|
+
colorSpace: "cs",
|
|
315
|
+
dpr: "dpr",
|
|
316
|
+
density: "dn",
|
|
317
|
+
defaultImage: "d",
|
|
318
|
+
format: "f",
|
|
319
|
+
quality: "q"
|
|
320
|
+
}, K = {
|
|
321
|
+
redEye: "redeye",
|
|
322
|
+
advancedRedEye: "adv_redeye",
|
|
323
|
+
oilPaint: "oil_paint",
|
|
324
|
+
unsharpMask: "unsharp_mask",
|
|
325
|
+
makeTransparent: "make_transparent",
|
|
326
|
+
generativeRestore: "gen_restore",
|
|
327
|
+
upscale: "upscale"
|
|
328
|
+
}, z = {
|
|
329
|
+
autoBest: "auto:best",
|
|
330
|
+
autoEco: "auto:eco",
|
|
331
|
+
autoGood: "auto:good",
|
|
332
|
+
autoLow: "auto:low",
|
|
333
|
+
jpegminiHigh: "jpegmini:1",
|
|
334
|
+
jpegminiMedium: "jpegmini:2",
|
|
335
|
+
jpegminiBest: "jpegmini:0"
|
|
336
|
+
}, B = {
|
|
337
|
+
fullHd: "full_hd",
|
|
338
|
+
fullHdWifi: "full_hd_wifi",
|
|
339
|
+
fullHdLean: "full_hd_lean",
|
|
340
|
+
hdLean: "hd_lean"
|
|
341
|
+
}, G = {
|
|
342
|
+
444: "CHROMA_444",
|
|
343
|
+
420: "CHROMA_420"
|
|
344
|
+
}, W = {
|
|
345
|
+
noCmyk: "no_cmyk",
|
|
346
|
+
keepCmyk: "keep_cmyk",
|
|
347
|
+
tinySrgb: "tinysrgb",
|
|
348
|
+
srgbTrueColor: "srgb:truecolor"
|
|
349
|
+
};
|
|
350
|
+
h(G);
|
|
351
|
+
h(W);
|
|
352
|
+
h(J);
|
|
353
|
+
const Z = h(H);
|
|
354
|
+
h(K);
|
|
355
|
+
h(z);
|
|
356
|
+
h(B);
|
|
357
|
+
class X extends C {
|
|
358
|
+
/**
|
|
359
|
+
* @param {string} deliveryKey A generic Delivery Action Key (such as q, f, dn, etc.)
|
|
360
|
+
* @param {string} deliveryType A Format Qualifiers for the action, such as Quality.auto()
|
|
361
|
+
* @param {string} modelProperty internal model property of the action, for example quality uses `level` while dpr uses `density`
|
|
362
|
+
* @see Visit {@link Actions.Delivery|Delivery} for an example
|
|
363
|
+
*/
|
|
364
|
+
constructor(t, r, s) {
|
|
365
|
+
super(), this._actionModel = {};
|
|
366
|
+
let n;
|
|
367
|
+
r instanceof Y ? n = r.getValue() : n = r, this._actionModel.actionType = Z[t], this._actionModel[s] = n, this.addQualifier(new m(t, r));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
class tt extends d {
|
|
371
|
+
constructor(t) {
|
|
372
|
+
super("progressive", t);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
class p extends X {
|
|
376
|
+
constructor(t, r) {
|
|
377
|
+
super(t, r, "formatType");
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* @description Uses lossy compression when delivering animated GIF files.
|
|
381
|
+
* @return {this}
|
|
382
|
+
*/
|
|
383
|
+
lossy() {
|
|
384
|
+
return this._actionModel.lossy = !0, this.addFlag(q()), this;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @description Uses progressive compression when delivering JPG file format.
|
|
388
|
+
* @return {this}
|
|
389
|
+
*/
|
|
390
|
+
progressive(t) {
|
|
391
|
+
return t instanceof tt ? (this._actionModel.progressive = { mode: t.getFlagValue() }, this.addFlag(t)) : (this._actionModel.progressive = { mode: t }, this.addFlag(Q(t))), this;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* @description Ensures that images with a transparency channel are delivered in PNG format.
|
|
395
|
+
*/
|
|
396
|
+
preserveTransparency() {
|
|
397
|
+
return this._actionModel.preserveTransparency = !0, this.addFlag(N()), this;
|
|
398
|
+
}
|
|
399
|
+
static fromJson(t) {
|
|
400
|
+
const { formatType: r, lossy: s, progressive: n, preserveTransparency: i } = t;
|
|
401
|
+
let o;
|
|
402
|
+
return r ? o = new this("f", r) : o = new this("f"), n && (n.mode ? o.progressive(n.mode) : o.progressive()), s && o.lossy(), i && o.preserveTransparency(), o;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
class y {
|
|
406
|
+
constructor() {
|
|
407
|
+
this.actions = [];
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* @param {SDK.Action | string} action
|
|
411
|
+
* @return {this}
|
|
412
|
+
*/
|
|
413
|
+
addAction(t) {
|
|
414
|
+
let r;
|
|
415
|
+
if (typeof t == "string") {
|
|
416
|
+
if (t.indexOf("/") >= 0)
|
|
417
|
+
throw "addAction cannot accept a string with a forward slash in it - /, use .addTransformation() instead";
|
|
418
|
+
r = new O(t);
|
|
419
|
+
} else
|
|
420
|
+
r = t;
|
|
421
|
+
return this.actions.push(r), this;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* @description Allows the injection of a raw transformation as a string into the transformation, or a Transformation instance that was previously created
|
|
425
|
+
* @param {string | SDK.Transformation} tx
|
|
426
|
+
* @example
|
|
427
|
+
* import {Transformation} from "@cloudinary/url-gen";
|
|
428
|
+
*
|
|
429
|
+
* const transformation = new Transformation();
|
|
430
|
+
* transformation.addTransformation('w_100/w_200/w_300');
|
|
431
|
+
* @return {this}
|
|
432
|
+
*/
|
|
433
|
+
addTransformation(t) {
|
|
434
|
+
return t instanceof y ? this.actions = this.actions.concat(t.actions) : this.actions.push(new O(t)), this;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* @return {string}
|
|
438
|
+
*/
|
|
439
|
+
toString() {
|
|
440
|
+
return this.actions.map((t) => t.toString()).filter((t) => t).join("/");
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* @description Delivers an animated GIF.
|
|
444
|
+
* @param {AnimatedAction} animatedAction
|
|
445
|
+
* @return {this}
|
|
446
|
+
*/
|
|
447
|
+
animated(t) {
|
|
448
|
+
return this.addAction(t);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* @description Adds a border around the image.
|
|
452
|
+
* @param {Border} borderAction
|
|
453
|
+
* @return {this}
|
|
454
|
+
*/
|
|
455
|
+
border(t) {
|
|
456
|
+
return this.addAction(t);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* @description Adjusts the shape of the delivered image. </br>
|
|
460
|
+
* <b>Learn more:</b> {@link https://cloudinary.com/documentation/effects_and_artistic_enhancements#distort|Shape changes and distortion effects}
|
|
461
|
+
* @param {IReshape} reshapeAction
|
|
462
|
+
* @return {this}
|
|
463
|
+
*/
|
|
464
|
+
reshape(t) {
|
|
465
|
+
return this.addAction(t);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* @description Resize the asset using provided resize action
|
|
469
|
+
* @param {ResizeSimpleAction} resizeAction
|
|
470
|
+
* @return {this}
|
|
471
|
+
*/
|
|
472
|
+
resize(t) {
|
|
473
|
+
return this.addAction(t);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* @desc An alias to Action Delivery.quality
|
|
477
|
+
* @param {string|number} quality
|
|
478
|
+
* @return {this}
|
|
479
|
+
*/
|
|
480
|
+
quality(t) {
|
|
481
|
+
return this.addAction(new p("q", t)), this;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* @desc An alias to Action Delivery.format
|
|
485
|
+
* @param {string} format
|
|
486
|
+
* @return {this}
|
|
487
|
+
*/
|
|
488
|
+
format(t) {
|
|
489
|
+
return this.addAction(new p("f", t)), this;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* @description Rounds the specified corners of an image.
|
|
493
|
+
* @param roundCornersAction
|
|
494
|
+
* @return {this}
|
|
495
|
+
*/
|
|
496
|
+
roundCorners(t) {
|
|
497
|
+
return this.addAction(t);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* @description Adds an overlay over the base image.
|
|
501
|
+
* @param {LayerAction} overlayAction
|
|
502
|
+
* @return {this}
|
|
503
|
+
*/
|
|
504
|
+
overlay(t) {
|
|
505
|
+
return this.addAction(t);
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* @description Adds an underlay under the base image.
|
|
509
|
+
* @param {LayerAction} underlayAction
|
|
510
|
+
* @return {this}
|
|
511
|
+
*/
|
|
512
|
+
underlay(t) {
|
|
513
|
+
return t.setLayerType("u"), this.addAction(t);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* @description Defines an new user variable.
|
|
517
|
+
* @param {VariableAction} variableAction
|
|
518
|
+
* @return {this}
|
|
519
|
+
*/
|
|
520
|
+
addVariable(t) {
|
|
521
|
+
return this.addAction(t);
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* @description Specifies a condition to be met before applying a transformation.
|
|
525
|
+
* @param {ConditionalAction} conditionAction
|
|
526
|
+
* @return {this}
|
|
527
|
+
*/
|
|
528
|
+
conditional(t) {
|
|
529
|
+
return this.addAction(t);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* @description Applies a filter or an effect on an asset.
|
|
533
|
+
* @param {SimpleEffectAction} effectAction
|
|
534
|
+
* @return {this}
|
|
535
|
+
*/
|
|
536
|
+
effect(t) {
|
|
537
|
+
return this.addAction(t);
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* @description Applies adjustment effect on an asset.
|
|
541
|
+
* @param action
|
|
542
|
+
* @return {this}
|
|
543
|
+
*/
|
|
544
|
+
adjust(t) {
|
|
545
|
+
return this.addAction(t);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* @description Rotates the asset by the given angle.
|
|
549
|
+
* @param {RotateAction} rotateAction
|
|
550
|
+
* @return {this}
|
|
551
|
+
*/
|
|
552
|
+
rotate(t) {
|
|
553
|
+
return this.addAction(t);
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* @description Applies a pre-defined named transformation of the given name.
|
|
557
|
+
* @param {NamedTransformation} namedTransformation
|
|
558
|
+
* @return {this}
|
|
559
|
+
*/
|
|
560
|
+
namedTransformation(t) {
|
|
561
|
+
return this.addAction(t);
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* @description Applies delivery action.
|
|
565
|
+
* @param deliveryAction
|
|
566
|
+
* @return {this}
|
|
567
|
+
*/
|
|
568
|
+
delivery(t) {
|
|
569
|
+
return this.addAction(t);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* @description Sets the color of the background.
|
|
573
|
+
* @param {Qualifiers.Color} color
|
|
574
|
+
* @return {this}
|
|
575
|
+
*/
|
|
576
|
+
backgroundColor(t) {
|
|
577
|
+
return this.addAction(new F(t));
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* @description Adds a layer in a Photoshop document.
|
|
581
|
+
* @param action
|
|
582
|
+
* @return {this}
|
|
583
|
+
*/
|
|
584
|
+
psdTools(t) {
|
|
585
|
+
return this.addAction(t);
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* @description Extracts an image or a page using an index, a range, or a name from a layered media asset.
|
|
589
|
+
* @param action
|
|
590
|
+
* @return {this}
|
|
591
|
+
*/
|
|
592
|
+
extract(t) {
|
|
593
|
+
return this.addAction(t);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* @description Adds a flag as a separate action.
|
|
597
|
+
* @param {Qualifiers.Flag | string} flagQualifier
|
|
598
|
+
* @return {this}
|
|
599
|
+
*/
|
|
600
|
+
addFlag(t) {
|
|
601
|
+
const r = new C();
|
|
602
|
+
let s = t;
|
|
603
|
+
return typeof t == "string" && (s = new d(t)), r.addQualifier(s), this.addAction(r);
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* @description Inject a custom function into the image transformation pipeline.
|
|
607
|
+
* @return {this}
|
|
608
|
+
*/
|
|
609
|
+
customFunction(t) {
|
|
610
|
+
return this.addAction(t);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Transcodes the video (or audio) to another format.
|
|
614
|
+
* @param {Action} action
|
|
615
|
+
* @return {this}
|
|
616
|
+
*/
|
|
617
|
+
transcode(t) {
|
|
618
|
+
return this.addAction(t);
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Applies the specified video edit action.
|
|
622
|
+
*
|
|
623
|
+
* @param {videoEditType} action
|
|
624
|
+
* @return {this}
|
|
625
|
+
*/
|
|
626
|
+
videoEdit(t) {
|
|
627
|
+
return this.addAction(t);
|
|
628
|
+
}
|
|
629
|
+
toJson() {
|
|
630
|
+
const t = [];
|
|
631
|
+
for (const r of this.actions) {
|
|
632
|
+
const s = r.toJson();
|
|
633
|
+
if (I(s))
|
|
634
|
+
return s;
|
|
635
|
+
t.push(s);
|
|
636
|
+
}
|
|
637
|
+
return { actions: t };
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
class et extends y {
|
|
641
|
+
}
|
|
642
|
+
class rt extends y {
|
|
643
|
+
}
|
|
644
|
+
function st(e) {
|
|
645
|
+
return e.match(/^https?:\//);
|
|
646
|
+
}
|
|
647
|
+
function nt(e) {
|
|
648
|
+
return e.indexOf("/") < 0;
|
|
649
|
+
}
|
|
650
|
+
function it(e) {
|
|
651
|
+
return e.match(/^v[0-9]+/);
|
|
652
|
+
}
|
|
653
|
+
function ot(e, t) {
|
|
654
|
+
const r = t.secure, s = t.privateCdn, n = t.cname, i = t.secureDistribution;
|
|
655
|
+
return !r && !n ? `http://res.cloudinary.com/${e}` : r && !i && s ? `https://${e}-res.cloudinary.com` : r && !i ? `https://res.cloudinary.com/${e}` : r && i && s ? `https://${i}` : r && i ? `https://${i}/${e}` : !r && n ? `http://${n}/${e}` : "ERROR";
|
|
656
|
+
}
|
|
657
|
+
function at(e) {
|
|
658
|
+
return e || "image";
|
|
659
|
+
}
|
|
660
|
+
function ut(e) {
|
|
661
|
+
return e || "upload";
|
|
662
|
+
}
|
|
663
|
+
function ct(e, t, r) {
|
|
664
|
+
const s = r !== !1;
|
|
665
|
+
return t ? `v${t}` : it(e) || st(e) || nt(e) ? "" : s ? "v1" : "";
|
|
666
|
+
}
|
|
667
|
+
function A(e, t, r) {
|
|
668
|
+
let s = t >> 0, n = String(r);
|
|
669
|
+
return e.length > s ? String(e) : (s = s - e.length, s > n.length && (n += dt(n, s / n.length)), n.slice(0, s) + String(e));
|
|
670
|
+
}
|
|
671
|
+
function dt(e, t) {
|
|
672
|
+
let r = t, s = "";
|
|
673
|
+
for (; r > 0; )
|
|
674
|
+
s += e, r--;
|
|
675
|
+
return s;
|
|
676
|
+
}
|
|
677
|
+
const lt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", g = {};
|
|
678
|
+
let w = 0;
|
|
679
|
+
lt.split("").forEach((e) => {
|
|
680
|
+
let t = w.toString(2);
|
|
681
|
+
t = A(t, 6, "0"), g[t] = e, w++;
|
|
682
|
+
});
|
|
683
|
+
function ht(e) {
|
|
684
|
+
if (e.split(".").length < 2)
|
|
685
|
+
throw new Error("invalid semVer, must have at least two segments");
|
|
686
|
+
return e.split(".").reverse().join(".");
|
|
687
|
+
}
|
|
688
|
+
function ft(e) {
|
|
689
|
+
if (e.split(".").length < 2)
|
|
690
|
+
throw new Error("invalid semVer, must have at least two segments");
|
|
691
|
+
return e.split(".").map((t) => {
|
|
692
|
+
const r = +t;
|
|
693
|
+
if (isNaN(r) || r < 0)
|
|
694
|
+
throw "Invalid version number provided";
|
|
695
|
+
return A(t, 2, "0");
|
|
696
|
+
}).join(".");
|
|
697
|
+
}
|
|
698
|
+
function b(e) {
|
|
699
|
+
let t = "";
|
|
700
|
+
const s = e.split(".").length * 6, n = ht(e), i = ft(n);
|
|
701
|
+
let a = parseInt(i.split(".").join("")).toString(2);
|
|
702
|
+
if (a = A(a, s, "0"), a.length % 6 !== 0)
|
|
703
|
+
throw "Version must be smaller than 43.21.26)";
|
|
704
|
+
return a.match(/.{1,6}/g).forEach((u) => {
|
|
705
|
+
t += g[u];
|
|
706
|
+
}), t;
|
|
707
|
+
}
|
|
708
|
+
function pt(e) {
|
|
709
|
+
const t = {
|
|
710
|
+
sdkSemver: e.sdkSemver,
|
|
711
|
+
techVersion: e.techVersion,
|
|
712
|
+
sdkCode: e.sdkCode,
|
|
713
|
+
product: e.product,
|
|
714
|
+
feature: "0",
|
|
715
|
+
osType: e.osType,
|
|
716
|
+
osVersion: e.osVersion
|
|
717
|
+
};
|
|
718
|
+
return e.accessibility && (t.feature = "D"), e.lazyload && (t.feature = "C"), e.responsive && (t.feature = "A"), e.placeholder && (t.feature = "B"), t;
|
|
719
|
+
}
|
|
720
|
+
const gt = "1.21.0";
|
|
721
|
+
function mt(e) {
|
|
722
|
+
const [t, r] = e.split("."), s = parseInt(t).toString(2), n = parseInt(r).toString(2), i = s.padStart(6, "0"), o = n.padStart(6, "0");
|
|
723
|
+
return g[i] + g[o];
|
|
724
|
+
}
|
|
725
|
+
function yt() {
|
|
726
|
+
const e = "0.0.0";
|
|
727
|
+
if (typeof window < "u")
|
|
728
|
+
return e;
|
|
729
|
+
try {
|
|
730
|
+
return process.versions.node || e;
|
|
731
|
+
} catch {
|
|
732
|
+
return e;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function _t(e) {
|
|
736
|
+
const t = {
|
|
737
|
+
techVersion: yt(),
|
|
738
|
+
sdkCode: "T",
|
|
739
|
+
sdkSemver: gt.split("-")[0],
|
|
740
|
+
product: "A",
|
|
741
|
+
osType: "Z",
|
|
742
|
+
osVersion: "0.0",
|
|
743
|
+
responsive: !1,
|
|
744
|
+
placeholder: !1,
|
|
745
|
+
lazyload: !1,
|
|
746
|
+
accessibility: !1
|
|
747
|
+
};
|
|
748
|
+
return e ? Object.assign(Object.assign({}, t), e) : t;
|
|
749
|
+
}
|
|
750
|
+
function E(e) {
|
|
751
|
+
const t = _t(e), r = pt(t);
|
|
752
|
+
try {
|
|
753
|
+
const s = Tt(r.techVersion), n = b(r.sdkSemver), i = b(s), o = mt(r.osVersion), a = r.feature, u = r.sdkCode, { product: c, osType: l } = r;
|
|
754
|
+
return `D${c}${u}${n}${i}${l}${o}${a}`;
|
|
755
|
+
} catch {
|
|
756
|
+
return "E";
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
function Tt(e) {
|
|
760
|
+
const t = e.split(".");
|
|
761
|
+
return `${t[0]}.${t[1]}`;
|
|
762
|
+
}
|
|
763
|
+
const V = {
|
|
764
|
+
"image/upload": "images",
|
|
765
|
+
"image/private": "private_images",
|
|
766
|
+
"image/authenticated": "authenticated_images",
|
|
767
|
+
"raw/upload": "files",
|
|
768
|
+
"video/upload": "videos"
|
|
769
|
+
};
|
|
770
|
+
class Ct {
|
|
771
|
+
constructor(t, r = {}, s) {
|
|
772
|
+
this.setPublicID(t), this.setCloudConfig(r), this.setURLConfig(s);
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* @description Sets the URL Config for this asset
|
|
776
|
+
* @param urlConfig
|
|
777
|
+
* @return {this}
|
|
778
|
+
*/
|
|
779
|
+
setURLConfig(t) {
|
|
780
|
+
return this.urlConfig = new _(t), this;
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* @description Sets the Cloud Config for this asset
|
|
784
|
+
* @param urlConfig
|
|
785
|
+
* @return {this}
|
|
786
|
+
*/
|
|
787
|
+
setCloudConfig(t) {
|
|
788
|
+
return this.cloudName = t.cloudName, this.apiKey = t.apiKey, this.apiSecret = t.apiSecret, this.authToken = t.authToken, this;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* @description Sets the public ID of the asset.
|
|
792
|
+
* @param {string} publicID The public ID of the asset.
|
|
793
|
+
* @return {this}
|
|
794
|
+
*/
|
|
795
|
+
setPublicID(t) {
|
|
796
|
+
return this.publicID = t ? t.toString() : "", this;
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* @description Sets the delivery type of the asset.
|
|
800
|
+
* @param {DELIVERY_TYPE | string} newType The type of the asset.
|
|
801
|
+
* @return {this}
|
|
802
|
+
*/
|
|
803
|
+
setDeliveryType(t) {
|
|
804
|
+
return this.deliveryType = t, this;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* @description Sets the URL SEO suffix of the asset.
|
|
808
|
+
* @param {string} newSuffix The SEO suffix.
|
|
809
|
+
* @return {this}
|
|
810
|
+
*/
|
|
811
|
+
setSuffix(t) {
|
|
812
|
+
return this.suffix = t, this;
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* @description Sets the signature of the asset.
|
|
816
|
+
* @param {string} signature The signature.
|
|
817
|
+
* @return {this}
|
|
818
|
+
*/
|
|
819
|
+
setSignature(t) {
|
|
820
|
+
return this.signature = t, this;
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* @description Sets the version of the asset.
|
|
824
|
+
* @param {string} newVersion The version of the asset.
|
|
825
|
+
* @return {this}
|
|
826
|
+
*/
|
|
827
|
+
setVersion(t) {
|
|
828
|
+
return t && (this.version = t), this;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* @description Sets the asset type.
|
|
832
|
+
* @param {string} newType The type of the asset.
|
|
833
|
+
* @return {this}
|
|
834
|
+
*/
|
|
835
|
+
setAssetType(t) {
|
|
836
|
+
return t && (this.assetType = t), this;
|
|
837
|
+
}
|
|
838
|
+
sign() {
|
|
839
|
+
return this;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* @description Serializes to URL string
|
|
843
|
+
* @param overwriteOptions
|
|
844
|
+
*/
|
|
845
|
+
toURL(t = {}) {
|
|
846
|
+
return this.createCloudinaryURL(null, t.trackedAnalytics);
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* @description Validate various options before attempting to create a URL
|
|
850
|
+
* The function will throw in case a violation
|
|
851
|
+
* @throws Validation errors
|
|
852
|
+
*/
|
|
853
|
+
validateAssetForURLCreation() {
|
|
854
|
+
if (typeof this.cloudName > "u")
|
|
855
|
+
throw "You must supply a cloudName when initializing the asset";
|
|
856
|
+
const t = this.suffix && this.suffix.indexOf(".") >= 0, r = this.suffix && this.suffix.indexOf("/") >= 0;
|
|
857
|
+
if (t || r)
|
|
858
|
+
throw "`suffix`` should not include . or /";
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* @description return an SEO friendly name for a combination of asset/delivery, some examples:
|
|
862
|
+
* * image/upload -> images
|
|
863
|
+
* * video/upload -> videos
|
|
864
|
+
* If no match is found, return `{asset}/{delivery}`
|
|
865
|
+
*/
|
|
866
|
+
getResourceType() {
|
|
867
|
+
const t = at(this.assetType), r = ut(this.deliveryType), s = !!this.suffix, n = `${t}/${r}`, i = V[`${t}/${r}`], o = this.urlConfig.useRootPath, a = this.urlConfig.shorten;
|
|
868
|
+
if (o) {
|
|
869
|
+
if (n === "image/upload")
|
|
870
|
+
return "";
|
|
871
|
+
throw new Error(`useRootPath can only be used with assetType: 'image' and deliveryType: 'upload'. Provided: ${n} instead`);
|
|
872
|
+
}
|
|
873
|
+
if (a && n === "image/upload")
|
|
874
|
+
return "iu";
|
|
875
|
+
if (s) {
|
|
876
|
+
if (i)
|
|
877
|
+
return i;
|
|
878
|
+
throw new Error(`URL Suffix only supported for ${Object.keys(V).join(", ")}, Provided: ${n} instead`);
|
|
879
|
+
}
|
|
880
|
+
return n;
|
|
881
|
+
}
|
|
882
|
+
getSignature() {
|
|
883
|
+
return this.signature ? `s--${this.signature}--` : "";
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
*
|
|
887
|
+
* @description Creates a fully qualified CloudinaryURL
|
|
888
|
+
* @return {string} CloudinaryURL
|
|
889
|
+
* @throws Validation Errors
|
|
890
|
+
*/
|
|
891
|
+
createCloudinaryURL(t, r) {
|
|
892
|
+
if (!this.publicID)
|
|
893
|
+
return "";
|
|
894
|
+
this.validateAssetForURLCreation();
|
|
895
|
+
const s = ot(this.cloudName, this.urlConfig), n = t ? t.toString() : "", i = ct(this.publicID, this.version, this.urlConfig.forceVersion), o = this.publicID;
|
|
896
|
+
if (typeof t == "string")
|
|
897
|
+
return [s, this.getResourceType(), this.getSignature(), n, i, o.replace(/,/g, "%2C"), this.suffix].filter((u) => u).join("/");
|
|
898
|
+
{
|
|
899
|
+
const a = [
|
|
900
|
+
encodeURI(s),
|
|
901
|
+
this.getResourceType(),
|
|
902
|
+
this.getSignature(),
|
|
903
|
+
encodeURI(n),
|
|
904
|
+
i,
|
|
905
|
+
encodeURI(o).replace(/,/g, "%2C"),
|
|
906
|
+
this.suffix && encodeURI(this.suffix)
|
|
907
|
+
].filter((l) => l).join("/").replace(/\?/g, "%3F").replace(/=/g, "%3D"), u = this.urlConfig.analytics !== !1 && !o.includes("?");
|
|
908
|
+
let c = "";
|
|
909
|
+
if (typeof this.urlConfig.queryParams == "object")
|
|
910
|
+
try {
|
|
911
|
+
const l = new URLSearchParams(this.urlConfig.queryParams);
|
|
912
|
+
u && l.set("_a", E(r)), c = l.toString();
|
|
913
|
+
} catch {
|
|
914
|
+
console.error("Error: URLSearchParams is not available so the queryParams object cannot be parsed, please try passing as an already parsed string");
|
|
915
|
+
}
|
|
916
|
+
else
|
|
917
|
+
c = this.urlConfig.queryParams || "", u && (c += `${c.length > 0 ? "&" : ""}_a=${E(r)}`);
|
|
918
|
+
return c ? `${a}?${c}` : a;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
class M extends Ct {
|
|
923
|
+
constructor(t, r, s, n) {
|
|
924
|
+
super(t, r, s), this.transformation = n;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
928
|
+
* @param {Actions.Animated} animated
|
|
929
|
+
* @return {this}
|
|
930
|
+
*/
|
|
931
|
+
animated(t) {
|
|
932
|
+
return this.transformation.animated(t), this;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
936
|
+
* @param {Actions.Border} border
|
|
937
|
+
* @return {this}
|
|
938
|
+
*/
|
|
939
|
+
border(t) {
|
|
940
|
+
return this.transformation.border(t), this;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
944
|
+
* @param {Actions.Reshape} reshape
|
|
945
|
+
* @return {this}
|
|
946
|
+
*/
|
|
947
|
+
reshape(t) {
|
|
948
|
+
return this.transformation.reshape(t), this;
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
952
|
+
* @param {Actions.Resize} resize
|
|
953
|
+
* @return {this}
|
|
954
|
+
*/
|
|
955
|
+
resize(t) {
|
|
956
|
+
return this.transformation.resize(t), this;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* @desc An alias to Action Delivery.quality
|
|
960
|
+
* @param {string|number} quality
|
|
961
|
+
* @return {this}
|
|
962
|
+
*/
|
|
963
|
+
quality(t) {
|
|
964
|
+
return this.addAction(new p("q", t)), this;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* @desc An alias to Action Delivery.format
|
|
968
|
+
* @param {string} format
|
|
969
|
+
* @return {this}
|
|
970
|
+
*/
|
|
971
|
+
format(t) {
|
|
972
|
+
return this.addAction(new p("f", t)), this;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
976
|
+
* @param {Actions.RoundCorners} roundCorners
|
|
977
|
+
* @return {this}
|
|
978
|
+
*/
|
|
979
|
+
roundCorners(t) {
|
|
980
|
+
return this.transformation.roundCorners(t), this;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
984
|
+
* @return {this}
|
|
985
|
+
*/
|
|
986
|
+
overlay(t) {
|
|
987
|
+
return this.transformation.overlay(t), this;
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
991
|
+
* @param {Actions.Variable} variableAction
|
|
992
|
+
* @return {this}
|
|
993
|
+
*/
|
|
994
|
+
addVariable(t) {
|
|
995
|
+
return this.transformation.addVariable(t), this;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
999
|
+
* @param {Actions.Condition} conditionalAction
|
|
1000
|
+
* @return {this}
|
|
1001
|
+
*/
|
|
1002
|
+
conditional(t) {
|
|
1003
|
+
return this.transformation.conditional(t), this;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1007
|
+
* @param {Actions.Effect} effect
|
|
1008
|
+
* @return {this}
|
|
1009
|
+
*/
|
|
1010
|
+
effect(t) {
|
|
1011
|
+
return this.transformation.effect(t), this;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1015
|
+
* @param {Actions.Adjust} action
|
|
1016
|
+
* @return {this}
|
|
1017
|
+
*/
|
|
1018
|
+
adjust(t) {
|
|
1019
|
+
return this.transformation.adjust(t), this;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1023
|
+
* @param {Actions.Rotate} rotate
|
|
1024
|
+
* @return {this}
|
|
1025
|
+
*/
|
|
1026
|
+
rotate(t) {
|
|
1027
|
+
return this.transformation.rotate(t), this;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1031
|
+
* @param {Actions.NamedTransformation} namedTransformation
|
|
1032
|
+
* @return {this}
|
|
1033
|
+
*/
|
|
1034
|
+
namedTransformation(t) {
|
|
1035
|
+
return this.transformation.namedTransformation(t), this;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1039
|
+
* @param {Actions.Delivery} deliveryAction
|
|
1040
|
+
* @return {this}
|
|
1041
|
+
*/
|
|
1042
|
+
delivery(t) {
|
|
1043
|
+
return this.transformation.delivery(t), this;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1047
|
+
* @param {Qualifiers.color} color
|
|
1048
|
+
* @return {this}
|
|
1049
|
+
*/
|
|
1050
|
+
backgroundColor(t) {
|
|
1051
|
+
return this.transformation.backgroundColor(t), this;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1055
|
+
* @param {Actions.PSDTools} action
|
|
1056
|
+
* @return {this}
|
|
1057
|
+
*/
|
|
1058
|
+
psdTools(t) {
|
|
1059
|
+
return this.transformation.psdTools(t), this;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1063
|
+
* @param {Actions.Extract} action
|
|
1064
|
+
* @return {this}
|
|
1065
|
+
*/
|
|
1066
|
+
extract(t) {
|
|
1067
|
+
return this.transformation.extract(t), this;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1071
|
+
* @param {Qualifiers.Flag | string} flagQualifier
|
|
1072
|
+
* @return {this}
|
|
1073
|
+
*/
|
|
1074
|
+
addFlag(t) {
|
|
1075
|
+
return this.transformation.addFlag(t), this;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1079
|
+
* @param {Actions.CustomFunction} customFunction
|
|
1080
|
+
* @return {this}
|
|
1081
|
+
*/
|
|
1082
|
+
customFunction(t) {
|
|
1083
|
+
return this.transformation.customFunction(t), this;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1087
|
+
* @param {SDK.Action | string} action
|
|
1088
|
+
* @return {this}
|
|
1089
|
+
*/
|
|
1090
|
+
addAction(t) {
|
|
1091
|
+
return this.transformation.addAction(t), this;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* @description Extend your transformation with another transformation
|
|
1095
|
+
* @param { string | SDK.Transformation } tx
|
|
1096
|
+
*/
|
|
1097
|
+
addTransformation(t) {
|
|
1098
|
+
return this.transformation.addTransformation(t), this;
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1102
|
+
* @return {string}
|
|
1103
|
+
*/
|
|
1104
|
+
toString() {
|
|
1105
|
+
return this.transformation.toString();
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1109
|
+
* @return {this}
|
|
1110
|
+
*/
|
|
1111
|
+
underlay(t) {
|
|
1112
|
+
return this.transformation.underlay(t), this;
|
|
1113
|
+
}
|
|
1114
|
+
toURL(t = {}) {
|
|
1115
|
+
return this.createCloudinaryURL(this.transformation, t == null ? void 0 : t.trackedAnalytics);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
class At extends M {
|
|
1119
|
+
constructor(t, r, s) {
|
|
1120
|
+
super(t, r, s, new et());
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
class St extends M {
|
|
1124
|
+
constructor(t, r, s) {
|
|
1125
|
+
super(t, r, s, new rt()), this.assetType = "video";
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1129
|
+
* @param {Actions.Transcode} action
|
|
1130
|
+
* @return {this}
|
|
1131
|
+
*/
|
|
1132
|
+
transcode(t) {
|
|
1133
|
+
return this.transformation.transcode(t), this;
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* @desc A proxy to {@link SDK.Transformation| Transformation} - Calls the same method contained in this.transformation
|
|
1137
|
+
* @param {Actions.VideoEdit} action
|
|
1138
|
+
* @return {this}
|
|
1139
|
+
*/
|
|
1140
|
+
videoEdit(t) {
|
|
1141
|
+
return this.transformation.videoEdit(t), this;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
class vt {
|
|
1145
|
+
constructor(t) {
|
|
1146
|
+
t && (this.cloudinaryConfig = t);
|
|
1147
|
+
}
|
|
1148
|
+
image(t) {
|
|
1149
|
+
return new At(t, this.cloudinaryConfig.cloud, this.cloudinaryConfig.url);
|
|
1150
|
+
}
|
|
1151
|
+
video(t) {
|
|
1152
|
+
return new St(t, this.cloudinaryConfig.cloud, this.cloudinaryConfig.url);
|
|
1153
|
+
}
|
|
1154
|
+
setConfig(t) {
|
|
1155
|
+
return this.cloudinaryConfig = t, this;
|
|
1156
|
+
}
|
|
1157
|
+
getConfig() {
|
|
1158
|
+
return this.cloudinaryConfig;
|
|
1159
|
+
}
|
|
1160
|
+
extendConfig() {
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
const bt = ({
|
|
1164
|
+
publicId: e,
|
|
1165
|
+
format: t = "webp"
|
|
1166
|
+
}) => {
|
|
1167
|
+
const r = S(() => new vt({
|
|
1168
|
+
cloud: {
|
|
1169
|
+
cloudName: "fluid-attacks"
|
|
1170
|
+
}
|
|
1171
|
+
}), []);
|
|
1172
|
+
return S(() => r.image(e).format(t), [r, e, t]);
|
|
1173
|
+
};
|
|
1174
|
+
export {
|
|
1175
|
+
bt as u
|
|
1176
|
+
};
|