game.js 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735
  1. (function(e) {
  2. "use strict";
  3. function t() {}
  4. function n(e) {
  5. if (e = e || {}, this.IS_MASTER = e.isMaster || !1, !this.IS_MASTER) throw Error("The DataStore can only be instantiated by the Master");
  6. this.dataStore = {}
  7. }
  8. function r(e, t) {
  9. if (this.IS_MASTER = e && e.isMaster ? e.isMaster : !1, this.IS_SLAVE = !this.IS_MASTER, this.messenger = null, this.subscribers = {}, this.moduleReady = t ? t : !1, this.gameState = "resume", !e || !e.messenger) throw Error("No messenger passed to the Game module instance");
  10. this.messenger = e.messenger, window.addEventListener ? window.addEventListener("message", this._performAction.bind(this), !1) : window.attachEvent && window.attachEvent("onmessage", this._performAction.bind(this))
  11. }
  12. function i(e, t) {
  13. e = e || {}, this.IS_MASTER = e.isMaster, this.IS_SLAVE = !this.IS_MASTER, this.moduleReady = t ? t : !1, this.messenger = e.messenger, this.data = e.data || null, this._setupMasterEvent()
  14. }
  15. function s(e, t) {
  16. e = e || {}, this.isMaster = e.isMaster, this.isStandalone = e.isStandalone, this.messenger = e.messenger, this.moduleReady = t ? t : !1, this.timeoutAfter = 500, this.timeout = !1, this._callbacks = {
  17. pause: !1,
  18. resume: !1
  19. }
  20. }
  21. function o(e, t) {
  22. e = e || {}, this.IS_MASTER = e.isMaster, this.isStandalone = e.isStandalone, this.messenger = e.messenger, this.eventTracking = e.eventTracking, this.moduleReady = t ? t : !1, this.events = {
  23. GAME_START: "GAME_START",
  24. GAME_END: "GAME_END",
  25. GAME_PAUSE: "GAME_PAUSE",
  26. GAME_CONTINUE: "GAME_CONTINUE",
  27. GAME_MUTE: "GAME_MUTE",
  28. LEVEL_FAIL: "LEVEL_FAIL",
  29. LEVEL_COMPLETE: "LEVEL_COMPLETE"
  30. }, this._setupEvents()
  31. }
  32. function u(e, t) {
  33. e = e || {}, this.IS_MASTER = e.isMaster, this.IS_SLAVE = !this.IS_MASTER, this.data = e.data, this.messenger = e.messenger, this.moduleReady = t ? t : !1, this.gamePlayTracking = {
  34. started: !1,
  35. appid: null,
  36. host: null,
  37. timestamp: null
  38. }, this.timeInGameTracking = {
  39. started: !1,
  40. appid: null,
  41. timestamp: null
  42. }
  43. }
  44. function a(e, t) {
  45. e = e || {}, this.IS_MASTER = e.isMaster, this.IS_SLAVE = !this.IS_MASTER, this.moduleReady = t ? t : !1, this.messenger = e.messenger, this.components = e.components, this.data = e.data || null
  46. }
  47. function f(e) {
  48. var t = "string" == typeof e ? l(e) : e;
  49. t && (this.type = t.type, this.callbackId = t.callbackId, this.data = t.data)
  50. }
  51. function l(e) {
  52. var t, n, r, i = !1,
  53. s = [];
  54. if ("string" == typeof e && (s = e.split("|"), "gameapi" === s[0])) {
  55. s.shift(), t = s.shift(), r = parseInt(s.shift(), 10), n = s.join("|");
  56. try {
  57. i = {
  58. type: t,
  59. callbackId: r,
  60. data: "" !== n ? JSON.parse(n) : ""
  61. }
  62. } catch (o) {}
  63. }
  64. return i
  65. }
  66. function c(e) {
  67. e = e || {}, this.IS_MASTER = "boolean" == typeof e.isMaster ? e.isMaster : !1, this.IS_SLAVE = !this.IS_MASTER, this.api = e.api ? e.api : {}, this._target = e.target ? e.target : {}, this._callbacks = [], this._channels = [], this.IS_MASTER && e.dataStore && (this.dataStore = e.dataStore), this._setupEventListener()
  68. }
  69. function h(e, n, s, u, a) {
  70. this.version = "0.13.7", this.isReady = !1, this._setRole(), this.__ = {}, this.__.dataStore = this.IS_MASTER ? new e({
  71. isMaster: !0
  72. }) : null, this.__.messenger = new n({
  73. isMaster: this.IS_MASTER,
  74. api: this,
  75. target: this._getTarget(),
  76. dataStore: this.__.dataStore
  77. }), this.__.components = new t, this.Branding = new s({
  78. isMaster: this.IS_MASTER,
  79. messenger: this.__.messenger,
  80. components: this.__.components
  81. }, !1), this.__.EventTracking = new u({
  82. isMaster: this.IS_MASTER,
  83. data: null,
  84. messenger: this.__.messenger
  85. }, !1), this.GameBreak = new a({
  86. isMaster: this.IS_MASTER,
  87. isStandalone: this.IS_STANDALONE,
  88. messenger: this.__.messenger
  89. }, !1), this.Game = new r({
  90. isMaster: this.IS_MASTER,
  91. messenger: this.__.messenger
  92. }, !1), this.Score = new i({
  93. isMaster: this.IS_MASTER,
  94. messenger: this.__.messenger
  95. }, !1), this.GameEvent = new o({
  96. isMaster: this.IS_MASTER,
  97. messenger: this.__.messenger,
  98. eventTracking: this.__.EventTracking
  99. }, !1)
  100. }
  101. var p;
  102. (function(e) {
  103. if ("function" == typeof bootstrap) bootstrap("promise", e);
  104. else if ("object" == typeof exports) module.exports = e();
  105. else if ("function" == typeof define && define.amd) define(e);
  106. else if ("undefined" != typeof ses) {
  107. if (!ses.ok()) return;
  108. ses.makeQ = e
  109. } else p = e()
  110. })(function() {
  111. function e(e) {
  112. return function() {
  113. return $.apply(e, arguments)
  114. }
  115. }
  116. function t(e) {
  117. return e === Object(e)
  118. }
  119. function n(e) {
  120. return "[object StopIteration]" === tt(e) || e instanceof z
  121. }
  122. function r(e, t) {
  123. if (q && t.stack && "object" == typeof e && null !== e && e.stack && -1 === e.stack.indexOf(nt)) {
  124. for (var n = [], r = t; r; r = r.source) r.stack && n.unshift(r.stack);
  125. n.unshift(e.stack);
  126. var s = n.join("\n" + nt + "\n");
  127. e.stack = i(s)
  128. }
  129. }
  130. function i(e) {
  131. for (var t = e.split("\n"), n = [], r = 0; t.length > r; ++r) {
  132. var i = t[r];
  133. u(i) || s(i) || !i || n.push(i)
  134. }
  135. return n.join("\n")
  136. }
  137. function s(e) {
  138. return -1 !== e.indexOf("(module.js:") || -1 !== e.indexOf("(node.js:")
  139. }
  140. function o(e) {
  141. var t = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);
  142. if (t) return [t[1], Number(t[2])];
  143. var n = /at ([^ ]+):(\d+):(?:\d+)$/.exec(e);
  144. if (n) return [n[1], Number(n[2])];
  145. var r = /.*@(.+):(\d+)$/.exec(e);
  146. return r ? [r[1], Number(r[2])] : void 0
  147. }
  148. function u(e) {
  149. var t = o(e);
  150. if (!t) return !1;
  151. var n = t[0],
  152. r = t[1];
  153. return n === U && r >= W && ot >= r
  154. }
  155. function a() {
  156. if (q) try {
  157. throw Error()
  158. } catch (e) {
  159. var t = e.stack.split("\n"),
  160. n = t[0].indexOf("@") > 0 ? t[1] : t[2],
  161. r = o(n);
  162. if (!r) return;
  163. return U = r[0], r[1]
  164. }
  165. }
  166. function f(e, t, n) {
  167. return function() {
  168. return "undefined" != typeof console && "function" == typeof console.warn && console.warn(t + " is deprecated, use " + n + " instead.", Error("").stack), e.apply(e, arguments)
  169. }
  170. }
  171. function l(e) {
  172. return g(e) ? e : y(e) ? k(e) : C(e)
  173. }
  174. function c() {
  175. function e(e) {
  176. t = e, s.source = e, K(n, function(t, n) {
  177. V(function() {
  178. e.promiseDispatch.apply(e, n)
  179. })
  180. }, void 0), n = void 0, r = void 0
  181. }
  182. var t, n = [],
  183. r = [],
  184. i = Y(c.prototype),
  185. s = Y(d.prototype);
  186. if (s.promiseDispatch = function(e, i, s) {
  187. var o = J(arguments);
  188. n ? (n.push(o), "when" === i && s[1] && r.push(s[1])) : V(function() {
  189. t.promiseDispatch.apply(t, o)
  190. })
  191. }, s.valueOf = function() {
  192. if (n) return s;
  193. var e = m(t);
  194. return g(e) && (t = e), e
  195. }, s.inspect = function() {
  196. return t ? t.inspect() : {
  197. state: "pending"
  198. }
  199. }, l.longStackSupport && q) try {
  200. throw Error()
  201. } catch (o) {
  202. s.stack = o.stack.substring(o.stack.indexOf("\n") + 1)
  203. }
  204. return i.promise = s, i.resolve = function(n) {
  205. t || e(l(n))
  206. }, i.fulfill = function(n) {
  207. t || e(C(n))
  208. }, i.reject = function(n) {
  209. t || e(N(n))
  210. }, i.notify = function(e) {
  211. t || K(r, function(t, n) {
  212. V(function() {
  213. n(e)
  214. })
  215. }, void 0)
  216. }, i
  217. }
  218. function h(e) {
  219. if ("function" != typeof e) throw new TypeError("resolver must be a function.");
  220. var t = c();
  221. try {
  222. e(t.resolve, t.reject, t.notify)
  223. } catch (n) {
  224. t.reject(n)
  225. }
  226. return t.promise
  227. }
  228. function p(e) {
  229. return h(function(t, n) {
  230. for (var r = 0, i = e.length; i > r; r++) l(e[r]).then(t, n)
  231. })
  232. }
  233. function d(e, t, n) {
  234. void 0 === t && (t = function(e) {
  235. return N(Error("Promise does not support operation: " + e))
  236. }), void 0 === n && (n = function() {
  237. return {
  238. state: "unknown"
  239. }
  240. });
  241. var r = Y(d.prototype);
  242. if (r.promiseDispatch = function(n, i, s) {
  243. var o;
  244. try {
  245. o = e[i] ? e[i].apply(r, s) : t.call(r, i, s)
  246. } catch (u) {
  247. o = N(u)
  248. }
  249. n && n(o)
  250. }, r.inspect = n, n) {
  251. var i = n();
  252. "rejected" === i.state && (r.exception = i.reason), r.valueOf = function() {
  253. var e = n();
  254. return "pending" === e.state || "rejected" === e.state ? r : e.value
  255. }
  256. }
  257. return r
  258. }
  259. function v(e, t, n, r) {
  260. return l(e).then(t, n, r)
  261. }
  262. function m(e) {
  263. if (g(e)) {
  264. var t = e.inspect();
  265. if ("fulfilled" === t.state) return t.value
  266. }
  267. return e
  268. }
  269. function g(e) {
  270. return t(e) && "function" == typeof e.promiseDispatch && "function" == typeof e.inspect
  271. }
  272. function y(e) {
  273. return t(e) && "function" == typeof e.then
  274. }
  275. function b(e) {
  276. return g(e) && "pending" === e.inspect().state
  277. }
  278. function w(e) {
  279. return !g(e) || "fulfilled" === e.inspect().state
  280. }
  281. function E(e) {
  282. return g(e) && "rejected" === e.inspect().state
  283. }
  284. function S() {
  285. rt.length = 0, it.length = 0, st || (st = !0)
  286. }
  287. function x(e, t) {
  288. st && (it.push(e), t && t.stack !== void 0 ? rt.push(t.stack) : rt.push("(no stack) " + t))
  289. }
  290. function T(e) {
  291. if (st) {
  292. var t = Q(it, e); - 1 !== t && (it.splice(t, 1), rt.splice(t, 1))
  293. }
  294. }
  295. function N(e) {
  296. var t = d({
  297. when: function(t) {
  298. return t && T(this), t ? t(e) : this
  299. }
  300. }, function() {
  301. return this
  302. }, function() {
  303. return {
  304. state: "rejected",
  305. reason: e
  306. }
  307. });
  308. return x(t, e), t
  309. }
  310. function C(e) {
  311. return d({
  312. when: function() {
  313. return e
  314. },
  315. get: function(t) {
  316. return e[t]
  317. },
  318. set: function(t, n) {
  319. e[t] = n
  320. },
  321. "delete": function(t) {
  322. delete e[t]
  323. },
  324. post: function(t, n) {
  325. return null === t || void 0 === t ? e.apply(void 0, n) : e[t].apply(e, n)
  326. },
  327. apply: function(t, n) {
  328. return e.apply(t, n)
  329. },
  330. keys: function() {
  331. return et(e)
  332. }
  333. }, void 0, function() {
  334. return {
  335. state: "fulfilled",
  336. value: e
  337. }
  338. })
  339. }
  340. function k(e) {
  341. var t = c();
  342. return V(function() {
  343. try {
  344. e.then(t.resolve, t.reject, t.notify)
  345. } catch (n) {
  346. t.reject(n)
  347. }
  348. }), t.promise
  349. }
  350. function L(e) {
  351. return d({
  352. isDef: function() {}
  353. }, function(t, n) {
  354. return P(e, t, n)
  355. }, function() {
  356. return l(e).inspect()
  357. })
  358. }
  359. function A(e, t, n) {
  360. return l(e).spread(t, n)
  361. }
  362. function O(e) {
  363. return function() {
  364. function t(e, t) {
  365. var o;
  366. if ("undefined" == typeof StopIteration) {
  367. try {
  368. o = r[e](t)
  369. } catch (u) {
  370. return N(u)
  371. }
  372. return o.done ? o.value : v(o.value, i, s)
  373. }
  374. try {
  375. o = r[e](t)
  376. } catch (u) {
  377. return n(u) ? u.value : N(u)
  378. }
  379. return v(o, i, s)
  380. }
  381. var r = e.apply(this, arguments),
  382. i = t.bind(t, "next"),
  383. s = t.bind(t, "throw");
  384. return i()
  385. }
  386. }
  387. function M(e) {
  388. l.done(l.async(e)())
  389. }
  390. function _(e) {
  391. throw new z(e)
  392. }
  393. function D(e) {
  394. return function() {
  395. return A([this, H(arguments)], function(t, n) {
  396. return e.apply(t, n)
  397. })
  398. }
  399. }
  400. function P(e, t, n) {
  401. return l(e).dispatch(t, n)
  402. }
  403. function H(e) {
  404. return v(e, function(e) {
  405. var t = 0,
  406. n = c();
  407. return K(e, function(r, i, s) {
  408. var o;
  409. g(i) && "fulfilled" === (o = i.inspect()).state ? e[s] = o.value : (++t, v(i, function(r) {
  410. e[s] = r, 0 === --t && n.resolve(e)
  411. }, n.reject, function(e) {
  412. n.notify({
  413. index: s,
  414. value: e
  415. })
  416. }))
  417. }, void 0), 0 === t && n.resolve(e), n.promise
  418. })
  419. }
  420. function B(e) {
  421. return v(e, function(e) {
  422. return e = G(e, l), v(H(G(e, function(e) {
  423. return v(e, X, X)
  424. })), function() {
  425. return e
  426. })
  427. })
  428. }
  429. function j(e) {
  430. return l(e).allSettled()
  431. }
  432. function F(e, t) {
  433. return l(e).then(void 0, void 0, t)
  434. }
  435. function I(e, t) {
  436. return l(e).nodeify(t)
  437. }
  438. var q = !1;
  439. try {
  440. throw Error()
  441. } catch (R) {
  442. q = !!R.stack
  443. }
  444. var U, z, W = a(),
  445. X = function() {},
  446. V = function() {
  447. function e() {
  448. for (; t.next;) {
  449. t = t.next;
  450. var n = t.task;
  451. t.task = void 0;
  452. var i = t.domain;
  453. i && (t.domain = void 0, i.enter());
  454. try {
  455. n()
  456. } catch (o) {
  457. if (s) throw i && i.exit(), setTimeout(e, 0), i && i.enter(), o;
  458. setTimeout(function() {
  459. throw o
  460. }, 0)
  461. }
  462. i && i.exit()
  463. }
  464. r = !1
  465. }
  466. var t = {
  467. task: void 0,
  468. next: null
  469. },
  470. n = t,
  471. r = !1,
  472. i = void 0,
  473. s = !1;
  474. if (V = function(e) {
  475. n = n.next = {
  476. task: e,
  477. domain: s && process.domain,
  478. next: null
  479. }, r || (r = !0, i())
  480. }, "undefined" != typeof process && process.nextTick) s = !0, i = function() {
  481. process.nextTick(e)
  482. };
  483. else if ("function" == typeof setImmediate) i = "undefined" != typeof window ? setImmediate.bind(window, e) : function() {
  484. setImmediate(e)
  485. };
  486. else if ("undefined" != typeof MessageChannel) {
  487. var o = new MessageChannel;
  488. o.port1.onmessage = function() {
  489. i = u, o.port1.onmessage = e, e()
  490. };
  491. var u = function() {
  492. o.port2.postMessage(0)
  493. };
  494. i = function() {
  495. setTimeout(e, 0), u()
  496. }
  497. } else i = function() {
  498. setTimeout(e, 0)
  499. };
  500. return V
  501. }(),
  502. $ = Function.call,
  503. J = e(Array.prototype.slice),
  504. K = e(Array.prototype.reduce || function(e, t) {
  505. var n = 0,
  506. r = this.length;
  507. if (1 === arguments.length)
  508. for (;;) {
  509. if (n in this) {
  510. t = this[n++];
  511. break
  512. }
  513. if (++n >= r) throw new TypeError
  514. }
  515. for (; r > n; n++) n in this && (t = e(t, this[n], n));
  516. return t
  517. }),
  518. Q = e(Array.prototype.indexOf || function(e) {
  519. for (var t = 0; this.length > t; t++)
  520. if (this[t] === e) return t;
  521. return -1
  522. }),
  523. G = e(Array.prototype.map || function(e, t) {
  524. var n = this,
  525. r = [];
  526. return K(n, function(i, s, o) {
  527. r.push(e.call(t, s, o, n))
  528. }, void 0), r
  529. }),
  530. Y = Object.create || function(e) {
  531. function t() {}
  532. return t.prototype = e, new t
  533. },
  534. Z = e(Object.prototype.hasOwnProperty),
  535. et = Object.keys || function(e) {
  536. var t = [];
  537. for (var n in e) Z(e, n) && t.push(n);
  538. return t
  539. },
  540. tt = e(Object.prototype.toString);
  541. z = "undefined" != typeof ReturnValue ? ReturnValue : function(e) {
  542. this.value = e
  543. };
  544. var nt = "From previous event:";
  545. l.resolve = l, l.nextTick = V, l.longStackSupport = !1, l.defer = c, c.prototype.makeNodeResolver = function() {
  546. var e = this;
  547. return function(t, n) {
  548. t ? e.reject(t) : arguments.length > 2 ? e.resolve(J(arguments, 1)) : e.resolve(n)
  549. }
  550. }, l.Promise = h, l.promise = h, h.race = p, h.all = H, h.reject = N, h.resolve = l, l.passByCopy = function(e) {
  551. return e
  552. }, d.prototype.passByCopy = function() {
  553. return this
  554. }, l.join = function(e, t) {
  555. return l(e).join(t)
  556. }, d.prototype.join = function(e) {
  557. return l([this, e]).spread(function(e, t) {
  558. if (e === t) return e;
  559. throw Error("Can't join: not the same: " + e + " " + t)
  560. })
  561. }, l.race = p, d.prototype.race = function() {
  562. return this.then(l.race)
  563. }, l.makePromise = d, d.prototype.toString = function() {
  564. return "[object Promise]"
  565. }, d.prototype.then = function(e, t, n) {
  566. function i(t) {
  567. try {
  568. return "function" == typeof e ? e(t) : t
  569. } catch (n) {
  570. return N(n)
  571. }
  572. }
  573. function s(e) {
  574. if ("function" == typeof t) {
  575. r(e, u);
  576. try {
  577. return t(e)
  578. } catch (n) {
  579. return N(n)
  580. }
  581. }
  582. return N(e)
  583. }
  584. function o(e) {
  585. return "function" == typeof n ? n(e) : e
  586. }
  587. var u = this,
  588. a = c(),
  589. f = !1;
  590. return V(function() {
  591. u.promiseDispatch(function(e) {
  592. f || (f = !0, a.resolve(i(e)))
  593. }, "when", [
  594. function(e) {
  595. f || (f = !0, a.resolve(s(e)))
  596. }
  597. ])
  598. }), u.promiseDispatch(void 0, "when", [void 0,
  599. function(e) {
  600. var t, n = !1;
  601. try {
  602. t = o(e)
  603. } catch (r) {
  604. if (n = !0, !l.onerror) throw r;
  605. l.onerror(r)
  606. }
  607. n || a.notify(t)
  608. }
  609. ]), a.promise
  610. }, l.when = v, d.prototype.thenResolve = function(e) {
  611. return this.then(function() {
  612. return e
  613. })
  614. }, l.thenResolve = function(e, t) {
  615. return l(e).thenResolve(t)
  616. }, d.prototype.thenReject = function(e) {
  617. return this.then(function() {
  618. throw e
  619. })
  620. }, l.thenReject = function(e, t) {
  621. return l(e).thenReject(t)
  622. }, l.nearer = m, l.isPromise = g, l.isPromiseAlike = y, l.isPending = b, d.prototype.isPending = function() {
  623. return "pending" === this.inspect().state
  624. }, l.isFulfilled = w, d.prototype.isFulfilled = function() {
  625. return "fulfilled" === this.inspect().state
  626. }, l.isRejected = E, d.prototype.isRejected = function() {
  627. return "rejected" === this.inspect().state
  628. };
  629. var rt = [],
  630. it = [],
  631. st = !0;
  632. l.resetUnhandledRejections = S, l.getUnhandledReasons = function() {
  633. return rt.slice()
  634. }, l.stopUnhandledRejectionTracking = function() {
  635. S(), st = !1
  636. }, S(), l.reject = N, l.fulfill = C, l.master = L, l.spread = A, d.prototype.spread = function(e, t) {
  637. return this.all().then(function(t) {
  638. return e.apply(void 0, t)
  639. }, t)
  640. }, l.async = O, l.spawn = M, l["return"] = _, l.promised = D, l.dispatch = P, d.prototype.dispatch = function(e, t) {
  641. var n = this,
  642. r = c();
  643. return V(function() {
  644. n.promiseDispatch(r.resolve, e, t)
  645. }), r.promise
  646. }, l.get = function(e, t) {
  647. return l(e).dispatch("get", [t])
  648. }, d.prototype.get = function(e) {
  649. return this.dispatch("get", [e])
  650. }, l.set = function(e, t, n) {
  651. return l(e).dispatch("set", [t, n])
  652. }, d.prototype.set = function(e, t) {
  653. return this.dispatch("set", [e, t])
  654. }, l.del = l["delete"] = function(e, t) {
  655. return l(e).dispatch("delete", [t])
  656. }, d.prototype.del = d.prototype["delete"] = function(e) {
  657. return this.dispatch("delete", [e])
  658. }, l.mapply = l.post = function(e, t, n) {
  659. return l(e).dispatch("post", [t, n])
  660. }, d.prototype.mapply = d.prototype.post = function(e, t) {
  661. return this.dispatch("post", [e, t])
  662. }, l.send = l.mcall = l.invoke = function(e, t) {
  663. return l(e).dispatch("post", [t, J(arguments, 2)])
  664. }, d.prototype.send = d.prototype.mcall = d.prototype.invoke = function(e) {
  665. return this.dispatch("post", [e, J(arguments, 1)])
  666. }, l.fapply = function(e, t) {
  667. return l(e).dispatch("apply", [void 0, t])
  668. }, d.prototype.fapply = function(e) {
  669. return this.dispatch("apply", [void 0, e])
  670. }, l["try"] = l.fcall = function(e) {
  671. return l(e).dispatch("apply", [void 0, J(arguments, 1)])
  672. }, d.prototype.fcall = function() {
  673. return this.dispatch("apply", [void 0, J(arguments)])
  674. }, l.fbind = function(e) {
  675. var t = l(e),
  676. n = J(arguments, 1);
  677. return function() {
  678. return t.dispatch("apply", [this, n.concat(J(arguments))])
  679. }
  680. }, d.prototype.fbind = function() {
  681. var e = this,
  682. t = J(arguments);
  683. return function() {
  684. return e.dispatch("apply", [this, t.concat(J(arguments))])
  685. }
  686. }, l.keys = function(e) {
  687. return l(e).dispatch("keys", [])
  688. }, d.prototype.keys = function() {
  689. return this.dispatch("keys", [])
  690. }, l.all = H, d.prototype.all = function() {
  691. return H(this)
  692. }, l.allResolved = f(B, "allResolved", "allSettled"), d.prototype.allResolved = function() {
  693. return B(this)
  694. }, l.allSettled = j, d.prototype.allSettled = function() {
  695. return this.then(function(e) {
  696. return H(G(e, function(e) {
  697. function t() {
  698. return e.inspect()
  699. }
  700. return e = l(e), e.then(t, t)
  701. }))
  702. })
  703. }, l.fail = l["catch"] = function(e, t) {
  704. return l(e).then(void 0, t)
  705. }, d.prototype.fail = d.prototype["catch"] = function(e) {
  706. return this.then(void 0, e)
  707. }, l.progress = F, d.prototype.progress = function(e) {
  708. return this.then(void 0, void 0, e)
  709. }, l.fin = l["finally"] = function(e, t) {
  710. return l(e)["finally"](t)
  711. }, d.prototype.fin = d.prototype["finally"] = function(e) {
  712. return e = l(e), this.then(function(t) {
  713. return e.fcall().then(function() {
  714. return t
  715. })
  716. }, function(t) {
  717. return e.fcall().then(function() {
  718. throw t
  719. })
  720. })
  721. }, l.done = function(e, t, n, r) {
  722. return l(e).done(t, n, r)
  723. }, d.prototype.done = function(e, t, n) {
  724. var i = function(e) {
  725. V(function() {
  726. if (r(e, s), !l.onerror) throw e;
  727. l.onerror(e)
  728. })
  729. },
  730. s = e || t || n ? this.then(e, t, n) : this;
  731. "object" == typeof process && process && process.domain && (i = process.domain.bind(i)), s.then(void 0, i)
  732. }, l.timeout = function(e, t, n) {
  733. return l(e).timeout(t, n)
  734. }, d.prototype.timeout = function(e, t) {
  735. var n = c(),
  736. r = setTimeout(function() {
  737. n.reject(Error(t || "Timed out after " + e + " ms"))
  738. }, e);
  739. return this.then(function(e) {
  740. clearTimeout(r), n.resolve(e)
  741. }, function(e) {
  742. clearTimeout(r), n.reject(e)
  743. }, n.notify), n.promise
  744. }, l.delay = function(e, t) {
  745. return void 0 === t && (t = e, e = void 0), l(e).delay(t)
  746. }, d.prototype.delay = function(e) {
  747. return this.then(function(t) {
  748. var n = c();
  749. return setTimeout(function() {
  750. n.resolve(t)
  751. }, e), n.promise
  752. })
  753. }, l.nfapply = function(e, t) {
  754. return l(e).nfapply(t)
  755. }, d.prototype.nfapply = function(e) {
  756. var t = c(),
  757. n = J(e);
  758. return n.push(t.makeNodeResolver()), this.fapply(n).fail(t.reject), t.promise
  759. }, l.nfcall = function(e) {
  760. var t = J(arguments, 1);
  761. return l(e).nfapply(t)
  762. }, d.prototype.nfcall = function() {
  763. var e = J(arguments),
  764. t = c();
  765. return e.push(t.makeNodeResolver()), this.fapply(e).fail(t.reject), t.promise
  766. }, l.nfbind = l.denodeify = function(e) {
  767. var t = J(arguments, 1);
  768. return function() {
  769. var n = t.concat(J(arguments)),
  770. r = c();
  771. return n.push(r.makeNodeResolver()), l(e).fapply(n).fail(r.reject), r.promise
  772. }
  773. }, d.prototype.nfbind = d.prototype.denodeify = function() {
  774. var e = J(arguments);
  775. return e.unshift(this), l.denodeify.apply(void 0, e)
  776. }, l.nbind = function(e, t) {
  777. var n = J(arguments, 2);
  778. return function() {
  779. function r() {
  780. return e.apply(t, arguments)
  781. }
  782. var i = n.concat(J(arguments)),
  783. s = c();
  784. return i.push(s.makeNodeResolver()), l(r).fapply(i).fail(s.reject), s.promise
  785. }
  786. }, d.prototype.nbind = function() {
  787. var e = J(arguments, 0);
  788. return e.unshift(this), l.nbind.apply(void 0, e)
  789. }, l.nmapply = l.npost = function(e, t, n) {
  790. return l(e).npost(t, n)
  791. }, d.prototype.nmapply = d.prototype.npost = function(e, t) {
  792. var n = J(t || []),
  793. r = c();
  794. return n.push(r.makeNodeResolver()), this.dispatch("post", [e, n]).fail(r.reject), r.promise
  795. }, l.nsend = l.nmcall = l.ninvoke = function(e, t) {
  796. var n = J(arguments, 2),
  797. r = c();
  798. return n.push(r.makeNodeResolver()), l(e).dispatch("post", [t, n]).fail(r.reject), r.promise
  799. }, d.prototype.nsend = d.prototype.nmcall = d.prototype.ninvoke = function(e) {
  800. var t = J(arguments, 1),
  801. n = c();
  802. return t.push(n.makeNodeResolver()), this.dispatch("post", [e, t]).fail(n.reject), n.promise
  803. }, l.nodeify = I, d.prototype.nodeify = function(e) {
  804. return e ? (this.then(function(t) {
  805. V(function() {
  806. e(null, t)
  807. })
  808. }, function(t) {
  809. V(function() {
  810. e(t)
  811. })
  812. }), void 0) : this
  813. };
  814. var ot = a();
  815. return l
  816. }),
  817. function(e) {
  818. var t = "Promise" in e && "cast" in e.Promise && "resolve" in e.Promise && "reject" in e.Promise && "all" in e.Promise && "race" in e.Promise && "spread" in e.Promise;
  819. t || (e.Promise = p.promise, e.Promise.all = p.all, e.Promise.timeout = p.timeout, p.stopUnhandledRejectionTracking())
  820. }(e !== void 0 ? e : this);
  821. var d = {
  822. timeout: 3e3
  823. };
  824. d.getGameConfig = function() {
  825. var e = p.defer();
  826. return SpilGames(["JSLib"], function(t) {
  827. var n = t.get("current.game.integration.info");
  828. n ? e.resolve(n) : e.reject(Error("No data retrieved from JSLib"))
  829. }), e.promise.timeout(this.timeout)
  830. }, d.getBrandingConfig = function(e) {
  831. var t = p.defer(),
  832. n = "http://api.configar.org/cf/pb/1/configs",
  833. r = e.portal.siteId,
  834. i = e.portal.channelId,
  835. s = e.portal.applicationId;
  836. return SpilGames(["Net", "JSLib"], function(e, o) {
  837. e.send({
  838. url: [n, i, r, s].join("/"),
  839. type: "GET",
  840. dataType: "JSON"
  841. }, function(e) {
  842. if (e && e.configar) window.postMessage(new f({
  843. type: "success",
  844. callbackId: null,
  845. data: "log.configar.getBranding.success"
  846. }), "*"), t.resolve(e.configar);
  847. else {
  848. var n = {};
  849. try {
  850. n = o.get("configar.data.cached") || n
  851. } catch (r) {}
  852. t.reject(n)
  853. }
  854. })
  855. }), t.promise.timeout(this.timeout)
  856. };
  857. var v = {};
  858. v.argsToArray = function(e) {
  859. return e ? Array.prototype.slice.apply(e) : []
  860. }, v.isA10 = function() {
  861. return /a10.com/.test(window.location.host)
  862. }, v.disableKeys = function(e) {
  863. var t = e.keyCode;
  864. (8 === t || 9 === t || t >= 32 && 40 >= t || 46 === t) && e.preventDefault()
  865. }, v.trackGA = function() {
  866. try {
  867. if ("www8.agame.com" === window.location.host) {
  868. var e = function(e, t, n, r, i, s, o) {
  869. e.GoogleAnalyticsObject = i, e[i] = e[i] || function() {
  870. (e[i].q = e[i].q || []).push(arguments)
  871. }, e[i].l = 1 * new Date, s = t.createElement(n), o = t.getElementsByTagName(n)[0], s.async = 1, s.src = r, o.parentNode.insertBefore(s, o)
  872. };
  873. e(window, document, "script", "#", "ga"), ga("create", "UA-8223336-3", "auto"), ga("send", "pageview")
  874. }
  875. } catch (t) {}
  876. }, v.getRole = function() {
  877. var e = "function" == typeof window.SpilGames,
  878. t = window.self !== window.top,
  879. n = null;
  880. if (v.isA10()) return window.onkeydown = this.disableKeys, {
  881. IS_MASTER: !0,
  882. IS_SLAVE: !0,
  883. IS_STANDALONE: !0
  884. };
  885. if (e) {
  886. var r = document.getElementById("#iframegame");
  887. switch (r) {
  888. case "null":
  889. n = {
  890. IS_MASTER: !0,
  891. IS_SLAVE: !0,
  892. IS_STANDALONE: !1
  893. };
  894. break;
  895. default:
  896. n = {
  897. IS_MASTER: !0,
  898. IS_SLAVE: !1,
  899. IS_STANDALONE: !1
  900. }
  901. }
  902. } else t ? (window.onkeydown = this.disableKeys, this.trackGA(), n = {
  903. IS_MASTER: !1,
  904. IS_SLAVE: !0,
  905. IS_STANDALONE: !1
  906. }) : (window.onkeydown = this.disableKeys, this.trackGA(), n = {
  907. IS_MASTER: !0,
  908. IS_SLAVE: !0,
  909. IS_STANDALONE: !0
  910. });
  911. return n
  912. }, v.callConfigar = function(e, t) {
  913. var n, r, i = e.site || 500,
  914. s = e.channel || 100,
  915. o = e.id || null;
  916. window.XDomainRequest ? (n = new XDomainRequest, n.onload = function() {
  917. t(200, n.responseText)
  918. }, n.onerror = function() {
  919. t(404, null)
  920. }, n.onprogress = function() {}) : window.XMLHttpRequest ? (n = new XMLHttpRequest, n.onreadystatechange = function() {
  921. 4 === n.readyState && t(n.status, n.responseText)
  922. }) : window.ActiveXObject && (n = new ActiveXObject("Microsoft.XMLHTTP"), n.onreadystatechange = function() {
  923. 4 === n.readyState && t(n.status, n.responseText)
  924. }), o && (r = ["http://api.configar.org/cf/pb/1/configs", s, i, o].join("/"), n.open("GET", r, !0), n.timeout = 3e3, n.ontimeout = function() {
  925. t(404, null)
  926. }, n.send())
  927. }, v.isWrapped = function() {
  928. return void 0 !== (window.PhoneGap || window.cordova || window.Cordova)
  929. }, v.isArray = Array.isArray || function(e) {
  930. return "[object Array]" === Object.prototype.toString.call(e)
  931. }, v._getQueryString = function() {
  932. return window.location.search
  933. }, v._getPortalHost = function() {
  934. return window && window.location && window.location.hostname ? window.location.hostname : "unknown"
  935. }, v.validateSchema = function(e, t) {
  936. for (var n in t)
  937. if (t.hasOwnProperty(n)) {
  938. if (!e.hasOwnProperty(n)) return {
  939. error: "Wrong argument passed: " + n
  940. };
  941. if (e.hasOwnProperty(n)) {
  942. var r = "object" == typeof e[n] ? e[n].type : e[n];
  943. if (t[n].constructor.name !== r) return {
  944. error: "Wrong value type for " + n + ": expected " + e[n] + ", got " + t[n].constructor.name
  945. };
  946. var i = e[n] && e[n].values || [];
  947. if (-1 === i.indexOf(t[n])) return {
  948. error: "Wrong value for " + n + ": expected " + i.join(" or ") + ", got " + t[n]
  949. }
  950. }
  951. }
  952. return {
  953. error: !1
  954. }
  955. };
  956. var m = {};
  957. m.getGameConfig = function() {
  958. return d.getGameConfig().catch(function() {
  959. return m.getLocalConfig()
  960. })
  961. }, m.getBrandingConfig = function(e) {
  962. return new Promise(function(t) {
  963. return d.getBrandingConfig(e).then(t, function(e) {
  964. t(e), window.postMessage(new f({
  965. type: "warning",
  966. callbackId: null,
  967. data: "log.configar.getBranding.failure"
  968. }), "*")
  969. })
  970. })
  971. }, m.getLocalConfig = function(e) {
  972. e = e && Object.keys(e).length ? e : {
  973. portal: {},
  974. game: {},
  975. branding: {}
  976. };
  977. var t = {
  978. game: {
  979. applicationId: e.portal.applicationId || "0",
  980. contentarId: e.portal.contentarId || "0",
  981. info: e.game.info || {},
  982. settings: e.game.objectSettings || {},
  983. features: {
  984. achievements: e.game.achievements || !1,
  985. gameSidePanel: e.game.gameSidePanel || !1,
  986. highscores: e.game.highscores || !1,
  987. recommendedGames: e.game.recommendedGames || !1
  988. }
  989. },
  990. user: {
  991. authenticated: e.portal.authenticated || !1,
  992. username: e.portal.username || ""
  993. },
  994. portal: {
  995. host: v._getPortalHost(),
  996. siteId: e.portal.siteId || 0,
  997. channelId: e.portal.channelId || 0,
  998. applicationId: e.portal.applicationId || "0"
  999. },
  1000. branding: e.branding || {}
  1001. };
  1002. return t.branding.logo = t.branding.logo || {}, t.branding.logo.url = t.branding.logo.url || !1, t.branding.logo.image = t.branding.logo.image || !1, t
  1003. }, m.setupStandaloneMode = function(e, t) {
  1004. var n = {},
  1005. r = {
  1006. configar: {
  1007. branding: {
  1008. main: {
  1009. label: "main",
  1010. image: "#",
  1011. url: "#",
  1012. style: "",
  1013. width: "202",
  1014. height: "50",
  1015. mime: "image/png",
  1016. type: "png",
  1017. handler: "newTab",
  1018. blacklisted: !0
  1019. },
  1020. logo: {
  1021. label: "logo",
  1022. image: "#",
  1023. url: "#",
  1024. style: "",
  1025. width: "202",
  1026. height: "50",
  1027. mime: "image/png",
  1028. type: "png",
  1029. handler: "newTab",
  1030. blacklisted: !1
  1031. },
  1032. more_games: {
  1033. label: "more_games",
  1034. image: null,
  1035. url: "#",
  1036. style: "",
  1037. width: null,
  1038. height: null,
  1039. mime: null,
  1040. type: null,
  1041. handler: "newTab",
  1042. blacklisted: !1
  1043. },
  1044. splash_screen: {
  1045. label: "splash_screen",
  1046. image: "place_holder_string",
  1047. url: "#",
  1048. style: "",
  1049. width: "0",
  1050. height: "0",
  1051. mime: "image/png",
  1052. type: "png",
  1053. handler: "newTab",
  1054. blacklisted: !1
  1055. }
  1056. }
  1057. }
  1058. };
  1059. n.JSLib = {
  1060. memory: {},
  1061. _channels: {},
  1062. get: function(e) {
  1063. return this.memory[e] ? this.memory[e] : !1
  1064. },
  1065. set: function(e, t) {
  1066. return this.memory[e] = t, t
  1067. },
  1068. publish: function(e, t) {
  1069. this._channels[e] && this._channels[e].forEach(function(e) {
  1070. try {
  1071. e.fn.call(this, t)
  1072. } catch (n) {}
  1073. })
  1074. },
  1075. subscribe: function(e, t) {
  1076. if ("function" != typeof t) throw Error("Callback has to be a function");
  1077. if ("string" != typeof e) throw Error("Channel name has to be a string");
  1078. this._channels[e] || (this._channels[e] = []), this._channels[e].push({
  1079. fn: t
  1080. })
  1081. }
  1082. }, n.Net = {
  1083. send: function(e, t) {
  1084. t.call(this, {})
  1085. }
  1086. }, window.SpilGamesBootstrap = [], window.SpilGames = function() {
  1087. var e = arguments;
  1088. if (e[0] && "string" == typeof e[0]) n.JSLib.publish(e[0], e[1] || null);
  1089. else if (e[0] && e[0] instanceof Array) {
  1090. var t, r, i = [];
  1091. for (t = 0, r = e[0].length; r > t; t++) i.push(n[e[0][t]]);
  1092. e[1].apply(this, i)
  1093. }
  1094. }, e && e.id ? v.callConfigar(e, function(n, i) {
  1095. if (200 === n && "string" == typeof i && JSON.parse(i)) {
  1096. var s = JSON.parse(i);
  1097. t.call(this, {
  1098. branding: s.configar && s.configar.branding ? s.configar.branding : r.configar.branding,
  1099. portal: {
  1100. applicationId: e.id,
  1101. siteId: e.site ? e.site : 500,
  1102. channelId: e.channel ? e.channel : 100
  1103. }
  1104. })
  1105. } else t.call(this, {
  1106. branding: r.configar.branding
  1107. })
  1108. }) : t.call(this, {
  1109. branding: r.configar.branding
  1110. })
  1111. }, m.getCachedConfig = function() {}, t.prototype.newTab = function(e) {
  1112. var t = window.navigator.userAgent.toLowerCase().match(/android.*applewebkit\/([\d.]+)/),
  1113. n = t && 537 > t[1],
  1114. r = n ? "_self" : "_blank",
  1115. i = e.url,
  1116. s = window.open(i, r);
  1117. return s && s.focus(), s
  1118. }, t.prototype.displayOnTop = function(e) {
  1119. if (e === void 0 || e.url === void 0 || "string" != typeof e.url || e.action === void 0 || "function" != typeof e.action) return e.callback !== void 0 || "function" == typeof e.callback ? (e.callback(), void 0) : void 0;
  1120. var t = document.createElement("div"),
  1121. n = e.url,
  1122. r = e.action,
  1123. i = e.callback;
  1124. return t.setAttribute("id", "spilgames-splash-screen-sample"), document.body.appendChild(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%", t.style.position = "absolute", t.style.zIndex = "10000", t.onclick = r, n && (t.style.background = "url('" + n + "') center center no-repeat #FFF"), window.setTimeout(function() {
  1125. var e = document.getElementById("spilgames-splash-screen-sample");
  1126. e.parentNode.removeChild(e), i && i()
  1127. }, 2e3), t
  1128. }, n.prototype.get = function(e) {
  1129. for (var t = this.dataStore, n = e.split("."), r = n.length, i = 0; r - 1 > i; i++) {
  1130. if (!t[n[i]]) return null;
  1131. t = t[n[i]]
  1132. }
  1133. return t[n[r - 1]] || null
  1134. }, n.prototype.put = function(e, t) {
  1135. for (var n = this.dataStore, r = e.split("."), i = r.length, s = 0; i - 1 > s; s++) {
  1136. var o = r[s];
  1137. n[o] || (n[o] = {}), n = n[o]
  1138. }
  1139. n[r[i - 1]] = t
  1140. }, n.prototype.set = function(e, t) {
  1141. this.put(e, t);
  1142. var n = Date.parse(new Date);
  1143. return this.notify({
  1144. type: "new",
  1145. key: e,
  1146. current: t,
  1147. previous: null,
  1148. timestamp: n
  1149. }), t
  1150. }, n.prototype.update = function(e, t) {
  1151. var n, r, i = null;
  1152. return this.get(e) ? (n = "update", i = this.get(e)) : n = "new", this.put(e, t), r = Date.parse(new Date), this.notify({
  1153. type: n,
  1154. key: e,
  1155. current: t,
  1156. previous: i,
  1157. timestamp: r
  1158. }), t
  1159. }, n.prototype.remove = function(e) {
  1160. if (this.get(e)) {
  1161. var t, n = this.get(e);
  1162. return this.put(e, null), t = Date.parse(new Date), this.notify({
  1163. type: "remove",
  1164. key: e,
  1165. current: null,
  1166. previous: n,
  1167. timestamp: t
  1168. }), !0
  1169. }
  1170. return !1
  1171. }, n.prototype._setCache = function(e) {
  1172. this.dataStore = e
  1173. }, n.prototype._getCache = function() {
  1174. return this.dataStore
  1175. }, n.prototype.notify = function(e) {
  1176. if (this.IS_MASTER) {
  1177. var t = (new f({
  1178. type: "datachange",
  1179. callbackId: null,
  1180. data: e
  1181. })).encode();
  1182. return window.postMessage(t, "*"), t
  1183. }
  1184. }, r.prototype._performAction = function(e) {
  1185. var t = new f(e.data || {}),
  1186. n = this.messenger,
  1187. r = this.subscribers || {};
  1188. if (t && t.type && t.data) switch (t.type) {
  1189. case "gameEvent":
  1190. t.data[0] && r[t.data[0]] && r[t.data[0]].length > 0 ? r[t.data[0]].forEach(function(e) {
  1191. e.call(this), n._postMessage([t.data[0], {
  1192. origin: "slave"
  1193. },
  1194. null
  1195. ], null, "gameState")
  1196. }) : t.data[0] && t.data[1] && "slave" === t.data[1].origin && "function" == typeof SWFtoJS && SWFtoJS({
  1197. call: t.data[0],
  1198. params: {}
  1199. });
  1200. break;
  1201. case "gameState":
  1202. t.data[0] && t.data[1] && "slave" === t.data[1].origin && (this.gameState = t.data[0])
  1203. }
  1204. }, r.prototype.on = function(e, t) {
  1205. this.IS_SLAVE && (this.subscribers[e] || (this.subscribers[e] = []), this.subscribers[e].push(t))
  1206. }, r.prototype.emit = function(e) {
  1207. if (!this.IS_MASTER) throw Error("Only the master environment can emit game events");
  1208. if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
  1209. if (e === this.gameState) throw Error("The game is already in state: `" + e + "`");
  1210. this.messenger._postMessage([e, {
  1211. origin: "master"
  1212. },
  1213. null
  1214. ], null, "gameEvent")
  1215. }, i.prototype._setupMasterEvent = function() {
  1216. this.IS_MASTER && this.messenger.subscribe("gameapi.score", this.submit, this)
  1217. }, i.prototype.submit = function(e) {
  1218. if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
  1219. return this.IS_MASTER ? "function" == typeof SWFtoJS && SWFtoJS({
  1220. call: "UPDATE_HIGHSCORE",
  1221. params: {
  1222. score: e
  1223. }
  1224. }) : (this.messenger._postMessage(e, void 0, "gameapi.score"), this.messenger._postMessage(["log.gameapi.score.submit", {
  1225. origin: "slave",
  1226. score: e
  1227. },
  1228. null
  1229. ], null, "log")), {
  1230. success: !0,
  1231. value: e
  1232. }
  1233. }, s.prototype.init = function() {
  1234. this._setupEvents()
  1235. }, s.prototype._setupEvents = function() {
  1236. var e = this.messenger;
  1237. this.isMaster ? (SpilGames(["JSLib"], function(t) {
  1238. t.subscribe("ad.request.accepted", function(t) {
  1239. !0 === t && (SpilGames("game.ad.accepted", !0), e._postMessage(!0, void 0, "ad.request.accepted"))
  1240. }), t.subscribe("ad.complete", function() {
  1241. e._postMessage("", "", "ad.complete")
  1242. })
  1243. }), this.messenger.subscribe("game.ad.request", this._triggerAd, this)) : (this.messenger.subscribe("ad.request.accepted", this._onAdAccepted, this), this.messenger.subscribe("ad.complete", this._onAdCompleted, this))
  1244. }, s.prototype._triggerAd = function() {
  1245. SpilGames("game.ad.request")
  1246. }, s.prototype._runCallback = function(e) {
  1247. this._callbacks[e] && (this._callbacks[e](), this._callbacks[e] = !1)
  1248. }, s.prototype.request = function(e, t) {
  1249. var n = this;
  1250. if ("function" != typeof e) throw Error("pauseGame argument should be a function");
  1251. if ("function" != typeof t) throw Error("resumeGame argument should be a function");
  1252. if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
  1253. this._callbacks.pause = e, this._callbacks.resume = t, this.messenger._postMessage(void 0, void 0, "game.ad.request"), this.isMaster || this.messenger._postMessage(["log.gameapi.ad.requested", {
  1254. origin: "slave"
  1255. },
  1256. null
  1257. ], null, "log"), this.timeout = setTimeout(function() {
  1258. n._requestTimeout()
  1259. }, this.timeoutAfter)
  1260. }, s.prototype._onAdAccepted = function(e) {
  1261. var t = this.messenger;
  1262. this.timeout && clearTimeout(this.timeout), !this.isMaster && e && (t._postMessage(["log.gameapi.ad.start", {
  1263. origin: "slave"
  1264. },
  1265. null
  1266. ], null, "log"), this._runCallback("pause"))
  1267. }, s.prototype._onAdCompleted = function() {
  1268. var e = this.messenger;
  1269. this.isMaster || e._postMessage(["log.gameapi.ad.complete", {
  1270. origin: "slave"
  1271. },
  1272. null
  1273. ], null, "log"), this._runCallback("resume")
  1274. }, s.prototype._requestTimeout = function() {
  1275. this._onAdCompleted()
  1276. }, o.prototype._setupEvents = function() {
  1277. this.IS_MASTER && this.messenger.subscribe("gameapi.gameevent", this.emit, this)
  1278. }, o.prototype._validateEvent = function(e) {
  1279. var t = !1;
  1280. return this.events[e] && this.events[e] !== void 0 && (t = !0), t
  1281. }, o.prototype.emit = function(e, t) {
  1282. if (!this.moduleReady) throw Error("This method cannot be called before the API is loaded");
  1283. this._validateEvent(e) ? this.IS_MASTER ? "function" == typeof SWFtoJS && SWFtoJS({
  1284. call: e
  1285. }) : (this.messenger._postMessage(e, void 0, "gameapi.gameevent"), this.messenger._postMessage(["log.gameapi.gameevent.emit", {
  1286. origin: "slave",
  1287. evt: e
  1288. },
  1289. null
  1290. ], null, "log")) : this.IS_MASTER || this.messenger._postMessage(["log.gameapi.gameevent.emit", {
  1291. origin: "slave"
  1292. },
  1293. null
  1294. ], null, "log")
  1295. }, u.prototype.init = function(e) {
  1296. e = e || {}, this.data = e.data || this.data;
  1297. var t = this.data && this.data.game && this.data.game.applicationId ? this.data.game.applicationId : null,
  1298. n = new Date,
  1299. r = window.location.hostname;
  1300. (this.IS_SLAVE || v.isWrapped()) && this.startInternalTracking(t, n, r)
  1301. }, u.prototype._createEventObject = function(e, t, n) {
  1302. return {
  1303. eventCategory: e,
  1304. eventAction: t,
  1305. properties: n
  1306. }
  1307. }, u.prototype._sendSETEvent = function(e, t, n) {
  1308. return this.messenger && (this.IS_SLAVE || v.isWrapped()) && this.messenger.post("tracker.event." + e, t, n), t
  1309. }, u.prototype.trackGamePlay = function(e) {
  1310. if (!this.gamePlayTracking.started) return !1;
  1311. var t = this.gamePlayTracking.gid,
  1312. n = this.gamePlayTracking.timestamp,
  1313. r = this.gamePlayTracking.host,
  1314. i = this._createEventObject("game", "gameplay", {
  1315. applicationId: t,
  1316. start: n,
  1317. host: r
  1318. });
  1319. return this._sendSETEvent("express", i, e), i
  1320. }, u.prototype.trackTimeInGame = function(e) {
  1321. if (!this.timeInGameTracking.started) return !1;
  1322. var t = this.timeInGameTracking.gid,
  1323. n = this.timeInGameTracking.timestamp,
  1324. r = this._createEventObject("game", "heartbeat", {
  1325. applicationId: t,
  1326. start: n
  1327. });
  1328. return this._sendSETEvent("express", r, e), r
  1329. }, u.prototype.startInternalTracking = function(e, t, n) {
  1330. var r = this,
  1331. i = 6e4,
  1332. s = function(e) {
  1333. if (!e) throw "Could not save the time in game"
  1334. };
  1335. return this.moduleReady ? e ? (this.gamePlayTracking.gid = e, this.gamePlayTracking.timestamp = Date.parse(t), this.gamePlayTracking.host = n, this.gamePlayTracking.started = !0, this.timeInGameTracking.gid = e, this.timeInGameTracking.timestamp = Date.parse(t), this.timeInGameTracking.started = !0, this.trackGamePlay(function(e) {
  1336. if (!e) throw "Could not save the game play"
  1337. }), this.trackTimeInGame(s), setInterval(function() {
  1338. r.trackTimeInGame(s)
  1339. }, i), this.gamePlayTracking.started && this.timeInGameTracking.started) : {
  1340. error: "No application ID defined for this game"
  1341. } : {
  1342. error: "This method cannot be called before the API is loaded"
  1343. }
  1344. }, a.prototype.init = function(e) {
  1345. e = e || {}, this.data = e.data || this.data
  1346. }, a.prototype.getLogo = function(e) {
  1347. if (!this.moduleReady) return {
  1348. error: "This method cannot be called before the API is loaded"
  1349. };
  1350. var t = this.IS_MASTER ? "master" : "slave";
  1351. this.messenger._postMessage(["log.branding.getlogo", {
  1352. origin: t
  1353. },
  1354. null
  1355. ], null, "log");
  1356. var n, r, i = {
  1357. type: {
  1358. type: "String",
  1359. values: ["png"]
  1360. },
  1361. width: "Number",
  1362. height: "Number"
  1363. };
  1364. return n = this._getLink("logo"), e && "object" == typeof e && (r = v.validateSchema(i, e), r.error && (n.error = r.error)), n
  1365. }, a.prototype.getLink = function(e) {
  1366. if (!e) return {
  1367. error: "No link identifier provided"
  1368. };
  1369. var t = this.listLinks();
  1370. if (-1 !== t.indexOf(e)) {
  1371. var n = this.IS_MASTER ? "master" : "slave";
  1372. return this.messenger._postMessage(["log.branding.getlink", {
  1373. origin: n,
  1374. linkName: e
  1375. },
  1376. null
  1377. ], null, "log"), this._getLink(e)
  1378. }
  1379. return {
  1380. error: "Invalid option: '" + e + "'",
  1381. action: function() {}
  1382. }
  1383. }, a.prototype._getLink = function(e) {
  1384. if (!e) return {
  1385. error: "No link identifier provided"
  1386. };
  1387. var t = this.data && this.data.branding ? this.data.branding : {};
  1388. return t && t[e] ? {
  1389. linkName: e,
  1390. image: t[e].image || !1,
  1391. action: this._executeHandler.bind(this, e)
  1392. } : {
  1393. error: "Invalid option: '" + e + "'",
  1394. action: function() {}
  1395. }
  1396. }, a.prototype._getGMLink = function(e) {
  1397. var t = null;
  1398. if (!e) return {
  1399. error: "No link identifier provided"
  1400. };
  1401. var n = this.data && this.data.branding ? this.data.branding : {};
  1402. return n && n[e] ? (t = this._tagUrl(n[e].url, e), {
  1403. linkName: e,
  1404. url: t
  1405. }) : {
  1406. error: "Invalid option: '" + e + "'",
  1407. url: null
  1408. }
  1409. }, a.prototype.getLinks = function() {
  1410. var e = {},
  1411. t = this.listLinks();
  1412. if (0 === t.length) e = {
  1413. more_games: {
  1414. action: function() {}
  1415. }
  1416. };
  1417. else
  1418. for (var n = 0; t.length > n; n++) {
  1419. var r = t[n];
  1420. e[r] = this._getLink(r)
  1421. }
  1422. return e
  1423. }, a.prototype._executeHandler = function(e) {
  1424. var t = this.data && this.data.branding ? this.data.branding : {},
  1425. n = t[e],
  1426. r = n.handler,
  1427. i = this._tagUrl(n.url, e);
  1428. if (n.url && n.url.length > 0 && r && this.components[r]) {
  1429. var s = this.IS_MASTER ? "master" : "slave";
  1430. return this.messenger._postMessage(["log.branding.linkAction", {
  1431. origin: s,
  1432. linkName: e
  1433. },
  1434. null
  1435. ], null, "log"), this.components[r]({
  1436. url: i
  1437. })
  1438. }
  1439. return function() {}
  1440. }, a.prototype.listLinks = function() {
  1441. var e = [],
  1442. t = this.data && this.data.branding ? this.data.branding : {},
  1443. n = Object.keys(t);
  1444. return e = n.filter(function(e) {
  1445. return !t[e].blacklisted
  1446. })
  1447. }, a.prototype.getSplashScreen = function() {
  1448. var e, t = this.IS_MASTER ? "master" : "slave";
  1449. if (this.data && this.data.branding && this.data.branding.splash_screen) {
  1450. var n = !0;
  1451. this.data.branding.splash_screen.image || this.data.branding.splash_screen.url || (n = !1), e = {
  1452. show: n,
  1453. action: this._getLink("splash_screen").action || function() {}
  1454. }
  1455. } else e = {
  1456. show: !0,
  1457. action: function() {}
  1458. };
  1459. return this.messenger._postMessage(["log.branding.splashScreen", {
  1460. origin: t
  1461. },
  1462. null
  1463. ], null, "log"), e
  1464. }, a.prototype.displaySplashScreen = function(e) {
  1465. if ("function" != typeof e) throw Error("argument passed to displaySplashScreen method should be a function");
  1466. var t = this.IS_MASTER ? "master" : "slave",
  1467. n = this._getLink("logo").image;
  1468. n && this.getSplashScreen().show ? ("master" !== t && this.messenger._postMessage(["log.branding.displaySplashScreen", {
  1469. origin: t
  1470. },
  1471. null
  1472. ], null, "log"), this.components.displayOnTop({
  1473. url: n,
  1474. action: this.getSplashScreen().action,
  1475. callback: e
  1476. })) : e()
  1477. }, a.prototype._tagUrl = function(e, t) {
  1478. var n, r, i, s = this.data && this.data.portal ? this.data.portal : {},
  1479. o = this.data && this.data.game ? this.data.game : {},
  1480. u = parseInt(s.siteId, 10);
  1481. if ("string" != typeof e) throw Error("No url specified");
  1482. return n = "string" == typeof t ? t : "logo", r = "brandedgames_" + (u > 0 && 500 > u ? "internal" : "external"), i = ["utm_medium=" + r, "utm_campaign=" + o.applicationId, "utm_source=" + s.host, "utm_content=" + n].join("&"), e += e.indexOf("?") > -1 ? "&" : "?", e + i
  1483. }, f.prototype.encode = function() {
  1484. var e = ["gameapi", this.type, this.callbackId, this.data ? JSON.stringify(this.data) : ""].join("|");
  1485. return e
  1486. }, c.prototype._postMessage = function(e, t, n) {
  1487. var r, i;
  1488. r = v.isArray(e) && "function" == typeof e[e.length - 1] ? this._callbacks.push(e.pop()) - 1 : t, i = (new f({
  1489. type: n || "jslib",
  1490. callbackId: r,
  1491. data: e
  1492. })).encode(), this._target.postMessage(i, "*")
  1493. }, c.prototype._callJSLib = function() {
  1494. SpilGames.apply(SpilGames, v.argsToArray(arguments))
  1495. }, c.prototype._setupEventListener = function() {
  1496. window.addEventListener ? window.addEventListener("message", this._handleMessage.bind(this), !1) : window.attachEvent && window.attachEvent("onmessage", this._handleMessage.bind(this))
  1497. }, c.prototype._handleMessage = function(e) {
  1498. var t, n, r, i, s = this,
  1499. o = new f(e.data);
  1500. if (o)
  1501. if (t = o.type, n = o.callbackId, r = o.data, i = this._callbacks[n] || !1, this.IS_MASTER) switch (t) {
  1502. case "jslib":
  1503. "Array" === r.constructor.name && r.push(function(e) {
  1504. s._postMessage(e, n)
  1505. }), this._callJSLib.apply(this, r);
  1506. break;
  1507. case "ugapi":
  1508. this._handleUGARequest(e);
  1509. break;
  1510. case "datachange":
  1511. this._postMessage(r, null, "datachange");
  1512. break;
  1513. default:
  1514. this.publish(t, r)
  1515. } else this.IS_SLAVE && ("function" == typeof i ? (delete this._callbacks[n], i(r)) : "datachange" === t || "jslib" !== t && this.publish(t, r));
  1516. return !1
  1517. }, c.prototype._handleUGARequest = function(e) {
  1518. var t, n, r, i = this,
  1519. s = new f(e.data);
  1520. if (s) switch (t = s.data[0], n = s.callbackId, r = s.data[1] ? s.data[1] : null, t) {
  1521. case "GameAPI.data":
  1522. i._postMessage(this.dataStore._getCache(), n, "ugapi");
  1523. break;
  1524. case "GameAPI.isReady":
  1525. i._postMessage({
  1526. isready: this.api.isReady
  1527. }, n, "ugapi")
  1528. }
  1529. }, c.prototype.post = function() {
  1530. var e = v.argsToArray(arguments);
  1531. return this.IS_SLAVE ? this._postMessage(e) : this._callJSLib.apply(this, e), this
  1532. }, c.prototype.publish = function(e, t) {
  1533. return this._channels[e] && this._channels[e].forEach(function(e) {
  1534. try {
  1535. e.fn.call(e.ctx, t)
  1536. } catch (n) {}
  1537. }), this
  1538. }, c.prototype.subscribe = function(e, t, n) {
  1539. if ("function" != typeof t) throw Error("Callback has to be a function");
  1540. if ("string" != typeof e) throw Error("Channel name has to be a string");
  1541. return this._channels[e] || (this._channels[e] = []), this._channels[e].push({
  1542. fn: t,
  1543. ctx: n
  1544. }), this
  1545. }, c.prototype.unsubscribe = function(e, t) {
  1546. return this._channels[e] && "function" == typeof t && (this._channels[e] = this._channels[e].filter(function(e) {
  1547. return e.fn !== t
  1548. })), this
  1549. }, c.prototype.subscribeOnce = function(e, t, n) {
  1550. function r(n) {
  1551. i.unsubscribe(e, r), t.call(this, n)
  1552. }
  1553. var i = this;
  1554. return this.subscribe(e, r, n)
  1555. }, c.prototype.requestFromParent = function(e, t, n) {
  1556. if (!this.IS_SLAVE) throw "You are the parent, stop talking to yourself";
  1557. t = t || {}, this._postMessage([e, t, n], null, "ugapi")
  1558. }, h.prototype._setRole = function() {
  1559. var e = v.getRole();
  1560. this.IS_MASTER = e.IS_MASTER, this.IS_SLAVE = e.IS_SLAVE, this.IS_STANDALONE = e.IS_STANDALONE
  1561. }, h.prototype._getTarget = function() {
  1562. if (this.IS_STANDALONE) return window;
  1563. var e = document.getElementById("iframegame"),
  1564. t = e && e.contentWindow ? e.contentWindow : window.parent;
  1565. return this.IS_MASTER ? t : window.parent
  1566. }, h.prototype.loadAPI = function(e, t) {
  1567. function r(t) {
  1568. return f.IS_MASTER && (t = i(t)), f.isReady = !0, f.Branding.moduleReady = !0, f.__.EventTracking.moduleReady = !0, f.GameBreak.moduleReady = !0, f.Game.moduleReady = !0, f.Score.moduleReady = !0, f.GameEvent.moduleReady = !0, f.Branding.init({
  1569. data: t
  1570. }), f.__.EventTracking.init({
  1571. data: t
  1572. }), f.GameBreak.init(), f.__.messenger._postMessage(["log.gameapi.loadapi.finish", {
  1573. origin: l,
  1574. version: f.version
  1575. },
  1576. null
  1577. ], null, "log"), e(f)
  1578. }
  1579. function i(e) {
  1580. var t = e.game || {},
  1581. n = e.user || {},
  1582. r = e.portal || {},
  1583. i = e.branding || {};
  1584. return m.getLocalConfig({
  1585. game: t,
  1586. user: n,
  1587. portal: r,
  1588. branding: i
  1589. })
  1590. }
  1591. function s() {
  1592. f.__.messenger.requestFromParent("GameAPI.data", {}, function(e) {
  1593. r(e)
  1594. })
  1595. }
  1596. function o() {
  1597. f.IS_STANDALONE = !0, f.IS_MASTER = !0, f.IS_SLAVE = !0, f.__.dataStore = new n({
  1598. isMaster: !0
  1599. }), t = t || null, m.setupStandaloneMode(t, function(e) {
  1600. f.__.dataStore._setCache(i(e)), r(e)
  1601. })
  1602. }
  1603. function u() {
  1604. f.__.messenger.requestFromParent("GameAPI.isReady", {}, function(e) {
  1605. a && clearTimeout(a), e.isready ? s() : 5 > c ? (c++, setTimeout(u, 500)) : s()
  1606. })
  1607. }
  1608. var a, f = this,
  1609. l = this.IS_MASTER ? "master" : "slave",
  1610. c = 0;
  1611. if ("function" != typeof e) throw Error("argument passed to loadAPI method should be a function");
  1612. return !0 === this.isReady ? (window.console && window.console.log && console.log("WARNING: Detected multiple executions of GameAPI.loadAPI(). This method should only be executed once per page load!"), e(f)) : (this.__.messenger._postMessage(["log.gameapi.loadapi.start", {
  1613. origin: l,
  1614. version: f.version,
  1615. spildata: t
  1616. },
  1617. null
  1618. ], null, "log"), this.IS_STANDALONE ? o() : this.IS_MASTER ? m.getGameConfig().then(function(e) {
  1619. m.getBrandingConfig(e).then(function(t) {
  1620. e && !e.isError && (e.branding = t.branding, f.__.dataStore._setCache(i(e))), r(e)
  1621. })
  1622. }) : (a = setTimeout(o, 600), u()), void 0)
  1623. };
  1624. var g = new h(n, c, a, u, s);
  1625. "function" == typeof define && define.amd && define("GameAPI", g), e.GameAPI = g
  1626. })(window),
  1627. function() {
  1628. "use strict";
  1629. function e(e) {
  1630. e && (e.setTargetValueAtTime || (e.setTargetValueAtTime = e.setTargetAtTime))
  1631. }
  1632. window.hasOwnProperty("AudioContext") && (window.webkitAudioContext = AudioContext, AudioContext.prototype.hasOwnProperty("internal_createGain") || (AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain, AudioContext.prototype.createGain = function() {
  1633. var n = this.internal_createGain();
  1634. return e(n.gain), n
  1635. }), AudioContext.prototype.hasOwnProperty("internal_createDelay") || (AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay, AudioContext.prototype.createDelay = function() {
  1636. var n = this.internal_createDelay();
  1637. return e(n.delayTime), n
  1638. }), AudioContext.prototype.hasOwnProperty("internal_createBufferSource") || (AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource, AudioContext.prototype.createBufferSource = function() {
  1639. var n = this.internal_createBufferSource();
  1640. return n.noteOn || (n.noteOn = n.start), n.noteGrainOn || (n.noteGrainOn = n.start), n.noteOff || (n.noteOff = n.stop), e(n.playbackRate), n
  1641. }), AudioContext.prototype.hasOwnProperty("internal_createDynamicsCompressor") || (AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor, AudioContext.prototype.createDynamicsCompressor = function() {
  1642. var n = this.internal_createDynamicsCompressor();
  1643. return e(n.threshold), e(n.knee), e(n.ratio), e(n.reduction), e(n.attack), e(n.release), n
  1644. }), AudioContext.prototype.hasOwnProperty("internal_createBiquadFilter") || (AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter, AudioContext.prototype.createBiquadFilter = function() {
  1645. var n = this.internal_createBiquadFilter();
  1646. e(n.frequency), e(n.detune), e(n.Q), e(n.gain);
  1647. for (var r = ["LOWPASS", "HIGHPASS", "BANDPASS", "LOWSHELF", "HIGHSHELF", "PEAKING", "NOTCH", "ALLPASS"], i = 0; r.length > i; ++i) {
  1648. var s = r[i],
  1649. o = s.toLowerCase();
  1650. n.hasOwnProperty(s) || (n[s] = o)
  1651. }
  1652. return n
  1653. }), AudioContext.prototype.hasOwnProperty("internal_createOscillator") || AudioContext.prototype.hasOwnProperty("createOscillator") && (AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator, AudioContext.prototype.createOscillator = function() {
  1654. var n = this.internal_createOscillator();
  1655. n.noteOn || (n.noteOn = n.start), n.noteOff || (n.noteOff = n.stop), e(n.frequency), e(n.detune);
  1656. for (var r = ["SINE", "SQUARE", "SAWTOOTH", "TRIANGLE", "CUSTOM"], i = 0; r.length > i; ++i) {
  1657. var s = r[i],
  1658. o = s.toLowerCase();
  1659. n.hasOwnProperty(s) || (n[s] = o)
  1660. }
  1661. return n.hasOwnProperty("setWaveTable") || (n.setWaveTable = n.setPeriodicTable), n
  1662. }), AudioContext.prototype.hasOwnProperty("internal_createPanner") || (AudioContext.prototype.internal_createPanner = AudioContext.prototype.createPanner, AudioContext.prototype.createPanner = function() {
  1663. var e = this.internal_createPanner(),
  1664. t = {
  1665. EQUALPOWER: "equalpower",
  1666. HRTF: "HRTF",
  1667. LINEAR_DISTANCE: "linear",
  1668. INVERSE_DISTANCE: "inverse",
  1669. EXPONENTIAL_DISTANCE: "exponential"
  1670. };
  1671. for (var n in t) {
  1672. var r = t[n];
  1673. e.hasOwnProperty(n) || (e[n] = r)
  1674. }
  1675. return e
  1676. }), AudioContext.prototype.hasOwnProperty("createGainNode") || (AudioContext.prototype.createGainNode = AudioContext.prototype.createGain), AudioContext.prototype.hasOwnProperty("createDelayNode") || (AudioContext.prototype.createDelayNode = AudioContext.prototype.createDelay), AudioContext.prototype.hasOwnProperty("createJavaScriptNode") || (AudioContext.prototype.createJavaScriptNode = AudioContext.prototype.createScriptProcessor), AudioContext.prototype.hasOwnProperty("createWaveTable") || (AudioContext.prototype.createWaveTable = AudioContext.prototype.createPeriodicWave))
  1677. }(window)