@afterswf/embed 0.1.4 → 0.1.5
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 +9 -4
- package/dist/HISTORY.txt +18 -0
- package/dist/VERSIONS.txt +5 -5
- package/dist/embed.js +1 -1
- package/dist/embed.js.map +1 -1
- package/dist/embed.mjs +1 -1
- package/dist/embed.mjs.map +1 -1
- package/dist/runtime.js +2 -2
- package/dist/runtime.js.map +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +7 -6
- package/dist/assets/progressBg.jpg +0 -0
- package/dist/assets/progressLine.jpg +0 -0
- package/dist/assets/splash.jpg +0 -0
package/dist/embed.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.mjs","sources":["../src/embed/flashMarkup.ts","../src/embed/swfobject.ts","../src/embed/AwayPlayerComponent.ts","../src/embed/index.ts"],"sourcesContent":["const FLASH_CLASSID = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';\nconst FLASH_TYPES = ['application/x-shockwave-flash', 'application/futuresplash'];\nconst SWF_URL = /\\.swf([?#]|$)/i;\n/**\n * Attributes that describe the plugin rather than the element, so aren't copied\n */\nconst PLUGIN_ATTRIBUTES = ['classid', 'codebase', 'type', 'pluginspage', 'data', 'src', 'width', 'height'];\n/**\n * Flash parameters, which <embed> takes as attributes\n */\nconst EMBED_PARAMS = [\n 'flashvars', 'bgcolor', 'scale', 'salign', 'wmode', 'quality', 'menu', 'play', 'loop', 'base',\n 'allowscriptaccess', 'allowfullscreen', 'allowfullscreeninteractive', 'allownetworking',\n 'devicefont', 'seamlesstabbing', 'swliveconnect', 'swremote', 'swfversion', 'expressinstall',\n];\nfunction paramsOf(el) {\n const params = {};\n for (const child of Array.from(el.children)) {\n if (child.localName === 'param' && child.getAttribute('name')) {\n params[child.getAttribute('name').toLowerCase()] = child.getAttribute('value') || '';\n }\n }\n return params;\n}\nexport function isFlashElement(el) {\n const tag = el.localName;\n if (tag !== 'object' && tag !== 'embed') {\n return false;\n }\n if (FLASH_TYPES.indexOf((el.getAttribute('type') || '').toLowerCase()) > -1\n || (el.getAttribute('classid') || '').toLowerCase() === FLASH_CLASSID) {\n return true;\n }\n const url = tag === 'embed'\n ? el.getAttribute('src')\n : el.getAttribute('data') || paramsOf(el).movie;\n return SWF_URL.test(url || '');\n}\nfunction hasFlashAncestor(el) {\n for (let parent = el.parentElement; parent; parent = parent.parentElement) {\n if (isFlashElement(parent)) {\n return true;\n }\n }\n return false;\n}\n/**\n * Reads an <object>/<embed> and any Flash elements nested in it (the usual\n * cross-browser markup), the outermost taking precedence\n */\nfunction readFlashMarkup(outer) {\n const markup = { attributes: {}, params: {} };\n const elements = [outer].concat(Array.from(outer.querySelectorAll('object, embed')).filter(isFlashElement));\n const set = (map, name, value) => {\n if (!(name in map)) {\n map[name] = value;\n }\n };\n for (const el of elements) {\n const isEmbed = el.localName === 'embed';\n const params = paramsOf(el);\n markup.src = markup.src\n || el.getAttribute(isEmbed ? 'src' : 'data')\n || params.movie\n || params.src;\n for (const attr of Array.from(el.attributes)) {\n const name = attr.name.toLowerCase();\n if (name === 'width' || name === 'height') {\n set(markup.attributes, name, attr.value);\n }\n else if (isEmbed && EMBED_PARAMS.indexOf(name) > -1) {\n set(markup.params, name, attr.value);\n }\n else if (PLUGIN_ATTRIBUTES.indexOf(name) === -1) {\n set(markup.attributes, name, attr.value);\n }\n }\n for (const name in params) {\n if (name !== 'movie' && name !== 'src') {\n set(markup.params, name, params[name]);\n }\n }\n }\n return markup;\n}\nexport function createPlayer(attributes, params) {\n const player = document.createElement('awayfl-player');\n for (const name in attributes) {\n try {\n player.setAttribute(name, attributes[name]);\n }\n catch (e) {\n console.warn(`[AwayFL] Skipping invalid attribute \"${name}\"`);\n }\n }\n for (const name in params) {\n const param = document.createElement('param');\n param.name = name;\n param.value = params[name];\n player.appendChild(param);\n }\n return player;\n}\n/**\n * Replaces Flash <object>/<embed> markup with an AwayFL player\n */\nexport function upgradeElement(el) {\n const markup = readFlashMarkup(el);\n if (!markup.src) {\n return null;\n }\n const player = createPlayer(Object.assign({ src: markup.src }, markup.attributes), markup.params);\n el.parentNode.replaceChild(player, el);\n return player;\n}\nexport function upgradeAll(root = document) {\n if (root instanceof Element && isFlashElement(root)) {\n if (!hasFlashAncestor(root)) {\n upgradeElement(root);\n }\n return;\n }\n root.querySelectorAll('object, embed').forEach((el) => {\n // nested elements are detached once their outermost element is upgraded\n if (el.isConnected && isFlashElement(el) && !hasFlashAncestor(el)) {\n upgradeElement(el);\n }\n });\n}\n/**\n * Upgrades Flash markup added to the page after it has loaded\n */\nexport function observeFlashMarkup() {\n let pending = [];\n const flush = () => {\n const added = pending;\n pending = [];\n added.forEach((el) => el.isConnected && upgradeAll(el));\n };\n new MutationObserver((records) => {\n const wasEmpty = !pending.length;\n for (const record of records) {\n record.addedNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n pending.push(node);\n }\n });\n }\n // wait for the script adding the markup to finish, e.g. appending its <param>s\n if (wasEmpty && pending.length) {\n setTimeout(flush);\n }\n }).observe(document.documentElement, { childList: true, subtree: true });\n}\n","import { createPlayer, isFlashElement, upgradeElement } from './flashMarkup';\n/**\n * The Flash Player version reported to pages, so they don't take their \"no Flash\" branch\n */\nconst PLAYER_VERSION = [32, 0, 0];\nconst userAgent = navigator.userAgent.toLowerCase();\nconst platform = (navigator.platform || '').toLowerCase();\nconst ua = {\n w3: true,\n pv: PLAYER_VERSION.slice(),\n wk: /webkit/.test(userAgent) ? parseFloat(userAgent.replace(/^.*webkit\\/(\\d+(\\.\\d+)?).*$/, '$1')) : false,\n ie: false,\n win: /win/.test(platform || userAgent),\n mac: /mac/.test(platform || userAgent),\n};\nlet encodeURIEnabled = false;\nlet autoHideShow = true;\nlet dynamicStylesheet = null;\nlet dynamicStylesheetMedia = null;\nfunction isDomLoaded() {\n return document.readyState !== 'loading';\n}\nfunction getElement(id) {\n return typeof id === 'string' ? document.getElementById(id) : id;\n}\n// by tag, as the element may be another build's class if both are loaded\nfunction isPlayer(el) {\n return !!el && el.localName === 'awayfl-player';\n}\nexport function addDomLoadEvent(fn) {\n if (isDomLoaded()) {\n fn();\n }\n else {\n document.addEventListener('DOMContentLoaded', () => fn());\n }\n}\nfunction addLoadEvent(fn) {\n if (document.readyState === 'complete') {\n setTimeout(fn);\n }\n else {\n window.addEventListener('load', () => fn());\n }\n}\nfunction hasPlayerVersion(versionStr) {\n const v = String(versionStr).split('.');\n const required = [parseInt(v[0], 10), parseInt(v[1], 10) || 0, parseInt(v[2], 10) || 0];\n const pv = PLAYER_VERSION;\n return pv[0] > required[0]\n || (pv[0] === required[0] && pv[1] > required[1])\n || (pv[0] === required[0] && pv[1] === required[1] && pv[2] >= required[2]);\n}\nfunction createCSS(selStr, declStr, mediaStr, newStyleBoolean) {\n const head = document.head;\n if (!head) {\n return;\n }\n const media = typeof mediaStr === 'string' && mediaStr ? mediaStr : 'screen';\n if (newStyleBoolean) {\n dynamicStylesheet = null;\n dynamicStylesheetMedia = null;\n }\n if (!dynamicStylesheet || dynamicStylesheetMedia !== media) {\n dynamicStylesheet = document.createElement('style');\n dynamicStylesheet.media = media;\n dynamicStylesheetMedia = media;\n head.appendChild(dynamicStylesheet);\n }\n dynamicStylesheet.appendChild(document.createTextNode(selStr + ' {' + declStr + '}'));\n}\n/**\n * Hides alternative content until it's replaced, as SWFObject does\n */\nfunction setVisibility(id, isVisible) {\n if (!autoHideShow || !id) {\n return;\n }\n const visibility = isVisible ? 'visible' : 'hidden';\n const el = document.getElementById(id);\n if (isDomLoaded() && el) {\n el.style.visibility = visibility;\n }\n else {\n createCSS('#' + CSS.escape(id), 'visibility:' + visibility);\n }\n}\nfunction createSWF(attObj, parObj, replaceElemIdStr) {\n const el = getElement(replaceElemIdStr);\n if (!el || !attObj || !attObj.data) {\n return undefined;\n }\n if (typeof attObj.id === 'undefined' && el.id) {\n attObj.id = el.id;\n }\n const attributes = { src: '' + attObj.data };\n for (const key in attObj) {\n const name = key.toLowerCase();\n if (name === 'styleclass') {\n attributes['class'] = '' + attObj[key];\n }\n else if (name !== 'classid' && name !== 'data') {\n attributes[key] = '' + attObj[key];\n }\n }\n const params = {};\n for (const key in parObj) {\n if (key.toLowerCase() !== 'movie') {\n params[key] = '' + parObj[key];\n }\n }\n const player = createPlayer(attributes, params);\n el.parentNode.replaceChild(player, el);\n return player;\n}\nfunction buildFlashVars(flashvarsObj) {\n if (!flashvarsObj || typeof flashvarsObj !== 'object') {\n return '';\n }\n return Object.keys(flashvarsObj)\n .map((key) => key + '=' + (encodeURIEnabled ? encodeURIComponent(flashvarsObj[key]) : flashvarsObj[key]))\n .join('&');\n}\nfunction embedSWF(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, _xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {\n const id = typeof replaceElemIdStr === 'string' ? replaceElemIdStr : replaceElemIdStr && replaceElemIdStr.id;\n const callbackObj = { success: false, id };\n // unlike SWFObject the version is optional, as AwayFL's own examples omit it\n if (!swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr) {\n callbackFn && callbackFn(callbackObj);\n return;\n }\n setVisibility(id, false);\n addDomLoadEvent(() => {\n // copied, as pages often reuse these objects for several SWFs\n const att = Object.assign({}, attObj, { data: swfUrlStr, width: '' + widthStr, height: '' + heightStr });\n const par = Object.assign({}, parObj);\n const flashvars = buildFlashVars(flashvarsObj);\n if (flashvars) {\n par.flashvars = typeof par.flashvars !== 'undefined' ? par.flashvars + '&' + flashvars : flashvars;\n }\n if (!swfVersionStr || hasPlayerVersion(swfVersionStr)) {\n const ref = createSWF(att, par, replaceElemIdStr);\n if (att.id == id) {\n setVisibility(id, true);\n }\n callbackObj.success = !!ref;\n if (ref) {\n callbackObj.ref = ref;\n }\n }\n else {\n // show the alternative content\n setVisibility(id, true);\n }\n callbackFn && callbackFn(callbackObj);\n });\n}\n/**\n * Static publishing: replaces the page's <object> markup with a player\n */\nfunction registerObject(objectIdStr, swfVersionStr, _xiSwfUrlStr, callbackFn) {\n if (!objectIdStr || !swfVersionStr) {\n callbackFn && callbackFn({ success: false, id: objectIdStr });\n return;\n }\n setVisibility(objectIdStr, false);\n addDomLoadEvent(() => {\n const callbackObj = { success: false, id: objectIdStr };\n if (hasPlayerVersion(swfVersionStr)) {\n let ref = document.getElementById(objectIdStr);\n // may already have been upgraded with the rest of the page's markup\n if (ref && !isPlayer(ref)) {\n ref = isFlashElement(ref) ? upgradeElement(ref) : null;\n }\n if (ref) {\n callbackObj.success = true;\n callbackObj.ref = ref;\n }\n }\n setVisibility(objectIdStr, true);\n callbackFn && callbackFn(callbackObj);\n });\n}\nfunction getObjectById(objectIdStr) {\n const el = document.getElementById(objectIdStr);\n return isPlayer(el) ? el : null;\n}\nfunction removeSWF(objElemIdStr) {\n const el = document.getElementById(objElemIdStr);\n if (el && (isPlayer(el) || isFlashElement(el))) {\n el.remove();\n }\n}\nfunction urlEncodeIfNecessary(s) {\n return /[\\\\\\\"<>\\.;]/.test(s) ? encodeURIComponent(s) : s;\n}\nfunction getQueryParamValue(param) {\n let q = document.location.search || document.location.hash;\n if (q) {\n if (/\\?/.test(q)) {\n q = q.split('?')[1];\n }\n if (param == null) {\n return urlEncodeIfNecessary(q);\n }\n const pairs = q.split('&');\n for (let i = 0; i < pairs.length; i++) {\n if (pairs[i].substring(0, pairs[i].indexOf('=')) == param) {\n return urlEncodeIfNecessary(pairs[i].substring(pairs[i].indexOf('=') + 1));\n }\n }\n }\n return '';\n}\nexport const swfobject = {\n registerObject,\n getObjectById,\n embedSWF,\n switchOffAutoHideShow() {\n autoHideShow = false;\n },\n enableUriEncoding(enable) {\n encodeURIEnabled = typeof enable === 'undefined' ? true : !!enable;\n },\n ua,\n getFlashPlayerVersion() {\n return { major: PLAYER_VERSION[0], minor: PLAYER_VERSION[1], release: PLAYER_VERSION[2] };\n },\n hasFlashPlayerVersion: hasPlayerVersion,\n createSWF(attObj, parObj, replaceElemIdStr) {\n return createSWF(attObj, parObj, replaceElemIdStr);\n },\n showExpressInstall(_att, _par, replaceElemIdStr, callbackFn) {\n console.warn('[AwayFL] Express Install is not needed or supported');\n callbackFn && callbackFn({ success: false, id: replaceElemIdStr });\n },\n removeSWF,\n createCSS,\n addDomLoadEvent,\n addLoadEvent,\n getQueryParamValue,\n expressInstallCallback() { },\n};\n/**\n * SWFObject 1.5: `new SWFObject(swf, id, width, height, version, bgcolor).write(elementId)`,\n * which renders the SWF inside the target element\n */\nexport class SWFObject {\n constructor(swf, id, w, h, ver, c, quality) {\n this._attributes = {};\n this._params = {};\n this._variables = {};\n this.setAttribute('swf', swf);\n this.setAttribute('id', id);\n this.setAttribute('width', '' + w);\n this.setAttribute('height', '' + h);\n this.setAttribute('version', ver);\n if (c) {\n this.addParam('bgcolor', c);\n }\n this.addParam('quality', quality || 'high');\n }\n setAttribute(name, value) {\n this._attributes[name] = value;\n }\n getAttribute(name) {\n return this._attributes[name] || '';\n }\n addParam(name, value) {\n this._params[name] = value;\n }\n getParams() {\n return this._params;\n }\n addVariable(name, value) {\n this._variables[name] = value;\n }\n getVariable(name) {\n return this._variables[name] || '';\n }\n getVariables() {\n return this._variables;\n }\n getVariablePairs() {\n return Object.keys(this._variables).map((key) => key + '=' + this._variables[key]);\n }\n useExpressInstall(_path) { }\n write(elementId) {\n const target = getElement(elementId);\n if (!target) {\n return false;\n }\n const id = this.getAttribute('id');\n const params = Object.assign({}, this._params);\n const flashvars = this.getVariablePairs().join('&');\n if (flashvars) {\n params.flashvars = flashvars;\n }\n const player = createPlayer({\n src: this.getAttribute('swf'),\n id,\n name: id,\n width: this.getAttribute('width'),\n height: this.getAttribute('height'),\n }, params);\n target.innerHTML = '';\n target.appendChild(player);\n return true;\n }\n}\n","//@ts-ignore\nimport template from \"./embed.html\";\n// rollup turns import.meta.url into document.currentScript's src in the classic\n// script build; in the ES module build it's the module's own URL\nconst scriptBaseUrl = new URL('.', import.meta.url).href;\nconst defaultProgress = {\n \"direction\": \"lr\",\n \"back\": \"#130d02\",\n \"line\": \"#f29f01\",\n \"rect\": [\n 0.25,\n 0.77,\n 0.5,\n 0.01\n ]\n};\n/**\n * Flash <object>/<embed> parameter and attribute names that map onto config keys.\n * Others, such as wmode, allowScriptAccess, quality and menu, have no equivalent\n * and are ignored.\n */\nconst FLASH_PARAMS = {\n movie: 'src',\n data: 'src',\n flashvars: 'flashvars',\n bgcolor: 'bgcolor',\n scale: 'scaleMode',\n salign: 'stageAlign',\n};\nconst SCALE_MODES = {\n showall: 'showAll',\n all: 'showAll',\n noborder: 'noBorder',\n exactfit: 'exactFit',\n noscale: 'noScale',\n};\nexport function parseFlashVars(value) {\n const result = {};\n if (typeof value === 'string') {\n new URLSearchParams(value).forEach((v, k) => {\n result[k] = v;\n });\n }\n else if (value) {\n for (const key in value) {\n result[key] = String(value[key]);\n }\n }\n return result;\n}\nfunction parseColor(value) {\n const match = /^#?([0-9a-f]{6})$/i.exec(value || '');\n return match ? parseInt(match[1], 16) : null;\n}\nfunction normalizeAlign(value) {\n const v = value.toUpperCase();\n return (v.indexOf('T') > -1 ? 'T' : v.indexOf('B') > -1 ? 'B' : '')\n + (v.indexOf('L') > -1 ? 'L' : v.indexOf('R') > -1 ? 'R' : '');\n}\nfunction cssSize(value) {\n return /^\\d+(\\.\\d+)?$/.test('' + value) ? value + 'px' : '' + value;\n}\nexport class AwayPlayerComponent extends HTMLElement {\n static get observedAttributes() {\n return [\n 'src',\n 'width',\n 'height'\n ];\n }\n get player() {\n return this._player;\n }\n get config() {\n return this._runConfig;\n }\n set config(cfg) {\n this._runConfig = cfg;\n }\n get src() {\n return this._runConfig.src || this.getAttribute('src');\n }\n set src(v) {\n this._runConfig.src = v;\n }\n set width(v) {\n this._runConfig.width = v;\n }\n get width() {\n return this._runConfig.width || this.getAttribute('width');\n }\n set height(v) {\n this._runConfig.height = v;\n }\n get height() {\n return this._runConfig.height || this.getAttribute('height');\n }\n set runtimeBaseUrl(v) {\n this._runConfig.runtimeBaseUrl = v;\n }\n get runtimeBaseUrl() {\n return this._runConfig.runtimeBaseUrl;\n }\n constructor() {\n super();\n this._runConfig = {};\n this.onError = this.onError.bind(this);\n this._root = this.attachShadow({ mode: 'closed' });\n }\n _getRuntimeUrl() {\n const baseUrl = this._runConfig.runtimeBaseUrl;\n const loader = new URL('loader.js', baseUrl).href;\n const runtime = new URL('runtime.js', baseUrl).href;\n /**\n * @todo support runtime version\n **/\n return {\n loader,\n runtime,\n baseUrl,\n };\n }\n _dropPlayer() {\n if (this._gameFrame) {\n this._gameFrame.remove();\n this._player = null;\n }\n }\n onError(_arg) {\n const f = this._runConfig.onError && self[this._runConfig.onError];\n if (typeof f === 'function') {\n f(_arg);\n }\n this.dispatchEvent(new ErrorEvent('error', {\n error: new Error('Awayfl runtime error'),\n message: (_arg === null || _arg === void 0 ? void 0 : _arg.message) || _arg,\n }));\n }\n _attachRuntimeEvents() {\n const fd = this._gameFrame.contentWindow;\n //@ts-ignore\n fd.addEventListener('awayfl-player-init', ({ detail }) => {\n this._player = detail;\n }, { once: true });\n fd.addEventListener('awayfl-player-load', () => {\n const f = this._runConfig.onLoad && self[this._runConfig.onLoad];\n if (typeof f === 'function') {\n f();\n }\n this.dispatchEvent(new CustomEvent('load'));\n this._gameFrame.style.display = '';\n }, { once: true });\n //@ts-ignore\n fd.addEventListener('awayfl-player-error', ({ detail }) => this.onError(detail), { once: true });\n //@ts-ignore\n fd.addEventListener('awayfl-player-progress', ({ detail }) => {\n const f = this._runConfig.onProgress && self[this._runConfig.onProgress];\n if (typeof f === 'function') {\n f(detail);\n }\n this.dispatchEvent(new CustomEvent('progress', { detail }));\n });\n }\n _buildTemplate(frame) {\n const t = template;\n const urls = this._getRuntimeUrl();\n const gameConfig = {\n width: frame.clientWidth,\n height: frame.clientHeight,\n backgroundColor: this._runConfig.backgroundColor,\n splash: this._runConfig.splash,\n progress: this._runConfig.progress,\n runtime: [urls.runtime],\n binary: [{\n path: this._runConfig.src,\n resourceType: 'GAME',\n name: 'Game',\n meta: {}\n }],\n //debug: true,\n baseUrl: urls.baseUrl,\n maxStageScale: +this._runConfig.maxStageScale,\n flashvars: parseFlashVars(this._runConfig.flashvars),\n stageScaleMode: this._runConfig.scaleMode,\n stageAlign: this._runConfig.stageAlign,\n stageColor: parseColor(this._runConfig.bgcolor),\n runtimeFlags: {\n defaultSmoothBitmap: !!this._runConfig.smoothBitmaps,\n enableBlends: !!this._runConfig.enableBlends,\n enableFilters: !!this._runConfig.enableFilters,\n }\n };\n return t\n .replace(/__LOADER_URL__/, urls.loader)\n .replace(/__GAME_CONFIG__/, JSON.stringify(JSON.stringify(gameConfig)));\n }\n _constructPlayer() {\n const root = this._root;\n const frame = document.createElement('iframe');\n frame.style.display = this._runConfig.hideBeforeLoad ? 'none' : '';\n this._gameFrame = frame;\n root.appendChild(frame);\n frame.addEventListener('load', this._attachRuntimeEvents.bind(this), {\n once: true\n });\n frame.addEventListener('error', this.onError);\n frame.srcdoc = this._buildTemplate(frame);\n }\n /**\n * Config key for a param or attribute name, matched case-insensitively as\n * HTML lowercases attribute names and Flash param names ignore case\n */\n _configKey(name) {\n const lower = name.toLowerCase();\n if (lower in FLASH_PARAMS) {\n return FLASH_PARAMS[lower];\n }\n return Object.keys(AwayPlayerComponent.BINDING_CONFIG)\n .find((key) => key.toLowerCase() === lower);\n }\n _mapAttrs() {\n const params = this.querySelectorAll('param');\n const config = this._runConfig;\n params.forEach(node => {\n const key = this._configKey(node.name);\n if (key) {\n config[key] = node.value;\n }\n });\n this.getAttributeNames().forEach(name => {\n const key = this._configKey(name);\n if (key) {\n config[key] = this.getAttribute(name);\n }\n });\n }\n _loadGlobalConfig() {\n const global = window;\n const globalCfg = global.AWAY_EMBED_CFG || {};\n const scheme = AwayPlayerComponent.BINDING_CONFIG;\n for (const [key, value] of Object.entries(globalCfg)) {\n if (key in scheme) {\n this._runConfig[key] = value;\n }\n }\n }\n _setDefaults() {\n const scheme = AwayPlayerComponent.BINDING_CONFIG;\n for (const key in scheme) {\n if (scheme[key].required && typeof this._runConfig[key] === 'undefined') {\n throw `Parameter ${key} is required!`;\n }\n if (typeof this._runConfig[key] === 'undefined') {\n this._runConfig[key] = scheme[key].default;\n }\n }\n }\n _normalizeConfig() {\n const config = this._runConfig;\n // absolute and ending in a slash, so the runtime's files resolve inside it\n config.runtimeBaseUrl = new URL(config.runtimeBaseUrl.replace(/\\/?$/, '/'), document.baseURI).href;\n if (config.splash === undefined) {\n config.splash = new URL('assets/splash.jpg', config.runtimeBaseUrl).href;\n }\n config.scaleMode = SCALE_MODES[('' + config.scaleMode).toLowerCase()] || config.scaleMode;\n if (config.stageAlign) {\n config.stageAlign = normalizeAlign(config.stageAlign) || undefined;\n }\n // params and attributes are strings, but \"false\" shouldn't mean true\n for (const key of ['autoplay', 'hideBeforeLoad', 'smoothBitmaps', 'enableBlends', 'enableFilters']) {\n if (typeof config[key] === 'string') {\n config[key] = !/^(false|0)$/i.test(config[key].trim());\n }\n }\n if (config.splash === 'false') {\n config.splash = false;\n }\n if (config.progress === 'false') {\n config.progress = false;\n }\n if (config.bgcolor) {\n config.backgroundColor = parseColor(config.bgcolor) === null\n ? config.bgcolor\n : '#' + config.bgcolor.replace('#', '');\n }\n }\n _updateStyle() {\n this._style.textContent = `\n :host {\n display: inline-block;\n contain: content;\n width: ${cssSize(this._runConfig.width)};\n height: ${cssSize(this._runConfig.height)};\n }\n iframe {\n display: block;\n width: 100%;\n height: 100%;\n border: none;\n }\n `;\n }\n connectedCallback() {\n setTimeout(() => {\n this._loaderHolder = this.querySelector('div.awayfl__loader');\n this._loadGlobalConfig();\n this._mapAttrs();\n this._setDefaults();\n this._normalizeConfig();\n this._style = document.createElement('style');\n this._updateStyle();\n this._root.appendChild(this._style);\n this._constructPlayer();\n });\n }\n disconnectedCallback() {\n this._dropPlayer();\n }\n attributeChangedCallback(name, _oldValue, newValue) {\n if (!this.isConnected) {\n return;\n }\n // if SRC changed, drop runtime and load again\n if (name === 'src' && this._player) {\n this._dropPlayer();\n this._runConfig.src = newValue;\n this._constructPlayer();\n return;\n }\n if ((name === 'width' || name === 'height') && this._style) {\n this._runConfig[name] = newValue;\n this._updateStyle();\n }\n }\n}\nAwayPlayerComponent.BINDING_CONFIG = {\n version: { required: false, default: 'latest' },\n runtimeBaseUrl: { required: false, default: scriptBaseUrl },\n src: { required: true },\n width: { required: false, default: 550 },\n height: { required: false, default: 400 },\n onLoad: { required: false },\n onProgress: { required: false },\n onError: { required: false },\n scaleMode: { required: false, default: 'showAll' },\n stageAlign: { required: false },\n autoplay: { required: false, default: true },\n hideBeforeLoad: { required: false, default: false },\n maxStageScale: { required: false, default: undefined },\n backgroundColor: { required: false, default: 'black' },\n bgcolor: { required: false },\n flashvars: { required: false },\n // defaults to the splash in runtimeBaseUrl's assets\n splash: { required: false },\n progress: { required: false, default: defaultProgress },\n // runtime\n smoothBitmaps: { required: false, default: false },\n enableBlends: { required: false, default: false },\n enableFilters: { required: false, default: false },\n};\n// both the script and module builds may be loaded\nif (!customElements.get('awayfl-player')) {\n customElements.define('awayfl-player', AwayPlayerComponent);\n}\n","import { observeFlashMarkup, upgradeAll } from './flashMarkup';\nimport { addDomLoadEvent, swfobject, SWFObject } from './swfobject';\nexport { AwayPlayerComponent } from './AwayPlayerComponent';\nexport { swfobject, swfobject as swfObject, SWFObject };\n//@ts-ignore\nexport const VERSION = \"__VERSION__\";\nconst global = window;\n/**\n * Sets options for players, the same as defining AWAY_EMBED_CFG\n */\nexport function configure(config) {\n global.AWAY_EMBED_CFG = Object.assign(global.AWAY_EMBED_CFG || {}, config);\n}\n/**\n * Defines a global that keeps AwayFL's value if a page's own swfobject.js assigns\n * over it later, so embed.js works whether it's included before or after it\n */\nfunction defineGlobal(name, value) {\n const existing = Object.getOwnPropertyDescriptor(window, name);\n if (existing && !existing.configurable) {\n global[name] = value;\n return;\n }\n Object.defineProperty(window, name, {\n configurable: true,\n enumerable: true,\n get: () => value,\n set: (other) => {\n if (other !== value) {\n console.info(`[AwayFL] Ignoring the page's ${name}, as AwayFL provides it`);\n }\n },\n });\n}\nif (global.swfobject || global.swfObject || global.SWFObject) {\n console.info('[AwayFL] Replacing the page\\'s SWFObject');\n}\ndefineGlobal('swfobject', swfobject);\ndefineGlobal('swfObject', swfobject);\ndefineGlobal('SWFObject', SWFObject);\n// upgrade <object>/<embed> markup, including on pages that don't use SWFObject;\n// a tick later, so a module importing this can call configure() first\naddDomLoadEvent(() => setTimeout(() => {\n if ((global.AWAY_EMBED_CFG || {}).autoUpgrade !== false) {\n upgradeAll();\n observeFlashMarkup();\n }\n}));\n"],"names":["FLASH_TYPES","SWF_URL","PLUGIN_ATTRIBUTES","EMBED_PARAMS","paramsOf","el","params","child","Array","from","children","localName","getAttribute","toLowerCase","isFlashElement","tag","indexOf","url","movie","test","hasFlashAncestor","parent","parentElement","createPlayer","attributes","player","document","createElement","name","setAttribute","e","console","warn","param","value","appendChild","upgradeElement","markup","outer","elements","concat","querySelectorAll","filter","set","map","isEmbed","src","attr","readFlashMarkup","Object","assign","parentNode","replaceChild","upgradeAll","root","Element","forEach","isConnected","PLAYER_VERSION","userAgent","navigator","platform","ua","w3","pv","slice","wk","parseFloat","replace","ie","win","mac","encodeURIEnabled","autoHideShow","dynamicStylesheet","dynamicStylesheetMedia","isDomLoaded","readyState","getElement","id","getElementById","isPlayer","addDomLoadEvent","fn","addEventListener","hasPlayerVersion","versionStr","v","String","split","required","parseInt","createCSS","selStr","declStr","mediaStr","newStyleBoolean","head","media","createTextNode","setVisibility","isVisible","visibility","style","CSS","escape","createSWF","attObj","parObj","replaceElemIdStr","data","key","urlEncodeIfNecessary","s","encodeURIComponent","swfobject","registerObject","objectIdStr","swfVersionStr","_xiSwfUrlStr","callbackFn","callbackObj","success","ref","getObjectById","embedSWF","swfUrlStr","widthStr","heightStr","flashvarsObj","att","width","height","par","flashvars","keys","join","buildFlashVars","switchOffAutoHideShow","enableUriEncoding","enable","getFlashPlayerVersion","major","minor","release","hasFlashPlayerVersion","showExpressInstall","_att","_par","removeSWF","objElemIdStr","remove","addLoadEvent","setTimeout","window","getQueryParamValue","q","location","search","hash","pairs","i","length","substring","expressInstallCallback","SWFObject","constructor","swf","w","h","ver","c","quality","this","_attributes","_params","_variables","addParam","getParams","addVariable","getVariable","getVariables","getVariablePairs","useExpressInstall","_path","write","elementId","target","innerHTML","scriptBaseUrl","URL","href","FLASH_PARAMS","bgcolor","scale","salign","SCALE_MODES","showall","all","noborder","exactfit","noscale","parseFlashVars","result","URLSearchParams","k","parseColor","match","exec","cssSize","AwayPlayerComponent","HTMLElement","observedAttributes","_player","config","_runConfig","cfg","runtimeBaseUrl","super","onError","bind","_root","attachShadow","mode","_getRuntimeUrl","baseUrl","loader","runtime","_dropPlayer","_gameFrame","_arg","f","self","dispatchEvent","ErrorEvent","error","Error","message","_attachRuntimeEvents","fd","contentWindow","detail","once","onLoad","CustomEvent","display","onProgress","_buildTemplate","frame","t","urls","gameConfig","clientWidth","clientHeight","backgroundColor","splash","progress","binary","path","resourceType","meta","maxStageScale","stageScaleMode","scaleMode","stageAlign","stageColor","runtimeFlags","defaultSmoothBitmap","smoothBitmaps","enableBlends","enableFilters","JSON","stringify","_constructPlayer","hideBeforeLoad","srcdoc","_configKey","lower","BINDING_CONFIG","find","_mapAttrs","node","getAttributeNames","_loadGlobalConfig","globalCfg","AWAY_EMBED_CFG","scheme","entries","_setDefaults","default","_normalizeConfig","baseURI","undefined","toUpperCase","normalizeAlign","trim","_updateStyle","_style","textContent","connectedCallback","_loaderHolder","querySelector","disconnectedCallback","attributeChangedCallback","_oldValue","newValue","version","autoplay","direction","back","line","rect","customElements","get","define","VERSION","global","configure","defineGlobal","existing","getOwnPropertyDescriptor","configurable","defineProperty","enumerable","other","info","swfObject","autoUpgrade","pending","flush","added","MutationObserver","records","wasEmpty","record","addedNodes","nodeType","Node","ELEMENT_NODE","push","observe","documentElement","childList","subtree","observeFlashMarkup"],"mappings":"AAAA,MACMA,EAAc,CAAC,gCAAiC,4BAChDC,EAAU,iBAIVC,E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uD,WAAaC,KAAKC,cACvBV,EAAQW,KAAK1D,KAKrBoD,GAAYL,EAAQtK,QACpBT,WAAWgL,KAEhBW,QAAQ1T,SAAS2T,gBAAiB,CAAEC,WAAW,EAAMC,SAAS,GACrE,CG5GQC"}
|
|
1
|
+
{"version":3,"file":"embed.mjs","sources":["../src/embed/flashMarkup.ts","../src/embed/swfobject.ts","../src/embed/AwayPlayerComponent.ts","../src/embed/index.ts"],"sourcesContent":["const FLASH_CLASSID = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';\nconst FLASH_TYPES = ['application/x-shockwave-flash', 'application/futuresplash'];\nconst SWF_URL = /\\.swf([?#]|$)/i;\n/**\n * Attributes that describe the plugin rather than the element, so aren't copied\n */\nconst PLUGIN_ATTRIBUTES = ['classid', 'codebase', 'type', 'pluginspage', 'data', 'src', 'width', 'height'];\n/**\n * Flash parameters, which <embed> takes as attributes\n */\nconst EMBED_PARAMS = [\n 'flashvars', 'bgcolor', 'scale', 'salign', 'wmode', 'quality', 'menu', 'play', 'loop', 'base',\n 'allowscriptaccess', 'allowfullscreen', 'allowfullscreeninteractive', 'allownetworking',\n 'devicefont', 'seamlesstabbing', 'swliveconnect', 'swremote', 'swfversion', 'expressinstall',\n];\nfunction paramsOf(el) {\n const params = {};\n for (const child of Array.from(el.children)) {\n if (child.localName === 'param' && child.getAttribute('name')) {\n params[child.getAttribute('name').toLowerCase()] = child.getAttribute('value') || '';\n }\n }\n return params;\n}\nexport function isFlashElement(el) {\n const tag = el.localName;\n if (tag !== 'object' && tag !== 'embed') {\n return false;\n }\n if (FLASH_TYPES.indexOf((el.getAttribute('type') || '').toLowerCase()) > -1\n || (el.getAttribute('classid') || '').toLowerCase() === FLASH_CLASSID) {\n return true;\n }\n const url = tag === 'embed'\n ? el.getAttribute('src')\n : el.getAttribute('data') || paramsOf(el).movie;\n return SWF_URL.test(url || '');\n}\nfunction hasFlashAncestor(el) {\n for (let parent = el.parentElement; parent; parent = parent.parentElement) {\n if (isFlashElement(parent)) {\n return true;\n }\n }\n return false;\n}\n/**\n * Reads an <object>/<embed> and any Flash elements nested in it (the usual\n * cross-browser markup), the outermost taking precedence\n */\nfunction readFlashMarkup(outer) {\n const markup = { attributes: {}, params: {} };\n const elements = [outer].concat(Array.from(outer.querySelectorAll('object, embed')).filter(isFlashElement));\n const set = (map, name, value) => {\n if (!(name in map)) {\n map[name] = value;\n }\n };\n for (const el of elements) {\n const isEmbed = el.localName === 'embed';\n const params = paramsOf(el);\n markup.src = markup.src\n || el.getAttribute(isEmbed ? 'src' : 'data')\n || params.movie\n || params.src;\n for (const attr of Array.from(el.attributes)) {\n const name = attr.name.toLowerCase();\n if (name === 'width' || name === 'height') {\n set(markup.attributes, name, attr.value);\n }\n else if (isEmbed && EMBED_PARAMS.indexOf(name) > -1) {\n set(markup.params, name, attr.value);\n }\n else if (PLUGIN_ATTRIBUTES.indexOf(name) === -1) {\n set(markup.attributes, name, attr.value);\n }\n }\n for (const name in params) {\n if (name !== 'movie' && name !== 'src') {\n set(markup.params, name, params[name]);\n }\n }\n }\n return markup;\n}\nexport function createPlayer(attributes, params) {\n const player = document.createElement('awayfl-player');\n for (const name in attributes) {\n try {\n player.setAttribute(name, attributes[name]);\n }\n catch (e) {\n console.warn(`[AwayFL] Skipping invalid attribute \"${name}\"`);\n }\n }\n for (const name in params) {\n const param = document.createElement('param');\n param.name = name;\n param.value = params[name];\n player.appendChild(param);\n }\n return player;\n}\n/**\n * Replaces Flash <object>/<embed> markup with an AwayFL player\n */\nexport function upgradeElement(el) {\n const markup = readFlashMarkup(el);\n if (!markup.src) {\n return null;\n }\n const player = createPlayer(Object.assign({ src: markup.src }, markup.attributes), markup.params);\n el.parentNode.replaceChild(player, el);\n return player;\n}\nexport function upgradeAll(root = document) {\n if (root instanceof Element && isFlashElement(root)) {\n if (!hasFlashAncestor(root)) {\n upgradeElement(root);\n }\n return;\n }\n root.querySelectorAll('object, embed').forEach((el) => {\n // nested elements are detached once their outermost element is upgraded\n if (el.isConnected && isFlashElement(el) && !hasFlashAncestor(el)) {\n upgradeElement(el);\n }\n });\n}\n/**\n * Upgrades Flash markup added to the page after it has loaded\n */\nexport function observeFlashMarkup() {\n let pending = [];\n const flush = () => {\n const added = pending;\n pending = [];\n added.forEach((el) => el.isConnected && upgradeAll(el));\n };\n new MutationObserver((records) => {\n const wasEmpty = !pending.length;\n for (const record of records) {\n record.addedNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n pending.push(node);\n }\n });\n }\n // wait for the script adding the markup to finish, e.g. appending its <param>s\n if (wasEmpty && pending.length) {\n setTimeout(flush);\n }\n }).observe(document.documentElement, { childList: true, subtree: true });\n}\n","import { createPlayer, isFlashElement, upgradeElement } from './flashMarkup';\n/**\n * The Flash Player version reported to pages, so they don't take their \"no Flash\" branch\n */\nconst PLAYER_VERSION = [32, 0, 0];\nconst userAgent = navigator.userAgent.toLowerCase();\nconst platform = (navigator.platform || '').toLowerCase();\nconst ua = {\n w3: true,\n pv: PLAYER_VERSION.slice(),\n wk: /webkit/.test(userAgent) ? parseFloat(userAgent.replace(/^.*webkit\\/(\\d+(\\.\\d+)?).*$/, '$1')) : false,\n ie: false,\n win: /win/.test(platform || userAgent),\n mac: /mac/.test(platform || userAgent),\n};\nlet encodeURIEnabled = false;\nlet autoHideShow = true;\nlet dynamicStylesheet = null;\nlet dynamicStylesheetMedia = null;\nfunction isDomLoaded() {\n return document.readyState !== 'loading';\n}\nfunction getElement(id) {\n return typeof id === 'string' ? document.getElementById(id) : id;\n}\n// by tag, as the element may be another build's class if both are loaded\nfunction isPlayer(el) {\n return !!el && el.localName === 'awayfl-player';\n}\nexport function addDomLoadEvent(fn) {\n if (isDomLoaded()) {\n fn();\n }\n else {\n document.addEventListener('DOMContentLoaded', () => fn());\n }\n}\nfunction addLoadEvent(fn) {\n if (document.readyState === 'complete') {\n setTimeout(fn);\n }\n else {\n window.addEventListener('load', () => fn());\n }\n}\nfunction hasPlayerVersion(versionStr) {\n const v = String(versionStr).split('.');\n const required = [parseInt(v[0], 10), parseInt(v[1], 10) || 0, parseInt(v[2], 10) || 0];\n const pv = PLAYER_VERSION;\n return pv[0] > required[0]\n || (pv[0] === required[0] && pv[1] > required[1])\n || (pv[0] === required[0] && pv[1] === required[1] && pv[2] >= required[2]);\n}\nfunction createCSS(selStr, declStr, mediaStr, newStyleBoolean) {\n const head = document.head;\n if (!head) {\n return;\n }\n const media = typeof mediaStr === 'string' && mediaStr ? mediaStr : 'screen';\n if (newStyleBoolean) {\n dynamicStylesheet = null;\n dynamicStylesheetMedia = null;\n }\n if (!dynamicStylesheet || dynamicStylesheetMedia !== media) {\n dynamicStylesheet = document.createElement('style');\n dynamicStylesheet.media = media;\n dynamicStylesheetMedia = media;\n head.appendChild(dynamicStylesheet);\n }\n dynamicStylesheet.appendChild(document.createTextNode(selStr + ' {' + declStr + '}'));\n}\n/**\n * Hides alternative content until it's replaced, as SWFObject does\n */\nfunction setVisibility(id, isVisible) {\n if (!autoHideShow || !id) {\n return;\n }\n const visibility = isVisible ? 'visible' : 'hidden';\n const el = document.getElementById(id);\n if (isDomLoaded() && el) {\n el.style.visibility = visibility;\n }\n else {\n createCSS('#' + CSS.escape(id), 'visibility:' + visibility);\n }\n}\nfunction createSWF(attObj, parObj, replaceElemIdStr) {\n const el = getElement(replaceElemIdStr);\n if (!el || !attObj || !attObj.data) {\n return undefined;\n }\n if (typeof attObj.id === 'undefined' && el.id) {\n attObj.id = el.id;\n }\n const attributes = { src: '' + attObj.data };\n for (const key in attObj) {\n const name = key.toLowerCase();\n if (name === 'styleclass') {\n attributes['class'] = '' + attObj[key];\n }\n else if (name !== 'classid' && name !== 'data') {\n attributes[key] = '' + attObj[key];\n }\n }\n const params = {};\n for (const key in parObj) {\n if (key.toLowerCase() !== 'movie') {\n params[key] = '' + parObj[key];\n }\n }\n const player = createPlayer(attributes, params);\n el.parentNode.replaceChild(player, el);\n return player;\n}\nfunction buildFlashVars(flashvarsObj) {\n if (!flashvarsObj || typeof flashvarsObj !== 'object') {\n return '';\n }\n return Object.keys(flashvarsObj)\n .map((key) => key + '=' + (encodeURIEnabled ? encodeURIComponent(flashvarsObj[key]) : flashvarsObj[key]))\n .join('&');\n}\nfunction embedSWF(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, _xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {\n const id = typeof replaceElemIdStr === 'string' ? replaceElemIdStr : replaceElemIdStr && replaceElemIdStr.id;\n const callbackObj = { success: false, id };\n // unlike SWFObject the version is optional, as AwayFL's own examples omit it\n if (!swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr) {\n callbackFn && callbackFn(callbackObj);\n return;\n }\n setVisibility(id, false);\n addDomLoadEvent(() => {\n // copied, as pages often reuse these objects for several SWFs\n const att = Object.assign({}, attObj, { data: swfUrlStr, width: '' + widthStr, height: '' + heightStr });\n const par = Object.assign({}, parObj);\n const flashvars = buildFlashVars(flashvarsObj);\n if (flashvars) {\n par.flashvars = typeof par.flashvars !== 'undefined' ? par.flashvars + '&' + flashvars : flashvars;\n }\n if (!swfVersionStr || hasPlayerVersion(swfVersionStr)) {\n const ref = createSWF(att, par, replaceElemIdStr);\n if (att.id == id) {\n setVisibility(id, true);\n }\n callbackObj.success = !!ref;\n if (ref) {\n callbackObj.ref = ref;\n }\n }\n else {\n // show the alternative content\n setVisibility(id, true);\n }\n callbackFn && callbackFn(callbackObj);\n });\n}\n/**\n * Static publishing: replaces the page's <object> markup with a player\n */\nfunction registerObject(objectIdStr, swfVersionStr, _xiSwfUrlStr, callbackFn) {\n if (!objectIdStr || !swfVersionStr) {\n callbackFn && callbackFn({ success: false, id: objectIdStr });\n return;\n }\n setVisibility(objectIdStr, false);\n addDomLoadEvent(() => {\n const callbackObj = { success: false, id: objectIdStr };\n if (hasPlayerVersion(swfVersionStr)) {\n let ref = document.getElementById(objectIdStr);\n // may already have been upgraded with the rest of the page's markup\n if (ref && !isPlayer(ref)) {\n ref = isFlashElement(ref) ? upgradeElement(ref) : null;\n }\n if (ref) {\n callbackObj.success = true;\n callbackObj.ref = ref;\n }\n }\n setVisibility(objectIdStr, true);\n callbackFn && callbackFn(callbackObj);\n });\n}\nfunction getObjectById(objectIdStr) {\n const el = document.getElementById(objectIdStr);\n return isPlayer(el) ? el : null;\n}\nfunction removeSWF(objElemIdStr) {\n const el = document.getElementById(objElemIdStr);\n if (el && (isPlayer(el) || isFlashElement(el))) {\n el.remove();\n }\n}\nfunction urlEncodeIfNecessary(s) {\n return /[\\\\\\\"<>\\.;]/.test(s) ? encodeURIComponent(s) : s;\n}\nfunction getQueryParamValue(param) {\n let q = document.location.search || document.location.hash;\n if (q) {\n if (/\\?/.test(q)) {\n q = q.split('?')[1];\n }\n if (param == null) {\n return urlEncodeIfNecessary(q);\n }\n const pairs = q.split('&');\n for (let i = 0; i < pairs.length; i++) {\n if (pairs[i].substring(0, pairs[i].indexOf('=')) == param) {\n return urlEncodeIfNecessary(pairs[i].substring(pairs[i].indexOf('=') + 1));\n }\n }\n }\n return '';\n}\nexport const swfobject = {\n registerObject,\n getObjectById,\n embedSWF,\n switchOffAutoHideShow() {\n autoHideShow = false;\n },\n enableUriEncoding(enable) {\n encodeURIEnabled = typeof enable === 'undefined' ? true : !!enable;\n },\n ua,\n getFlashPlayerVersion() {\n return { major: PLAYER_VERSION[0], minor: PLAYER_VERSION[1], release: PLAYER_VERSION[2] };\n },\n hasFlashPlayerVersion: hasPlayerVersion,\n createSWF(attObj, parObj, replaceElemIdStr) {\n return createSWF(attObj, parObj, replaceElemIdStr);\n },\n showExpressInstall(_att, _par, replaceElemIdStr, callbackFn) {\n console.warn('[AwayFL] Express Install is not needed or supported');\n callbackFn && callbackFn({ success: false, id: replaceElemIdStr });\n },\n removeSWF,\n createCSS,\n addDomLoadEvent,\n addLoadEvent,\n getQueryParamValue,\n expressInstallCallback() { },\n};\n/**\n * SWFObject 1.5: `new SWFObject(swf, id, width, height, version, bgcolor).write(elementId)`,\n * which renders the SWF inside the target element\n */\nexport class SWFObject {\n constructor(swf, id, w, h, ver, c, quality) {\n this._attributes = {};\n this._params = {};\n this._variables = {};\n this.setAttribute('swf', swf);\n this.setAttribute('id', id);\n this.setAttribute('width', '' + w);\n this.setAttribute('height', '' + h);\n this.setAttribute('version', ver);\n if (c) {\n this.addParam('bgcolor', c);\n }\n this.addParam('quality', quality || 'high');\n }\n setAttribute(name, value) {\n this._attributes[name] = value;\n }\n getAttribute(name) {\n return this._attributes[name] || '';\n }\n addParam(name, value) {\n this._params[name] = value;\n }\n getParams() {\n return this._params;\n }\n addVariable(name, value) {\n this._variables[name] = value;\n }\n getVariable(name) {\n return this._variables[name] || '';\n }\n getVariables() {\n return this._variables;\n }\n getVariablePairs() {\n return Object.keys(this._variables).map((key) => key + '=' + this._variables[key]);\n }\n useExpressInstall(_path) { }\n write(elementId) {\n const target = getElement(elementId);\n if (!target) {\n return false;\n }\n const id = this.getAttribute('id');\n const params = Object.assign({}, this._params);\n const flashvars = this.getVariablePairs().join('&');\n if (flashvars) {\n params.flashvars = flashvars;\n }\n const player = createPlayer({\n src: this.getAttribute('swf'),\n id,\n name: id,\n width: this.getAttribute('width'),\n height: this.getAttribute('height'),\n }, params);\n target.innerHTML = '';\n target.appendChild(player);\n return true;\n }\n}\n","//@ts-ignore\nimport template from \"./embed.html\";\n// rollup turns import.meta.url into document.currentScript's src in the classic\n// script build; in the ES module build it's the module's own URL\nconst scriptBaseUrl = new URL('.', import.meta.url).href;\n// a plain bar across the middle; its colours come from the element's text colour\nconst defaultProgress = {\n \"direction\": \"lr\",\n \"rect\": [\n 0.25,\n 0.495,\n 0.5,\n 0.01\n ]\n};\n/**\n * Flash <object>/<embed> parameter and attribute names that map onto config keys.\n * Others, such as wmode, allowScriptAccess, quality and menu, have no equivalent\n * and are ignored.\n */\nconst FLASH_PARAMS = {\n movie: 'src',\n data: 'src',\n flashvars: 'flashvars',\n bgcolor: 'bgcolor',\n scale: 'scaleMode',\n salign: 'stageAlign',\n};\nconst SCALE_MODES = {\n showall: 'showAll',\n all: 'showAll',\n noborder: 'noBorder',\n exactfit: 'exactFit',\n noscale: 'noScale',\n};\nexport function parseFlashVars(value) {\n const result = {};\n if (typeof value === 'string') {\n new URLSearchParams(value).forEach((v, k) => {\n result[k] = v;\n });\n }\n else if (value) {\n for (const key in value) {\n result[key] = String(value[key]);\n }\n }\n return result;\n}\nfunction parseColor(value) {\n const match = /^#?([0-9a-f]{6})$/i.exec(value || '');\n return match ? parseInt(match[1], 16) : null;\n}\nfunction normalizeAlign(value) {\n const v = value.toUpperCase();\n return (v.indexOf('T') > -1 ? 'T' : v.indexOf('B') > -1 ? 'B' : '')\n + (v.indexOf('L') > -1 ? 'L' : v.indexOf('R') > -1 ? 'R' : '');\n}\nfunction cssSize(value) {\n return /^\\d+(\\.\\d+)?$/.test('' + value) ? value + 'px' : '' + value;\n}\nexport class AwayPlayerComponent extends HTMLElement {\n static get observedAttributes() {\n return [\n 'src',\n 'width',\n 'height'\n ];\n }\n get player() {\n return this._player;\n }\n get config() {\n return this._runConfig;\n }\n set config(cfg) {\n this._runConfig = cfg;\n }\n get src() {\n return this._runConfig.src || this.getAttribute('src');\n }\n set src(v) {\n this._runConfig.src = v;\n }\n set width(v) {\n this._runConfig.width = v;\n }\n get width() {\n return this._runConfig.width || this.getAttribute('width');\n }\n set height(v) {\n this._runConfig.height = v;\n }\n get height() {\n return this._runConfig.height || this.getAttribute('height');\n }\n set runtimeBaseUrl(v) {\n this._runConfig.runtimeBaseUrl = v;\n }\n get runtimeBaseUrl() {\n return this._runConfig.runtimeBaseUrl;\n }\n constructor() {\n super();\n this._runConfig = {};\n this.onError = this.onError.bind(this);\n this._root = this.attachShadow({ mode: 'closed' });\n }\n _getRuntimeUrl() {\n const baseUrl = this._runConfig.runtimeBaseUrl;\n const loader = new URL('loader.js', baseUrl).href;\n const runtime = new URL('runtime.js', baseUrl).href;\n /**\n * @todo support runtime version\n **/\n return {\n loader,\n runtime,\n baseUrl,\n };\n }\n _dropPlayer() {\n if (this._gameFrame) {\n this._gameFrame.remove();\n this._player = null;\n }\n }\n onError(_arg) {\n const f = this._runConfig.onError && self[this._runConfig.onError];\n if (typeof f === 'function') {\n f(_arg);\n }\n this.dispatchEvent(new ErrorEvent('error', {\n error: new Error('Awayfl runtime error'),\n message: (_arg === null || _arg === void 0 ? void 0 : _arg.message) || _arg,\n }));\n }\n _attachRuntimeEvents() {\n const fd = this._gameFrame.contentWindow;\n //@ts-ignore\n fd.addEventListener('awayfl-player-init', ({ detail }) => {\n this._player = detail;\n }, { once: true });\n fd.addEventListener('awayfl-player-load', () => {\n const f = this._runConfig.onLoad && self[this._runConfig.onLoad];\n if (typeof f === 'function') {\n f();\n }\n this.dispatchEvent(new CustomEvent('load'));\n this._gameFrame.style.display = '';\n }, { once: true });\n //@ts-ignore\n fd.addEventListener('awayfl-player-error', ({ detail }) => this.onError(detail), { once: true });\n //@ts-ignore\n fd.addEventListener('awayfl-player-progress', ({ detail }) => {\n const f = this._runConfig.onProgress && self[this._runConfig.onProgress];\n if (typeof f === 'function') {\n f(detail);\n }\n this.dispatchEvent(new CustomEvent('progress', { detail }));\n });\n }\n /**\n * The loading bar, in the element's text colour on a fainter track unless\n * colours are given, so it suits the page it's on\n */\n _progressConfig() {\n const progress = this._runConfig.progress;\n if (!progress) {\n return false;\n }\n const color = getComputedStyle(this).color;\n return Object.assign(Object.assign({ line: color, back: `color-mix(in srgb, ${color} 20%, transparent)` }, defaultProgress), (typeof progress === 'object' ? progress : {}));\n }\n _buildTemplate(frame) {\n const t = template;\n const urls = this._getRuntimeUrl();\n const gameConfig = {\n width: frame.clientWidth,\n height: frame.clientHeight,\n backgroundColor: this._runConfig.backgroundColor,\n splash: this._runConfig.splash,\n progress: this._progressConfig(),\n runtime: [urls.runtime],\n binary: [{\n path: this._runConfig.src,\n resourceType: 'GAME',\n name: 'Game',\n meta: {}\n }],\n //debug: true,\n baseUrl: urls.baseUrl,\n maxStageScale: +this._runConfig.maxStageScale,\n flashvars: parseFlashVars(this._runConfig.flashvars),\n stageScaleMode: this._runConfig.scaleMode,\n stageAlign: this._runConfig.stageAlign,\n stageColor: parseColor(this._runConfig.bgcolor),\n runtimeFlags: {\n defaultSmoothBitmap: !!this._runConfig.smoothBitmaps,\n enableBlends: !!this._runConfig.enableBlends,\n enableFilters: !!this._runConfig.enableFilters,\n }\n };\n return t\n .replace(/__LOADER_URL__/, urls.loader)\n .replace(/__GAME_CONFIG__/, JSON.stringify(JSON.stringify(gameConfig)));\n }\n _constructPlayer() {\n const root = this._root;\n const frame = document.createElement('iframe');\n frame.style.display = this._runConfig.hideBeforeLoad ? 'none' : '';\n this._gameFrame = frame;\n root.appendChild(frame);\n frame.addEventListener('load', this._attachRuntimeEvents.bind(this), {\n once: true\n });\n frame.addEventListener('error', this.onError);\n frame.srcdoc = this._buildTemplate(frame);\n }\n /**\n * Config key for a param or attribute name, matched case-insensitively as\n * HTML lowercases attribute names and Flash param names ignore case\n */\n _configKey(name) {\n const lower = name.toLowerCase();\n if (lower in FLASH_PARAMS) {\n return FLASH_PARAMS[lower];\n }\n return Object.keys(AwayPlayerComponent.BINDING_CONFIG)\n .find((key) => key.toLowerCase() === lower);\n }\n _mapAttrs() {\n const params = this.querySelectorAll('param');\n const config = this._runConfig;\n params.forEach(node => {\n const key = this._configKey(node.name);\n if (key) {\n config[key] = node.value;\n }\n });\n this.getAttributeNames().forEach(name => {\n const key = this._configKey(name);\n if (key) {\n config[key] = this.getAttribute(name);\n }\n });\n }\n _loadGlobalConfig() {\n const global = window;\n const globalCfg = global.AWAY_EMBED_CFG || {};\n const scheme = AwayPlayerComponent.BINDING_CONFIG;\n for (const [key, value] of Object.entries(globalCfg)) {\n if (key in scheme) {\n this._runConfig[key] = value;\n }\n }\n }\n _setDefaults() {\n const scheme = AwayPlayerComponent.BINDING_CONFIG;\n for (const key in scheme) {\n if (scheme[key].required && typeof this._runConfig[key] === 'undefined') {\n throw `Parameter ${key} is required!`;\n }\n if (typeof this._runConfig[key] === 'undefined') {\n this._runConfig[key] = scheme[key].default;\n }\n }\n }\n _normalizeConfig() {\n const config = this._runConfig;\n // absolute and ending in a slash, so the runtime's files resolve inside it\n config.runtimeBaseUrl = new URL(config.runtimeBaseUrl.replace(/\\/?$/, '/'), document.baseURI).href;\n config.scaleMode = SCALE_MODES[('' + config.scaleMode).toLowerCase()] || config.scaleMode;\n if (config.stageAlign) {\n config.stageAlign = normalizeAlign(config.stageAlign) || undefined;\n }\n // params and attributes are strings, but \"false\" shouldn't mean true\n for (const key of ['autoplay', 'hideBeforeLoad', 'smoothBitmaps', 'enableBlends', 'enableFilters']) {\n if (typeof config[key] === 'string') {\n config[key] = !/^(false|0)$/i.test(config[key].trim());\n }\n }\n if (config.splash === 'false') {\n config.splash = false;\n }\n if (config.progress === 'false') {\n config.progress = false;\n }\n if (config.bgcolor) {\n config.backgroundColor = parseColor(config.bgcolor) === null\n ? config.bgcolor\n : '#' + config.bgcolor.replace('#', '');\n }\n }\n _updateStyle() {\n this._style.textContent = `\n :host {\n display: inline-block;\n contain: content;\n width: ${cssSize(this._runConfig.width)};\n height: ${cssSize(this._runConfig.height)};\n }\n iframe {\n display: block;\n width: 100%;\n height: 100%;\n border: none;\n /* matches the frame's own document, or browsers make the frame opaque */\n color-scheme: light;\n }\n `;\n }\n connectedCallback() {\n setTimeout(() => {\n this._loaderHolder = this.querySelector('div.awayfl__loader');\n this._loadGlobalConfig();\n this._mapAttrs();\n this._setDefaults();\n this._normalizeConfig();\n this._style = document.createElement('style');\n this._updateStyle();\n this._root.appendChild(this._style);\n this._constructPlayer();\n });\n }\n disconnectedCallback() {\n this._dropPlayer();\n }\n attributeChangedCallback(name, _oldValue, newValue) {\n if (!this.isConnected) {\n return;\n }\n // if SRC changed, drop runtime and load again\n if (name === 'src' && this._player) {\n this._dropPlayer();\n this._runConfig.src = newValue;\n this._constructPlayer();\n return;\n }\n if ((name === 'width' || name === 'height') && this._style) {\n this._runConfig[name] = newValue;\n this._updateStyle();\n }\n }\n}\nAwayPlayerComponent.BINDING_CONFIG = {\n version: { required: false, default: 'latest' },\n runtimeBaseUrl: { required: false, default: scriptBaseUrl },\n src: { required: true },\n width: { required: false, default: 550 },\n height: { required: false, default: 400 },\n onLoad: { required: false },\n onProgress: { required: false },\n onError: { required: false },\n scaleMode: { required: false, default: 'showAll' },\n stageAlign: { required: false },\n autoplay: { required: false, default: true },\n hideBeforeLoad: { required: false, default: false },\n maxStageScale: { required: false, default: undefined },\n // transparent while loading, then the stage colour, as in Flash\n backgroundColor: { required: false },\n bgcolor: { required: false },\n flashvars: { required: false },\n // an image to show while loading\n splash: { required: false },\n progress: { required: false, default: defaultProgress },\n // runtime\n smoothBitmaps: { required: false, default: false },\n enableBlends: { required: false, default: false },\n enableFilters: { required: false, default: false },\n};\n// both the script and module builds may be loaded\nif (!customElements.get('awayfl-player')) {\n customElements.define('awayfl-player', AwayPlayerComponent);\n}\n","import { observeFlashMarkup, upgradeAll } from './flashMarkup';\nimport { addDomLoadEvent, swfobject, SWFObject } from './swfobject';\nexport { AwayPlayerComponent } from './AwayPlayerComponent';\nexport { swfobject, swfobject as swfObject, SWFObject };\n//@ts-ignore\nexport const VERSION = \"__VERSION__\";\nconst global = window;\n/**\n * Sets options for players, the same as defining AWAY_EMBED_CFG\n */\nexport function configure(config) {\n global.AWAY_EMBED_CFG = Object.assign(global.AWAY_EMBED_CFG || {}, config);\n}\n/**\n * Defines a global that keeps AwayFL's value if a page's own swfobject.js assigns\n * over it later, so embed.js works whether it's included before or after it\n */\nfunction defineGlobal(name, value) {\n const existing = Object.getOwnPropertyDescriptor(window, name);\n if (existing && !existing.configurable) {\n global[name] = value;\n return;\n }\n Object.defineProperty(window, name, {\n configurable: true,\n enumerable: true,\n get: () => value,\n set: (other) => {\n if (other !== value) {\n console.info(`[AwayFL] Ignoring the page's ${name}, as AwayFL provides it`);\n }\n },\n });\n}\nif (global.swfobject || global.swfObject || global.SWFObject) {\n console.info('[AwayFL] Replacing the page\\'s SWFObject');\n}\ndefineGlobal('swfobject', swfobject);\ndefineGlobal('swfObject', swfobject);\ndefineGlobal('SWFObject', SWFObject);\n// upgrade <object>/<embed> markup, including on pages that don't use SWFObject;\n// a tick later, so a module importing this can call configure() first\naddDomLoadEvent(() => setTimeout(() => {\n if ((global.AWAY_EMBED_CFG || {}).autoUpgrade !== false) {\n upgradeAll();\n observeFlashMarkup();\n }\n}));\n"],"names":["FLASH_TYPES","SWF_URL","PLUGIN_ATTRIBUTES","EMBED_PARAMS","paramsOf","el","params","child","Array","from","children","localName","getAttribute","toLowerCase","isFlashElement","tag","indexOf","url","movie","test","hasFlashAncestor","parent","parentElement","createPlayer","attributes","player","document","createElement","name","setAttribute","e","console","warn","param","value","appendChild","upgradeElement","markup","outer","elements","concat","querySelectorAll","filter","set","map","isEmbed","src","attr","readFlashMarkup","Object","assign","parentNode","replaceChild","upgradeAll","root","Element","forEach","isConnected","PLAYER_VERSION","userAgent","navigator","platform","ua","w3","pv","slice","wk","parseFloat","replace","ie","win","mac","encodeURIEnabled","autoHideShow","dynamicStylesheet","dynamicStylesheetMedia","isDomLoaded","readyState","getElement","id","getElementById","isPlayer","addDomLoadEvent","fn","addEventListener","hasPlayerVersion","versionStr","v","String","split","required","parseInt","createCSS","selStr","declStr","mediaStr","newStyleBoolean","head","media","createTextNode","setVisibility","isVisible","visibility","style","CSS","escape","createSWF","attObj","parObj","replaceElemIdStr","data","key","urlEncodeIfNecessary","s","encodeURIComponent","swfobject","registerObject","objectIdStr","swfVersionStr","_xiSwfUrlStr","callbackFn","callbackObj","success","ref","getObjectById","embedSWF","swfUrlStr","widthStr","heightStr","flashvarsObj","att","width","height","par","flashvars","keys","join","buildFlashVars","switchOffAutoHideShow","enableUriEncoding","enable","getFlashPlayerVersion","major","minor","release","hasFlashPlayerVersion","showExpressInstall","_att","_par","removeSWF","objElemIdStr","remove","addLoadEvent","setTimeout","window","getQueryParamValue","q","location","search","hash","pairs","i","length","substring","expressInstallCallback","SWFObject","constructor","swf","w","h","ver","c","quality","this","_attributes","_params","_variables","addParam","getParams","addVariable","getVariable","getVariables","getVariablePairs","useExpressInstall","_path","write","elementId","target","innerHTML","scriptBaseUrl","URL","href","defaultProgress","direction","rect","FLASH_PARAMS","bgcolor","scale","salign","SCALE_MODES","showall","all","noborder","exactfit","noscale","parseFlashVars","result","URLSearchParams","k","parseColor","match","exec","cssSize","AwayPlayerComponent","HTMLElement","observedAttributes","_player","config","_runConfig","cfg","runtimeBaseUrl","super","onError","bind","_root","attachShadow","mode","_getRuntimeUrl","baseUrl","loader","runtime","_dropPlayer","_gameFrame","_arg","f","self","dispatchEvent","ErrorEvent","error","Error","message","_attachRuntimeEvents","fd","contentWindow","detail","once","onLoad","CustomEvent","display","onProgress","_progressConfig","progress","color","getComputedStyle","line","back","_buildTemplate","frame","t","urls","gameConfig","clientWidth","clientHeight","backgroundColor","splash","binary","path","resourceType","meta","maxStageScale","stageScaleMode","scaleMode","stageAlign","stageColor","runtimeFlags","defaultSmoothBitmap","smoothBitmaps","enableBlends","enableFilters","JSON","stringify","_constructPlayer","hideBeforeLoad","srcdoc","_configKey","lower","BINDING_CONFIG","find","_mapAttrs","node","getAttributeNames","_loadGlobalConfig","globalCfg","AWAY_EMBED_CFG","scheme","entries","_setDefaults","default","_normalizeConfig","baseURI","toUpperCase","normalizeAlign","undefined","trim","_updateStyle","_style","textContent","connectedCallback","_loaderHolder","querySelector","disconnectedCallback","attributeChangedCallback","_oldValue","newValue","version","autoplay","customElements","get","define","VERSION","global","configure","defineGlobal","existing","getOwnPropertyDescriptor","configurable","defineProperty","enumerable","other","info","swfObject","autoUpgrade","pending","flush","added","MutationObserver","records","wasEmpty","record","addedNodes","nodeType","Node","ELEMENT_NODE","push","observe","documentElement","childList","subtree","observeFlashMarkup"],"mappings":"AAAA,MACMA,EAAc,CAAC,gCAAiC,4BAChDC,EAAU,iBAIVC,EAAoB,CAAC,UAAW,WAAY,OAAQ,cAAe,OAAQ,MAAO,QAAS,UAI3FC,EAAe,CACjB,YAAa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