import createWaflashModule from "./waflash.js?2021111901"; const WAFLASH_BASE_URL = "https://clubpenguinadvanced.github.io/waflash-demo/alt/emulator2/waflash_latest/", createWaflash = (t, e) => { if (t || (t = ""), (e = e || {}).flashVars && (t += (t.includes("?") ? "&" : "?") + e.flashVars), self != top) return; let a = { arguments: [t, "0", e.gpu ? "webgl" : "default", !0 === e.enableFilters ? "0" : "1"], options: e, preRun: [], postRun: [], locateFile: (t, e) => WAFLASH_BASE_URL + t + "?2021111901", print(t) { console.log(t) }, printErr(t) { console.error(t) }, canvas: function() { const t = document.getElementById("canvas"); return t.addEventListener("webglcontextlost", (function(t) { alert("WebGL context lost. You will need to reload the page."), t.preventDefault() }), !1), t }(), statusElement: document.getElementById("waflashStatus"), setStatus: t => { if (!t) return; t = t.replace(/Downloading data\.\.\. \((\d+)\/(\d+)\)/, ((t, e, a) => "Downloading player... " + Math.floor(parseInt(e) / parseInt(a) * 100) + "%")), console.log("WAFLASH> " + t); const e = ''; 0 == t.indexOf("Downloading player...") && (t = "Downloading player " + e), 0 == t.indexOf("Loading SWF...") && (t = "Loading SWF " + e), a.statusElement.innerHTML = t, a.showStatus() }, showStatus() { a.statusElement.style.display = "block" }, hideStatus() { a.statusElement.style.display = "none" }, unload() {}, WAFLASH: { hal: { url_transformRequestUrl(t) { const a = "owner" == window.T?.config?.ROLE; const n = function(t) { let n = e.resourceMap; if (Array.isArray(n)) for (let [e, a] of n) { if ("string" != typeof e && !e instanceof RegExp) continue; const n = e instanceof RegExp || "~" == e.charAt(0); if (!n && "=" == e.charAt(0)) { if (e = e.substr(1), e == t) return a } else if (n) { let n = e instanceof RegExp ? e : new RegExp(e = e.substr(1)); if (n.test(t)) { return null === a ? null : t.replace(n, a) } } else { let n = t.indexOf("?"), s = "", o = t; if (n >= 0 && (o = t.substring(0, n), s = "&" + t.substr(n + 1)), e == o) return null === a ? null : a + s } } else if (a && console.log("old-style resourceMap mode!!!!!!!!!!!!!!!"), n = window.wafResourceMap || e.resourceMap, n && "object" == typeof n) for (let [e, a] of Object.entries(n)) { const n = "=" == e.charAt(0), s = "~" == e.charAt(0); if (n) { if (e = e.substr(1), e == t) return a } else if (s) { e = e.substr(1); let n = new RegExp(e); if (n.test(t)) { return null === a ? null : t.replace(n, a) } } else { let n = t.indexOf("?"), s = "", o = t; if (n >= 0 && (o = t.substring(0, n), s = "&" + t.substr(n + 1)), e == o) return null === a ? null : a + s } } var s = t.lastIndexOf("/"); if (s >= 0) { let e, a = t.substr(0, s + 1), n = t.substr(s + 1), o = n.substr(n.lastIndexOf(".")); if (".swf" == o) { if ("http://images.hangame.co.kr/static/flash/flashgame/game/lang/" == a) return "https://swfs.waflash.io/uploads/hangame/" + n; if ("http://img.ibravo.com/game/source/" == a) return "https://darkviky.github.io/assets/ibravo/" + n; if ("http://www.ibravo.com/web/game/popup/signed.aspx" == t) return "https://darkviky.github.io/assets/ibravo/web/game/popup/signed.aspx"; if (t.lastIndexOf("/ads/default/loading.swf") >= 0) return "https://darkviky.github.io/assets/dearyou/loading.swf" } if (t.lastIndexOf("/loading/loading640x480.swf") > 0) return "https://blog.kakaocdn.net/dn/Ek0nH/btq3lUD7jcQ/gEYgOPz64grAZsrYbmX0Dk/loading640x480.swf?attach=1&knm=tfile.swf"; if (t.lastIndexOf("/loading/loading.swf") > 0) return "https://blog.kakaocdn.net/dn/Vv9ag/btq3mYTdq8w/hHts2k7y4VYKN9y5f9eT5K/loading.swf?attach=1&knm=tfile.swf"; if (t.lastIndexOf("/loading/result2_v3_2.swf") > 0) return "https://blog.kakaocdn.net/dn/eqSlVE/btqSX7mihN2/zlCy2XV43iQX4GahzZDkIk/result2_v3_2.swf?attach=1&knm=tfile.swf"; if (t.startsWith("http://www.kiniwini.com/games/common/user_info.php")) return "https://blog.kakaocdn.net/dn/RhEMp/btq17btItmP/cJHm5tYvKfKe1ztq8XOzw1/user_info.php.txt?attach=1&knm=tfile.txt"; if (t.indexOf("//panyroom.jr.naver.com/game/gameset.php") > 0) return "https://xwvy1u8cxc.execute-api.ap-northeast-2.amazonaws.com/prod/panyroom_game_gameset"; if (e = "http://zuzunza.joins.com/all/check_id.php", t.startsWith(e)) return "https://ieazco9902.execute-api.ap-northeast-2.amazonaws.com/zuzunza/all/check_id" + t.substr(e.length); if (e = "http://www.zuzunza.com/all/check_id.php", t.startsWith(e)) return "https://ieazco9902.execute-api.ap-northeast-2.amazonaws.com/zuzunza/all/check_id" + t.substr(e.length); if (0 == t.lastIndexOf("https://blog.kakaocdn.net/swf/loading_default.swf")) return "https://blog.kakaocdn.net/dn/ccsyy7/btqU4Zs74KE/CLNg8AqGHfOkobsqhoKWok/loading_default.swf?attach=1&knm=tfile.swf"; if (t.match(/^http\:\/\/file\.barunson\.com\/upfile\/object\/Loading\/loading[0-9a-z]+\.swf$/)) return "https://blog.kakaocdn.net/dn/bq8LCx/btq6W2p55q8/U7FtlDnJwgORqSF3zE7WuK/barunson-loading.waf?attach=1&knm=tfile.waf"; if (t.startsWith("http://file.barunson.com/upfile/object/Loading/www.swf")) return "https://blog.kakaocdn.net/dn/ytl0f/btq6AtDeWRF/utoYw63znPZzuBDKeIOFd1/barunson-logo.waf?attach=1&knm=tfile.waf"; if (t.endsWith("/loading/loading_lg.swf")) return "https://blog.kakaocdn.net/dn/uyECc/btq6BEraq42/M2P9hB84fAZFDsJSJgLCA0/loading_lg.swf?attach=1&knm=tfile.swf"; if (".mp3" == o && "http://juter01.tistory.com/attachment/" == a) return "https://darkviky.github.io/assets/gog/" + n } return [".kakaocdn.net", ".github.io", ".waflash.io", "waflash.cdn.ntruss.com", ".archive.org"].some((e => t.indexOf(e) > 0)) ? t.replace("http://", "https://") : null }(t); return a && t != n && (n ? console.log(`redirect ${t} => ${n}`) : console.error(`redirect ${t} => ${n}`)), n } } } }; window.waflash = a, window.onerror = (t, e, n, s, o) => { "string" != typeof t && (o = t.error, t.filename || t.fileName, t.lineno || t.lineNumber, t.colno || t.columnNumber, t = t.message || t.name || o.message || o.name); let l = ""; o && o.stack && (l = o.stack); let r = document.location + "|" + t; a.ga && a.ga("event", document.location.origin, { event_category: "error", event_label: r, non_interaction: !0, send_to: a.gid }) }, a.setStatus("Prepairing..."), createWaflashModule(a).then((t => { console.log("WAFLASH> Waflash module created!") })) }, destroyWaflash = () => { console.log("WAFLASH> Waflash component will unmount!"), waflash.unload(), waflash = null, window.waflash = null }; export { createWaflash, destroyWaflash };