@flourish/sdk 4.2.2 → 5.1.0
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/README.md +14 -1
- package/RELEASE_NOTES.md +7 -2
- package/common/embed/credit.js +2 -3
- package/common/embed/customer_analytics.js +5 -6
- package/common/embed/embedding.d.ts +1 -1
- package/common/embed/embedding.js +7 -9
- package/common/embed/localizations.d.ts +8 -8
- package/common/package.json +11 -2
- package/common/tsconfig.sdk.tsbuildinfo +1 -1
- package/common/utils/columns.js +7 -8
- package/common/utils/data.d.ts +36 -15
- package/common/utils/data.js +84 -27
- package/common/utils/json.d.ts +6 -3
- package/common/utils/json.js +4 -5
- package/common/utils/state.js +7 -8
- package/common/utils/types.d.ts +63 -0
- package/common/utils/types.js +3 -0
- package/lib/cmd/login.js +12 -17
- package/lib/cmd/logout.js +17 -5
- package/lib/cmd/publish.js +2 -7
- package/lib/cmd/register.js +10 -13
- package/lib/sdk.js +59 -13
- package/package.json +24 -24
- package/rollup.config.mjs +49 -0
- package/server/index.js +29 -10
- package/server/json.js +1 -0
- package/server/views/index.html +5 -2
- package/site/embedded.js +2 -1
- package/site/images/icon-add-folder.svg +1 -1
- package/site/script.js +3 -2
- package/site/sdk.css +1 -1
- package/tsconfig.json +1 -1
- package/server/data.js +0 -327
package/lib/sdk.js
CHANGED
|
@@ -4,8 +4,6 @@ const fs = require("fs"),
|
|
|
4
4
|
path = require("path"),
|
|
5
5
|
|
|
6
6
|
cross_spawn = require("cross-spawn"),
|
|
7
|
-
fetch = require("node-fetch"),
|
|
8
|
-
FormData = require("form-data"),
|
|
9
7
|
shell_quote = require("shell-quote"),
|
|
10
8
|
yaml = require("js-yaml"),
|
|
11
9
|
nodeResolve = require("resolve"),
|
|
@@ -63,6 +61,36 @@ function setSdkToken(server_opts, sdk_token) {
|
|
|
63
61
|
});
|
|
64
62
|
}
|
|
65
63
|
|
|
64
|
+
function deleteSdkToken(host) {
|
|
65
|
+
return new Promise(function(resolve) {
|
|
66
|
+
if (host == null) {
|
|
67
|
+
log.die("No host specified");
|
|
68
|
+
}
|
|
69
|
+
fs.readFile(sdk_tokens_file, function(error, body) {
|
|
70
|
+
if (error) log.die(`Failed to read ${sdk_tokens_file}`, error.message);
|
|
71
|
+
|
|
72
|
+
let sdk_tokens;
|
|
73
|
+
try {
|
|
74
|
+
sdk_tokens = JSON.parse(body);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
log.die(`Failed to parse ${sdk_tokens_file}`, "Remove it and try again");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
delete sdk_tokens[host];
|
|
81
|
+
fs.writeFile(sdk_tokens_file, JSON.stringify(sdk_tokens), { mode: 0o600 }, function(error) {
|
|
82
|
+
if (error) log.die(`Failed to save ${sdk_tokens_file}`, error.message);
|
|
83
|
+
resolve();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Deletes all SDK tokens
|
|
91
|
+
* this will delete the .flourish_sdk file from the user's home directory
|
|
92
|
+
* which clears all tokens across all configured hosts
|
|
93
|
+
*/
|
|
66
94
|
function deleteSdkTokens() {
|
|
67
95
|
return new Promise(function(resolve, reject) {
|
|
68
96
|
fs.unlink(sdk_tokens_file, function(error) {
|
|
@@ -74,10 +102,11 @@ function deleteSdkTokens() {
|
|
|
74
102
|
|
|
75
103
|
const AUTHENTICATED_REQUEST_METHODS = new Set([
|
|
76
104
|
"template/assign-version-number", "template/publish", "template/delete", "template/list", "template/history",
|
|
77
|
-
"user/whoami"
|
|
105
|
+
"user/whoami", "user/logout"
|
|
78
106
|
]);
|
|
79
107
|
|
|
80
|
-
async function request(server_opts, method, data) {
|
|
108
|
+
async function request(server_opts, method, data, config = { exit_on_failure: true }) {
|
|
109
|
+
const fetch = await import("node-fetch");
|
|
81
110
|
let sdk_token;
|
|
82
111
|
|
|
83
112
|
if (AUTHENTICATED_REQUEST_METHODS.has(method)) {
|
|
@@ -97,12 +126,11 @@ async function request(server_opts, method, data) {
|
|
|
97
126
|
const options = { method: data ? "POST" : "GET" };
|
|
98
127
|
|
|
99
128
|
if (data) {
|
|
100
|
-
if (data instanceof FormData) {
|
|
129
|
+
if (data instanceof fetch.FormData) {
|
|
101
130
|
if (sdk_token) {
|
|
102
131
|
data.append("sdk_token", sdk_token);
|
|
103
132
|
}
|
|
104
133
|
data.append("sdk_version", SDK_VERSION);
|
|
105
|
-
options.headers = data.getHeaders();
|
|
106
134
|
options.body = data;
|
|
107
135
|
}
|
|
108
136
|
else {
|
|
@@ -118,10 +146,15 @@ async function request(server_opts, method, data) {
|
|
|
118
146
|
let res;
|
|
119
147
|
|
|
120
148
|
try {
|
|
121
|
-
res = await fetch(url, options);
|
|
149
|
+
res = await fetch.default(url, options);
|
|
122
150
|
}
|
|
123
151
|
catch (e) {
|
|
124
|
-
|
|
152
|
+
if (config.exit_on_failure) {
|
|
153
|
+
log.die(e);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
throw e;
|
|
157
|
+
}
|
|
125
158
|
}
|
|
126
159
|
|
|
127
160
|
let text;
|
|
@@ -132,7 +165,12 @@ async function request(server_opts, method, data) {
|
|
|
132
165
|
text = await res.text();
|
|
133
166
|
}
|
|
134
167
|
catch (error) {
|
|
135
|
-
|
|
168
|
+
if (config.exit_on_failure) {
|
|
169
|
+
log.die("Failed to get response from server", error);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
136
174
|
}
|
|
137
175
|
|
|
138
176
|
let body;
|
|
@@ -141,7 +179,10 @@ async function request(server_opts, method, data) {
|
|
|
141
179
|
body = JSON.parse(text);
|
|
142
180
|
}
|
|
143
181
|
catch (error) {
|
|
144
|
-
|
|
182
|
+
if (config.exit_on_failure) {
|
|
183
|
+
log.die("Failed to parse response body", res.status, error, text);
|
|
184
|
+
}
|
|
185
|
+
else throw error;
|
|
145
186
|
}
|
|
146
187
|
|
|
147
188
|
if (res.ok) {
|
|
@@ -149,7 +190,12 @@ async function request(server_opts, method, data) {
|
|
|
149
190
|
}
|
|
150
191
|
|
|
151
192
|
if (body.error) {
|
|
152
|
-
|
|
193
|
+
if (config.exit_on_failure) {
|
|
194
|
+
log.die("Error from server", res.status, body.error.message);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
throw body.error;
|
|
198
|
+
}
|
|
153
199
|
}
|
|
154
200
|
|
|
155
201
|
log.die("Server error", res.status, JSON.stringify(body));
|
|
@@ -226,7 +272,7 @@ function readYaml(yaml_file) {
|
|
|
226
272
|
fs.readFile(yaml_file, "utf8", function(error, text) {
|
|
227
273
|
if (error) return reject(new Error(`Failed to read ${yaml_file}: ${error.message}`));
|
|
228
274
|
try {
|
|
229
|
-
return resolve(yaml.
|
|
275
|
+
return resolve(yaml.load(text));
|
|
230
276
|
}
|
|
231
277
|
catch (error) {
|
|
232
278
|
return reject(new Error(`Failed to parse ${yaml_file}: ${error.message}`));
|
|
@@ -590,7 +636,7 @@ const TEMPLATE_SPECIAL = new Set([
|
|
|
590
636
|
module.exports = {
|
|
591
637
|
checkTemplateVersion,
|
|
592
638
|
|
|
593
|
-
getSdkToken, setSdkToken, deleteSdkTokens,
|
|
639
|
+
getSdkToken, setSdkToken, deleteSdkTokens, deleteSdkToken,
|
|
594
640
|
request,
|
|
595
641
|
runBuildCommand, buildTemplate,
|
|
596
642
|
readConfig, readAndValidateConfig, writeConfig, buildRules,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flourish/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "The Flourish SDK",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,38 +15,38 @@
|
|
|
15
15
|
"repository": "kiln/flourish-sdk",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@flourish/interpreter": "^8.5.0",
|
|
18
|
-
"@flourish/semver": "^1.0.
|
|
18
|
+
"@flourish/semver": "^1.0.2",
|
|
19
19
|
"@flourish/transform-data": "^2.1.0",
|
|
20
|
-
"@
|
|
21
|
-
"@rollup/plugin-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
21
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
22
|
+
"@handlebars/allow-prototype-access": "^1.0.5",
|
|
23
|
+
"archiver": "^7.0.1",
|
|
24
|
+
"chokidar": "^3.6.0",
|
|
24
25
|
"cross-spawn": "^7.0.3",
|
|
25
26
|
"d3-dsv": "^2.0.0",
|
|
26
|
-
"express": "^4.
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"minimist": "^1.2.6",
|
|
27
|
+
"express": "^4.19.2",
|
|
28
|
+
"handlebars": "^4.7.8",
|
|
29
|
+
"js-yaml": "^4.1.0",
|
|
30
|
+
"minimist": "^1.2.8",
|
|
31
31
|
"ncp": "^2.0.0",
|
|
32
|
-
"node-fetch": "^
|
|
32
|
+
"node-fetch": "^3.3.2",
|
|
33
33
|
"parse5": "^7.1.2",
|
|
34
|
-
"picocolors": "^1.0.
|
|
35
|
-
"read": "^
|
|
36
|
-
"resolve": "^1.
|
|
34
|
+
"picocolors": "^1.0.1",
|
|
35
|
+
"read": "^3.0.1",
|
|
36
|
+
"resolve": "^1.22.8",
|
|
37
37
|
"rewrite-links": "^1.1.0",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"ws": "^7.4.6"
|
|
38
|
+
"shell-quote": "^1.8.1",
|
|
39
|
+
"tmp": "^0.2.3",
|
|
40
|
+
"ws": "^8.17.0"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
|
-
"@rollup/plugin-node-resolve": "^
|
|
43
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
44
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
45
45
|
"d3-request": "^1.0.6",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"sinon": "^
|
|
49
|
-
"tempy": "^3.
|
|
46
|
+
"rollup": "^4.17.2",
|
|
47
|
+
"mocha": "^10.4.0",
|
|
48
|
+
"sinon": "^18.0.0",
|
|
49
|
+
"tempy": "^3.1.0"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=13.2"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
2
|
+
import terser from "@rollup/plugin-terser";
|
|
3
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
4
|
+
// Note: this typescript plugin is used instead @rollup/plugin-typescript
|
|
5
|
+
// this is because it uses typescript's file resolution rather than rollup's
|
|
6
|
+
// and the SDK
|
|
7
|
+
import typescript from "rollup-plugin-typescript2";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
input: "src/index.js",
|
|
11
|
+
output: {
|
|
12
|
+
format: "iife",
|
|
13
|
+
name: "Flourish",
|
|
14
|
+
file: "site/script.js",
|
|
15
|
+
sourcemap: true,
|
|
16
|
+
globals: {
|
|
17
|
+
crypto: "crypto"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// d3 relies on the node-resolve plugin
|
|
22
|
+
plugins: [
|
|
23
|
+
nodeResolve(),
|
|
24
|
+
typescript({
|
|
25
|
+
tsconfig: "./tsconfig.json",
|
|
26
|
+
tsconfigOverride: {
|
|
27
|
+
"compilerOptions": {
|
|
28
|
+
moduleResolution: "bundler",
|
|
29
|
+
},
|
|
30
|
+
include: [
|
|
31
|
+
"../common/",
|
|
32
|
+
"."
|
|
33
|
+
],
|
|
34
|
+
exclude: [
|
|
35
|
+
"./common",
|
|
36
|
+
"../common/*/**/*.tests.ts",
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
commonjs(),
|
|
41
|
+
terser()
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
external: ["crypto"],
|
|
45
|
+
|
|
46
|
+
onwarn: function (warning, warn) {
|
|
47
|
+
if (warning.code !== "CIRCULAR_DEPENDENCY") warn(warning);
|
|
48
|
+
}
|
|
49
|
+
};
|
package/server/index.js
CHANGED
|
@@ -66,7 +66,7 @@ function loadFile(path_parts, options) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
case "yaml":
|
|
69
|
-
try { return succeed(yaml.
|
|
69
|
+
try { return succeed(yaml.load(loaded_text)); }
|
|
70
70
|
catch (error) {
|
|
71
71
|
return fail(`Uh-oh! There's a problem with your ${filename} file.`, error);
|
|
72
72
|
}
|
|
@@ -120,27 +120,37 @@ function listDataTables(template_dir) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
function getData(template_dir, data_tables) {
|
|
123
|
-
return Promise.all(data_tables.map((
|
|
124
|
-
.then((
|
|
123
|
+
return Promise.all(data_tables.map((data_table_id) => getDataTable(template_dir, data_table_id)))
|
|
124
|
+
.then((data_and_timestamps) => {
|
|
125
125
|
const data_by_name = {};
|
|
126
126
|
const column_types_by_name = {};
|
|
127
|
+
const timestamps_by_name = {};
|
|
127
128
|
for (var i = 0; i < data_tables.length; i++) {
|
|
128
|
-
data_by_name[data_tables[i]] =
|
|
129
|
+
data_by_name[data_tables[i]] = data_and_timestamps[i].data;
|
|
130
|
+
timestamps_by_name[data_tables[i]] = data_and_timestamps[i].timestamps;
|
|
129
131
|
}
|
|
130
132
|
for (const data_table in data_by_name) {
|
|
131
133
|
const data = data_by_name[data_table];
|
|
132
134
|
column_types_by_name[data_table] = data_utils.getColumnTypesForData(data);
|
|
133
135
|
}
|
|
134
|
-
return { data: data_by_name, column_types_by_name };
|
|
136
|
+
return { data: data_by_name, column_types_by_name, timestamps_by_name };
|
|
135
137
|
});
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
function getDataTable(template_dir, data_table) {
|
|
139
141
|
return new Promise(function(resolve, reject) {
|
|
140
|
-
|
|
142
|
+
const filename = path.join(template_dir, "data", data_table + ".csv");
|
|
143
|
+
const { mtime: last_updated } = fs.statSync(filename);
|
|
144
|
+
const timestamps = {
|
|
145
|
+
last_updated: new Date(last_updated),
|
|
146
|
+
};
|
|
147
|
+
fs.readFile(filename, "utf8", function(error, csv_text) {
|
|
141
148
|
if (error) return reject(error);
|
|
142
149
|
if (csv_text.charAt(0) === "\uFEFF") csv_text = csv_text.substr(1);
|
|
143
|
-
resolve(
|
|
150
|
+
resolve({
|
|
151
|
+
data: d3_dsv.csvParseRows(csv_text),
|
|
152
|
+
timestamps,
|
|
153
|
+
});
|
|
144
154
|
});
|
|
145
155
|
});
|
|
146
156
|
}
|
|
@@ -219,6 +229,7 @@ function loadTemplate(template_dir, sdk_template, build_failed, options) {
|
|
|
219
229
|
visualisation_js: "new Flourish.Visualisation('1', 0," + json.safeStringify({
|
|
220
230
|
data_bindings: data_bindings,
|
|
221
231
|
data_tables: data_tables,
|
|
232
|
+
template_store_key: settings.name.toLowerCase().replace(" ", "") + "@" + settings.version
|
|
222
233
|
}) + ")",
|
|
223
234
|
settings: json.safeStringify(settings.settings || []),
|
|
224
235
|
data_bindings: json.safeStringify(settings.data || []),
|
|
@@ -271,31 +282,36 @@ function loadTemplate(template_dir, sdk_template, build_failed, options) {
|
|
|
271
282
|
}));
|
|
272
283
|
}
|
|
273
284
|
|
|
274
|
-
function previewInitJs(template_dir, template_data_bindings, data_bindings,
|
|
275
|
-
return getData(template_dir,
|
|
285
|
+
function previewInitJs(template_dir, template_data_bindings, data_bindings, data_table_names) {
|
|
286
|
+
return getData(template_dir, data_table_names).then(({data, column_types_by_name, timestamps_by_name }) => {
|
|
276
287
|
const prepared_data = {};
|
|
277
288
|
for (let dataset in data_bindings) {
|
|
278
289
|
prepared_data[dataset] = data_utils.extractData(
|
|
279
290
|
data_bindings[dataset], data, column_types_by_name,
|
|
280
291
|
template_data_bindings[dataset],
|
|
292
|
+
{ per_data_table: timestamps_by_name },
|
|
281
293
|
);
|
|
282
294
|
}
|
|
283
295
|
|
|
284
296
|
const column_names = {};
|
|
285
297
|
const metadata = {};
|
|
298
|
+
const timestamps = {};
|
|
286
299
|
for (let dataset in prepared_data) {
|
|
287
300
|
column_names[dataset] = prepared_data[dataset].column_names;
|
|
288
301
|
metadata[dataset] = prepared_data[dataset].metadata;
|
|
302
|
+
timestamps[dataset] = prepared_data[dataset].timestamps;
|
|
289
303
|
}
|
|
290
304
|
|
|
291
305
|
return `
|
|
292
306
|
var _Flourish_data_column_names = ${json.safeStringify(column_names)},
|
|
293
307
|
_Flourish_data_metadata = ${json.safeStringify(metadata)},
|
|
308
|
+
_Flourish_data_timestamps = ${json.javaScriptStringify(timestamps)},
|
|
294
309
|
_Flourish_data = ${json.javaScriptStringify(prepared_data)};
|
|
295
310
|
for (var _Flourish_dataset in _Flourish_data) {
|
|
296
311
|
window.template.data[_Flourish_dataset] = _Flourish_data[_Flourish_dataset];
|
|
297
312
|
window.template.data[_Flourish_dataset].column_names = _Flourish_data_column_names[_Flourish_dataset];
|
|
298
313
|
window.template.data[_Flourish_dataset].metadata = _Flourish_data_metadata[_Flourish_dataset];
|
|
314
|
+
window.template.data[_Flourish_dataset].timestamps = _Flourish_data_timestamps[_Flourish_dataset];
|
|
299
315
|
}
|
|
300
316
|
window.template.draw();
|
|
301
317
|
`;
|
|
@@ -386,8 +402,11 @@ module.exports = function(template_dir, options) {
|
|
|
386
402
|
|
|
387
403
|
// API for accessing data tables
|
|
388
404
|
app.get("/api/data_table/:id/csv", function(req, res) {
|
|
405
|
+
const filename = path.resolve(template_dir, "data", req.params.id + ".csv");
|
|
406
|
+
const { mtime: last_updated } = fs.statSync(filename);
|
|
389
407
|
res.status(200).header("Content-Type", "text/csv")
|
|
390
|
-
.
|
|
408
|
+
.header("Last-Modified", last_updated) // Send last modified time
|
|
409
|
+
.sendFile(filename);
|
|
391
410
|
});
|
|
392
411
|
|
|
393
412
|
// Preview not in an iframe
|
package/server/json.js
CHANGED
package/server/views/index.html
CHANGED
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
</span>
|
|
52
52
|
</div>
|
|
53
53
|
</div>
|
|
54
|
+
<span class="sdk-status-label"></span>
|
|
55
|
+
<button class="sdk-session-reset-button" title="Resets the development session.">Reset</button>
|
|
56
|
+
<div class="confirm-saved saved" data-testid="saving-indicator"><i class="fa fa-check"></i> <span class="label"></span></div>
|
|
54
57
|
</div>
|
|
55
58
|
<svg class="svg-defs">
|
|
56
59
|
<symbol id="cancel-setting" width="8px" height="8px" viewBox="0 0 8 8"><path stroke="#252525" stroke-width="2" fill="none" fill-rule="evenodd" stroke-linecap="square" d="M1.45012627,1.45012627 L6.39987373,6.39987373 M1.45012627,6.39987373 L6.39987373,1.44987373" transform="translate(3.925000, 3.924874) rotate(-270.000000) translate(-3.925000, -3.924874) "></path></symbol>
|
|
@@ -107,8 +110,8 @@
|
|
|
107
110
|
</div>
|
|
108
111
|
|
|
109
112
|
<script>
|
|
110
|
-
|
|
111
|
-
Flourish.app.
|
|
113
|
+
Flourish.initSDK({{{ visualisation_js }}}, {{{ settings }}}, {{{ data_bindings }}}, "{{ public_url_prefix }}");
|
|
114
|
+
Flourish.app.initTemplate();
|
|
112
115
|
Flourish.talkToServer();
|
|
113
116
|
</script>
|
|
114
117
|
</body>
|
package/site/embedded.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";var e,t,i=!1;function n(e){if(i&&window.top!==window.self){var t=window;"srcdoc"===t.location.pathname&&(t=t.parent);var n,o=(n={},window._Flourish_template_id&&(n.template_id=window._Flourish_template_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_template_id&&(n.template_id=window.Flourish.app.loaded_template_id),window._Flourish_visualisation_id&&(n.visualisation_id=window._Flourish_visualisation_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_visualisation&&(n.visualisation_id=window.Flourish.app.loaded_visualisation.id),window.Flourish&&window.Flourish.app&&window.Flourish.app.story&&(n.story_id=window.Flourish.app.story.id,n.slide_count=window.Flourish.app.story.slides.length),window.Flourish&&window.Flourish.app&&window.Flourish.app.current_slide&&(n.slide_index=window.Flourish.app.current_slide.index+1),n),r={sender:"Flourish",method:"customerAnalytics"};for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a]);for(var a in e)e.hasOwnProperty(a)&&(r[a]=e[a]);t.parent.postMessage(JSON.stringify(r),"*")}}function o(e){if("function"!=typeof e)throw new Error("Analytics callback is not a function");window.Flourish._analytics_listeners.push(e)}function r(){i=!0;[{event_name:"click",action_name:"click",use_capture:!0},{event_name:"keydown",action_name:"key_down",use_capture:!0},{event_name:"mouseenter",action_name:"mouse_enter",use_capture:!1},{event_name:"mouseleave",action_name:"mouse_leave",use_capture:!1}].forEach((function(e){document.body.addEventListener(e.event_name,(function(){n({action:e.action_name})}),e.use_capture)}))}function a(){if(null==e){var t=function(){var e=window.location;"about:srcdoc"==e.href&&(e=window.parent.location);var t={};return function(e,i,n){for(;n=i.exec(e);)t[decodeURIComponent(n[1])]=decodeURIComponent(n[2])}(e.search.substring(1).replace(/\+/g,"%20"),/([^&=]+)=?([^&]*)/g),t}();e="referrer"in t?/^https:\/\/medium.com\//.test(t.referrer):!("auto"in t)}return e}function s(e){var t=e||window.innerWidth;return t>999?650:t>599?575:400}function l(e){if(e&&window.top!==window.self){var t=window;"srcdoc"==t.location.pathname&&(t=t.parent);var i={sender:"Flourish",method:"scrolly"};if(e)for(var n in e)i[n]=e[n];t.parent.postMessage(JSON.stringify(i),"*")}}function d(e,i){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),t)return e=parseInt(e,10),void n.parent.postMessage({sentinel:"amp",type:"embed-size",height:e},"*");var o={sender:"Flourish",context:"iframe.resize",method:"resize",height:e,src:n.location.toString()};if(i)for(var r in i)o[r]=i[r];n.parent.postMessage(JSON.stringify(o),"*")}}function u(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function c(e){return"string"==typeof e||e instanceof String}function h(e){return"warn"!==e.method?(console.warn("BUG: validateWarnMessage called for method"+e.method),!1):!(null!=e.message&&!c(e.message))&&!(null!=e.explanation&&!c(e.explanation))}function f(e){return"resize"!==e.method?(console.warn("BUG: validateResizeMessage called for method"+e.method),!1):!!c(e.src)&&(!!c(e.context)&&!!("number"==typeof(t=e.height)?!isNaN(t)&&t>=0:c(t)&&/\d/.test(t)&&/^[0-9]*(\.[0-9]*)?(cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%)?$/i.test(t)));var t}function p(e){throw new Error("Validation for setSetting is not implemented yet; see issue #4328")}function m(e){return"scrolly"!==e.method?(console.warn("BUG: validateScrolly called for method"+e.method),!1):!!Array.isArray(e.slides)}function w(e){return"customerAnalytics"===e.method||(console.warn("BUG: validateCustomerAnalyticsMessage called for method"+e.method),!1)}function g(e){return"request-upload"!==e.method?(console.warn("BUG: validateResizeMessage called for method"+e.method),!1):!!c(e.name)&&!(null!=e.accept&&!c(e.accept))}function y(e,t,i){var n=function(e){for(var t={warn:h,resize:f,setSetting:p,customerAnalytics:w,"request-upload":g,scrolly:m},i={},n=0;n<e.length;n++){var o=e[n];if(!t[o])throw new Error("No validator found for method "+o);i[o]=t[o]}return i}(t);window.addEventListener("message",(function(t){var o=function(){if(t.origin==document.location.origin)return!0;if(i){const e=t.origin.toLowerCase();if(i=i.toLowerCase(),e.endsWith("//"+i))return!0;if(e.endsWith("."+i))return!0}return!!t.origin.match(/\/\/localhost:\d+$|\/\/(?:public|app)\.flourish.devlocal$|\/\/flourish-api\.com$|\.flourish\.(?:local(:\d+)?|net|rocks|studio)$|\.uri\.sh$|\/\/flourish-user-templates\.com$/)}();if(null!=t.source&&o){var r;try{r="object"==typeof t.data?t.data:JSON.parse(t.data)}catch(e){return void console.warn("Unexpected non-JSON message: "+JSON.stringify(t.data))}if("Flourish"===r.sender)if(r.method)if(Object.prototype.hasOwnProperty.call(n,r.method))if(n[r.method](r)){for(var a=document.querySelectorAll("iframe"),s=0;s<a.length;s++)if(a[s].contentWindow==t.source||a[s].contentWindow==t.source.parent)return void e(r,a[s]);console.warn("could not find frame",r)}else console.warn("Validation failed for the message",r);else console.warn("No validator implemented for message",r);else console.warn("The 'method' property was missing from message",r)}})),u()&&(window.addEventListener("resize",v),v())}function v(){for(var e=document.querySelectorAll(".flourish-embed"),t=0;t<e.length;t++){var i=e[t];if(!i.getAttribute("data-width")){var n=i.querySelector("iframe");if(n){var o=window.getComputedStyle(i),r=i.offsetWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight);n.style.width=r+"px"}}}}function _(e,t){var i=e.parentNode;if(i.classList.contains("fl-scrolly-wrapper"))console.warn("createScrolly is being called more than once per story. This should not happen.");else{i.classList.add("fl-scrolly-wrapper"),i.style.position="relative",i.style.paddingBottom="1px",i.style.transform="translate3d(0, 0, 0)",e.style.position="sticky";var n=i.getAttribute("data-height")||null;n||(n="80vh",e.style.height=n),e.style.top="calc(50vh - "+n+"/2)";var o=i.querySelector(".flourish-credit");o&&(o.style.position="sticky",o.style.top="calc(50vh + "+n+"/2)"),t.forEach((function(e,t){var n="string"==typeof e&&""!=e.trim(),o=document.createElement("div");o.setAttribute("data-slide",t),o.classList.add("fl-scrolly-caption"),o.style.position="relative",o.style.transform="translate3d(0,0,0)",o.style.textAlign="center",o.style.maxWidth="500px",o.style.height="auto",o.style.marginTop="0",o.style.marginBottom=n?"100vh":"50vh",o.style.marginLeft="auto",o.style.marginRight="auto";var r=document.createElement("div");r.innerHTML=e,r.style.visibility=n?"":"hidden",r.style.display="inline-block",r.style.paddingTop="1.25em",r.style.paddingRight="1.25em",r.style.paddingBottom="1.25em",r.style.paddingLeft="1.25em",r.style.background="rgba(255,255,255,0.9)",r.style.boxShadow="0px 0px 10px rgba(0,0,0,0.2)",r.style.borderRadius="10px",r.style.textAlign="center",r.style.maxWidth="100%",r.style.margin="0 20px",r.style.overflowX="hidden",o.appendChild(r),i.appendChild(o)})),function(e){for(var t=new IntersectionObserver((function(t){t.forEach((function(t){if(t.isIntersecting){var i=e.querySelector("iframe");i&&(i.src=i.src.replace(/#slide-.*/,"")+"#slide-"+t.target.getAttribute("data-slide"))}}))}),{rootMargin:"0px 0px -0% 0px"}),i=e.querySelectorAll(".fl-scrolly-caption"),n=0;n<i.length;n++)t.observe(i[n]);e.querySelectorAll(".fl-scrolly-caption img").forEach((function(e){e.style.maxWidth="100%"}))}(i)}}function F(e,t,i,n,o){var r=document.createElement("iframe");if(r.setAttribute("scrolling","no"),r.setAttribute("frameborder","0"),r.setAttribute("title","Interactive or visual content"),r.setAttribute("sandbox","allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"),t.appendChild(r),r.offsetParent||"fixed"===getComputedStyle(r).position)x(e,t,r,i,n,o);else{var a={embed_url:e,container:t,iframe:r,width:i,height:n,play_on_load:o};if(window._flourish_poll_items?window._flourish_poll_items.push(a):window._flourish_poll_items=[a],window._flourish_poll_items.length>1)return r;var s=setInterval((function(){window._flourish_poll_items=window._flourish_poll_items.filter((function(e){return!e.iframe.offsetParent||(x(e.embed_url,e.container,e.iframe,e.width,e.height,e.play_on_load),!1)})),window._flourish_poll_items.length||clearInterval(s)}),500)}return r}function x(e,t,i,n,o,r){var a;return n&&"number"==typeof n?(a=n,n+="px"):n&&n.match(/^[ \t\r\n\f]*([+-]?\d+|\d*\.\d+(?:[eE][+-]?\d+)?)(?:\\?[Pp]|\\0{0,4}[57]0(?:\r\n|[ \t\r\n\f])?)(?:\\?[Xx]|\\0{0,4}[57]8(?:\r\n|[ \t\r\n\f])?)[ \t\r\n\f]*$/)&&(a=parseFloat(n)),o&&"number"==typeof o&&(o+="px"),n?i.style.width=n:u()?i.style.width=t.offsetWidth+"px":i.style.width="100%",!!o||(e.match(/\?/)?e+="&auto=1":e+="?auto=1",o=s(a||i.offsetWidth)+"px"),o&&("%"===o.charAt(o.length-1)&&(o=parseFloat(o)/100*t.parentNode.offsetHeight+"px"),i.style.height=o),i.setAttribute("src",e+(r?"#play-on-load":"")),i}function b(e){return!Array.isArray(e)&&"object"==typeof e&&null!=e}function A(e,t){for(var i in t)b(e[i])&&b(t[i])?A(e[i],t[i]):e[i]=t[i];return e}!function(){var e,i=window.top===window.self,c=i?null:(t="#amp=1"==window.location.hash,{createEmbedIframe:F,isFixedHeight:a,getHeightForBreakpoint:s,startEventListeners:y,notifyParentWindow:d,initScrolly:l,createScrolly:_,isSafari:u,initCustomerAnalytics:r,addAnalyticsListener:o,sendCustomerAnalyticsMessage:n}),h=!0;function f(){var t;Flourish.fixed_height||(null!=e?t=e:h&&(t=c.getHeightForBreakpoint()),t!==window.innerHeight&&c.notifyParentWindow(t))}function p(){-1!==window.location.search.indexOf("enable_customer_analytics=1")&&Flourish.enableCustomerAnalytics(),f(),window.addEventListener("resize",f)}Flourish.warn=function(e){if("string"==typeof e&&(e={message:e}),i||"editor"!==Flourish.environment)console.warn(e.message);else{var t={sender:"Flourish",method:"warn",message:e.message,explanation:e.explanation};window.parent.postMessage(JSON.stringify(t),"*")}},Flourish.uploadImage=function(e){if(i||"story_editor"!==Flourish.environment)throw"Invalid upload request";var t={sender:"Flourish",method:"request-upload",name:e.name,accept:e.accept};window.parent.postMessage(JSON.stringify(t),"*")},Flourish.setSetting=function(e,t){if("editor"===Flourish.environment||"sdk"===Flourish.environment){var i={sender:"Flourish",method:"setSetting",name:e,value:t};window.parent.postMessage(JSON.stringify(i),"*")}else if("story_editor"===Flourish.environment){var n={};n[e]=t,A(window.template.state,function(e){var t={};for(var i in e){for(var n=t,o=i.indexOf("."),r=0;o>=0;o=i.indexOf(".",r=o+1)){var a=i.substring(r,o);a in n||(n[a]={}),n=n[a]}n[i.substring(r)]=e[i]}return t}(n))}},Flourish.setHeight=function(t){Flourish.fixed_height||(e=t,h=null==t,f())},Flourish.checkHeight=function(){if(!i){var e=Flourish.__container_height;null!=e?(Flourish.fixed_height=!0,c.notifyParentWindow(e)):c.isFixedHeight()?Flourish.fixed_height=!0:(Flourish.fixed_height=!1,f())}},Flourish.fixed_height=i||c.isFixedHeight(),Flourish.enableCustomerAnalytics=function(){c&&c.initCustomerAnalytics()},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",p):p()}()}();
|
|
1
|
+
!function(){"use strict";var e=!1;function t(t){if(e&&window.top!==window.self){var n=window;"srcdoc"===n.location.pathname&&(n=n.parent);var o,i=(o={},window._Flourish_template_id&&(o.template_id=window._Flourish_template_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_template_id&&(o.template_id=window.Flourish.app.loaded_template_id),window._Flourish_visualisation_id&&(o.visualisation_id=window._Flourish_visualisation_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_visualisation&&(o.visualisation_id=window.Flourish.app.loaded_visualisation.id),window.Flourish&&window.Flourish.app&&window.Flourish.app.story&&(o.story_id=window.Flourish.app.story.id,o.slide_count=window.Flourish.app.story.slides.length),window.Flourish&&window.Flourish.app&&window.Flourish.app.current_slide&&(o.slide_index=window.Flourish.app.current_slide.index+1),o),r={sender:"Flourish",method:"customerAnalytics"};for(var a in i)i.hasOwnProperty(a)&&(r[a]=i[a]);for(var a in t)t.hasOwnProperty(a)&&(r[a]=t[a]);n.parent.postMessage(JSON.stringify(r),"*")}}function n(e){if("function"!=typeof e)throw new Error("Analytics callback is not a function");window.Flourish._analytics_listeners.push(e)}function o(){e=!0;[{event_name:"click",action_name:"click",use_capture:!0},{event_name:"keydown",action_name:"key_down",use_capture:!0},{event_name:"mouseenter",action_name:"mouse_enter",use_capture:!1},{event_name:"mouseleave",action_name:"mouse_leave",use_capture:!1}].forEach((function(e){document.body.addEventListener(e.event_name,(function(){t({action:e.action_name})}),e.use_capture)}))}
|
|
2
|
+
/*! @license DOMPurify 3.1.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.4/LICENSE */const{entries:i,setPrototypeOf:r,isFrozen:a,getPrototypeOf:l,getOwnPropertyDescriptor:s}=Object;let{freeze:c,seal:u,create:d}=Object,{apply:p,construct:m}="undefined"!=typeof Reflect&&Reflect;c||(c=function(e){return e}),u||(u=function(e){return e}),p||(p=function(e,t,n){return e.apply(t,n)}),m||(m=function(e,t){return new e(...t)});const f=C(Array.prototype.forEach),h=C(Array.prototype.pop),g=C(Array.prototype.push),y=C(String.prototype.toLowerCase),_=C(String.prototype.toString),w=C(String.prototype.match),v=C(String.prototype.replace),T=C(String.prototype.indexOf),A=C(String.prototype.trim),E=C(Object.prototype.hasOwnProperty),b=C(RegExp.prototype.test),S=(N=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m(N,t)});var N;function x(e){return"number"==typeof e&&isNaN(e)}function C(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return p(e,t,o)}}function R(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:y;r&&r(e,null);let o=t.length;for(;o--;){let i=t[o];if("string"==typeof i){const e=n(i);e!==i&&(a(t)||(t[o]=e),i=e)}e[i]=!0}return e}function L(e){for(let t=0;t<e.length;t++){E(e,t)||(e[t]=null)}return e}function O(e){const t=d(null);for(const[n,o]of i(e)){E(e,n)&&(Array.isArray(o)?t[n]=L(o):o&&"object"==typeof o&&o.constructor===Object?t[n]=O(o):t[n]=o)}return t}function k(e,t){for(;null!==e;){const n=s(e,t);if(n){if(n.get)return C(n.get);if("function"==typeof n.value)return C(n.value)}e=l(e)}return function(){return null}}const F=c(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),D=c(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),M=c(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),I=c(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),U=c(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),P=c(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),H=c(["#text"]),z=c(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),W=c(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),B=c(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),G=c(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),j=u(/\{\{[\w\W]*|[\w\W]*\}\}/gm),q=u(/<%[\w\W]*|[\w\W]*%>/gm),Y=u(/\${[\w\W]*}/gm),$=u(/^data-[\-\w.\u00B7-\uFFFF]/),X=u(/^aria-[\-\w]+$/),J=u(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=u(/^(?:\w+script|data):/i),K=u(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=u(/^html$/i),Q=u(/^[a-z][.\w]*(-[.\w]+)+$/i);var ee=Object.freeze({__proto__:null,MUSTACHE_EXPR:j,ERB_EXPR:q,TMPLIT_EXPR:Y,DATA_ATTR:$,ARIA_ATTR:X,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:V,ATTR_WHITESPACE:K,DOCTYPE_NAME:Z,CUSTOM_ELEMENT:Q});const te=1,ne=3,oe=7,ie=8,re=9,ae=function(){return"undefined"==typeof window?null:window},le=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};var se,ce,ue=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ae();const n=t=>e(t);if(n.version="3.1.4",n.removed=[],!t||!t.document||t.document.nodeType!==re)return n.isSupported=!1,n;let{document:o}=t;const r=o,a=r.currentScript,{DocumentFragment:l,HTMLTemplateElement:s,Node:u,Element:p,NodeFilter:m,NamedNodeMap:N=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:C,DOMParser:L,trustedTypes:j}=t,q=p.prototype,Y=k(q,"cloneNode"),$=k(q,"nextSibling"),X=k(q,"childNodes"),V=k(q,"parentNode");if("function"==typeof s){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let K,Q="";const{implementation:se,createNodeIterator:ce,createDocumentFragment:ue,getElementsByTagName:de}=o,{importNode:pe}=r;let me={};n.isSupported="function"==typeof i&&"function"==typeof V&&se&&void 0!==se.createHTMLDocument;const{MUSTACHE_EXPR:fe,ERB_EXPR:he,TMPLIT_EXPR:ge,DATA_ATTR:ye,ARIA_ATTR:_e,IS_SCRIPT_OR_DATA:we,ATTR_WHITESPACE:ve,CUSTOM_ELEMENT:Te}=ee;let{IS_ALLOWED_URI:Ae}=ee,Ee=null;const be=R({},[...F,...D,...M,...U,...H]);let Se=null;const Ne=R({},[...z,...W,...B,...G]);let xe=Object.seal(d(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,Re=null,Le=!0,Oe=!0,ke=!1,Fe=!0,De=!1,Me=!0,Ie=!1,Ue=!1,Pe=!1,He=!1,ze=!1,We=!1,Be=!0,Ge=!1;const je="user-content-";let qe=!0,Ye=!1,$e={},Xe=null;const Je=R({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const Ke=R({},["audio","video","img","source","image","track"]);let Ze=null;const Qe=R({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),et="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let ot=nt,it=!1,rt=null;const at=R({},[et,tt,nt],_);let lt=null;const st=["application/xhtml+xml","text/html"],ct="text/html";let ut=null,dt=null;const pt=255,mt=o.createElement("form"),ft=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!dt||dt!==e){if(e&&"object"==typeof e||(e={}),e=O(e),lt=-1===st.indexOf(e.PARSER_MEDIA_TYPE)?ct:e.PARSER_MEDIA_TYPE,ut="application/xhtml+xml"===lt?_:y,Ee=E(e,"ALLOWED_TAGS")?R({},e.ALLOWED_TAGS,ut):be,Se=E(e,"ALLOWED_ATTR")?R({},e.ALLOWED_ATTR,ut):Ne,rt=E(e,"ALLOWED_NAMESPACES")?R({},e.ALLOWED_NAMESPACES,_):at,Ze=E(e,"ADD_URI_SAFE_ATTR")?R(O(Qe),e.ADD_URI_SAFE_ATTR,ut):Qe,Ve=E(e,"ADD_DATA_URI_TAGS")?R(O(Ke),e.ADD_DATA_URI_TAGS,ut):Ke,Xe=E(e,"FORBID_CONTENTS")?R({},e.FORBID_CONTENTS,ut):Je,Ce=E(e,"FORBID_TAGS")?R({},e.FORBID_TAGS,ut):{},Re=E(e,"FORBID_ATTR")?R({},e.FORBID_ATTR,ut):{},$e=!!E(e,"USE_PROFILES")&&e.USE_PROFILES,Le=!1!==e.ALLOW_ARIA_ATTR,Oe=!1!==e.ALLOW_DATA_ATTR,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,De=e.SAFE_FOR_TEMPLATES||!1,Me=!1!==e.SAFE_FOR_XML,Ie=e.WHOLE_DOCUMENT||!1,He=e.RETURN_DOM||!1,ze=e.RETURN_DOM_FRAGMENT||!1,We=e.RETURN_TRUSTED_TYPE||!1,Pe=e.FORCE_BODY||!1,Be=!1!==e.SANITIZE_DOM,Ge=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,Ye=e.IN_PLACE||!1,Ae=e.ALLOWED_URI_REGEXP||J,ot=e.NAMESPACE||nt,xe=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ft(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(xe.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ft(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(xe.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(xe.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),De&&(Oe=!1),ze&&(He=!0),$e&&(Ee=R({},H),Se=[],!0===$e.html&&(R(Ee,F),R(Se,z)),!0===$e.svg&&(R(Ee,D),R(Se,W),R(Se,G)),!0===$e.svgFilters&&(R(Ee,M),R(Se,W),R(Se,G)),!0===$e.mathMl&&(R(Ee,U),R(Se,B),R(Se,G))),e.ADD_TAGS&&(Ee===be&&(Ee=O(Ee)),R(Ee,e.ADD_TAGS,ut)),e.ADD_ATTR&&(Se===Ne&&(Se=O(Se)),R(Se,e.ADD_ATTR,ut)),e.ADD_URI_SAFE_ATTR&&R(Ze,e.ADD_URI_SAFE_ATTR,ut),e.FORBID_CONTENTS&&(Xe===Je&&(Xe=O(Xe)),R(Xe,e.FORBID_CONTENTS,ut)),qe&&(Ee["#text"]=!0),Ie&&R(Ee,["html","head","body"]),Ee.table&&(R(Ee,["tbody"]),delete Ce.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw S('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw S('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');K=e.TRUSTED_TYPES_POLICY,Q=K.createHTML("")}else void 0===K&&(K=le(j,a)),null!==K&&"string"==typeof Q&&(Q=K.createHTML(""));c&&c(e),dt=e}},gt=R({},["mi","mo","mn","ms","mtext"]),yt=R({},["foreignobject","annotation-xml"]),_t=R({},["title","style","font","a","script"]),wt=R({},[...D,...M,...I]),vt=R({},[...U,...P]),Tt=function(e){let t=V(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});const n=y(e.tagName),o=y(t.tagName);return!!rt[e.namespaceURI]&&(e.namespaceURI===tt?t.namespaceURI===nt?"svg"===n:t.namespaceURI===et?"svg"===n&&("annotation-xml"===o||gt[o]):Boolean(wt[n]):e.namespaceURI===et?t.namespaceURI===nt?"math"===n:t.namespaceURI===tt?"math"===n&&yt[o]:Boolean(vt[n]):e.namespaceURI===nt?!(t.namespaceURI===tt&&!yt[o])&&(!(t.namespaceURI===et&&!gt[o])&&(!vt[n]&&(_t[n]||!wt[n]))):!("application/xhtml+xml"!==lt||!rt[e.namespaceURI]))},At=function(e){g(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Et=function(e,t){try{g(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){g(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Se[e])if(He||ze)try{At(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},bt=function(e){let t=null,n=null;if(Pe)e="<remove></remove>"+e;else{const t=w(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===lt&&ot===nt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=K?K.createHTML(e):e;if(ot===nt)try{t=(new L).parseFromString(i,lt)}catch(e){}if(!t||!t.documentElement){t=se.createDocument(ot,"template",null);try{t.documentElement.innerHTML=it?Q:i}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(o.createTextNode(n),r.childNodes[0]||null),ot===nt?de.call(t,Ie?"html":"body")[0]:Ie?t.documentElement:r},St=function(e){return ce.call(e.ownerDocument||e,e,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},Nt=function(e){return e instanceof C&&(void 0!==e.__depth&&"number"!=typeof e.__depth||void 0!==e.__removalCount&&"number"!=typeof e.__removalCount||"string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof N)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},xt=function(e){return"function"==typeof u&&e instanceof u},Ct=function(e,t,o){me[e]&&f(me[e],(e=>{e.call(n,t,o,dt)}))},Rt=function(e){let t=null;if(Ct("beforeSanitizeElements",e,null),Nt(e))return At(e),!0;const o=ut(e.nodeName);if(Ct("uponSanitizeElement",e,{tagName:o,allowedTags:Ee}),e.hasChildNodes()&&!xt(e.firstElementChild)&&b(/<[/\w]/g,e.innerHTML)&&b(/<[/\w]/g,e.textContent))return At(e),!0;if(e.nodeType===oe)return At(e),!0;if(Me&&e.nodeType===ie&&b(/<[/\w]/g,e.data))return At(e),!0;if(!Ee[o]||Ce[o]){if(!Ce[o]&&Ot(o)){if(xe.tagNameCheck instanceof RegExp&&b(xe.tagNameCheck,o))return!1;if(xe.tagNameCheck instanceof Function&&xe.tagNameCheck(o))return!1}if(qe&&!Xe[o]){const t=V(e)||e.parentNode,n=X(e)||e.childNodes;if(n&&t){for(let o=n.length-1;o>=0;--o){const i=Y(n[o],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,$(e))}}}return At(e),!0}return e instanceof p&&!Tt(e)?(At(e),!0):"noscript"!==o&&"noembed"!==o&&"noframes"!==o||!b(/<\/no(script|embed|frames)/i,e.innerHTML)?(De&&e.nodeType===ne&&(t=e.textContent,f([fe,he,ge],(e=>{t=v(t,e," ")})),e.textContent!==t&&(g(n.removed,{element:e.cloneNode()}),e.textContent=t)),Ct("afterSanitizeElements",e,null),!1):(At(e),!0)},Lt=function(e,t,n){if(Be&&("id"===t||"name"===t)&&(n in o||n in mt||"__depth"===n||"__removalCount"===n))return!1;if(Oe&&!Re[t]&&b(ye,t));else if(Le&&b(_e,t));else if(!Se[t]||Re[t]){if(!(Ot(e)&&(xe.tagNameCheck instanceof RegExp&&b(xe.tagNameCheck,e)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(e))&&(xe.attributeNameCheck instanceof RegExp&&b(xe.attributeNameCheck,t)||xe.attributeNameCheck instanceof Function&&xe.attributeNameCheck(t))||"is"===t&&xe.allowCustomizedBuiltInElements&&(xe.tagNameCheck instanceof RegExp&&b(xe.tagNameCheck,n)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(n))))return!1}else if(Ze[t]);else if(b(Ae,v(n,ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==T(n,"data:")||!Ve[e]){if(ke&&!b(we,v(n,ve,"")));else if(n)return!1}else;return!0},Ot=function(e){return"annotation-xml"!==e&&w(e,Te)},kt=function(e){Ct("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se};let i=t.length;for(;i--;){const r=t[i],{name:a,namespaceURI:l,value:s}=r,c=ut(a);let u="value"===a?s:A(s);if(o.attrName=c,o.attrValue=u,o.keepAttr=!0,o.forceKeepAttr=void 0,Ct("uponSanitizeAttribute",e,o),u=o.attrValue,o.forceKeepAttr)continue;if(Et(a,e),!o.keepAttr)continue;if(!Fe&&b(/\/>/i,u)){Et(a,e);continue}if(Me&&b(/((--!?|])>)|<\/(style|title)/i,u)){Et(a,e);continue}De&&f([fe,he,ge],(e=>{u=v(u,e," ")}));const d=ut(e.nodeName);if(Lt(d,c,u)){if(!Ge||"id"!==c&&"name"!==c||(Et(a,e),u=je+u),K&&"object"==typeof j&&"function"==typeof j.getAttributeType)if(l);else switch(j.getAttributeType(d,c)){case"TrustedHTML":u=K.createHTML(u);break;case"TrustedScriptURL":u=K.createScriptURL(u)}try{l?e.setAttributeNS(l,a,u):e.setAttribute(a,u),Nt(e)?At(e):h(n.removed)}catch(e){}}}Ct("afterSanitizeAttributes",e,null)},Ft=function e(t){let n=null;const o=St(t);for(Ct("beforeSanitizeShadowDOM",t,null);n=o.nextNode();){if(Ct("uponSanitizeShadowNode",n,null),Rt(n))continue;const t=V(n);n.nodeType===te&&(t&&t.__depth?n.__depth=(n.__removalCount||0)+t.__depth+1:n.__depth=1),(n.__depth>=pt||n.__depth<0||x(n.__depth))&&At(n),n.content instanceof l&&(n.content.__depth=n.__depth,e(n.content)),kt(n)}Ct("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,i=null,a=null,s=null;if(it=!e,it&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xt(e)){if("function"!=typeof e.toString)throw S("toString is not a function");if("string"!=typeof(e=e.toString()))throw S("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Ue||ht(t),n.removed=[],"string"==typeof e&&(Ye=!1),Ye){if(e.nodeName){const t=ut(e.nodeName);if(!Ee[t]||Ce[t])throw S("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof u)o=bt("\x3c!----\x3e"),i=o.ownerDocument.importNode(e,!0),i.nodeType===te&&"BODY"===i.nodeName||"HTML"===i.nodeName?o=i:o.appendChild(i);else{if(!He&&!De&&!Ie&&-1===e.indexOf("<"))return K&&We?K.createHTML(e):e;if(o=bt(e),!o)return He?null:We?Q:""}o&&Pe&&At(o.firstChild);const c=St(Ye?e:o);for(;a=c.nextNode();){if(Rt(a))continue;const e=V(a);a.nodeType===te&&(e&&e.__depth?a.__depth=(a.__removalCount||0)+e.__depth+1:a.__depth=1),(a.__depth>=pt||a.__depth<0||x(a.__depth))&&At(a),a.content instanceof l&&(a.content.__depth=a.__depth,Ft(a.content)),kt(a)}if(Ye)return e;if(He){if(ze)for(s=ue.call(o.ownerDocument);o.firstChild;)s.appendChild(o.firstChild);else s=o;return(Se.shadowroot||Se.shadowrootmode)&&(s=pe.call(r,s,!0)),s}let d=Ie?o.outerHTML:o.innerHTML;return Ie&&Ee["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&b(Z,o.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+d),De&&f([fe,he,ge],(e=>{d=v(d,e," ")})),K&&We?K.createHTML(d):d},n.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ht(e),Ue=!0},n.clearConfig=function(){dt=null,Ue=!1},n.isValidAttribute=function(e,t,n){dt||ht({});const o=ut(e),i=ut(t);return Lt(o,i,n)},n.addHook=function(e,t){"function"==typeof t&&(me[e]=me[e]||[],g(me[e],t))},n.removeHook=function(e){if(me[e])return h(me[e])},n.removeHooks=function(e){me[e]&&(me[e]=[])},n.removeAllHooks=function(){me={}},n}();function de(){if(null==se){var e=function(){var e=window.location;"about:srcdoc"==e.href&&(e=window.parent.location);var t={};return function(e,n,o){for(;o=n.exec(e);)t[decodeURIComponent(o[1])]=decodeURIComponent(o[2])}(e.search.substring(1).replace(/\+/g,"%20"),/([^&=]+)=?([^&]*)/g),t}();se="referrer"in e?/^https:\/\/medium.com\//.test(e.referrer):!("auto"in e)}return se}function pe(e){var t=e||window.innerWidth;return t>999?650:t>599?575:400}function me(e){if(e&&window.top!==window.self){var t=window;"srcdoc"==t.location.pathname&&(t=t.parent);var n={sender:"Flourish",method:"scrolly",captions:e.captions};t.parent.postMessage(JSON.stringify(n),"*")}}function fe(e,t){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),ce)return e=parseInt(e,10),void n.parent.postMessage({sentinel:"amp",type:"embed-size",height:e},"*");var o={sender:"Flourish",context:"iframe.resize",method:"resize",height:e,src:n.location.toString()};if(t)for(var i in t)o[i]=t[i];n.parent.postMessage(JSON.stringify(o),"*")}}function he(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function ge(e){return"string"==typeof e||e instanceof String}function ye(e){return"warn"!==e.method?(console.warn("BUG: validateWarnMessage called for method"+e.method),!1):!(null!=e.message&&!ge(e.message))&&!(null!=e.explanation&&!ge(e.explanation))}function _e(e){return"resize"!==e.method?(console.warn("BUG: validateResizeMessage called for method"+e.method),!1):!!ge(e.src)&&(!!ge(e.context)&&!!("number"==typeof(t=e.height)?!isNaN(t)&&t>=0:ge(t)&&/\d/.test(t)&&/^[0-9]*(\.[0-9]*)?(cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%)?$/i.test(t)));var t}function we(e){throw new Error("Validation for setSetting is not implemented yet; see issue #4328")}function ve(e){return"scrolly"!==e.method?(console.warn("BUG: validateScrolly called for method"+e.method),!1):!!Array.isArray(e.captions)}function Te(e){return"customerAnalytics"===e.method||(console.warn("BUG: validateCustomerAnalyticsMessage called for method"+e.method),!1)}function Ae(e){return"request-upload"!==e.method?(console.warn("BUG: validateResizeMessage called for method"+e.method),!1):!!ge(e.name)&&!(null!=e.accept&&!ge(e.accept))}function Ee(e,t,n){var o=function(e){for(var t={warn:ye,resize:_e,setSetting:we,customerAnalytics:Te,"request-upload":Ae,scrolly:ve},n={},o=0;o<e.length;o++){var i=e[o];if(!t[i])throw new Error("No validator found for method "+i);n[i]=t[i]}return n}(t);window.addEventListener("message",(function(t){var i=function(){if(t.origin==document.location.origin)return!0;if(n){const e=t.origin.toLowerCase();if(n=n.toLowerCase(),e.endsWith("//"+n))return!0;if(e.endsWith("."+n))return!0}return!!t.origin.match(/\/\/localhost:\d+$|\/\/(?:public|app)\.flourish.devlocal$|\/\/flourish-api\.com$|\.flourish\.(?:local(:\d+)?|net|rocks|studio)$|\.uri\.sh$|\/\/flourish-user-templates\.com$/)}();if(null!=t.source&&i){var r;try{r="object"==typeof t.data?t.data:JSON.parse(t.data)}catch(e){return void console.warn("Unexpected non-JSON message: "+JSON.stringify(t.data))}if("Flourish"===r.sender)if(r.method)if(Object.prototype.hasOwnProperty.call(o,r.method))if(o[r.method](r)){for(var a=document.querySelectorAll("iframe"),l=0;l<a.length;l++)if(a[l].contentWindow==t.source||a[l].contentWindow==t.source.parent)return void e(r,a[l]);console.warn("could not find frame",r)}else console.warn("Validation failed for the message",r);else console.warn("No validator implemented for message",r);else console.warn("The 'method' property was missing from message",r)}})),he()&&(window.addEventListener("resize",be),be())}function be(){for(var e=document.querySelectorAll(".flourish-embed"),t=0;t<e.length;t++){var n=e[t];if(!n.getAttribute("data-width")){var o=n.querySelector("iframe");if(o){var i=window.getComputedStyle(n),r=n.offsetWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight);o.style.width=r+"px"}}}}function Se(e,t){var n=e.parentNode;if(n.classList.contains("fl-scrolly-wrapper"))console.warn("createScrolly is being called more than once per story. This should not happen.");else{n.classList.add("fl-scrolly-wrapper"),n.style.position="relative",n.style.paddingBottom="1px",n.style.transform="translate3d(0, 0, 0)",e.style.position="sticky";var o=n.getAttribute("data-height")||null;o||(o="80vh",e.style.height=o),e.style.top="calc(50vh - "+o+"/2)";var i=n.querySelector(".flourish-credit");i&&(i.style.position="sticky",i.style.top="calc(50vh + "+o+"/2)"),t.forEach((function(e,t){var o="string"==typeof e&&""!=e.trim(),i=document.createElement("div");i.setAttribute("data-slide",t),i.classList.add("fl-scrolly-caption"),i.style.position="relative",i.style.transform="translate3d(0,0,0)",i.style.textAlign="center",i.style.maxWidth="500px",i.style.height="auto",i.style.marginTop="0",i.style.marginBottom=o?"100vh":"50vh",i.style.marginLeft="auto",i.style.marginRight="auto";var r=document.createElement("div");r.innerHTML=ue.sanitize(e,{ADD_ATTR:["target"]}),r.style.visibility=o?"":"hidden",r.style.display="inline-block",r.style.paddingTop="1.25em",r.style.paddingRight="1.25em",r.style.paddingBottom="1.25em",r.style.paddingLeft="1.25em",r.style.background="rgba(255,255,255,0.9)",r.style.boxShadow="0px 0px 10px rgba(0,0,0,0.2)",r.style.borderRadius="10px",r.style.textAlign="center",r.style.maxWidth="100%",r.style.margin="0 20px",r.style.overflowX="hidden",i.appendChild(r),n.appendChild(i)})),function(e){for(var t=new IntersectionObserver((function(t){t.forEach((function(t){if(t.isIntersecting){var n=e.querySelector("iframe");n&&(n.src=n.src.replace(/#slide-.*/,"")+"#slide-"+t.target.getAttribute("data-slide"))}}))}),{rootMargin:"0px 0px -0% 0px"}),n=e.querySelectorAll(".fl-scrolly-caption"),o=0;o<n.length;o++)t.observe(n[o]);e.querySelectorAll(".fl-scrolly-caption img").forEach((function(e){e.style.maxWidth="100%"}))}(n)}}function Ne(e,t,n,o,i){var r=document.createElement("iframe");if(r.setAttribute("scrolling","no"),r.setAttribute("frameborder","0"),r.setAttribute("title","Interactive or visual content"),r.setAttribute("sandbox","allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"),t.appendChild(r),r.offsetParent||"fixed"===getComputedStyle(r).position)xe(e,t,r,n,o,i);else{var a={embed_url:e,container:t,iframe:r,width:n,height:o,play_on_load:i};if(window._flourish_poll_items?window._flourish_poll_items.push(a):window._flourish_poll_items=[a],window._flourish_poll_items.length>1)return r;var l=setInterval((function(){window._flourish_poll_items=window._flourish_poll_items.filter((function(e){return!e.iframe.offsetParent||(xe(e.embed_url,e.container,e.iframe,e.width,e.height,e.play_on_load),!1)})),window._flourish_poll_items.length||clearInterval(l)}),500)}return r}function xe(e,t,n,o,i,r){var a;return o&&"number"==typeof o?(a=o,o+="px"):o&&o.match(/^[ \t\r\n\f]*([+-]?\d+|\d*\.\d+(?:[eE][+-]?\d+)?)(?:\\?[Pp]|\\0{0,4}[57]0(?:\r\n|[ \t\r\n\f])?)(?:\\?[Xx]|\\0{0,4}[57]8(?:\r\n|[ \t\r\n\f])?)[ \t\r\n\f]*$/)&&(a=parseFloat(o)),i&&"number"==typeof i&&(i+="px"),o?n.style.width=o:he()?n.style.width=t.offsetWidth+"px":n.style.width="100%",!!i||(e.match(/\?/)?e+="&auto=1":e+="?auto=1",i=pe(a||n.offsetWidth)+"px"),i&&("%"===i.charAt(i.length-1)&&(i=parseFloat(i)/100*t.parentNode.offsetHeight+"px"),n.style.height=i),n.setAttribute("src",e+(r?"#play-on-load":"")),n}function Ce(e){return!Array.isArray(e)&&"object"==typeof e&&null!=e}function Re(e,t){for(var n in t)Ce(e[n])&&Ce(t[n])?Re(e[n],t[n]):e[n]=t[n];return e}!function(){var e,i=window.top===window.self,r=i?null:(ce="#amp=1"==window.location.hash,{createEmbedIframe:Ne,isFixedHeight:de,getHeightForBreakpoint:pe,startEventListeners:Ee,notifyParentWindow:fe,initScrolly:me,createScrolly:Se,isSafari:he,initCustomerAnalytics:o,addAnalyticsListener:n,sendCustomerAnalyticsMessage:t}),a=!0;function l(){var t;Flourish.fixed_height||(null!=e?t=e:a&&(t=r.getHeightForBreakpoint()),t!==window.innerHeight&&r.notifyParentWindow(t))}function s(){-1!==window.location.search.indexOf("enable_customer_analytics=1")&&Flourish.enableCustomerAnalytics(),l(),window.addEventListener("resize",l)}Flourish.warn=function(e){if("string"==typeof e&&(e={message:e}),i||"editor"!==Flourish.environment)console.warn(e.message);else{var t={sender:"Flourish",method:"warn",message:e.message,explanation:e.explanation};window.parent.postMessage(JSON.stringify(t),"*")}},Flourish.uploadImage=function(e){if(i||"story_editor"!==Flourish.environment)throw"Invalid upload request";var t={sender:"Flourish",method:"request-upload",name:e.name,accept:e.accept};window.parent.postMessage(JSON.stringify(t),"*")},Flourish.setSetting=function(e,t){if("editor"===Flourish.environment||"sdk"===Flourish.environment){var n={sender:"Flourish",method:"setSetting",name:e,value:t};window.parent.postMessage(JSON.stringify(n),"*")}else if("story_editor"===Flourish.environment){var o={};o[e]=t,Re(window.template.state,function(e){var t={};for(var n in e){for(var o=t,i=n.indexOf("."),r=0;i>=0;i=n.indexOf(".",r=i+1)){var a=n.substring(r,i);a in o||(o[a]={}),o=o[a]}o[n.substring(r)]=e[n]}return t}(o))}},Flourish.setHeight=function(t){Flourish.fixed_height||(e=t,a=null==t,l())},Flourish.checkHeight=function(){if(!i){var e=Flourish.__container_height;null!=e?(Flourish.fixed_height=!0,r.notifyParentWindow(e)):r.isFixedHeight()?Flourish.fixed_height=!0:(Flourish.fixed_height=!1,l())}},Flourish.fixed_height=i||r.isFixedHeight(),Flourish.enableCustomerAnalytics=function(){r&&r.initCustomerAnalytics()},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",s):s()}()}();
|
|
2
3
|
//# sourceMappingURL=embedded.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
2
|
<g id="icon-add-folder">
|
|
3
|
-
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M4.66667 3.5H9.29873C10.0161 3.5 10.653 4.08402 10.8799 4.76459L11.2917 6H15.5C16.3284 6 17 6.63959 17 7.42857V14.5714C17 15.3604 16.3284 16 15.5 16H7.64582C7.96983 15.714 8.24715 15.3764 8.46489 15H15.6324C15.8529 15 16 14.8607 16 14.7321V7.26782C16 7.13928 15.8529 6.99997 15.6324 6.99997H4.36767C4.14711 6.99997 4.00003 7.13928 4.00003 7.26782V9.12601C3.64525 9.21732 3.30951 9.35608 3 9.53513V7.42857C3 7.35266 3.00622 7.27813 3.01819 7.20541C3.00621 7.12478 3 7.04227 3 6.9583V5.29163C3 4.37116 3.74619 3.5 4.66667 3.5ZM10.1737 6H4.5C4.32468 6 4.15639 6.02864 4 6.08129V4.91663C4 4.68652 4.18655 4.49997 4.41667 4.49997H9.29873C9.47808 4.49997 9.63731 4.61473 9.69402 4.78487L10.1737 6ZM2 13C2 11.3432 3.34315 10 5 10C6.65685 10 8 11.3432 8 13C8 14.6569 6.65685 16 5 16C3.34315 16 2 14.6569 2 13ZM4.61393 14.7104C4.59402 14.6577 4.58498 14.6015 4.58737 14.5451L4.58662 14.5444V13.3513H3.39349C3.28264 13.3513 3.17633 13.3072 3.09795 13.2288C3.01956 13.1505 2.97552 13.0441 2.97552 12.9333C2.97552 12.8224 3.01956 12.7161 3.09795 12.6377C3.17633 12.5594 3.28264 12.5153 3.39349 12.5153H4.58737V11.3222C4.58737 11.2113 4.63141 11.105 4.70979 11.0266C4.78818 10.9483 4.89449 10.9042 5.00534 10.9042C5.1162 10.9042 5.22251 10.9483 5.30089 11.0266C5.37928 11.105 5.42331 11.2113 5.42331 11.3222V12.5153H6.61644C6.72729 12.5153 6.83361 12.5594 6.91199 12.6377C6.99037 12.7161 7.03441 12.8224 7.03441 12.9333C7.03441 13.0441 6.99037 13.1505 6.91199 13.2288C6.83361 13.3072 6.72729 13.3513 6.61644 13.3513H5.42256V14.5451C5.42495 14.6015 5.41592 14.6577 5.39601 14.7104C5.3761 14.7632 5.34572 14.8114 5.30671 14.8521C5.2677 14.8928 5.22086 14.9252 5.169 14.9473C5.11714 14.9694 5.06135 14.9808 5.00497 14.9808C4.94859 14.9808 4.89279 14.9694 4.84094 14.9473C4.78908 14.9252 4.74224 14.8928 4.70322 14.8521C4.66421 14.8114 4.63384 14.7632 4.61393 14.7104Z" fill="#
|
|
3
|
+
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M4.66667 3.5H9.29873C10.0161 3.5 10.653 4.08402 10.8799 4.76459L11.2917 6H15.5C16.3284 6 17 6.63959 17 7.42857V14.5714C17 15.3604 16.3284 16 15.5 16H7.64582C7.96983 15.714 8.24715 15.3764 8.46489 15H15.6324C15.8529 15 16 14.8607 16 14.7321V7.26782C16 7.13928 15.8529 6.99997 15.6324 6.99997H4.36767C4.14711 6.99997 4.00003 7.13928 4.00003 7.26782V9.12601C3.64525 9.21732 3.30951 9.35608 3 9.53513V7.42857C3 7.35266 3.00622 7.27813 3.01819 7.20541C3.00621 7.12478 3 7.04227 3 6.9583V5.29163C3 4.37116 3.74619 3.5 4.66667 3.5ZM10.1737 6H4.5C4.32468 6 4.15639 6.02864 4 6.08129V4.91663C4 4.68652 4.18655 4.49997 4.41667 4.49997H9.29873C9.47808 4.49997 9.63731 4.61473 9.69402 4.78487L10.1737 6ZM2 13C2 11.3432 3.34315 10 5 10C6.65685 10 8 11.3432 8 13C8 14.6569 6.65685 16 5 16C3.34315 16 2 14.6569 2 13ZM4.61393 14.7104C4.59402 14.6577 4.58498 14.6015 4.58737 14.5451L4.58662 14.5444V13.3513H3.39349C3.28264 13.3513 3.17633 13.3072 3.09795 13.2288C3.01956 13.1505 2.97552 13.0441 2.97552 12.9333C2.97552 12.8224 3.01956 12.7161 3.09795 12.6377C3.17633 12.5594 3.28264 12.5153 3.39349 12.5153H4.58737V11.3222C4.58737 11.2113 4.63141 11.105 4.70979 11.0266C4.78818 10.9483 4.89449 10.9042 5.00534 10.9042C5.1162 10.9042 5.22251 10.9483 5.30089 11.0266C5.37928 11.105 5.42331 11.2113 5.42331 11.3222V12.5153H6.61644C6.72729 12.5153 6.83361 12.5594 6.91199 12.6377C6.99037 12.7161 7.03441 12.8224 7.03441 12.9333C7.03441 13.0441 6.99037 13.1505 6.91199 13.2288C6.83361 13.3072 6.72729 13.3513 6.61644 13.3513H5.42256V14.5451C5.42495 14.6015 5.41592 14.6577 5.39601 14.7104C5.3761 14.7632 5.34572 14.8114 5.30671 14.8521C5.2677 14.8928 5.22086 14.9252 5.169 14.9473C5.11714 14.9694 5.06135 14.9808 5.00497 14.9808C4.94859 14.9808 4.89279 14.9694 4.84094 14.9473C4.78908 14.9252 4.74224 14.8928 4.70322 14.8521C4.66421 14.8114 4.63384 14.7632 4.61393 14.7104Z" fill="#333333"/>
|
|
4
4
|
</g>
|
|
5
5
|
</svg>
|