';
						};
						if (insertBeforeLoad) {
							insertHtml(html);
						};
						if (processor == Processor.Youtube) {
							window.onYouTubeIframeAPIReady = () => {
								player = new YT.Player('player', {
									events: {
										onReady,
										onStateChange,
									}
								});
							};
							const onReady = (event) => {
							};
							const onStateChange = (event) => {
							};
						};
						loadLibs(libs, () => {
							if (!insertBeforeLoad) {
								insertHtml(html);
							};
							if (js) {
								try {
									eval(js);
								} catch (e) {
									console.error(e);
								};
							};
							resize();
						});
					};
				});
				win.on('resize', resize);
				function resize () {
					if (!allowIframeResize) {
						return;
					};
					const height = useRootHeight ? root.height() : document.documentElement.scrollHeight;
					window.parent.postMessage({ type: 'resize', height, blockId }, '*');
				};
				function insertHtml (html) {
					if (cachedHtml !== html) {
						root.html(html);
						cachedHtml = html;
					};
				};
				function loadLibs (list, callBack) {
					if (!list.length) {
						if (callBack) {
							callBack();
						};
						return;
					};
					const src = list.shift();
					const script = document.createElement('script');
					scripts.append(script);
					script.onload = function (e) {
						if (list.length) {
							loadLibs(list, callBack);
						} else
						if (callBack) {
							callBack();
						};
					};
					script.type = 'text/javascript';
					script.src = src;
				};
				function getParam () {
					const a = location.search.replace(/^\?/, '').split('&');
					const param = {};
					a.forEach((s) => {
						const kv = s.split('=');
						param[kv[0]] = kv[1];
					});
					return param;
				};
				function loadGithubGist (html) {
					const m = html.match(/src="([^"]+)"/);
					if (!m || (m.length < 1)) {
						return;
					};
					$.ajax({
						url: m[1].replace(/\.js$/, '.json'),
						dataType: 'jsonp',
						timeout: 1000,
						success: (data) => {
							if (!head.find('#gist-css').length) {
								head.append(``);
							};
							root.html(data.div);
							resize();
						}
					});
				};
				function loadKroki (html) {
					if (!html) {
						return;
					};
					$.ajax({
						url: html,
						dataType: 'text',
						timeout: 1000,
						success: (data) => {
							root.html(data);
							root.find('a').off('click').on('click', function (e) {
								e.preventDefault();
								window.parent.postMessage({ type: 'openUrl', url: $(this).attr('href') }, '*');
							});
						}
					});
				};
				function getEnvironmentContent (processor) {
					const libs = [];
					let html = '';
					switch (processor) {
						case Processor.Chart: {
							html = ``;
							libs.push('https://cdn.jsdelivr.net/npm/chart.js');
							break;
						};
						case Processor.Twitter: {
							libs.push('https://platform.twitter.com/widgets.js');
							break;
						};
						case Processor.Reddit: {
							libs.push('https://embed.reddit.com/widgets.js');
							break;
						};
						case Processor.Instagram: {
							libs.push('https://www.instagram.com/embed.js');
							break;
						};
						case Processor.Codepen: {
							libs.push('https://cpwebassets.codepen.io/assets/embed/ei.js');
							break;
						};
						case Processor.Youtube:
							libs.push('https://www.youtube.com/iframe_api');
							break;
					};
					return {
						html,
						libs,
					};
				};
			});