rocket-loader.min.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. !function() {
  2. "use strict";
  3. function t() {
  4. return "cf-marker-" + Math.random().toString().slice(2)
  5. }
  6. function e() {
  7. for (var t = [], e = 0; e < arguments.length; e++)
  8. t[e] = arguments[e];
  9. (n = console.warn || console.log).call.apply(n, [console, "[ROCKET LOADER] "].concat(t));
  10. var n
  11. }
  12. function n(t, e) {
  13. var n = e.parentNode;
  14. n && h(t, n, e)
  15. }
  16. function r(t, e) {
  17. h(t, e, e.childNodes[0])
  18. }
  19. function o(t) {
  20. var e = t.parentNode;
  21. e && e.removeChild(t)
  22. }
  23. function i(t) {
  24. var e = t.namespaceURI === A ? "xlink:href" : "src";
  25. return t.getAttribute(e)
  26. }
  27. function a(t, e) {
  28. var n = t.type.substr(e.length);
  29. return !(n && !E[n.trim()]) && ((!k || !t.hasAttribute("nomodule")) && !(!k && "module" === n))
  30. }
  31. function c(t) {
  32. return a(t, "")
  33. }
  34. function s(t, e) {
  35. return function(n) {
  36. if (e(),
  37. t)
  38. return t.call(this, n)
  39. }
  40. }
  41. function u(t, e) {
  42. t.onload = s(t.onload, e),
  43. t.onerror = s(t.onerror, e)
  44. }
  45. function p(t) {
  46. var e = document.createElementNS(t.namespaceURI, "script");
  47. e.async = t.hasAttribute("async"),
  48. e.textContent = t.textContent;
  49. for (var n = 0; n < t.attributes.length; n++) {
  50. var r = t.attributes[n];
  51. try {
  52. r.namespaceURI ? e.setAttributeNS(r.namespaceURI, r.name, r.value) : e.setAttribute(r.name, r.value)
  53. } catch (o) {}
  54. }
  55. return e
  56. }
  57. function l(t, e) {
  58. var n = new I(e);
  59. t.dispatchEvent(n)
  60. }
  61. function d(e) {
  62. var n = e.namespaceURI === A
  63. , r = t();
  64. e.setAttribute(r, "");
  65. var i = n ? "<svg>" + e.outerHTML + "</svg>" : e.outerHTML;
  66. L.call(document, i);
  67. var a = document.querySelector("[" + r + "]");
  68. if (a) {
  69. a.removeAttribute(r);
  70. var c = n && a.parentNode;
  71. c && o(c)
  72. }
  73. return a
  74. }
  75. function f(t) {
  76. if (t && "handleEvent"in t) {
  77. var e = t.handleEvent;
  78. return "function" == typeof e ? e.bind(t) : e
  79. }
  80. return t
  81. }
  82. function h(t, e, n) {
  83. var r = n ? function(t) {
  84. return e.insertBefore(t, n)
  85. }
  86. : function(t) {
  87. return e.appendChild(t)
  88. }
  89. ;
  90. Array.prototype.slice.call(t).forEach(r)
  91. }
  92. function v() {
  93. return /chrome/i.test(navigator.userAgent) && /google/i.test(navigator.vendor)
  94. }
  95. function y(t, e) {
  96. function n() {
  97. this.constructor = t
  98. }
  99. H(t, e),
  100. t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype,
  101. new n)
  102. }
  103. function m(t) {
  104. return t instanceof Window ? ["load"] : t instanceof Document ? ["DOMContentLoaded", "readystatechange"] : []
  105. }
  106. function b(t) {
  107. var e = t.getAttribute(R);
  108. if (!e)
  109. return null;
  110. var n = e.split(T);
  111. return {
  112. nonce: n[0],
  113. handlerPrefixLength: +n[1],
  114. bailout: !t.hasAttribute("defer")
  115. }
  116. }
  117. function g(t) {
  118. var e = B + t.nonce;
  119. Array.prototype.forEach.call(document.querySelectorAll("[" + e + "]"), function(n) {
  120. n.removeAttribute(e),
  121. Array.prototype.forEach.call(n.attributes, function(e) {
  122. /^on/.test(e.name) && "function" != typeof n[e.name] && n.setAttribute(e.name, e.value.substring(t.handlerPrefixLength))
  123. })
  124. })
  125. }
  126. function S() {
  127. var t = window;
  128. "undefined" != typeof Promise && (t.__cfQR = {
  129. done: new Promise(function(t) {
  130. return U = t
  131. }
  132. )
  133. })
  134. }
  135. function w(t) {
  136. var e = new N(t)
  137. , n = new C(e);
  138. e.harvestScriptsInDocument(),
  139. new W(e,{
  140. nonce: t,
  141. blocking: !0,
  142. docWriteSimulator: n,
  143. callback: function() {}
  144. }).run()
  145. }
  146. function x(t) {
  147. var e = new N(t)
  148. , n = new C(e);
  149. e.harvestScriptsInDocument();
  150. var r = new W(e,{
  151. nonce: t,
  152. blocking: !1,
  153. docWriteSimulator: n,
  154. callback: function() {
  155. window.__cfRLUnblockHandlers = !0,
  156. r.removePreloadHints(),
  157. P(t)
  158. }
  159. });
  160. r.insertPreloadHints(),
  161. M.runOnLoad(function() {
  162. r.run()
  163. })
  164. }
  165. function P(t) {
  166. var e = new O(t);
  167. M.simulateStateBeforeDeferScriptsActivation(),
  168. e.harvestDeferScriptsInDocument(),
  169. new W(e,{
  170. nonce: t,
  171. blocking: !1,
  172. callback: function() {
  173. M.simulateStateAfterDeferScriptsActivation(),
  174. U && U()
  175. }
  176. }).run()
  177. }
  178. var A = "http://www.w3.org/2000/svg"
  179. , E = {
  180. "application/ecmascript": !0,
  181. "application/javascript": !0,
  182. "application/x-ecmascript": !0,
  183. "application/x-javascript": !0,
  184. "text/ecmascript": !0,
  185. "text/javascript": !0,
  186. "text/javascript1.0": !0,
  187. "text/javascript1.1": !0,
  188. "text/javascript1.2": !0,
  189. "text/javascript1.3": !0,
  190. "text/javascript1.4": !0,
  191. "text/javascript1.5": !0,
  192. "text/jscript": !0,
  193. "text/livescript": !0,
  194. "text/x-ecmascript": !0,
  195. "text/x-javascript": !0,
  196. module: !0
  197. }
  198. , k = void 0 !== document.createElement("script").noModule
  199. , I = function() {
  200. var t = window;
  201. return t.__rocketLoaderEventCtor || Object.defineProperty(t, "__rocketLoaderEventCtor", {
  202. value: Event
  203. }),
  204. t.__rocketLoaderEventCtor
  205. }()
  206. , L = document.write
  207. , _ = document.writeln
  208. , H = Object.setPrototypeOf || {
  209. __proto__: []
  210. }instanceof Array && function(t, e) {
  211. t.__proto__ = e
  212. }
  213. || function(t, e) {
  214. for (var n in e)
  215. e.hasOwnProperty(n) && (t[n] = e[n])
  216. }
  217. , D = function() {
  218. function t(t) {
  219. this.nonce = t,
  220. this.items = []
  221. }
  222. return Object.defineProperty(t.prototype, "hasItems", {
  223. get: function() {
  224. return this.items.length > 0
  225. },
  226. enumerable: !0,
  227. configurable: !0
  228. }),
  229. t.prototype.pop = function() {
  230. return this.items.pop()
  231. }
  232. ,
  233. t.prototype.forEach = function(t) {
  234. this.items.forEach(function(e) {
  235. var n = e.script;
  236. return t(n)
  237. })
  238. }
  239. ,
  240. t.prototype.harvestScripts = function(t, e) {
  241. var n = this
  242. , r = e.filter
  243. , o = e.mutate;
  244. Array.prototype.slice.call(t.querySelectorAll("script")).filter(r).reverse().forEach(function(t) {
  245. o(t),
  246. n.pushScriptOnStack(t)
  247. })
  248. }
  249. ,
  250. t.prototype.pushScriptOnStack = function(t) {
  251. var e = t.parentNode
  252. , n = this.createPlaceholder(t)
  253. , r = !!i(t);
  254. e.replaceChild(n, t),
  255. this.items.push({
  256. script: t,
  257. placeholder: n,
  258. external: r,
  259. async: r && t.hasAttribute("async"),
  260. executable: c(t)
  261. })
  262. }
  263. ,
  264. t.prototype.hasNonce = function(t) {
  265. return 0 === (t.getAttribute("type") || "").indexOf(this.nonce)
  266. }
  267. ,
  268. t.prototype.removeNonce = function(t) {
  269. t.type = t.type.substr(this.nonce.length)
  270. }
  271. ,
  272. t.prototype.makeNonExecutable = function(t) {
  273. t.type = this.nonce + t.type
  274. }
  275. ,
  276. t.prototype.isPendingDeferScript = function(t) {
  277. return t.hasAttribute("defer") || t.type === this.nonce + "module" && !t.hasAttribute("async")
  278. }
  279. ,
  280. t
  281. }()
  282. , N = function(t) {
  283. function e() {
  284. return null !== t && t.apply(this, arguments) || this
  285. }
  286. return y(e, t),
  287. e.prototype.harvestScriptsInDocument = function() {
  288. var t = this;
  289. this.harvestScripts(document, {
  290. filter: function(e) {
  291. return t.hasNonce(e)
  292. },
  293. mutate: function(e) {
  294. t.isPendingDeferScript(e) || t.removeNonce(e)
  295. }
  296. })
  297. }
  298. ,
  299. e.prototype.harvestScriptsAfterDocWrite = function(t) {
  300. var e = this;
  301. this.harvestScripts(t, {
  302. filter: c,
  303. mutate: function(t) {
  304. e.isPendingDeferScript(t) && e.makeNonExecutable(t)
  305. }
  306. })
  307. }
  308. ,
  309. e.prototype.createPlaceholder = function(t) {
  310. return document.createComment(t.outerHTML)
  311. }
  312. ,
  313. e
  314. }(D)
  315. , O = function(t) {
  316. function e() {
  317. return null !== t && t.apply(this, arguments) || this
  318. }
  319. return y(e, t),
  320. e.prototype.harvestDeferScriptsInDocument = function() {
  321. var t = this;
  322. this.harvestScripts(document, {
  323. filter: function(e) {
  324. return t.hasNonce(e) && t.isPendingDeferScript(e)
  325. },
  326. mutate: function(e) {
  327. return t.removeNonce(e)
  328. }
  329. })
  330. }
  331. ,
  332. e.prototype.createPlaceholder = function(t) {
  333. var e = p(t);
  334. return this.makeNonExecutable(e),
  335. e
  336. }
  337. ,
  338. e
  339. }(D)
  340. , C = function() {
  341. function t(t) {
  342. this.scriptStack = t
  343. }
  344. return t.prototype.enable = function(t) {
  345. var e = this;
  346. this.insertionPointMarker = t,
  347. this.buffer = "",
  348. document.write = function() {
  349. for (var t = [], n = 0; n < arguments.length; n++)
  350. t[n] = arguments[n];
  351. return e.write(t, !1)
  352. }
  353. ,
  354. document.writeln = function() {
  355. for (var t = [], n = 0; n < arguments.length; n++)
  356. t[n] = arguments[n];
  357. return e.write(t, !0)
  358. }
  359. }
  360. ,
  361. t.prototype.flushWrittenContentAndDisable = function() {
  362. document.write = L,
  363. document.writeln = _,
  364. this.buffer.length && (document.contains(this.insertionPointMarker) ? this.insertionPointMarker.parentNode === document.head ? this.insertContentInHead() : this.insertContentInBody() : e("Insertion point marker for document.write was detached from document:", "Markup will not be inserted"))
  365. }
  366. ,
  367. t.prototype.insertContentInHead = function() {
  368. var t = new DOMParser
  369. , e = "<!DOCTYPE html><head>" + this.buffer + "</head>"
  370. , o = t.parseFromString(e, "text/html");
  371. if (this.scriptStack.harvestScriptsAfterDocWrite(o),
  372. n(o.head.childNodes, this.insertionPointMarker),
  373. o.body.childNodes.length) {
  374. for (var i = Array.prototype.slice.call(o.body.childNodes), a = this.insertionPointMarker.nextSibling; a; )
  375. i.push(a),
  376. a = a.nextSibling;
  377. document.body || L.call(document, "<body>"),
  378. r(i, document.body)
  379. }
  380. }
  381. ,
  382. t.prototype.insertContentInBody = function() {
  383. var t = this.insertionPointMarker.parentElement
  384. , e = document.createElement(t.tagName);
  385. e.innerHTML = this.buffer,
  386. this.scriptStack.harvestScriptsAfterDocWrite(e),
  387. n(e.childNodes, this.insertionPointMarker)
  388. }
  389. ,
  390. t.prototype.write = function(t, e) {
  391. var n = document.currentScript;
  392. n && i(n) && n.hasAttribute("async") ? (r = e ? _ : L).call.apply(r, [document].concat(t)) : this.buffer += t.map(String).join(e ? "\n" : "");
  393. var r
  394. }
  395. ,
  396. t
  397. }()
  398. , j = function() {
  399. function t() {
  400. var t = this;
  401. this.simulatedReadyState = "loading",
  402. this.bypassEventsInProxies = !1,
  403. this.nativeWindowAddEventListener = window.addEventListener;
  404. try {
  405. Object.defineProperty(document, "readyState", {
  406. get: function() {
  407. return t.simulatedReadyState
  408. }
  409. })
  410. } catch (e) {}
  411. this.setupEventListenerProxy(),
  412. this.updateInlineHandlers()
  413. }
  414. return t.prototype.runOnLoad = function(t) {
  415. var e = this;
  416. this.nativeWindowAddEventListener.call(window, "load", function(n) {
  417. if (!e.bypassEventsInProxies)
  418. return t(n)
  419. })
  420. }
  421. ,
  422. t.prototype.updateInlineHandlers = function() {
  423. this.proxyInlineHandler(document, "onreadystatechange"),
  424. this.proxyInlineHandler(window, "onload"),
  425. document.body && this.proxyInlineHandler(document.body, "onload")
  426. }
  427. ,
  428. t.prototype.simulateStateBeforeDeferScriptsActivation = function() {
  429. this.bypassEventsInProxies = !0,
  430. this.simulatedReadyState = "interactive",
  431. l(document, "readystatechange"),
  432. this.bypassEventsInProxies = !1
  433. }
  434. ,
  435. t.prototype.simulateStateAfterDeferScriptsActivation = function() {
  436. var t = this;
  437. this.bypassEventsInProxies = !0,
  438. l(document, "DOMContentLoaded"),
  439. this.simulatedReadyState = "complete",
  440. l(document, "readystatechange"),
  441. l(window, "load"),
  442. this.bypassEventsInProxies = !1,
  443. window.setTimeout(function() {
  444. return t.bypassEventsInProxies = !0
  445. }, 0)
  446. }
  447. ,
  448. t.prototype.setupEventListenerProxy = function() {
  449. var t = this;
  450. ("undefined" != typeof EventTarget ? [EventTarget.prototype] : [Node.prototype, Window.prototype]).forEach(function(e) {
  451. return t.patchEventTargetMethods(e)
  452. })
  453. }
  454. ,
  455. t.prototype.patchEventTargetMethods = function(t) {
  456. var e = this
  457. , n = t.addEventListener
  458. , r = t.removeEventListener;
  459. t.addEventListener = function(t, r) {
  460. for (var o = [], i = 2; i < arguments.length; i++)
  461. o[i - 2] = arguments[i];
  462. var a = m(this)
  463. , c = r && r.__rocketLoaderProxiedHandler;
  464. if (!c) {
  465. var s = f(r);
  466. "function" == typeof s ? (c = function(n) {
  467. if (e.bypassEventsInProxies || a.indexOf(t) < 0)
  468. return s.call(this, n)
  469. }
  470. ,
  471. Object.defineProperty(r, "__rocketLoaderProxiedHandler", {
  472. value: c
  473. })) : c = r
  474. }
  475. n.call.apply(n, [this, t, c].concat(o))
  476. }
  477. ,
  478. t.removeEventListener = function(t, e) {
  479. for (var n = [], o = 2; o < arguments.length; o++)
  480. n[o - 2] = arguments[o];
  481. var i = e && e.__rocketLoaderProxiedHandler || e;
  482. r.call.apply(r, [this, t, i].concat(n))
  483. }
  484. }
  485. ,
  486. t.prototype.proxyInlineHandler = function(t, e) {
  487. try {
  488. var n = t[e];
  489. if (n && !n.__rocketLoaderInlineHandlerProxy) {
  490. var r = this;
  491. t[e] = function(t) {
  492. if (r.bypassEventsInProxies)
  493. return n.call(this, t)
  494. }
  495. ,
  496. Object.defineProperty(t[e], "__rocketLoaderInlineHandlerProxy", {
  497. value: !0
  498. })
  499. }
  500. } catch (o) {
  501. return void console.warn("encountered an error when accessing " + e + " handler:", o.message)
  502. }
  503. }
  504. ,
  505. t
  506. }()
  507. , M = function() {
  508. var t = window;
  509. return t.__rocketLoaderLoadProgressSimulator || Object.defineProperty(t, "__rocketLoaderLoadProgressSimulator", {
  510. value: new j
  511. }),
  512. t.__rocketLoaderLoadProgressSimulator
  513. }()
  514. , W = function() {
  515. function t(t, e) {
  516. this.scriptStack = t,
  517. this.settings = e,
  518. this.preloadHints = []
  519. }
  520. return t.prototype.insertPreloadHints = function() {
  521. var t = this;
  522. this.scriptStack.forEach(function(e) {
  523. if (a(e, t.settings.nonce)) {
  524. var n = i(e)
  525. , r = v() && e.hasAttribute("integrity");
  526. if (n && !r) {
  527. var o = document.createElement("link");
  528. o.setAttribute("rel", "preload"),
  529. o.setAttribute("as", "script"),
  530. o.setAttribute("href", n),
  531. e.crossOrigin && o.setAttribute("crossorigin", e.crossOrigin),
  532. document.head.appendChild(o),
  533. t.preloadHints.push(o)
  534. }
  535. }
  536. })
  537. }
  538. ,
  539. t.prototype.removePreloadHints = function() {
  540. this.preloadHints.forEach(function(t) {
  541. return o(t)
  542. })
  543. }
  544. ,
  545. t.prototype.run = function() {
  546. for (var t = this, e = this; this.scriptStack.hasItems; ) {
  547. var n = function() {
  548. var n = e.settings.docWriteSimulator
  549. , r = e.scriptStack.pop();
  550. n && !r.async && n.enable(r.placeholder);
  551. var o = e.activateScript(r);
  552. return o ? r.external && r.executable && !r.async ? (u(o, function() {
  553. t.finalizeActivation(r),
  554. t.run()
  555. }),
  556. {
  557. value: void 0
  558. }) : void e.finalizeActivation(r) : (n && n.flushWrittenContentAndDisable(),
  559. "continue")
  560. }();
  561. if ("object" == typeof n)
  562. return n.value
  563. }
  564. this.scriptStack.hasItems || this.settings.callback()
  565. }
  566. ,
  567. t.prototype.finalizeActivation = function(t) {
  568. this.settings.docWriteSimulator && !t.async && this.settings.docWriteSimulator.flushWrittenContentAndDisable(),
  569. M.updateInlineHandlers(),
  570. o(t.placeholder)
  571. }
  572. ,
  573. t.prototype.activateScript = function(t) {
  574. var n = t.script
  575. , r = t.placeholder
  576. , o = t.external
  577. , i = t.async
  578. , a = r.parentNode;
  579. if (!document.contains(r))
  580. return e("Placeholder for script \n" + n.outerHTML + "\n was detached from document.", "Script will not be executed."),
  581. null;
  582. var c = this.settings.blocking && o && !i ? d(n) : p(n);
  583. return c ? (a.insertBefore(c, r),
  584. c) : (e("Failed to create activatable copy of script \n" + n.outerHTML + "\n", "Script will not be executed."),
  585. null)
  586. }
  587. ,
  588. t
  589. }()
  590. , R = "data-cf-settings"
  591. , T = "|"
  592. , B = "data-cf-modified-"
  593. , U = void 0;
  594. !function() {
  595. var t = document.currentScript;
  596. if (t) {
  597. var n = b(t);
  598. n ? (o(t),
  599. g(n),
  600. M.updateInlineHandlers(),
  601. n.bailout ? w(n.nonce) : (S(),
  602. x(n.nonce))) : e("Activator script doesn't have settings. No scripts will be executed.")
  603. } else
  604. e("Can't obtain activator script. No scripts will be executed.")
  605. }()
  606. }();