Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

cordova.js 65KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104
  1. // Platform: ios
  2. // 538a985db128858c0a0eb4dd40fb9c8e5433fc94
  3. /*
  4. Licensed to the Apache Software Foundation (ASF) under one
  5. or more contributor license agreements. See the NOTICE file
  6. distributed with this work for additional information
  7. regarding copyright ownership. The ASF licenses this file
  8. to you under the Apache License, Version 2.0 (the
  9. "License"); you may not use this file except in compliance
  10. with the License. You may obtain a copy of the License at
  11. http://www.apache.org/licenses/LICENSE-2.0
  12. Unless required by applicable law or agreed to in writing,
  13. software distributed under the License is distributed on an
  14. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. KIND, either express or implied. See the License for the
  16. specific language governing permissions and limitations
  17. under the License.
  18. */
  19. ;(function() {
  20. var PLATFORM_VERSION_BUILD_LABEL = '6.1.1';
  21. // file: src/scripts/require.js
  22. var require;
  23. var define;
  24. (function () {
  25. var modules = {};
  26. // Stack of moduleIds currently being built.
  27. var requireStack = [];
  28. // Map of module ID -> index into requireStack of modules currently being built.
  29. var inProgressModules = {};
  30. var SEPARATOR = '.';
  31. function build (module) {
  32. var factory = module.factory;
  33. var localRequire = function (id) {
  34. var resultantId = id;
  35. // Its a relative path, so lop off the last portion and add the id (minus "./")
  36. if (id.charAt(0) === '.') {
  37. resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2);
  38. }
  39. return require(resultantId);
  40. };
  41. module.exports = {};
  42. delete module.factory;
  43. factory(localRequire, module.exports, module);
  44. return module.exports;
  45. }
  46. require = function (id) {
  47. if (!modules[id]) {
  48. throw new Error('module ' + id + ' not found');
  49. } else if (id in inProgressModules) {
  50. var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
  51. throw new Error('Cycle in require graph: ' + cycle);
  52. }
  53. if (modules[id].factory) {
  54. try {
  55. inProgressModules[id] = requireStack.length;
  56. requireStack.push(id);
  57. return build(modules[id]);
  58. } finally {
  59. delete inProgressModules[id];
  60. requireStack.pop();
  61. }
  62. }
  63. return modules[id].exports;
  64. };
  65. define = function (id, factory) {
  66. if (Object.prototype.hasOwnProperty.call(modules, id)) {
  67. throw new Error('module ' + id + ' already defined');
  68. }
  69. modules[id] = {
  70. id: id,
  71. factory: factory
  72. };
  73. };
  74. define.remove = function (id) {
  75. delete modules[id];
  76. };
  77. define.moduleMap = modules;
  78. })();
  79. // Export for use in node
  80. if (typeof module === 'object' && typeof require === 'function') {
  81. module.exports.require = require;
  82. module.exports.define = define;
  83. }
  84. // file: src/cordova.js
  85. define("cordova", function(require, exports, module) {
  86. // Workaround for Windows 10 in hosted environment case
  87. // http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object
  88. if (window.cordova && !(window.cordova instanceof HTMLElement)) {
  89. throw new Error('cordova already defined');
  90. }
  91. var channel = require('cordova/channel');
  92. var platform = require('cordova/platform');
  93. /**
  94. * Intercept calls to addEventListener + removeEventListener and handle deviceready,
  95. * resume, and pause events.
  96. */
  97. var m_document_addEventListener = document.addEventListener;
  98. var m_document_removeEventListener = document.removeEventListener;
  99. var m_window_addEventListener = window.addEventListener;
  100. var m_window_removeEventListener = window.removeEventListener;
  101. /**
  102. * Houses custom event handlers to intercept on document + window event listeners.
  103. */
  104. var documentEventHandlers = {};
  105. var windowEventHandlers = {};
  106. document.addEventListener = function (evt, handler, capture) {
  107. var e = evt.toLowerCase();
  108. if (typeof documentEventHandlers[e] !== 'undefined') {
  109. documentEventHandlers[e].subscribe(handler);
  110. } else {
  111. m_document_addEventListener.call(document, evt, handler, capture);
  112. }
  113. };
  114. window.addEventListener = function (evt, handler, capture) {
  115. var e = evt.toLowerCase();
  116. if (typeof windowEventHandlers[e] !== 'undefined') {
  117. windowEventHandlers[e].subscribe(handler);
  118. } else {
  119. m_window_addEventListener.call(window, evt, handler, capture);
  120. }
  121. };
  122. document.removeEventListener = function (evt, handler, capture) {
  123. var e = evt.toLowerCase();
  124. // If unsubscribing from an event that is handled by a plugin
  125. if (typeof documentEventHandlers[e] !== 'undefined') {
  126. documentEventHandlers[e].unsubscribe(handler);
  127. } else {
  128. m_document_removeEventListener.call(document, evt, handler, capture);
  129. }
  130. };
  131. window.removeEventListener = function (evt, handler, capture) {
  132. var e = evt.toLowerCase();
  133. // If unsubscribing from an event that is handled by a plugin
  134. if (typeof windowEventHandlers[e] !== 'undefined') {
  135. windowEventHandlers[e].unsubscribe(handler);
  136. } else {
  137. m_window_removeEventListener.call(window, evt, handler, capture);
  138. }
  139. };
  140. function createEvent (type, data) {
  141. var event = document.createEvent('Events');
  142. event.initEvent(type, false, false);
  143. if (data) {
  144. for (var i in data) {
  145. if (Object.prototype.hasOwnProperty.call(data, i)) {
  146. event[i] = data[i];
  147. }
  148. }
  149. }
  150. return event;
  151. }
  152. var cordova = {
  153. define: define,
  154. require: require,
  155. version: PLATFORM_VERSION_BUILD_LABEL,
  156. platformVersion: PLATFORM_VERSION_BUILD_LABEL,
  157. platformId: platform.id,
  158. /**
  159. * Methods to add/remove your own addEventListener hijacking on document + window.
  160. */
  161. addWindowEventHandler: function (event) {
  162. return (windowEventHandlers[event] = channel.create(event));
  163. },
  164. addStickyDocumentEventHandler: function (event) {
  165. return (documentEventHandlers[event] = channel.createSticky(event));
  166. },
  167. addDocumentEventHandler: function (event) {
  168. return (documentEventHandlers[event] = channel.create(event));
  169. },
  170. removeWindowEventHandler: function (event) {
  171. delete windowEventHandlers[event];
  172. },
  173. removeDocumentEventHandler: function (event) {
  174. delete documentEventHandlers[event];
  175. },
  176. /**
  177. * Retrieve original event handlers that were replaced by Cordova
  178. *
  179. * @return object
  180. */
  181. getOriginalHandlers: function () {
  182. return {
  183. document: {
  184. addEventListener: m_document_addEventListener,
  185. removeEventListener: m_document_removeEventListener
  186. },
  187. window: {
  188. addEventListener: m_window_addEventListener,
  189. removeEventListener: m_window_removeEventListener
  190. }
  191. };
  192. },
  193. /**
  194. * Method to fire event from native code
  195. * bNoDetach is required for events which cause an exception which needs to be caught in native code
  196. */
  197. fireDocumentEvent: function (type, data, bNoDetach) {
  198. var evt = createEvent(type, data);
  199. if (typeof documentEventHandlers[type] !== 'undefined') {
  200. if (bNoDetach) {
  201. documentEventHandlers[type].fire(evt);
  202. } else {
  203. setTimeout(function () {
  204. // Fire deviceready on listeners that were registered before cordova.js was loaded.
  205. if (type === 'deviceready') {
  206. document.dispatchEvent(evt);
  207. }
  208. documentEventHandlers[type].fire(evt);
  209. }, 0);
  210. }
  211. } else {
  212. document.dispatchEvent(evt);
  213. }
  214. },
  215. fireWindowEvent: function (type, data) {
  216. var evt = createEvent(type, data);
  217. if (typeof windowEventHandlers[type] !== 'undefined') {
  218. setTimeout(function () {
  219. windowEventHandlers[type].fire(evt);
  220. }, 0);
  221. } else {
  222. window.dispatchEvent(evt);
  223. }
  224. },
  225. /**
  226. * Plugin callback mechanism.
  227. */
  228. // Randomize the starting callbackId to avoid collisions after refreshing or navigating.
  229. // This way, it's very unlikely that any new callback would get the same callbackId as an old callback.
  230. callbackId: Math.floor(Math.random() * 2000000000),
  231. callbacks: {},
  232. callbackStatus: {
  233. NO_RESULT: 0,
  234. OK: 1,
  235. CLASS_NOT_FOUND_EXCEPTION: 2,
  236. ILLEGAL_ACCESS_EXCEPTION: 3,
  237. INSTANTIATION_EXCEPTION: 4,
  238. MALFORMED_URL_EXCEPTION: 5,
  239. IO_EXCEPTION: 6,
  240. INVALID_ACTION: 7,
  241. JSON_EXCEPTION: 8,
  242. ERROR: 9
  243. },
  244. /**
  245. * Called by native code when returning successful result from an action.
  246. */
  247. callbackSuccess: function (callbackId, args) {
  248. cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback);
  249. },
  250. /**
  251. * Called by native code when returning error result from an action.
  252. */
  253. callbackError: function (callbackId, args) {
  254. // TODO: Deprecate callbackSuccess and callbackError in favour of callbackFromNative.
  255. // Derive success from status.
  256. cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback);
  257. },
  258. /**
  259. * Called by native code when returning the result from an action.
  260. */
  261. callbackFromNative: function (callbackId, isSuccess, status, args, keepCallback) {
  262. try {
  263. var callback = cordova.callbacks[callbackId];
  264. if (callback) {
  265. if (isSuccess && status === cordova.callbackStatus.OK) {
  266. callback.success && callback.success.apply(null, args);
  267. } else if (!isSuccess) {
  268. callback.fail && callback.fail.apply(null, args);
  269. }
  270. /*
  271. else
  272. Note, this case is intentionally not caught.
  273. this can happen if isSuccess is true, but callbackStatus is NO_RESULT
  274. which is used to remove a callback from the list without calling the callbacks
  275. typically keepCallback is false in this case
  276. */
  277. // Clear callback if not expecting any more results
  278. if (!keepCallback) {
  279. delete cordova.callbacks[callbackId];
  280. }
  281. }
  282. } catch (err) {
  283. var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
  284. cordova.fireWindowEvent('cordovacallbackerror', { message: msg, error: err });
  285. throw err;
  286. }
  287. },
  288. addConstructor: function (func) {
  289. channel.onCordovaReady.subscribe(function () {
  290. try {
  291. func();
  292. } catch (e) {
  293. console.log('Failed to run constructor: ' + e);
  294. }
  295. });
  296. }
  297. };
  298. module.exports = cordova;
  299. });
  300. // file: src/common/argscheck.js
  301. define("cordova/argscheck", function(require, exports, module) {
  302. var utils = require('cordova/utils');
  303. var moduleExports = module.exports;
  304. var typeMap = {
  305. A: 'Array',
  306. D: 'Date',
  307. N: 'Number',
  308. S: 'String',
  309. F: 'Function',
  310. O: 'Object'
  311. };
  312. function extractParamName (callee, argIndex) {
  313. return (/\(\s*([^)]*?)\s*\)/).exec(callee)[1].split(/\s*,\s*/)[argIndex];
  314. }
  315. /**
  316. * Checks the given arguments' types and throws if they are not as expected.
  317. *
  318. * `spec` is a string where each character stands for the required type of the
  319. * argument at the same position. In other words: the character at `spec[i]`
  320. * specifies the required type for `args[i]`. The characters in `spec` are the
  321. * first letter of the required type's name. The supported types are:
  322. *
  323. * Array, Date, Number, String, Function, Object
  324. *
  325. * Lowercase characters specify arguments that must not be `null` or `undefined`
  326. * while uppercase characters allow those values to be passed.
  327. *
  328. * Finally, `*` can be used to allow any type at the corresponding position.
  329. *
  330. * @example
  331. * function foo (arr, opts) {
  332. * // require `arr` to be an Array and `opts` an Object, null or undefined
  333. * checkArgs('aO', 'my.package.foo', arguments);
  334. * // ...
  335. * }
  336. * @param {String} spec - the type specification for `args` as described above
  337. * @param {String} functionName - full name of the callee.
  338. * Used in the error message
  339. * @param {Array|arguments} args - the arguments to be checked against `spec`
  340. * @param {Function} [opt_callee=args.callee] - the recipient of `args`.
  341. * Used to extract parameter names for the error message
  342. * @throws {TypeError} if args do not satisfy spec
  343. */
  344. function checkArgs (spec, functionName, args, opt_callee) {
  345. if (!moduleExports.enableChecks) {
  346. return;
  347. }
  348. var errMsg = null;
  349. var typeName;
  350. for (var i = 0; i < spec.length; ++i) {
  351. var c = spec.charAt(i);
  352. var cUpper = c.toUpperCase();
  353. var arg = args[i];
  354. // Asterix means allow anything.
  355. if (c === '*') {
  356. continue;
  357. }
  358. typeName = utils.typeName(arg);
  359. if ((arg === null || arg === undefined) && c === cUpper) {
  360. continue;
  361. }
  362. if (typeName !== typeMap[cUpper]) {
  363. errMsg = 'Expected ' + typeMap[cUpper];
  364. break;
  365. }
  366. }
  367. if (errMsg) {
  368. errMsg += ', but got ' + typeName + '.';
  369. errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
  370. // Don't log when running unit tests.
  371. if (typeof jasmine === 'undefined') {
  372. console.error(errMsg);
  373. }
  374. throw TypeError(errMsg);
  375. }
  376. }
  377. function getValue (value, defaultValue) {
  378. return value === undefined ? defaultValue : value;
  379. }
  380. moduleExports.checkArgs = checkArgs;
  381. moduleExports.getValue = getValue;
  382. moduleExports.enableChecks = true;
  383. });
  384. // file: src/common/base64.js
  385. define("cordova/base64", function(require, exports, module) {
  386. var base64 = exports;
  387. base64.fromArrayBuffer = function (arrayBuffer) {
  388. var array = new Uint8Array(arrayBuffer);
  389. return uint8ToBase64(array);
  390. };
  391. base64.toArrayBuffer = function (str) {
  392. var decodedStr = atob(str);
  393. var arrayBuffer = new ArrayBuffer(decodedStr.length);
  394. var array = new Uint8Array(arrayBuffer);
  395. for (var i = 0, len = decodedStr.length; i < len; i++) {
  396. array[i] = decodedStr.charCodeAt(i);
  397. }
  398. return arrayBuffer;
  399. };
  400. // ------------------------------------------------------------------------------
  401. /* This code is based on the performance tests at http://jsperf.com/b64tests
  402. * This 12-bit-at-a-time algorithm was the best performing version on all
  403. * platforms tested.
  404. */
  405. var b64_6bit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  406. var b64_12bit;
  407. var b64_12bitTable = function () {
  408. b64_12bit = [];
  409. for (var i = 0; i < 64; i++) {
  410. for (var j = 0; j < 64; j++) {
  411. b64_12bit[i * 64 + j] = b64_6bit[i] + b64_6bit[j];
  412. }
  413. }
  414. b64_12bitTable = function () { return b64_12bit; };
  415. return b64_12bit;
  416. };
  417. function uint8ToBase64 (rawData) {
  418. var numBytes = rawData.byteLength;
  419. var output = '';
  420. var segment;
  421. var table = b64_12bitTable();
  422. for (var i = 0; i < numBytes - 2; i += 3) {
  423. segment = (rawData[i] << 16) + (rawData[i + 1] << 8) + rawData[i + 2];
  424. output += table[segment >> 12];
  425. output += table[segment & 0xfff];
  426. }
  427. if (numBytes - i === 2) {
  428. segment = (rawData[i] << 16) + (rawData[i + 1] << 8);
  429. output += table[segment >> 12];
  430. output += b64_6bit[(segment & 0xfff) >> 6];
  431. output += '=';
  432. } else if (numBytes - i === 1) {
  433. segment = (rawData[i] << 16);
  434. output += table[segment >> 12];
  435. output += '==';
  436. }
  437. return output;
  438. }
  439. });
  440. // file: src/common/builder.js
  441. define("cordova/builder", function(require, exports, module) {
  442. var utils = require('cordova/utils');
  443. function each (objects, func, context) {
  444. for (var prop in objects) {
  445. if (Object.prototype.hasOwnProperty.call(objects, prop)) {
  446. func.apply(context, [objects[prop], prop]);
  447. }
  448. }
  449. }
  450. function clobber (obj, key, value) {
  451. var needsProperty = false;
  452. try {
  453. obj[key] = value;
  454. } catch (e) {
  455. needsProperty = true;
  456. }
  457. // Getters can only be overridden by getters.
  458. if (needsProperty || obj[key] !== value) {
  459. utils.defineGetter(obj, key, function () {
  460. return value;
  461. });
  462. }
  463. }
  464. function assignOrWrapInDeprecateGetter (obj, key, value, message) {
  465. if (message) {
  466. utils.defineGetter(obj, key, function () {
  467. console.log(message);
  468. delete obj[key];
  469. clobber(obj, key, value);
  470. return value;
  471. });
  472. } else {
  473. clobber(obj, key, value);
  474. }
  475. }
  476. function include (parent, objects, clobber, merge) {
  477. each(objects, function (obj, key) {
  478. try {
  479. var result = obj.path ? require(obj.path) : {};
  480. if (clobber) {
  481. // Clobber if it doesn't exist.
  482. if (typeof parent[key] === 'undefined') {
  483. assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
  484. } else if (typeof obj.path !== 'undefined') {
  485. // If merging, merge properties onto parent, otherwise, clobber.
  486. if (merge) {
  487. recursiveMerge(parent[key], result);
  488. } else {
  489. assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
  490. }
  491. }
  492. result = parent[key];
  493. } else {
  494. // Overwrite if not currently defined.
  495. if (typeof parent[key] === 'undefined') {
  496. assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
  497. } else {
  498. // Set result to what already exists, so we can build children into it if they exist.
  499. result = parent[key];
  500. }
  501. }
  502. if (obj.children) {
  503. include(result, obj.children, clobber, merge);
  504. }
  505. } catch (e) {
  506. utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"');
  507. }
  508. });
  509. }
  510. /**
  511. * Merge properties from one object onto another recursively. Properties from
  512. * the src object will overwrite existing target property.
  513. *
  514. * @param target Object to merge properties into.
  515. * @param src Object to merge properties from.
  516. */
  517. function recursiveMerge (target, src) {
  518. for (var prop in src) {
  519. if (Object.prototype.hasOwnProperty.call(src, prop)) {
  520. if (target.prototype && target.prototype.constructor === target) {
  521. // If the target object is a constructor override off prototype.
  522. clobber(target.prototype, prop, src[prop]);
  523. } else {
  524. if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
  525. recursiveMerge(target[prop], src[prop]);
  526. } else {
  527. clobber(target, prop, src[prop]);
  528. }
  529. }
  530. }
  531. }
  532. }
  533. exports.buildIntoButDoNotClobber = function (objects, target) {
  534. include(target, objects, false, false);
  535. };
  536. exports.buildIntoAndClobber = function (objects, target) {
  537. include(target, objects, true, false);
  538. };
  539. exports.buildIntoAndMerge = function (objects, target) {
  540. include(target, objects, true, true);
  541. };
  542. exports.recursiveMerge = recursiveMerge;
  543. exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter;
  544. });
  545. // file: src/common/channel.js
  546. define("cordova/channel", function(require, exports, module) {
  547. var utils = require('cordova/utils');
  548. var nextGuid = 1;
  549. /**
  550. * Custom pub-sub "channel" that can have functions subscribed to it
  551. * This object is used to define and control firing of events for
  552. * cordova initialization, as well as for custom events thereafter.
  553. *
  554. * The order of events during page load and Cordova startup is as follows:
  555. *
  556. * onDOMContentLoaded* Internal event that is received when the web page is loaded and parsed.
  557. * onNativeReady* Internal event that indicates the Cordova native side is ready.
  558. * onCordovaReady* Internal event fired when all Cordova JavaScript objects have been created.
  559. * onDeviceReady* User event fired to indicate that Cordova is ready
  560. * onResume User event fired to indicate a start/resume lifecycle event
  561. * onPause User event fired to indicate a pause lifecycle event
  562. *
  563. * The events marked with an * are sticky. Once they have fired, they will stay in the fired state.
  564. * All listeners that subscribe after the event is fired will be executed right away.
  565. *
  566. * The only Cordova events that user code should register for are:
  567. * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript
  568. * pause App has moved to background
  569. * resume App has returned to foreground
  570. *
  571. * Listeners can be registered as:
  572. * document.addEventListener("deviceready", myDeviceReadyListener, false);
  573. * document.addEventListener("resume", myResumeListener, false);
  574. * document.addEventListener("pause", myPauseListener, false);
  575. *
  576. * The DOM lifecycle events should be used for saving and restoring state
  577. * window.onload
  578. * window.onunload
  579. *
  580. */
  581. /**
  582. * Channel
  583. * @constructor
  584. * @param type String the channel name
  585. */
  586. var Channel = function (type, sticky) {
  587. this.type = type;
  588. // Map of guid -> function.
  589. this.handlers = {};
  590. // 0 = Non-sticky, 1 = Sticky non-fired, 2 = Sticky fired.
  591. this.state = sticky ? 1 : 0;
  592. // Used in sticky mode to remember args passed to fire().
  593. this.fireArgs = null;
  594. // Used by onHasSubscribersChange to know if there are any listeners.
  595. this.numHandlers = 0;
  596. // Function that is called when the first listener is subscribed, or when
  597. // the last listener is unsubscribed.
  598. this.onHasSubscribersChange = null;
  599. };
  600. var channel = {
  601. /**
  602. * Calls the provided function only after all of the channels specified
  603. * have been fired. All channels must be sticky channels.
  604. */
  605. join: function (h, c) {
  606. var len = c.length;
  607. var i = len;
  608. var f = function () {
  609. if (!(--i)) h();
  610. };
  611. for (var j = 0; j < len; j++) {
  612. if (c[j].state === 0) {
  613. throw Error('Can only use join with sticky channels.');
  614. }
  615. c[j].subscribe(f);
  616. }
  617. if (!len) h();
  618. },
  619. create: function (type) {
  620. return (channel[type] = new Channel(type, false));
  621. },
  622. createSticky: function (type) {
  623. return (channel[type] = new Channel(type, true));
  624. },
  625. /**
  626. * cordova Channels that must fire before "deviceready" is fired.
  627. */
  628. deviceReadyChannelsArray: [],
  629. deviceReadyChannelsMap: {},
  630. /**
  631. * Indicate that a feature needs to be initialized before it is ready to be used.
  632. * This holds up Cordova's "deviceready" event until the feature has been initialized
  633. * and Cordova.initComplete(feature) is called.
  634. *
  635. * @param feature {String} The unique feature name
  636. */
  637. waitForInitialization: function (feature) {
  638. if (feature) {
  639. var c = channel[feature] || this.createSticky(feature);
  640. this.deviceReadyChannelsMap[feature] = c;
  641. this.deviceReadyChannelsArray.push(c);
  642. }
  643. },
  644. /**
  645. * Indicate that initialization code has completed and the feature is ready to be used.
  646. *
  647. * @param feature {String} The unique feature name
  648. */
  649. initializationComplete: function (feature) {
  650. var c = this.deviceReadyChannelsMap[feature];
  651. if (c) {
  652. c.fire();
  653. }
  654. }
  655. };
  656. function checkSubscriptionArgument (argument) {
  657. if (typeof argument !== 'function' && typeof argument.handleEvent !== 'function') {
  658. throw new Error(
  659. 'Must provide a function or an EventListener object ' +
  660. 'implementing the handleEvent interface.'
  661. );
  662. }
  663. }
  664. /**
  665. * Subscribes the given function to the channel. Any time that
  666. * Channel.fire is called so too will the function.
  667. * Optionally specify an execution context for the function
  668. * and a guid that can be used to stop subscribing to the channel.
  669. * Returns the guid.
  670. */
  671. Channel.prototype.subscribe = function (eventListenerOrFunction, eventListener) {
  672. checkSubscriptionArgument(eventListenerOrFunction);
  673. var handleEvent, guid;
  674. if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
  675. // Received an EventListener object implementing the handleEvent interface
  676. handleEvent = eventListenerOrFunction.handleEvent;
  677. eventListener = eventListenerOrFunction;
  678. } else {
  679. // Received a function to handle event
  680. handleEvent = eventListenerOrFunction;
  681. }
  682. if (this.state === 2) {
  683. handleEvent.apply(eventListener || this, this.fireArgs);
  684. return;
  685. }
  686. guid = eventListenerOrFunction.observer_guid;
  687. if (typeof eventListener === 'object') {
  688. handleEvent = utils.close(eventListener, handleEvent);
  689. }
  690. if (!guid) {
  691. // First time any channel has seen this subscriber
  692. guid = '' + nextGuid++;
  693. }
  694. handleEvent.observer_guid = guid;
  695. eventListenerOrFunction.observer_guid = guid;
  696. // Don't add the same handler more than once.
  697. if (!this.handlers[guid]) {
  698. this.handlers[guid] = handleEvent;
  699. this.numHandlers++;
  700. if (this.numHandlers === 1) {
  701. this.onHasSubscribersChange && this.onHasSubscribersChange();
  702. }
  703. }
  704. };
  705. /**
  706. * Unsubscribes the function with the given guid from the channel.
  707. */
  708. Channel.prototype.unsubscribe = function (eventListenerOrFunction) {
  709. checkSubscriptionArgument(eventListenerOrFunction);
  710. var handleEvent, guid, handler;
  711. if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
  712. // Received an EventListener object implementing the handleEvent interface
  713. handleEvent = eventListenerOrFunction.handleEvent;
  714. } else {
  715. // Received a function to handle event
  716. handleEvent = eventListenerOrFunction;
  717. }
  718. guid = handleEvent.observer_guid;
  719. handler = this.handlers[guid];
  720. if (handler) {
  721. delete this.handlers[guid];
  722. this.numHandlers--;
  723. if (this.numHandlers === 0) {
  724. this.onHasSubscribersChange && this.onHasSubscribersChange();
  725. }
  726. }
  727. };
  728. /**
  729. * Calls all functions subscribed to this channel.
  730. */
  731. Channel.prototype.fire = function (e) {
  732. var fireArgs = Array.prototype.slice.call(arguments);
  733. // Apply stickiness.
  734. if (this.state === 1) {
  735. this.state = 2;
  736. this.fireArgs = fireArgs;
  737. }
  738. if (this.numHandlers) {
  739. // Copy the values first so that it is safe to modify it from within
  740. // callbacks.
  741. var toCall = [];
  742. for (var item in this.handlers) {
  743. toCall.push(this.handlers[item]);
  744. }
  745. for (var i = 0; i < toCall.length; ++i) {
  746. toCall[i].apply(this, fireArgs);
  747. }
  748. if (this.state === 2 && this.numHandlers) {
  749. this.numHandlers = 0;
  750. this.handlers = {};
  751. this.onHasSubscribersChange && this.onHasSubscribersChange();
  752. }
  753. }
  754. };
  755. // defining them here so they are ready super fast!
  756. // DOM event that is received when the web page is loaded and parsed.
  757. channel.createSticky('onDOMContentLoaded');
  758. // Event to indicate the Cordova native side is ready.
  759. channel.createSticky('onNativeReady');
  760. // Event to indicate that all Cordova JavaScript objects have been created
  761. // and it's time to run plugin constructors.
  762. channel.createSticky('onCordovaReady');
  763. // Event to indicate that all automatically loaded JS plugins are loaded and ready.
  764. // FIXME remove this
  765. channel.createSticky('onPluginsReady');
  766. // Event to indicate that Cordova is ready
  767. channel.createSticky('onDeviceReady');
  768. // Event to indicate a resume lifecycle event
  769. channel.create('onResume');
  770. // Event to indicate a pause lifecycle event
  771. channel.create('onPause');
  772. // Channels that must fire before "deviceready" is fired.
  773. channel.waitForInitialization('onCordovaReady');
  774. channel.waitForInitialization('onDOMContentLoaded');
  775. module.exports = channel;
  776. });
  777. // file: ../cordova-ios/cordova-js-src/exec.js
  778. define("cordova/exec", function(require, exports, module) {
  779. /**
  780. * Creates the exec bridge used to notify the native code of
  781. * commands.
  782. */
  783. var cordova = require('cordova');
  784. var utils = require('cordova/utils');
  785. var base64 = require('cordova/base64');
  786. function massageArgsJsToNative (args) {
  787. if (!args || utils.typeName(args) !== 'Array') {
  788. return args;
  789. }
  790. var ret = [];
  791. args.forEach(function (arg, i) {
  792. if (utils.typeName(arg) === 'ArrayBuffer') {
  793. ret.push({
  794. CDVType: 'ArrayBuffer',
  795. data: base64.fromArrayBuffer(arg)
  796. });
  797. } else {
  798. ret.push(arg);
  799. }
  800. });
  801. return ret;
  802. }
  803. function massageMessageNativeToJs (message) {
  804. if (message.CDVType === 'ArrayBuffer') {
  805. var stringToArrayBuffer = function (str) {
  806. var ret = new Uint8Array(str.length);
  807. for (var i = 0; i < str.length; i++) {
  808. ret[i] = str.charCodeAt(i);
  809. }
  810. return ret.buffer;
  811. };
  812. var base64ToArrayBuffer = function (b64) {
  813. return stringToArrayBuffer(atob(b64)); // eslint-disable-line no-undef
  814. };
  815. message = base64ToArrayBuffer(message.data);
  816. }
  817. return message;
  818. }
  819. function convertMessageToArgsNativeToJs (message) {
  820. var args = [];
  821. if (!message || !Object.prototype.hasOwnProperty.call(message, 'CDVType')) {
  822. args.push(message);
  823. } else if (message.CDVType === 'MultiPart') {
  824. message.messages.forEach(function (e) {
  825. args.push(massageMessageNativeToJs(e));
  826. });
  827. } else {
  828. args.push(massageMessageNativeToJs(message));
  829. }
  830. return args;
  831. }
  832. var iOSExec = function () {
  833. var successCallback, failCallback, service, action, actionArgs;
  834. var callbackId = null;
  835. if (typeof arguments[0] !== 'string') {
  836. // FORMAT ONE
  837. successCallback = arguments[0];
  838. failCallback = arguments[1];
  839. service = arguments[2];
  840. action = arguments[3];
  841. actionArgs = arguments[4];
  842. // Since we need to maintain backwards compatibility, we have to pass
  843. // an invalid callbackId even if no callback was provided since plugins
  844. // will be expecting it. The Cordova.exec() implementation allocates
  845. // an invalid callbackId and passes it even if no callbacks were given.
  846. callbackId = 'INVALID';
  847. } else {
  848. throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + // eslint-disable-line
  849. 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);');
  850. }
  851. // If actionArgs is not provided, default to an empty array
  852. actionArgs = actionArgs || [];
  853. // Register the callbacks and add the callbackId to the positional
  854. // arguments if given.
  855. if (successCallback || failCallback) {
  856. callbackId = service + cordova.callbackId++;
  857. cordova.callbacks[callbackId] =
  858. { success: successCallback, fail: failCallback };
  859. }
  860. actionArgs = massageArgsJsToNative(actionArgs);
  861. // CB-10133 DataClone DOM Exception 25 guard (fast function remover)
  862. var command = [callbackId, service, action, JSON.parse(JSON.stringify(actionArgs))];
  863. window.webkit.messageHandlers.cordova.postMessage(command);
  864. };
  865. iOSExec.nativeCallback = function (callbackId, status, message, keepCallback, debug) {
  866. var success = status === 0 || status === 1;
  867. var args = convertMessageToArgsNativeToJs(message);
  868. Promise.resolve().then(function () {
  869. cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line
  870. });
  871. };
  872. // for backwards compatibility
  873. iOSExec.nativeEvalAndFetch = function (func) {
  874. try {
  875. func();
  876. } catch (e) {
  877. console.log(e);
  878. }
  879. };
  880. // Proxy the exec for bridge changes. See CB-10106
  881. function cordovaExec () {
  882. var cexec = require('cordova/exec');
  883. var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function');
  884. return (cexec_valid && execProxy !== cexec) ? cexec : iOSExec;
  885. }
  886. function execProxy () {
  887. cordovaExec().apply(null, arguments);
  888. }
  889. execProxy.nativeFetchMessages = function () {
  890. return cordovaExec().nativeFetchMessages.apply(null, arguments);
  891. };
  892. execProxy.nativeEvalAndFetch = function () {
  893. return cordovaExec().nativeEvalAndFetch.apply(null, arguments);
  894. };
  895. execProxy.nativeCallback = function () {
  896. return cordovaExec().nativeCallback.apply(null, arguments);
  897. };
  898. module.exports = execProxy;
  899. });
  900. // file: src/common/exec/proxy.js
  901. define("cordova/exec/proxy", function(require, exports, module) {
  902. // internal map of proxy function
  903. var CommandProxyMap = {};
  904. module.exports = {
  905. // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
  906. add: function (id, proxyObj) {
  907. console.log('adding proxy for ' + id);
  908. CommandProxyMap[id] = proxyObj;
  909. return proxyObj;
  910. },
  911. // cordova.commandProxy.remove("Accelerometer");
  912. remove: function (id) {
  913. var proxy = CommandProxyMap[id];
  914. delete CommandProxyMap[id];
  915. CommandProxyMap[id] = null;
  916. return proxy;
  917. },
  918. get: function (service, action) {
  919. return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null);
  920. }
  921. };
  922. });
  923. // file: src/common/init.js
  924. define("cordova/init", function(require, exports, module) {
  925. var channel = require('cordova/channel');
  926. var cordova = require('cordova');
  927. var modulemapper = require('cordova/modulemapper');
  928. var platform = require('cordova/platform');
  929. var pluginloader = require('cordova/pluginloader');
  930. var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
  931. function logUnfiredChannels (arr) {
  932. for (var i = 0; i < arr.length; ++i) {
  933. if (arr[i].state !== 2) {
  934. console.log('Channel not fired: ' + arr[i].type);
  935. }
  936. }
  937. }
  938. window.setTimeout(function () {
  939. if (channel.onDeviceReady.state !== 2) {
  940. console.log('deviceready has not fired after 5 seconds.');
  941. logUnfiredChannels(platformInitChannelsArray);
  942. logUnfiredChannels(channel.deviceReadyChannelsArray);
  943. }
  944. }, 5000);
  945. if (!window.console) {
  946. window.console = {
  947. log: function () {}
  948. };
  949. }
  950. if (!window.console.warn) {
  951. window.console.warn = function (msg) {
  952. this.log('warn: ' + msg);
  953. };
  954. }
  955. // Register pause, resume and deviceready channels as events on document.
  956. channel.onPause = cordova.addDocumentEventHandler('pause');
  957. channel.onResume = cordova.addDocumentEventHandler('resume');
  958. channel.onActivated = cordova.addDocumentEventHandler('activated');
  959. channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
  960. // Listen for DOMContentLoaded and notify our channel subscribers.
  961. if (document.readyState === 'complete' || document.readyState === 'interactive') {
  962. channel.onDOMContentLoaded.fire();
  963. } else {
  964. document.addEventListener('DOMContentLoaded', function () {
  965. channel.onDOMContentLoaded.fire();
  966. }, false);
  967. }
  968. // _nativeReady is global variable that the native side can set
  969. // to signify that the native code is ready. It is a global since
  970. // it may be called before any cordova JS is ready.
  971. if (window._nativeReady) {
  972. channel.onNativeReady.fire();
  973. }
  974. modulemapper.clobbers('cordova', 'cordova');
  975. modulemapper.clobbers('cordova/exec', 'cordova.exec');
  976. modulemapper.clobbers('cordova/exec', 'Cordova.exec');
  977. // Call the platform-specific initialization.
  978. platform.bootstrap && platform.bootstrap();
  979. // Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
  980. // The delay allows the attached modules to be defined before the plugin loader looks for them.
  981. setTimeout(function () {
  982. pluginloader.load(function () {
  983. channel.onPluginsReady.fire();
  984. });
  985. }, 0);
  986. /**
  987. * Create all cordova objects once native side is ready.
  988. */
  989. channel.join(function () {
  990. modulemapper.mapModules(window);
  991. platform.initialize && platform.initialize();
  992. // Fire event to notify that all objects are created
  993. channel.onCordovaReady.fire();
  994. // Fire onDeviceReady event once page has fully loaded, all
  995. // constructors have run and cordova info has been received from native
  996. // side.
  997. channel.join(function () {
  998. require('cordova').fireDocumentEvent('deviceready');
  999. }, channel.deviceReadyChannelsArray);
  1000. }, platformInitChannelsArray);
  1001. });
  1002. // file: src/common/modulemapper.js
  1003. define("cordova/modulemapper", function(require, exports, module) {
  1004. var builder = require('cordova/builder');
  1005. var moduleMap = define.moduleMap;
  1006. var symbolList;
  1007. var deprecationMap;
  1008. exports.reset = function () {
  1009. symbolList = [];
  1010. deprecationMap = {};
  1011. };
  1012. function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) {
  1013. if (!(moduleName in moduleMap)) {
  1014. throw new Error('Module ' + moduleName + ' does not exist.');
  1015. }
  1016. symbolList.push(strategy, moduleName, symbolPath);
  1017. if (opt_deprecationMessage) {
  1018. deprecationMap[symbolPath] = opt_deprecationMessage;
  1019. }
  1020. }
  1021. // Note: Android 2.3 does have Function.bind().
  1022. exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) {
  1023. addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
  1024. };
  1025. exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) {
  1026. addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
  1027. };
  1028. exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) {
  1029. addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
  1030. };
  1031. exports.runs = function (moduleName) {
  1032. addEntry('r', moduleName, null);
  1033. };
  1034. function prepareNamespace (symbolPath, context) {
  1035. if (!symbolPath) {
  1036. return context;
  1037. }
  1038. return symbolPath.split('.').reduce(function (cur, part) {
  1039. return (cur[part] = cur[part] || {});
  1040. }, context);
  1041. }
  1042. exports.mapModules = function (context) {
  1043. var origSymbols = {};
  1044. context.CDV_origSymbols = origSymbols;
  1045. for (var i = 0, len = symbolList.length; i < len; i += 3) {
  1046. var strategy = symbolList[i];
  1047. var moduleName = symbolList[i + 1];
  1048. var module = require(moduleName);
  1049. // <runs/>
  1050. if (strategy === 'r') {
  1051. continue;
  1052. }
  1053. var symbolPath = symbolList[i + 2];
  1054. var lastDot = symbolPath.lastIndexOf('.');
  1055. var namespace = symbolPath.substr(0, lastDot);
  1056. var lastName = symbolPath.substr(lastDot + 1);
  1057. var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
  1058. var parentObj = prepareNamespace(namespace, context);
  1059. var target = parentObj[lastName];
  1060. if (strategy === 'm' && target) {
  1061. builder.recursiveMerge(target, module);
  1062. } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
  1063. if (!(symbolPath in origSymbols)) {
  1064. origSymbols[symbolPath] = target;
  1065. }
  1066. builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
  1067. }
  1068. }
  1069. };
  1070. exports.getOriginalSymbol = function (context, symbolPath) {
  1071. var origSymbols = context.CDV_origSymbols;
  1072. if (origSymbols && (symbolPath in origSymbols)) {
  1073. return origSymbols[symbolPath];
  1074. }
  1075. var parts = symbolPath.split('.');
  1076. var obj = context;
  1077. for (var i = 0; i < parts.length; ++i) {
  1078. obj = obj && obj[parts[i]];
  1079. }
  1080. return obj;
  1081. };
  1082. exports.reset();
  1083. });
  1084. // file: ../cordova-ios/cordova-js-src/platform.js
  1085. define("cordova/platform", function(require, exports, module) {
  1086. module.exports = {
  1087. id: 'ios',
  1088. bootstrap: function () {
  1089. // Attach the console polyfill that is iOS-only to window.console
  1090. // see the file under plugin/ios/console.js
  1091. require('cordova/modulemapper').clobbers('cordova/plugin/ios/console', 'window.console');
  1092. // Attach the wkwebkit utility to window.WkWebView
  1093. // see the file under plugin/ios/wkwebkit.js
  1094. require('cordova/modulemapper').clobbers('cordova/plugin/ios/wkwebkit', 'window.WkWebView');
  1095. // Attach the splashscreen utility to window.navigator.splashscreen
  1096. // see the file under plugin/ios/launchscreen.js
  1097. require('cordova/modulemapper').clobbers('cordova/plugin/ios/launchscreen', 'navigator.splashscreen');
  1098. require('cordova/channel').onNativeReady.fire();
  1099. }
  1100. };
  1101. });
  1102. // file: ../cordova-ios/cordova-js-src/plugin/ios/console.js
  1103. define("cordova/plugin/ios/console", function(require, exports, module) {
  1104. // ------------------------------------------------------------------------------
  1105. var logger = require('cordova/plugin/ios/logger');
  1106. // ------------------------------------------------------------------------------
  1107. // object that we're exporting
  1108. // ------------------------------------------------------------------------------
  1109. var console = module.exports;
  1110. // ------------------------------------------------------------------------------
  1111. // copy of the original console object
  1112. // ------------------------------------------------------------------------------
  1113. var WinConsole = window.console;
  1114. // ------------------------------------------------------------------------------
  1115. // whether to use the logger
  1116. // ------------------------------------------------------------------------------
  1117. var UseLogger = false;
  1118. // ------------------------------------------------------------------------------
  1119. // Timers
  1120. // ------------------------------------------------------------------------------
  1121. var Timers = {};
  1122. // ------------------------------------------------------------------------------
  1123. // used for unimplemented methods
  1124. // ------------------------------------------------------------------------------
  1125. function noop () {}
  1126. // ------------------------------------------------------------------------------
  1127. // used for unimplemented methods
  1128. // ------------------------------------------------------------------------------
  1129. console.useLogger = function (value) {
  1130. if (arguments.length) UseLogger = !!value;
  1131. if (UseLogger) {
  1132. if (logger.useConsole()) {
  1133. throw new Error('console and logger are too intertwingly');
  1134. }
  1135. }
  1136. return UseLogger;
  1137. };
  1138. // ------------------------------------------------------------------------------
  1139. console.log = function () {
  1140. if (logger.useConsole()) return;
  1141. logger.log.apply(logger, [].slice.call(arguments));
  1142. };
  1143. // ------------------------------------------------------------------------------
  1144. console.error = function () {
  1145. if (logger.useConsole()) return;
  1146. logger.error.apply(logger, [].slice.call(arguments));
  1147. };
  1148. // ------------------------------------------------------------------------------
  1149. console.warn = function () {
  1150. if (logger.useConsole()) return;
  1151. logger.warn.apply(logger, [].slice.call(arguments));
  1152. };
  1153. // ------------------------------------------------------------------------------
  1154. console.info = function () {
  1155. if (logger.useConsole()) return;
  1156. logger.info.apply(logger, [].slice.call(arguments));
  1157. };
  1158. // ------------------------------------------------------------------------------
  1159. console.debug = function () {
  1160. if (logger.useConsole()) return;
  1161. logger.debug.apply(logger, [].slice.call(arguments));
  1162. };
  1163. // ------------------------------------------------------------------------------
  1164. console.assert = function (expression) {
  1165. if (expression) return;
  1166. var message = logger.format.apply(logger.format, [].slice.call(arguments, 1));
  1167. console.log('ASSERT: ' + message);
  1168. };
  1169. // ------------------------------------------------------------------------------
  1170. console.clear = function () {};
  1171. // ------------------------------------------------------------------------------
  1172. console.dir = function (object) {
  1173. console.log('%o', object);
  1174. };
  1175. // ------------------------------------------------------------------------------
  1176. console.dirxml = function (node) {
  1177. console.log(node.innerHTML);
  1178. };
  1179. // ------------------------------------------------------------------------------
  1180. console.trace = noop;
  1181. // ------------------------------------------------------------------------------
  1182. console.group = console.log;
  1183. // ------------------------------------------------------------------------------
  1184. console.groupCollapsed = console.log;
  1185. // ------------------------------------------------------------------------------
  1186. console.groupEnd = noop;
  1187. // ------------------------------------------------------------------------------
  1188. console.time = function (name) {
  1189. Timers[name] = new Date().valueOf();
  1190. };
  1191. // ------------------------------------------------------------------------------
  1192. console.timeEnd = function (name) {
  1193. var timeStart = Timers[name];
  1194. if (!timeStart) {
  1195. console.warn('unknown timer: ' + name);
  1196. return;
  1197. }
  1198. var timeElapsed = new Date().valueOf() - timeStart;
  1199. console.log(name + ': ' + timeElapsed + 'ms');
  1200. };
  1201. // ------------------------------------------------------------------------------
  1202. console.timeStamp = noop;
  1203. // ------------------------------------------------------------------------------
  1204. console.profile = noop;
  1205. // ------------------------------------------------------------------------------
  1206. console.profileEnd = noop;
  1207. // ------------------------------------------------------------------------------
  1208. console.count = noop;
  1209. // ------------------------------------------------------------------------------
  1210. console.exception = console.log;
  1211. // ------------------------------------------------------------------------------
  1212. console.table = function (data, columns) {
  1213. console.log('%o', data);
  1214. };
  1215. // ------------------------------------------------------------------------------
  1216. // return a new function that calls both functions passed as args
  1217. // ------------------------------------------------------------------------------
  1218. function wrappedOrigCall (orgFunc, newFunc) {
  1219. return function () {
  1220. var args = [].slice.call(arguments);
  1221. try { orgFunc.apply(WinConsole, args); } catch (e) {}
  1222. try { newFunc.apply(console, args); } catch (e) {}
  1223. };
  1224. }
  1225. // ------------------------------------------------------------------------------
  1226. // For every function that exists in the original console object, that
  1227. // also exists in the new console object, wrap the new console method
  1228. // with one that calls both
  1229. // ------------------------------------------------------------------------------
  1230. for (var key in console) {
  1231. if (typeof WinConsole[key] === 'function') {
  1232. console[key] = wrappedOrigCall(WinConsole[key], console[key]);
  1233. }
  1234. }
  1235. });
  1236. // file: ../cordova-ios/cordova-js-src/plugin/ios/launchscreen.js
  1237. define("cordova/plugin/ios/launchscreen", function(require, exports, module) {
  1238. var exec = require('cordova/exec');
  1239. var launchscreen = {
  1240. show: function () {
  1241. exec(null, null, 'LaunchScreen', 'show', []);
  1242. },
  1243. hide: function () {
  1244. exec(null, null, 'LaunchScreen', 'hide', []);
  1245. }
  1246. };
  1247. module.exports = launchscreen;
  1248. });
  1249. // file: ../cordova-ios/cordova-js-src/plugin/ios/logger.js
  1250. define("cordova/plugin/ios/logger", function(require, exports, module) {
  1251. // ------------------------------------------------------------------------------
  1252. // The logger module exports the following properties/functions:
  1253. //
  1254. // LOG - constant for the level LOG
  1255. // ERROR - constant for the level ERROR
  1256. // WARN - constant for the level WARN
  1257. // INFO - constant for the level INFO
  1258. // DEBUG - constant for the level DEBUG
  1259. // logLevel() - returns current log level
  1260. // logLevel(value) - sets and returns a new log level
  1261. // useConsole() - returns whether logger is using console
  1262. // useConsole(value) - sets and returns whether logger is using console
  1263. // log(message,...) - logs a message at level LOG
  1264. // error(message,...) - logs a message at level ERROR
  1265. // warn(message,...) - logs a message at level WARN
  1266. // info(message,...) - logs a message at level INFO
  1267. // debug(message,...) - logs a message at level DEBUG
  1268. // logLevel(level,message,...) - logs a message specified level
  1269. //
  1270. // ------------------------------------------------------------------------------
  1271. var logger = exports;
  1272. var exec = require('cordova/exec');
  1273. var UseConsole = false;
  1274. var UseLogger = true;
  1275. var Queued = [];
  1276. var DeviceReady = false;
  1277. var CurrentLevel;
  1278. var originalConsole = console;
  1279. /**
  1280. * Logging levels
  1281. */
  1282. var Levels = [
  1283. 'LOG',
  1284. 'ERROR',
  1285. 'WARN',
  1286. 'INFO',
  1287. 'DEBUG'
  1288. ];
  1289. /*
  1290. * add the logging levels to the logger object and
  1291. * to a separate levelsMap object for testing
  1292. */
  1293. var LevelsMap = {};
  1294. for (var i = 0; i < Levels.length; i++) {
  1295. var level = Levels[i];
  1296. LevelsMap[level] = i;
  1297. logger[level] = level;
  1298. }
  1299. CurrentLevel = LevelsMap.WARN;
  1300. /**
  1301. * Getter/Setter for the logging level
  1302. *
  1303. * Returns the current logging level.
  1304. *
  1305. * When a value is passed, sets the logging level to that value.
  1306. * The values should be one of the following constants:
  1307. * logger.LOG
  1308. * logger.ERROR
  1309. * logger.WARN
  1310. * logger.INFO
  1311. * logger.DEBUG
  1312. *
  1313. * The value used determines which messages get printed. The logging
  1314. * values above are in order, and only messages logged at the logging
  1315. * level or above will actually be displayed to the user. E.g., the
  1316. * default level is WARN, so only messages logged with LOG, ERROR, or
  1317. * WARN will be displayed; INFO and DEBUG messages will be ignored.
  1318. */
  1319. logger.level = function (value) {
  1320. if (arguments.length) {
  1321. if (LevelsMap[value] === null) {
  1322. throw new Error('invalid logging level: ' + value);
  1323. }
  1324. CurrentLevel = LevelsMap[value];
  1325. }
  1326. return Levels[CurrentLevel];
  1327. };
  1328. /**
  1329. * Getter/Setter for the useConsole functionality
  1330. *
  1331. * When useConsole is true, the logger will log via the
  1332. * browser 'console' object.
  1333. */
  1334. logger.useConsole = function (value) {
  1335. if (arguments.length) UseConsole = !!value;
  1336. if (UseConsole) {
  1337. if (typeof console === 'undefined') {
  1338. throw new Error('global console object is not defined');
  1339. }
  1340. if (typeof console.log !== 'function') {
  1341. throw new Error('global console object does not have a log function');
  1342. }
  1343. if (typeof console.useLogger === 'function') {
  1344. if (console.useLogger()) {
  1345. throw new Error('console and logger are too intertwingly');
  1346. }
  1347. }
  1348. }
  1349. return UseConsole;
  1350. };
  1351. /**
  1352. * Getter/Setter for the useLogger functionality
  1353. *
  1354. * When useLogger is true, the logger will log via the
  1355. * native Logger plugin.
  1356. */
  1357. logger.useLogger = function (value) {
  1358. // Enforce boolean
  1359. if (arguments.length) UseLogger = !!value;
  1360. return UseLogger;
  1361. };
  1362. /**
  1363. * Logs a message at the LOG level.
  1364. *
  1365. * Parameters passed after message are used applied to
  1366. * the message with utils.format()
  1367. */
  1368. logger.log = function (message) { logWithArgs('LOG', arguments); };
  1369. /**
  1370. * Logs a message at the ERROR level.
  1371. *
  1372. * Parameters passed after message are used applied to
  1373. * the message with utils.format()
  1374. */
  1375. logger.error = function (message) { logWithArgs('ERROR', arguments); };
  1376. /**
  1377. * Logs a message at the WARN level.
  1378. *
  1379. * Parameters passed after message are used applied to
  1380. * the message with utils.format()
  1381. */
  1382. logger.warn = function (message) { logWithArgs('WARN', arguments); };
  1383. /**
  1384. * Logs a message at the INFO level.
  1385. *
  1386. * Parameters passed after message are used applied to
  1387. * the message with utils.format()
  1388. */
  1389. logger.info = function (message) { logWithArgs('INFO', arguments); };
  1390. /**
  1391. * Logs a message at the DEBUG level.
  1392. *
  1393. * Parameters passed after message are used applied to
  1394. * the message with utils.format()
  1395. */
  1396. logger.debug = function (message) { logWithArgs('DEBUG', arguments); };
  1397. // log at the specified level with args
  1398. function logWithArgs (level, args) {
  1399. args = [level].concat([].slice.call(args));
  1400. logger.logLevel.apply(logger, args);
  1401. }
  1402. // return the correct formatString for an object
  1403. function formatStringForMessage (message) {
  1404. return (typeof message === 'string') ? '' : '%o';
  1405. }
  1406. /**
  1407. * Logs a message at the specified level.
  1408. *
  1409. * Parameters passed after message are used applied to
  1410. * the message with utils.format()
  1411. */
  1412. logger.logLevel = function (level /* , ... */) {
  1413. // format the message with the parameters
  1414. var formatArgs = [].slice.call(arguments, 1);
  1415. var fmtString = formatStringForMessage(formatArgs[0]);
  1416. if (fmtString.length > 0) {
  1417. formatArgs.unshift(fmtString); // add formatString
  1418. }
  1419. var message = logger.format.apply(logger.format, formatArgs);
  1420. if (LevelsMap[level] === null) {
  1421. throw new Error('invalid logging level: ' + level);
  1422. }
  1423. if (LevelsMap[level] > CurrentLevel) return;
  1424. // queue the message if not yet at deviceready
  1425. if (!DeviceReady && !UseConsole) {
  1426. Queued.push([level, message]);
  1427. return;
  1428. }
  1429. // Log using the native logger if that is enabled
  1430. if (UseLogger) {
  1431. exec(null, null, 'Console', 'logLevel', [level, message]);
  1432. }
  1433. // Log using the console if that is enabled
  1434. if (UseConsole) {
  1435. // make sure console is not using logger
  1436. if (console.useLogger()) {
  1437. throw new Error('console and logger are too intertwingly');
  1438. }
  1439. // log to the console
  1440. switch (level) {
  1441. case logger.LOG: originalConsole.log(message); break;
  1442. case logger.ERROR: originalConsole.log('ERROR: ' + message); break;
  1443. case logger.WARN: originalConsole.log('WARN: ' + message); break;
  1444. case logger.INFO: originalConsole.log('INFO: ' + message); break;
  1445. case logger.DEBUG: originalConsole.log('DEBUG: ' + message); break;
  1446. }
  1447. }
  1448. };
  1449. /**
  1450. * Formats a string and arguments following it ala console.log()
  1451. *
  1452. * Any remaining arguments will be appended to the formatted string.
  1453. *
  1454. * for rationale, see FireBug's Console API:
  1455. * http://getfirebug.com/wiki/index.php/Console_API
  1456. */
  1457. logger.format = function (formatString, args) {
  1458. return __format(arguments[0], [].slice.call(arguments, 1)).join(' ');
  1459. };
  1460. // ------------------------------------------------------------------------------
  1461. /**
  1462. * Formats a string and arguments following it ala vsprintf()
  1463. *
  1464. * format chars:
  1465. * %j - format arg as JSON
  1466. * %o - format arg as JSON
  1467. * %c - format arg as ''
  1468. * %% - replace with '%'
  1469. * any other char following % will format it's
  1470. * arg via toString().
  1471. *
  1472. * Returns an array containing the formatted string and any remaining
  1473. * arguments.
  1474. */
  1475. function __format (formatString, args) {
  1476. if (formatString === null || formatString === undefined) return [''];
  1477. if (arguments.length === 1) return [formatString.toString()];
  1478. if (typeof formatString !== 'string') { formatString = formatString.toString(); }
  1479. var pattern = /(.*?)%(.)(.*)/;
  1480. var rest = formatString;
  1481. var result = [];
  1482. while (args.length) {
  1483. var match = pattern.exec(rest);
  1484. if (!match) break;
  1485. var arg = args.shift();
  1486. rest = match[3];
  1487. result.push(match[1]);
  1488. if (match[2] === '%') {
  1489. result.push('%');
  1490. args.unshift(arg);
  1491. continue;
  1492. }
  1493. result.push(__formatted(arg, match[2]));
  1494. }
  1495. result.push(rest);
  1496. var remainingArgs = [].slice.call(args);
  1497. remainingArgs.unshift(result.join(''));
  1498. return remainingArgs;
  1499. }
  1500. function __formatted (object, formatChar) {
  1501. try {
  1502. switch (formatChar) {
  1503. case 'j':
  1504. case 'o': return JSON.stringify(object);
  1505. case 'c': return '';
  1506. }
  1507. } catch (e) {
  1508. return 'error JSON.stringify()ing argument: ' + e;
  1509. }
  1510. if ((object === null) || (object === undefined)) {
  1511. return Object.prototype.toString.call(object);
  1512. }
  1513. return object.toString();
  1514. }
  1515. // ------------------------------------------------------------------------------
  1516. // when deviceready fires, log queued messages
  1517. logger.__onDeviceReady = function () {
  1518. if (DeviceReady) return;
  1519. DeviceReady = true;
  1520. for (var i = 0; i < Queued.length; i++) {
  1521. var messageArgs = Queued[i];
  1522. logger.logLevel(messageArgs[0], messageArgs[1]);
  1523. }
  1524. Queued = null;
  1525. };
  1526. // add a deviceready event to log queued messages
  1527. document.addEventListener('deviceready', logger.__onDeviceReady, false);
  1528. });
  1529. // file: ../cordova-ios/cordova-js-src/plugin/ios/wkwebkit.js
  1530. define("cordova/plugin/ios/wkwebkit", function(require, exports, module) {
  1531. var exec = require('cordova/exec');
  1532. var WkWebKit = {
  1533. allowsBackForwardNavigationGestures: function (allow) {
  1534. exec(null, null, 'CDVWebViewEngine', 'allowsBackForwardNavigationGestures', [allow]);
  1535. },
  1536. convertFilePath: function (path) {
  1537. if (!path || !window.CDV_ASSETS_URL) {
  1538. return path;
  1539. }
  1540. if (path.startsWith('/')) {
  1541. return window.CDV_ASSETS_URL + '/_app_file_' + path;
  1542. }
  1543. if (path.startsWith('file://')) {
  1544. return window.CDV_ASSETS_URL + path.replace('file://', '/_app_file_');
  1545. }
  1546. return path;
  1547. }
  1548. };
  1549. module.exports = WkWebKit;
  1550. });
  1551. // file: src/common/pluginloader.js
  1552. define("cordova/pluginloader", function(require, exports, module) {
  1553. var modulemapper = require('cordova/modulemapper');
  1554. // Helper function to inject a <script> tag.
  1555. // Exported for testing.
  1556. exports.injectScript = function (url, onload, onerror) {
  1557. var script = document.createElement('script');
  1558. // onload fires even when script fails loads with an error.
  1559. script.onload = onload;
  1560. // onerror fires for malformed URLs.
  1561. script.onerror = onerror;
  1562. script.src = url;
  1563. document.head.appendChild(script);
  1564. };
  1565. function injectIfNecessary (id, url, onload, onerror) {
  1566. onerror = onerror || onload;
  1567. if (id in define.moduleMap) {
  1568. onload();
  1569. } else {
  1570. exports.injectScript(url, function () {
  1571. if (id in define.moduleMap) {
  1572. onload();
  1573. } else {
  1574. onerror();
  1575. }
  1576. }, onerror);
  1577. }
  1578. }
  1579. function onScriptLoadingComplete (moduleList, finishPluginLoading) {
  1580. // Loop through all the plugins and then through their clobbers and merges.
  1581. for (var i = 0, module; (module = moduleList[i]); i++) {
  1582. if (module.clobbers && module.clobbers.length) {
  1583. for (var j = 0; j < module.clobbers.length; j++) {
  1584. modulemapper.clobbers(module.id, module.clobbers[j]);
  1585. }
  1586. }
  1587. if (module.merges && module.merges.length) {
  1588. for (var k = 0; k < module.merges.length; k++) {
  1589. modulemapper.merges(module.id, module.merges[k]);
  1590. }
  1591. }
  1592. // Finally, if runs is truthy we want to simply require() the module.
  1593. if (module.runs) {
  1594. modulemapper.runs(module.id);
  1595. }
  1596. }
  1597. finishPluginLoading();
  1598. }
  1599. // Handler for the cordova_plugins.js content.
  1600. // See plugman's plugin_loader.js for the details of this object.
  1601. // This function is only called if the really is a plugins array that isn't empty.
  1602. // Otherwise the onerror response handler will just call finishPluginLoading().
  1603. function handlePluginsObject (path, moduleList, finishPluginLoading) {
  1604. // Now inject the scripts.
  1605. var scriptCounter = moduleList.length;
  1606. if (!scriptCounter) {
  1607. finishPluginLoading();
  1608. return;
  1609. }
  1610. function scriptLoadedCallback () {
  1611. if (!--scriptCounter) {
  1612. onScriptLoadingComplete(moduleList, finishPluginLoading);
  1613. }
  1614. }
  1615. for (var i = 0; i < moduleList.length; i++) {
  1616. injectIfNecessary(moduleList[i].id, path + moduleList[i].file, scriptLoadedCallback);
  1617. }
  1618. }
  1619. function findCordovaPath () {
  1620. var path = null;
  1621. var scripts = document.getElementsByTagName('script');
  1622. var term = '/cordova.js';
  1623. for (var n = scripts.length - 1; n > -1; n--) {
  1624. var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
  1625. if (src.indexOf(term) === (src.length - term.length)) {
  1626. path = src.substring(0, src.length - term.length) + '/';
  1627. break;
  1628. }
  1629. }
  1630. return path;
  1631. }
  1632. // Tries to load all plugins' js-modules.
  1633. // This is an async process, but onDeviceReady is blocked on onPluginsReady.
  1634. // onPluginsReady is fired when there are no plugins to load, or they are all done.
  1635. exports.load = function (callback) {
  1636. var pathPrefix = findCordovaPath();
  1637. if (pathPrefix === null) {
  1638. console.log('Could not find cordova.js script tag. Plugin loading may fail.');
  1639. pathPrefix = '';
  1640. }
  1641. injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function () {
  1642. var moduleList = require('cordova/plugin_list');
  1643. handlePluginsObject(pathPrefix, moduleList, callback);
  1644. }, callback);
  1645. };
  1646. });
  1647. // file: src/common/urlutil.js
  1648. define("cordova/urlutil", function(require, exports, module) {
  1649. /**
  1650. * For already absolute URLs, returns what is passed in.
  1651. * For relative URLs, converts them to absolute ones.
  1652. */
  1653. exports.makeAbsolute = function makeAbsolute (url) {
  1654. var anchorEl = document.createElement('a');
  1655. anchorEl.href = url;
  1656. return anchorEl.href;
  1657. };
  1658. });
  1659. // file: src/common/utils.js
  1660. define("cordova/utils", function(require, exports, module) {
  1661. var utils = exports;
  1662. /**
  1663. * Defines a property getter / setter for obj[key].
  1664. */
  1665. utils.defineGetterSetter = function (obj, key, getFunc, opt_setFunc) {
  1666. if (Object.defineProperty) {
  1667. var desc = {
  1668. get: getFunc,
  1669. configurable: true
  1670. };
  1671. if (opt_setFunc) {
  1672. desc.set = opt_setFunc;
  1673. }
  1674. Object.defineProperty(obj, key, desc);
  1675. } else {
  1676. obj.__defineGetter__(key, getFunc);
  1677. if (opt_setFunc) {
  1678. obj.__defineSetter__(key, opt_setFunc);
  1679. }
  1680. }
  1681. };
  1682. /**
  1683. * Defines a property getter for obj[key].
  1684. */
  1685. utils.defineGetter = utils.defineGetterSetter;
  1686. utils.arrayIndexOf = function (a, item) {
  1687. if (a.indexOf) {
  1688. return a.indexOf(item);
  1689. }
  1690. var len = a.length;
  1691. for (var i = 0; i < len; ++i) {
  1692. if (a[i] === item) {
  1693. return i;
  1694. }
  1695. }
  1696. return -1;
  1697. };
  1698. /**
  1699. * Returns whether the item was found in the array.
  1700. */
  1701. utils.arrayRemove = function (a, item) {
  1702. var index = utils.arrayIndexOf(a, item);
  1703. if (index !== -1) {
  1704. a.splice(index, 1);
  1705. }
  1706. return index !== -1;
  1707. };
  1708. utils.typeName = function (val) {
  1709. return Object.prototype.toString.call(val).slice(8, -1);
  1710. };
  1711. /**
  1712. * Returns an indication of whether the argument is an array or not
  1713. */
  1714. utils.isArray = Array.isArray ||
  1715. function (a) { return utils.typeName(a) === 'Array'; };
  1716. /**
  1717. * Returns an indication of whether the argument is a Date or not
  1718. */
  1719. utils.isDate = function (d) {
  1720. return (d instanceof Date);
  1721. };
  1722. /**
  1723. * Does a deep clone of the object.
  1724. */
  1725. utils.clone = function (obj) {
  1726. if (!obj || typeof obj === 'function' || utils.isDate(obj) || typeof obj !== 'object') {
  1727. return obj;
  1728. }
  1729. var retVal, i;
  1730. if (utils.isArray(obj)) {
  1731. retVal = [];
  1732. for (i = 0; i < obj.length; ++i) {
  1733. retVal.push(utils.clone(obj[i]));
  1734. }
  1735. return retVal;
  1736. }
  1737. retVal = {};
  1738. for (i in obj) {
  1739. // 'unknown' type may be returned in custom protocol activation case on
  1740. // Windows Phone 8.1 causing "No such interface supported" exception on
  1741. // cloning (https://issues.apache.org/jira/browse/CB-11522)
  1742. // eslint-disable-next-line valid-typeof
  1743. if ((!(i in retVal) || retVal[i] !== obj[i]) && typeof obj[i] !== 'undefined' && typeof obj[i] !== 'unknown') {
  1744. retVal[i] = utils.clone(obj[i]);
  1745. }
  1746. }
  1747. return retVal;
  1748. };
  1749. /**
  1750. * Returns a wrapped version of the function
  1751. */
  1752. utils.close = function (context, func, params) {
  1753. return function () {
  1754. var args = params || arguments;
  1755. return func.apply(context, args);
  1756. };
  1757. };
  1758. // ------------------------------------------------------------------------------
  1759. function UUIDcreatePart (length) {
  1760. var uuidpart = '';
  1761. for (var i = 0; i < length; i++) {
  1762. var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
  1763. if (uuidchar.length === 1) {
  1764. uuidchar = '0' + uuidchar;
  1765. }
  1766. uuidpart += uuidchar;
  1767. }
  1768. return uuidpart;
  1769. }
  1770. /**
  1771. * Create a UUID
  1772. */
  1773. utils.createUUID = function () {
  1774. return UUIDcreatePart(4) + '-' +
  1775. UUIDcreatePart(2) + '-' +
  1776. UUIDcreatePart(2) + '-' +
  1777. UUIDcreatePart(2) + '-' +
  1778. UUIDcreatePart(6);
  1779. };
  1780. /**
  1781. * Extends a child object from a parent object using classical inheritance
  1782. * pattern.
  1783. */
  1784. utils.extend = (function () {
  1785. // proxy used to establish prototype chain
  1786. var F = function () {};
  1787. // extend Child from Parent
  1788. return function (Child, Parent) {
  1789. F.prototype = Parent.prototype;
  1790. Child.prototype = new F();
  1791. Child.__super__ = Parent.prototype;
  1792. Child.prototype.constructor = Child;
  1793. };
  1794. }());
  1795. /**
  1796. * Alerts a message in any available way: alert or console.log.
  1797. */
  1798. utils.alert = function (msg) {
  1799. if (window.alert) {
  1800. window.alert(msg);
  1801. } else if (console && console.log) {
  1802. console.log(msg);
  1803. }
  1804. };
  1805. });
  1806. window.cordova = require('cordova');
  1807. // file: src/scripts/bootstrap.js
  1808. require('cordova/init');
  1809. })();