cesiumWorkerBootstrapper.js 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  1. /**
  2. * @license
  3. * Cesium - https://github.com/CesiumGS/cesium
  4. * Version 1.105
  5. *
  6. * Copyright 2011-2022 Cesium Contributors
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. *
  20. * Columbus View (Pat. Pend.)
  21. *
  22. * Portions licensed separately.
  23. * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
  24. */
  25. if (typeof self === "undefined") {
  26. self = {};
  27. }
  28. self.onmessage = function(event) {
  29. var data = event.data;
  30. require(data.loaderConfig, [data.workerModule], function(workerModule) {
  31. self.onmessage = workerModule;
  32. self.CESIUM_BASE_URL = data.loaderConfig.baseUrl;
  33. });
  34. };
  35. function setTimeout(fn) {
  36. fn();
  37. }
  38. /** vim: et:ts=4:sw=4:sts=4
  39. * @license RequireJS 2.1.20 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
  40. * Available via the MIT or new BSD license.
  41. * see: http://github.com/jrburke/requirejs for details
  42. */
  43. var requirejs, require, define;
  44. (function(global) {
  45. var req, s, head, baseElement, dataMain, src, interactiveScript, currentlyAddingScript, mainScript, subPath, version = "2.1.20", commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, jsSuffixRegExp = /\.js$/, currDirRegExp = /^\.\//, op = Object.prototype, ostring = op.toString, hasOwn = op.hasOwnProperty, ap = Array.prototype, isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document), isWebWorker = !isBrowser && typeof importScripts !== "undefined", readyRegExp = isBrowser && navigator.platform === "PLAYSTATION 3" ? /^complete$/ : /^(complete|loaded)$/, defContextName = "_", isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]", contexts = {}, cfg = {}, globalDefQueue = [], useInteractive = false;
  46. function isFunction(it) {
  47. return ostring.call(it) === "[object Function]";
  48. }
  49. function isArray(it) {
  50. return ostring.call(it) === "[object Array]";
  51. }
  52. function each(ary, func) {
  53. if (ary) {
  54. var i;
  55. for (i = 0; i < ary.length; i += 1) {
  56. if (ary[i] && func(ary[i], i, ary)) {
  57. break;
  58. }
  59. }
  60. }
  61. }
  62. function eachReverse(ary, func) {
  63. if (ary) {
  64. var i;
  65. for (i = ary.length - 1; i > -1; i -= 1) {
  66. if (ary[i] && func(ary[i], i, ary)) {
  67. break;
  68. }
  69. }
  70. }
  71. }
  72. function hasProp(obj, prop) {
  73. return hasOwn.call(obj, prop);
  74. }
  75. function getOwn(obj, prop) {
  76. return hasProp(obj, prop) && obj[prop];
  77. }
  78. function eachProp(obj, func) {
  79. var prop;
  80. for (prop in obj) {
  81. if (hasProp(obj, prop)) {
  82. if (func(obj[prop], prop)) {
  83. break;
  84. }
  85. }
  86. }
  87. }
  88. function mixin(target, source, force, deepStringMixin) {
  89. if (source) {
  90. eachProp(source, function(value, prop) {
  91. if (force || !hasProp(target, prop)) {
  92. if (deepStringMixin && typeof value === "object" && value && !isArray(value) && !isFunction(value) && !(value instanceof RegExp)) {
  93. if (!target[prop]) {
  94. target[prop] = {};
  95. }
  96. mixin(target[prop], value, force, deepStringMixin);
  97. } else {
  98. target[prop] = value;
  99. }
  100. }
  101. });
  102. }
  103. return target;
  104. }
  105. function bind(obj, fn) {
  106. return function() {
  107. return fn.apply(obj, arguments);
  108. };
  109. }
  110. function scripts() {
  111. return document.getElementsByTagName("script");
  112. }
  113. function defaultOnError(err) {
  114. throw err;
  115. }
  116. function getGlobal(value) {
  117. if (!value) {
  118. return value;
  119. }
  120. var g = global;
  121. each(value.split("."), function(part) {
  122. g = g[part];
  123. });
  124. return g;
  125. }
  126. function makeError(id, msg, err, requireModules) {
  127. var e = new Error(msg + "\nhttp://requirejs.org/docs/errors.html#" + id);
  128. e.requireType = id;
  129. e.requireModules = requireModules;
  130. if (err) {
  131. e.originalError = err;
  132. }
  133. return e;
  134. }
  135. if (typeof define !== "undefined") {
  136. return;
  137. }
  138. if (typeof requirejs !== "undefined") {
  139. if (isFunction(requirejs)) {
  140. return;
  141. }
  142. cfg = requirejs;
  143. requirejs = void 0;
  144. }
  145. if (typeof require !== "undefined" && !isFunction(require)) {
  146. cfg = require;
  147. require = void 0;
  148. }
  149. function newContext(contextName) {
  150. var inCheckLoaded, Module, context, handlers, checkLoadedTimeoutId, config = {
  151. //Defaults. Do not set a default for map
  152. //config to speed up normalize(), which
  153. //will run faster if there is no default.
  154. waitSeconds: 7,
  155. baseUrl: "./",
  156. paths: {},
  157. bundles: {},
  158. pkgs: {},
  159. shim: {},
  160. config: {}
  161. }, registry = {}, enabledRegistry = {}, undefEvents = {}, defQueue = [], defined = {}, urlFetched = {}, bundlesMap = {}, requireCounter = 1, unnormalizedCounter = 1;
  162. function trimDots(ary) {
  163. var i, part;
  164. for (i = 0; i < ary.length; i++) {
  165. part = ary[i];
  166. if (part === ".") {
  167. ary.splice(i, 1);
  168. i -= 1;
  169. } else if (part === "..") {
  170. if (i === 0 || i === 1 && ary[2] === ".." || ary[i - 1] === "..") {
  171. continue;
  172. } else if (i > 0) {
  173. ary.splice(i - 1, 2);
  174. i -= 2;
  175. }
  176. }
  177. }
  178. }
  179. function normalize(name, baseName, applyMap) {
  180. var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex, foundMap, foundI, foundStarMap, starI, normalizedBaseParts, baseParts = baseName && baseName.split("/"), map = config.map, starMap = map && map["*"];
  181. if (name) {
  182. name = name.split("/");
  183. lastIndex = name.length - 1;
  184. if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
  185. name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, "");
  186. }
  187. if (name[0].charAt(0) === "." && baseParts) {
  188. normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
  189. name = normalizedBaseParts.concat(name);
  190. }
  191. trimDots(name);
  192. name = name.join("/");
  193. }
  194. if (applyMap && map && (baseParts || starMap)) {
  195. nameParts = name.split("/");
  196. outerLoop:
  197. for (i = nameParts.length; i > 0; i -= 1) {
  198. nameSegment = nameParts.slice(0, i).join("/");
  199. if (baseParts) {
  200. for (j = baseParts.length; j > 0; j -= 1) {
  201. mapValue = getOwn(map, baseParts.slice(0, j).join("/"));
  202. if (mapValue) {
  203. mapValue = getOwn(mapValue, nameSegment);
  204. if (mapValue) {
  205. foundMap = mapValue;
  206. foundI = i;
  207. break outerLoop;
  208. }
  209. }
  210. }
  211. }
  212. if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
  213. foundStarMap = getOwn(starMap, nameSegment);
  214. starI = i;
  215. }
  216. }
  217. if (!foundMap && foundStarMap) {
  218. foundMap = foundStarMap;
  219. foundI = starI;
  220. }
  221. if (foundMap) {
  222. nameParts.splice(0, foundI, foundMap);
  223. name = nameParts.join("/");
  224. }
  225. }
  226. pkgMain = getOwn(config.pkgs, name);
  227. return pkgMain ? pkgMain : name;
  228. }
  229. function removeScript(name) {
  230. if (isBrowser) {
  231. each(scripts(), function(scriptNode) {
  232. if (scriptNode.getAttribute("data-requiremodule") === name && scriptNode.getAttribute("data-requirecontext") === context.contextName) {
  233. scriptNode.parentNode.removeChild(scriptNode);
  234. return true;
  235. }
  236. });
  237. }
  238. }
  239. function hasPathFallback(id) {
  240. var pathConfig = getOwn(config.paths, id);
  241. if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
  242. pathConfig.shift();
  243. context.require.undef(id);
  244. context.makeRequire(null, {
  245. skipMap: true
  246. })([id]);
  247. return true;
  248. }
  249. }
  250. function splitPrefix(name) {
  251. var prefix, index = name ? name.indexOf("!") : -1;
  252. if (index > -1) {
  253. prefix = name.substring(0, index);
  254. name = name.substring(index + 1, name.length);
  255. }
  256. return [prefix, name];
  257. }
  258. function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
  259. var url, pluginModule, suffix, nameParts, prefix = null, parentName = parentModuleMap ? parentModuleMap.name : null, originalName = name, isDefine = true, normalizedName = "";
  260. if (!name) {
  261. isDefine = false;
  262. name = "_@r" + (requireCounter += 1);
  263. }
  264. nameParts = splitPrefix(name);
  265. prefix = nameParts[0];
  266. name = nameParts[1];
  267. if (prefix) {
  268. prefix = normalize(prefix, parentName, applyMap);
  269. pluginModule = getOwn(defined, prefix);
  270. }
  271. if (name) {
  272. if (prefix) {
  273. if (pluginModule && pluginModule.normalize) {
  274. normalizedName = pluginModule.normalize(name, function(name2) {
  275. return normalize(name2, parentName, applyMap);
  276. });
  277. } else {
  278. normalizedName = name.indexOf("!") === -1 ? normalize(name, parentName, applyMap) : name;
  279. }
  280. } else {
  281. normalizedName = normalize(name, parentName, applyMap);
  282. nameParts = splitPrefix(normalizedName);
  283. prefix = nameParts[0];
  284. normalizedName = nameParts[1];
  285. isNormalized = true;
  286. url = context.nameToUrl(normalizedName);
  287. }
  288. }
  289. suffix = prefix && !pluginModule && !isNormalized ? "_unnormalized" + (unnormalizedCounter += 1) : "";
  290. return {
  291. prefix,
  292. name: normalizedName,
  293. parentMap: parentModuleMap,
  294. unnormalized: !!suffix,
  295. url,
  296. originalName,
  297. isDefine,
  298. id: (prefix ? prefix + "!" + normalizedName : normalizedName) + suffix
  299. };
  300. }
  301. function getModule(depMap) {
  302. var id = depMap.id, mod = getOwn(registry, id);
  303. if (!mod) {
  304. mod = registry[id] = new context.Module(depMap);
  305. }
  306. return mod;
  307. }
  308. function on(depMap, name, fn) {
  309. var id = depMap.id, mod = getOwn(registry, id);
  310. if (hasProp(defined, id) && (!mod || mod.defineEmitComplete)) {
  311. if (name === "defined") {
  312. fn(defined[id]);
  313. }
  314. } else {
  315. mod = getModule(depMap);
  316. if (mod.error && name === "error") {
  317. fn(mod.error);
  318. } else {
  319. mod.on(name, fn);
  320. }
  321. }
  322. }
  323. function onError(err, errback) {
  324. var ids = err.requireModules, notified = false;
  325. if (errback) {
  326. errback(err);
  327. } else {
  328. each(ids, function(id) {
  329. var mod = getOwn(registry, id);
  330. if (mod) {
  331. mod.error = err;
  332. if (mod.events.error) {
  333. notified = true;
  334. mod.emit("error", err);
  335. }
  336. }
  337. });
  338. if (!notified) {
  339. req.onError(err);
  340. }
  341. }
  342. }
  343. function takeGlobalQueue() {
  344. if (globalDefQueue.length) {
  345. each(globalDefQueue, function(queueItem) {
  346. var id = queueItem[0];
  347. if (typeof id === "string") {
  348. context.defQueueMap[id] = true;
  349. }
  350. defQueue.push(queueItem);
  351. });
  352. globalDefQueue = [];
  353. }
  354. }
  355. handlers = {
  356. require: function(mod) {
  357. if (mod.require) {
  358. return mod.require;
  359. } else {
  360. return mod.require = context.makeRequire(mod.map);
  361. }
  362. },
  363. exports: function(mod) {
  364. mod.usingExports = true;
  365. if (mod.map.isDefine) {
  366. if (mod.exports) {
  367. return defined[mod.map.id] = mod.exports;
  368. } else {
  369. return mod.exports = defined[mod.map.id] = {};
  370. }
  371. }
  372. },
  373. module: function(mod) {
  374. if (mod.module) {
  375. return mod.module;
  376. } else {
  377. return mod.module = {
  378. id: mod.map.id,
  379. uri: mod.map.url,
  380. config: function() {
  381. return getOwn(config.config, mod.map.id) || {};
  382. },
  383. exports: mod.exports || (mod.exports = {})
  384. };
  385. }
  386. }
  387. };
  388. function cleanRegistry(id) {
  389. delete registry[id];
  390. delete enabledRegistry[id];
  391. }
  392. function breakCycle(mod, traced, processed) {
  393. var id = mod.map.id;
  394. if (mod.error) {
  395. mod.emit("error", mod.error);
  396. } else {
  397. traced[id] = true;
  398. each(mod.depMaps, function(depMap, i) {
  399. var depId = depMap.id, dep = getOwn(registry, depId);
  400. if (dep && !mod.depMatched[i] && !processed[depId]) {
  401. if (getOwn(traced, depId)) {
  402. mod.defineDep(i, defined[depId]);
  403. mod.check();
  404. } else {
  405. breakCycle(dep, traced, processed);
  406. }
  407. }
  408. });
  409. processed[id] = true;
  410. }
  411. }
  412. function checkLoaded() {
  413. var err, usingPathFallback, waitInterval = config.waitSeconds * 1e3, expired = waitInterval && context.startTime + waitInterval < (/* @__PURE__ */ new Date()).getTime(), noLoads = [], reqCalls = [], stillLoading = false, needCycleCheck = true;
  414. if (inCheckLoaded) {
  415. return;
  416. }
  417. inCheckLoaded = true;
  418. eachProp(enabledRegistry, function(mod) {
  419. var map = mod.map, modId = map.id;
  420. if (!mod.enabled) {
  421. return;
  422. }
  423. if (!map.isDefine) {
  424. reqCalls.push(mod);
  425. }
  426. if (!mod.error) {
  427. if (!mod.inited && expired) {
  428. if (hasPathFallback(modId)) {
  429. usingPathFallback = true;
  430. stillLoading = true;
  431. } else {
  432. noLoads.push(modId);
  433. removeScript(modId);
  434. }
  435. } else if (!mod.inited && mod.fetched && map.isDefine) {
  436. stillLoading = true;
  437. if (!map.prefix) {
  438. return needCycleCheck = false;
  439. }
  440. }
  441. }
  442. });
  443. if (expired && noLoads.length) {
  444. err = makeError(
  445. "timeout",
  446. "Load timeout for modules: " + noLoads,
  447. null,
  448. noLoads
  449. );
  450. err.contextName = context.contextName;
  451. return onError(err);
  452. }
  453. if (needCycleCheck) {
  454. each(reqCalls, function(mod) {
  455. breakCycle(mod, {}, {});
  456. });
  457. }
  458. if ((!expired || usingPathFallback) && stillLoading) {
  459. if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
  460. checkLoadedTimeoutId = setTimeout(function() {
  461. checkLoadedTimeoutId = 0;
  462. checkLoaded();
  463. }, 50);
  464. }
  465. }
  466. inCheckLoaded = false;
  467. }
  468. Module = function(map) {
  469. this.events = getOwn(undefEvents, map.id) || {};
  470. this.map = map;
  471. this.shim = getOwn(config.shim, map.id);
  472. this.depExports = [];
  473. this.depMaps = [];
  474. this.depMatched = [];
  475. this.pluginMaps = {};
  476. this.depCount = 0;
  477. };
  478. Module.prototype = {
  479. init: function(depMaps, factory, errback, options) {
  480. options = options || {};
  481. if (this.inited) {
  482. return;
  483. }
  484. this.factory = factory;
  485. if (errback) {
  486. this.on("error", errback);
  487. } else if (this.events.error) {
  488. errback = bind(this, function(err) {
  489. this.emit("error", err);
  490. });
  491. }
  492. this.depMaps = depMaps && depMaps.slice(0);
  493. this.errback = errback;
  494. this.inited = true;
  495. this.ignore = options.ignore;
  496. if (options.enabled || this.enabled) {
  497. this.enable();
  498. } else {
  499. this.check();
  500. }
  501. },
  502. defineDep: function(i, depExports) {
  503. if (!this.depMatched[i]) {
  504. this.depMatched[i] = true;
  505. this.depCount -= 1;
  506. this.depExports[i] = depExports;
  507. }
  508. },
  509. fetch: function() {
  510. if (this.fetched) {
  511. return;
  512. }
  513. this.fetched = true;
  514. context.startTime = (/* @__PURE__ */ new Date()).getTime();
  515. var map = this.map;
  516. if (this.shim) {
  517. context.makeRequire(this.map, {
  518. enableBuildCallback: true
  519. })(
  520. this.shim.deps || [],
  521. bind(this, function() {
  522. return map.prefix ? this.callPlugin() : this.load();
  523. })
  524. );
  525. } else {
  526. return map.prefix ? this.callPlugin() : this.load();
  527. }
  528. },
  529. load: function() {
  530. var url = this.map.url;
  531. if (!urlFetched[url]) {
  532. urlFetched[url] = true;
  533. context.load(this.map.id, url);
  534. }
  535. },
  536. /**
  537. * Checks if the module is ready to define itself, and if so,
  538. * define it.
  539. * @private
  540. */
  541. check: function() {
  542. if (!this.enabled || this.enabling) {
  543. return;
  544. }
  545. var err, cjsModule, id = this.map.id, depExports = this.depExports, exports = this.exports, factory = this.factory;
  546. if (!this.inited) {
  547. if (!hasProp(context.defQueueMap, id)) {
  548. this.fetch();
  549. }
  550. } else if (this.error) {
  551. this.emit("error", this.error);
  552. } else if (!this.defining) {
  553. this.defining = true;
  554. if (this.depCount < 1 && !this.defined) {
  555. if (isFunction(factory)) {
  556. if (this.events.error && this.map.isDefine || req.onError !== defaultOnError) {
  557. try {
  558. exports = context.execCb(id, factory, depExports, exports);
  559. } catch (e) {
  560. err = e;
  561. }
  562. } else {
  563. exports = context.execCb(id, factory, depExports, exports);
  564. }
  565. if (this.map.isDefine && exports === void 0) {
  566. cjsModule = this.module;
  567. if (cjsModule) {
  568. exports = cjsModule.exports;
  569. } else if (this.usingExports) {
  570. exports = this.exports;
  571. }
  572. }
  573. if (err) {
  574. err.requireMap = this.map;
  575. err.requireModules = this.map.isDefine ? [this.map.id] : null;
  576. err.requireType = this.map.isDefine ? "define" : "require";
  577. return onError(this.error = err);
  578. }
  579. } else {
  580. exports = factory;
  581. }
  582. this.exports = exports;
  583. if (this.map.isDefine && !this.ignore) {
  584. defined[id] = exports;
  585. if (req.onResourceLoad) {
  586. req.onResourceLoad(context, this.map, this.depMaps);
  587. }
  588. }
  589. cleanRegistry(id);
  590. this.defined = true;
  591. }
  592. this.defining = false;
  593. if (this.defined && !this.defineEmitted) {
  594. this.defineEmitted = true;
  595. this.emit("defined", this.exports);
  596. this.defineEmitComplete = true;
  597. }
  598. }
  599. },
  600. callPlugin: function() {
  601. var map = this.map, id = map.id, pluginMap = makeModuleMap(map.prefix);
  602. this.depMaps.push(pluginMap);
  603. on(
  604. pluginMap,
  605. "defined",
  606. bind(this, function(plugin) {
  607. var load, normalizedMap, normalizedMod, bundleId = getOwn(bundlesMap, this.map.id), name = this.map.name, parentName = this.map.parentMap ? this.map.parentMap.name : null, localRequire = context.makeRequire(map.parentMap, {
  608. enableBuildCallback: true
  609. });
  610. if (this.map.unnormalized) {
  611. if (plugin.normalize) {
  612. name = plugin.normalize(name, function(name2) {
  613. return normalize(name2, parentName, true);
  614. }) || "";
  615. }
  616. normalizedMap = makeModuleMap(
  617. map.prefix + "!" + name,
  618. this.map.parentMap
  619. );
  620. on(
  621. normalizedMap,
  622. "defined",
  623. bind(this, function(value) {
  624. this.init(
  625. [],
  626. function() {
  627. return value;
  628. },
  629. null,
  630. {
  631. enabled: true,
  632. ignore: true
  633. }
  634. );
  635. })
  636. );
  637. normalizedMod = getOwn(registry, normalizedMap.id);
  638. if (normalizedMod) {
  639. this.depMaps.push(normalizedMap);
  640. if (this.events.error) {
  641. normalizedMod.on(
  642. "error",
  643. bind(this, function(err) {
  644. this.emit("error", err);
  645. })
  646. );
  647. }
  648. normalizedMod.enable();
  649. }
  650. return;
  651. }
  652. if (bundleId) {
  653. this.map.url = context.nameToUrl(bundleId);
  654. this.load();
  655. return;
  656. }
  657. load = bind(this, function(value) {
  658. this.init(
  659. [],
  660. function() {
  661. return value;
  662. },
  663. null,
  664. {
  665. enabled: true
  666. }
  667. );
  668. });
  669. load.error = bind(this, function(err) {
  670. this.inited = true;
  671. this.error = err;
  672. err.requireModules = [id];
  673. eachProp(registry, function(mod) {
  674. if (mod.map.id.indexOf(id + "_unnormalized") === 0) {
  675. cleanRegistry(mod.map.id);
  676. }
  677. });
  678. onError(err);
  679. });
  680. load.fromText = bind(this, function(text2, textAlt) {
  681. var moduleName = map.name, moduleMap = makeModuleMap(moduleName), hasInteractive = useInteractive;
  682. if (textAlt) {
  683. text2 = textAlt;
  684. }
  685. if (hasInteractive) {
  686. useInteractive = false;
  687. }
  688. getModule(moduleMap);
  689. if (hasProp(config.config, id)) {
  690. config.config[moduleName] = config.config[id];
  691. }
  692. try {
  693. req.exec(text2);
  694. } catch (e) {
  695. return onError(
  696. makeError(
  697. "fromtexteval",
  698. "fromText eval for " + id + " failed: " + e,
  699. e,
  700. [id]
  701. )
  702. );
  703. }
  704. if (hasInteractive) {
  705. useInteractive = true;
  706. }
  707. this.depMaps.push(moduleMap);
  708. context.completeLoad(moduleName);
  709. localRequire([moduleName], load);
  710. });
  711. plugin.load(map.name, localRequire, load, config);
  712. })
  713. );
  714. context.enable(pluginMap, this);
  715. this.pluginMaps[pluginMap.id] = pluginMap;
  716. },
  717. enable: function() {
  718. enabledRegistry[this.map.id] = this;
  719. this.enabled = true;
  720. this.enabling = true;
  721. each(
  722. this.depMaps,
  723. bind(this, function(depMap, i) {
  724. var id, mod, handler;
  725. if (typeof depMap === "string") {
  726. depMap = makeModuleMap(
  727. depMap,
  728. this.map.isDefine ? this.map : this.map.parentMap,
  729. false,
  730. !this.skipMap
  731. );
  732. this.depMaps[i] = depMap;
  733. handler = getOwn(handlers, depMap.id);
  734. if (handler) {
  735. this.depExports[i] = handler(this);
  736. return;
  737. }
  738. this.depCount += 1;
  739. on(
  740. depMap,
  741. "defined",
  742. bind(this, function(depExports) {
  743. if (this.undefed) {
  744. return;
  745. }
  746. this.defineDep(i, depExports);
  747. this.check();
  748. })
  749. );
  750. if (this.errback) {
  751. on(depMap, "error", bind(this, this.errback));
  752. } else if (this.events.error) {
  753. on(
  754. depMap,
  755. "error",
  756. bind(this, function(err) {
  757. this.emit("error", err);
  758. })
  759. );
  760. }
  761. }
  762. id = depMap.id;
  763. mod = registry[id];
  764. if (!hasProp(handlers, id) && mod && !mod.enabled) {
  765. context.enable(depMap, this);
  766. }
  767. })
  768. );
  769. eachProp(
  770. this.pluginMaps,
  771. bind(this, function(pluginMap) {
  772. var mod = getOwn(registry, pluginMap.id);
  773. if (mod && !mod.enabled) {
  774. context.enable(pluginMap, this);
  775. }
  776. })
  777. );
  778. this.enabling = false;
  779. this.check();
  780. },
  781. on: function(name, cb) {
  782. var cbs = this.events[name];
  783. if (!cbs) {
  784. cbs = this.events[name] = [];
  785. }
  786. cbs.push(cb);
  787. },
  788. emit: function(name, evt) {
  789. each(this.events[name], function(cb) {
  790. cb(evt);
  791. });
  792. if (name === "error") {
  793. delete this.events[name];
  794. }
  795. }
  796. };
  797. function callGetModule(args) {
  798. if (!hasProp(defined, args[0])) {
  799. getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
  800. }
  801. }
  802. function removeListener(node, func, name, ieName) {
  803. if (node.detachEvent && !isOpera) {
  804. if (ieName) {
  805. node.detachEvent(ieName, func);
  806. }
  807. } else {
  808. node.removeEventListener(name, func, false);
  809. }
  810. }
  811. function getScriptData(evt) {
  812. var node = evt.currentTarget || evt.srcElement;
  813. removeListener(node, context.onScriptLoad, "load", "onreadystatechange");
  814. removeListener(node, context.onScriptError, "error");
  815. return {
  816. node,
  817. id: node && node.getAttribute("data-requiremodule")
  818. };
  819. }
  820. function intakeDefines() {
  821. var args;
  822. takeGlobalQueue();
  823. while (defQueue.length) {
  824. args = defQueue.shift();
  825. if (args[0] === null) {
  826. return onError(
  827. makeError(
  828. "mismatch",
  829. "Mismatched anonymous define() module: " + args[args.length - 1]
  830. )
  831. );
  832. } else {
  833. callGetModule(args);
  834. }
  835. }
  836. context.defQueueMap = {};
  837. }
  838. context = {
  839. config,
  840. contextName,
  841. registry,
  842. defined,
  843. urlFetched,
  844. defQueue,
  845. defQueueMap: {},
  846. Module,
  847. makeModuleMap,
  848. nextTick: req.nextTick,
  849. onError,
  850. /**
  851. * @private
  852. * Set a configuration for the context.
  853. * @param {object} cfg config object to integrate.
  854. */
  855. configure: function(cfg2) {
  856. if (cfg2.baseUrl) {
  857. if (cfg2.baseUrl.charAt(cfg2.baseUrl.length - 1) !== "/") {
  858. cfg2.baseUrl += "/";
  859. }
  860. }
  861. var shim = config.shim, objs = {
  862. paths: true,
  863. bundles: true,
  864. config: true,
  865. map: true
  866. };
  867. eachProp(cfg2, function(value, prop) {
  868. if (objs[prop]) {
  869. if (!config[prop]) {
  870. config[prop] = {};
  871. }
  872. mixin(config[prop], value, true, true);
  873. } else {
  874. config[prop] = value;
  875. }
  876. });
  877. if (cfg2.bundles) {
  878. eachProp(cfg2.bundles, function(value, prop) {
  879. each(value, function(v) {
  880. if (v !== prop) {
  881. bundlesMap[v] = prop;
  882. }
  883. });
  884. });
  885. }
  886. if (cfg2.shim) {
  887. eachProp(cfg2.shim, function(value, id) {
  888. if (isArray(value)) {
  889. value = {
  890. deps: value
  891. };
  892. }
  893. if ((value.exports || value.init) && !value.exportsFn) {
  894. value.exportsFn = context.makeShimExports(value);
  895. }
  896. shim[id] = value;
  897. });
  898. config.shim = shim;
  899. }
  900. if (cfg2.packages) {
  901. each(cfg2.packages, function(pkgObj) {
  902. var location, name;
  903. pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
  904. name = pkgObj.name;
  905. location = pkgObj.location;
  906. if (location) {
  907. config.paths[name] = pkgObj.location;
  908. }
  909. config.pkgs[name] = pkgObj.name + "/" + (pkgObj.main || "main").replace(currDirRegExp, "").replace(jsSuffixRegExp, "");
  910. });
  911. }
  912. eachProp(registry, function(mod, id) {
  913. if (!mod.inited && !mod.map.unnormalized) {
  914. mod.map = makeModuleMap(id, null, true);
  915. }
  916. });
  917. if (cfg2.deps || cfg2.callback) {
  918. context.require(cfg2.deps || [], cfg2.callback);
  919. }
  920. },
  921. makeShimExports: function(value) {
  922. function fn() {
  923. var ret;
  924. if (value.init) {
  925. ret = value.init.apply(global, arguments);
  926. }
  927. return ret || value.exports && getGlobal(value.exports);
  928. }
  929. return fn;
  930. },
  931. makeRequire: function(relMap, options) {
  932. options = options || {};
  933. function localRequire(deps, callback, errback) {
  934. var id, map, requireMod;
  935. if (options.enableBuildCallback && callback && isFunction(callback)) {
  936. callback.__requireJsBuild = true;
  937. }
  938. if (typeof deps === "string") {
  939. if (isFunction(callback)) {
  940. return onError(
  941. makeError("requireargs", "Invalid require call"),
  942. errback
  943. );
  944. }
  945. if (relMap && hasProp(handlers, deps)) {
  946. return handlers[deps](registry[relMap.id]);
  947. }
  948. if (req.get) {
  949. return req.get(context, deps, relMap, localRequire);
  950. }
  951. map = makeModuleMap(deps, relMap, false, true);
  952. id = map.id;
  953. if (!hasProp(defined, id)) {
  954. return onError(
  955. makeError(
  956. "notloaded",
  957. 'Module name "' + id + '" has not been loaded yet for context: ' + contextName + (relMap ? "" : ". Use require([])")
  958. )
  959. );
  960. }
  961. return defined[id];
  962. }
  963. intakeDefines();
  964. context.nextTick(function() {
  965. intakeDefines();
  966. requireMod = getModule(makeModuleMap(null, relMap));
  967. requireMod.skipMap = options.skipMap;
  968. requireMod.init(deps, callback, errback, {
  969. enabled: true
  970. });
  971. checkLoaded();
  972. });
  973. return localRequire;
  974. }
  975. mixin(localRequire, {
  976. isBrowser,
  977. /**
  978. * Converts a module name + .extension into an URL path.
  979. * *Requires* the use of a module name. It does not support using
  980. * plain URLs like nameToUrl.
  981. */
  982. toUrl: function(moduleNamePlusExt) {
  983. var ext, index = moduleNamePlusExt.lastIndexOf("."), segment = moduleNamePlusExt.split("/")[0], isRelative = segment === "." || segment === "..";
  984. if (index !== -1 && (!isRelative || index > 1)) {
  985. ext = moduleNamePlusExt.substring(
  986. index,
  987. moduleNamePlusExt.length
  988. );
  989. moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
  990. }
  991. return context.nameToUrl(
  992. normalize(moduleNamePlusExt, relMap && relMap.id, true),
  993. ext,
  994. true
  995. );
  996. },
  997. defined: function(id) {
  998. return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
  999. },
  1000. specified: function(id) {
  1001. id = makeModuleMap(id, relMap, false, true).id;
  1002. return hasProp(defined, id) || hasProp(registry, id);
  1003. }
  1004. });
  1005. if (!relMap) {
  1006. localRequire.undef = function(id) {
  1007. takeGlobalQueue();
  1008. var map = makeModuleMap(id, relMap, true), mod = getOwn(registry, id);
  1009. mod.undefed = true;
  1010. removeScript(id);
  1011. delete defined[id];
  1012. delete urlFetched[map.url];
  1013. delete undefEvents[id];
  1014. eachReverse(defQueue, function(args, i) {
  1015. if (args[0] === id) {
  1016. defQueue.splice(i, 1);
  1017. }
  1018. });
  1019. delete context.defQueueMap[id];
  1020. if (mod) {
  1021. if (mod.events.defined) {
  1022. undefEvents[id] = mod.events;
  1023. }
  1024. cleanRegistry(id);
  1025. }
  1026. };
  1027. }
  1028. return localRequire;
  1029. },
  1030. /**
  1031. * @private
  1032. * Called to enable a module if it is still in the registry
  1033. * awaiting enablement. A second arg, parent, the parent module,
  1034. * is passed in for context, when this method is overridden by
  1035. * the optimizer. Not shown here to keep code compact.
  1036. */
  1037. enable: function(depMap) {
  1038. var mod = getOwn(registry, depMap.id);
  1039. if (mod) {
  1040. getModule(depMap).enable();
  1041. }
  1042. },
  1043. /**
  1044. * Internal method used by environment adapters to complete a load event.
  1045. * A load event could be a script load or just a load pass from a synchronous
  1046. * load call.
  1047. * @param {string} moduleName the name of the module to potentially complete.
  1048. * @private
  1049. */
  1050. completeLoad: function(moduleName) {
  1051. var found, args, mod, shim = getOwn(config.shim, moduleName) || {}, shExports = shim.exports;
  1052. takeGlobalQueue();
  1053. while (defQueue.length) {
  1054. args = defQueue.shift();
  1055. if (args[0] === null) {
  1056. args[0] = moduleName;
  1057. if (found) {
  1058. break;
  1059. }
  1060. found = true;
  1061. } else if (args[0] === moduleName) {
  1062. found = true;
  1063. }
  1064. callGetModule(args);
  1065. }
  1066. context.defQueueMap = {};
  1067. mod = getOwn(registry, moduleName);
  1068. if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
  1069. if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
  1070. if (hasPathFallback(moduleName)) {
  1071. return;
  1072. } else {
  1073. return onError(
  1074. makeError(
  1075. "nodefine",
  1076. "No define call for " + moduleName,
  1077. null,
  1078. [moduleName]
  1079. )
  1080. );
  1081. }
  1082. } else {
  1083. callGetModule([moduleName, shim.deps || [], shim.exportsFn]);
  1084. }
  1085. }
  1086. checkLoaded();
  1087. },
  1088. /**
  1089. * @private
  1090. * Converts a module name to a file path. Supports cases where
  1091. * moduleName may actually be just an URL.
  1092. * Note that it **does not** call normalize on the moduleName,
  1093. * it is assumed to have already been normalized. This is an
  1094. * internal API, not a public one. Use toUrl for the public API.
  1095. */
  1096. nameToUrl: function(moduleName, ext, skipExt) {
  1097. var paths, syms, i, parentModule, url, parentPath, bundleId, pkgMain = getOwn(config.pkgs, moduleName);
  1098. if (pkgMain) {
  1099. moduleName = pkgMain;
  1100. }
  1101. bundleId = getOwn(bundlesMap, moduleName);
  1102. if (bundleId) {
  1103. return context.nameToUrl(bundleId, ext, skipExt);
  1104. }
  1105. if (req.jsExtRegExp.test(moduleName)) {
  1106. url = moduleName + (ext || "");
  1107. } else {
  1108. paths = config.paths;
  1109. syms = moduleName.split("/");
  1110. for (i = syms.length; i > 0; i -= 1) {
  1111. parentModule = syms.slice(0, i).join("/");
  1112. parentPath = getOwn(paths, parentModule);
  1113. if (parentPath) {
  1114. if (isArray(parentPath)) {
  1115. parentPath = parentPath[0];
  1116. }
  1117. syms.splice(0, i, parentPath);
  1118. break;
  1119. }
  1120. }
  1121. url = syms.join("/");
  1122. url += ext || (/^data\:|\?/.test(url) || skipExt ? "" : ".js");
  1123. url = (url.charAt(0) === "/" || url.match(/^[\w\+\.\-]+:/) ? "" : config.baseUrl) + url;
  1124. }
  1125. return config.urlArgs ? url + ((url.indexOf("?") === -1 ? "?" : "&") + config.urlArgs) : url;
  1126. },
  1127. //Delegates to req.load. Broken out as a separate function to
  1128. //allow overriding in the optimizer.
  1129. load: function(id, url) {
  1130. req.load(context, id, url);
  1131. },
  1132. /**
  1133. * Executes a module callback function. Broken out as a separate function
  1134. * solely to allow the build system to sequence the files in the built
  1135. * layer in the right sequence.
  1136. *
  1137. * @private
  1138. */
  1139. execCb: function(name, callback, args, exports) {
  1140. return callback.apply(exports, args);
  1141. },
  1142. /**
  1143. * callback for script loads, used to check status of loading.
  1144. * @private
  1145. * @param {Event} evt the event from the browser for the script
  1146. * that was loaded.
  1147. */
  1148. onScriptLoad: function(evt) {
  1149. if (evt.type === "load" || readyRegExp.test((evt.currentTarget || evt.srcElement).readyState)) {
  1150. interactiveScript = null;
  1151. var data = getScriptData(evt);
  1152. context.completeLoad(data.id);
  1153. }
  1154. },
  1155. /**
  1156. * @private
  1157. * Callback for script errors.
  1158. */
  1159. onScriptError: function(evt) {
  1160. var data = getScriptData(evt);
  1161. if (!hasPathFallback(data.id)) {
  1162. return onError(
  1163. makeError("scripterror", "Script error for: " + data.id, evt, [
  1164. data.id
  1165. ])
  1166. );
  1167. }
  1168. }
  1169. };
  1170. context.require = context.makeRequire();
  1171. return context;
  1172. }
  1173. req = requirejs = function(deps, callback, errback, optional) {
  1174. var context, config, contextName = defContextName;
  1175. if (!isArray(deps) && typeof deps !== "string") {
  1176. config = deps;
  1177. if (isArray(callback)) {
  1178. deps = callback;
  1179. callback = errback;
  1180. errback = optional;
  1181. } else {
  1182. deps = [];
  1183. }
  1184. }
  1185. if (config && config.context) {
  1186. contextName = config.context;
  1187. }
  1188. context = getOwn(contexts, contextName);
  1189. if (!context) {
  1190. context = contexts[contextName] = req.s.newContext(contextName);
  1191. }
  1192. if (config) {
  1193. context.configure(config);
  1194. }
  1195. return context.require(deps, callback, errback);
  1196. };
  1197. req.config = function(config) {
  1198. return req(config);
  1199. };
  1200. req.nextTick = typeof setTimeout !== "undefined" ? function(fn) {
  1201. setTimeout(fn, 4);
  1202. } : function(fn) {
  1203. fn();
  1204. };
  1205. if (!require) {
  1206. require = req;
  1207. }
  1208. req.version = version;
  1209. req.jsExtRegExp = /^\/|:|\?|\.js$/;
  1210. req.isBrowser = isBrowser;
  1211. s = req.s = {
  1212. contexts,
  1213. newContext
  1214. };
  1215. req({});
  1216. each(["toUrl", "undef", "defined", "specified"], function(prop) {
  1217. req[prop] = function() {
  1218. var ctx = contexts[defContextName];
  1219. return ctx.require[prop].apply(ctx, arguments);
  1220. };
  1221. });
  1222. if (isBrowser) {
  1223. head = s.head = document.getElementsByTagName("head")[0];
  1224. baseElement = document.getElementsByTagName("base")[0];
  1225. if (baseElement) {
  1226. head = s.head = baseElement.parentNode;
  1227. }
  1228. }
  1229. req.onError = defaultOnError;
  1230. req.createNode = function(config, moduleName, url) {
  1231. var node = config.xhtml ? document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") : document.createElement("script");
  1232. node.type = config.scriptType || "text/javascript";
  1233. node.charset = "utf-8";
  1234. node.async = true;
  1235. return node;
  1236. };
  1237. req.load = function(context, moduleName, url) {
  1238. var config = context && context.config || {}, node;
  1239. if (isBrowser) {
  1240. node = req.createNode(config, moduleName, url);
  1241. if (config.onNodeCreated) {
  1242. config.onNodeCreated(node, config, moduleName, url);
  1243. }
  1244. node.setAttribute("data-requirecontext", context.contextName);
  1245. node.setAttribute("data-requiremodule", moduleName);
  1246. if (node.attachEvent && //Check if node.attachEvent is artificially added by custom script or
  1247. //natively supported by browser
  1248. //read https://github.com/jrburke/requirejs/issues/187
  1249. //if we can NOT find [native code] then it must NOT natively supported.
  1250. //in IE8, node.attachEvent does not have toString()
  1251. //Note the test for "[native code" with no closing brace, see:
  1252. //https://github.com/jrburke/requirejs/issues/273
  1253. !(node.attachEvent.toString && node.attachEvent.toString().indexOf("[native code") < 0) && !isOpera) {
  1254. useInteractive = true;
  1255. node.attachEvent("onreadystatechange", context.onScriptLoad);
  1256. } else {
  1257. node.addEventListener("load", context.onScriptLoad, false);
  1258. node.addEventListener("error", context.onScriptError, false);
  1259. }
  1260. node.src = url;
  1261. currentlyAddingScript = node;
  1262. if (baseElement) {
  1263. head.insertBefore(node, baseElement);
  1264. } else {
  1265. head.appendChild(node);
  1266. }
  1267. currentlyAddingScript = null;
  1268. return node;
  1269. } else if (isWebWorker) {
  1270. try {
  1271. importScripts(url);
  1272. context.completeLoad(moduleName);
  1273. } catch (e) {
  1274. context.onError(
  1275. makeError(
  1276. "importscripts",
  1277. "importScripts failed for " + moduleName + " at " + url,
  1278. e,
  1279. [moduleName]
  1280. )
  1281. );
  1282. }
  1283. }
  1284. };
  1285. function getInteractiveScript() {
  1286. if (interactiveScript && interactiveScript.readyState === "interactive") {
  1287. return interactiveScript;
  1288. }
  1289. eachReverse(scripts(), function(script) {
  1290. if (script.readyState === "interactive") {
  1291. return interactiveScript = script;
  1292. }
  1293. });
  1294. return interactiveScript;
  1295. }
  1296. if (isBrowser && !cfg.skipDataMain) {
  1297. eachReverse(scripts(), function(script) {
  1298. if (!head) {
  1299. head = script.parentNode;
  1300. }
  1301. dataMain = script.getAttribute("data-main");
  1302. if (dataMain) {
  1303. mainScript = dataMain;
  1304. if (!cfg.baseUrl) {
  1305. src = mainScript.split("/");
  1306. mainScript = src.pop();
  1307. subPath = src.length ? src.join("/") + "/" : "./";
  1308. cfg.baseUrl = subPath;
  1309. }
  1310. mainScript = mainScript.replace(jsSuffixRegExp, "");
  1311. if (req.jsExtRegExp.test(mainScript)) {
  1312. mainScript = dataMain;
  1313. }
  1314. cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
  1315. return true;
  1316. }
  1317. });
  1318. }
  1319. define = function(name, deps, callback) {
  1320. var node, context;
  1321. if (typeof name !== "string") {
  1322. callback = deps;
  1323. deps = name;
  1324. name = null;
  1325. }
  1326. if (!isArray(deps)) {
  1327. callback = deps;
  1328. deps = null;
  1329. }
  1330. if (!deps && isFunction(callback)) {
  1331. deps = [];
  1332. if (callback.length) {
  1333. callback.toString().replace(commentRegExp, "").replace(cjsRequireRegExp, function(match, dep) {
  1334. deps.push(dep);
  1335. });
  1336. deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
  1337. }
  1338. }
  1339. if (useInteractive) {
  1340. node = currentlyAddingScript || getInteractiveScript();
  1341. if (node) {
  1342. if (!name) {
  1343. name = node.getAttribute("data-requiremodule");
  1344. }
  1345. context = contexts[node.getAttribute("data-requirecontext")];
  1346. }
  1347. }
  1348. if (context) {
  1349. context.defQueue.push([name, deps, callback]);
  1350. context.defQueueMap[name] = true;
  1351. } else {
  1352. globalDefQueue.push([name, deps, callback]);
  1353. }
  1354. };
  1355. define.amd = {
  1356. jQuery: true
  1357. };
  1358. req.exec = function(text) {
  1359. return eval(text);
  1360. };
  1361. req(cfg);
  1362. })(this);