twreporter-react
Version:
React-Redux site for The Reporter Foundation in Taiwan
34 lines • 198 kB
JavaScript
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
;(function(){
;eval("/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n//----------------------------------------------------------------------------\n// an implementation of the require() function as specified for use with\n// CommonJS Modules - see http://commonjs.org/specs/modules/1.0.html\n//----------------------------------------------------------------------------\n\n//----------------------------------------------------------------------------\n// inspired from David Flanagan's require() function documented here:\n// http://www.davidflanagan.com/2009/11/a-module-loader.html\n//----------------------------------------------------------------------------\n\n//----------------------------------------------------------------------------\n// only supports \"preloaded\" modules ala define() (AMD)\n// http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition\n// but the id parameter is required\n//----------------------------------------------------------------------------\n\n//----------------------------------------------------------------------------\n// function wrapper\n//----------------------------------------------------------------------------\n(function(){\n\n//----------------------------------------------------------------------------\n// some constants\n//----------------------------------------------------------------------------\nvar PROGRAM = \"modjewel\"\nvar VERSION = \"2.0.0\"\nvar global = this\n\n//----------------------------------------------------------------------------\n// if require() is already defined, leave\n//----------------------------------------------------------------------------\nif (global.modjewel) {\n log(\"modjewel global variable already defined\")\n return\n}\n\nglobal.modjewel = null\n\n//----------------------------------------------------------------------------\n// \"globals\" (local to this function scope though)\n//----------------------------------------------------------------------------\nvar ModuleStore\nvar ModulePreloadStore\nvar MainModule\nvar WarnOnRecursiveRequire = false\n\n//----------------------------------------------------------------------------\n// the require function\n//----------------------------------------------------------------------------\nfunction get_require(currentModule) {\n var result = function require(moduleId) {\n\n if (moduleId.match(/^\\.{1,2}\\//)) {\n moduleId = normalize(currentModule, moduleId)\n }\n\n if (hop(ModuleStore, moduleId)) {\n var module = ModuleStore[moduleId]\n if (module.__isLoading) {\n if (WarnOnRecursiveRequire) {\n var fromModule = currentModule ? currentModule.id : \"<root>\"\n console.log(\"module '\" + moduleId + \"' recursively require()d from '\" + fromModule + \"', problem?\")\n }\n }\n\n currentModule.moduleIdsRequired.push(moduleId)\n\n return module.exports\n }\n\n if (!hop(ModulePreloadStore, moduleId)) {\n var fromModule = currentModule ? currentModule.id : \"<root>\"\n error(\"module '\" + moduleId + \"' not found from '\" + fromModule + \"', must be define()'d first\")\n }\n\n var factory = ModulePreloadStore[moduleId][0]\n var prereqs = ModulePreloadStore[moduleId][1]\n\n var module = create_module(moduleId)\n\n var newRequire = get_require(module)\n\n ModuleStore[moduleId] = module\n\n module.__isLoading = true\n try {\n currentModule.moduleIdsRequired.push(moduleId)\n\n var prereqModules = []\n for (var i=0; i<prereqs.length; i++) {\n var prereqId = prereqs[i]\n var prereqModule\n\n if (prereqId == \"require\") prereqModule = newRequire\n else if (prereqId == \"exports\") prereqModule = module.exports\n else if (prereqId == \"module\") prereqModule = module\n else prereqModule = newRequire(prereqId)\n\n prereqModules.push(prereqModule)\n }\n\n if (typeof factory == \"function\") {\n var result = factory.apply(null, prereqModules)\n if (result) {\n module.exports = result\n }\n }\n else {\n module.exports = factory\n }\n }\n finally {\n module.__isLoading = false\n }\n\n return module.exports\n }\n\n result.define = require_define\n result.implementation = PROGRAM\n result.version = VERSION\n\n return result\n}\n\n//----------------------------------------------------------------------------\n// shorter version of hasOwnProperty\n//----------------------------------------------------------------------------\nfunction hop(object, name) {\n return Object.prototype.hasOwnProperty.call(object, name)\n}\n\n//----------------------------------------------------------------------------\n// create a new module\n//----------------------------------------------------------------------------\nfunction create_module(id) {\n return {\n id: id,\n uri: id,\n exports: {},\n prereqIds: [],\n moduleIdsRequired: []\n }\n}\n\n//----------------------------------------------------------------------------\n// reset the stores\n//----------------------------------------------------------------------------\nfunction require_reset() {\n ModuleStore = {}\n ModulePreloadStore = {}\n MainModule = create_module(null)\n\n var require = get_require(MainModule)\n var define = require_define\n \n define(\"modjewel\", modjewel_module)\n\n global.modjewel = require(\"modjewel\")\n global.modjewel.require = require\n global.modjewel.define = define\n global.modjewel.define.amd = {implementation: PROGRAM, version: VERSION}\n}\n\n//----------------------------------------------------------------------------\n// used by pre-built modules that can be included via <script src=>\n// a simplification of\n// http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition\n// where id is required\n//----------------------------------------------------------------------------\nfunction require_define(moduleId, prereqs, factory) {\n var rem = [\"require\", \"exports\", \"module\"]\n\n if (typeof moduleId != \"string\") {\n console.log(\"modjewel.define(): first parameter must be a string; was: \" + moduleId)\n return\n }\n\n if (arguments.length == 2) {\n factory = prereqs\n prereqs = null\n }\n\n if (!prereqs || prereqs.length == 0) {\n prereqs = rem\n }\n\n if (typeof factory != \"function\") {\n if (factory) {\n ModulePreloadStore[moduleId] = [factory, prereqs]\n return\n }\n\n console.log(\"modjewel.define(): factory was falsy: \" + factory)\n return\n }\n\n if (moduleId.match(/^\\./)) {\n console.log(\"modjewel.define(): moduleId must not start with '.': '\" + moduleName + \"'\")\n return\n }\n\n if (hop(ModulePreloadStore, moduleId)) {\n console.log(\"modjewel.define(): module '\" + moduleId + \"' has already been defined\")\n return\n }\n\n ModulePreloadStore[moduleId] = [factory, prereqs]\n}\n\n//----------------------------------------------------------------------------\n// get the path of a module\n//----------------------------------------------------------------------------\nfunction getModulePath(module) {\n if (!module || !module.id) return \"\"\n\n var parts = module.id.split(\"/\")\n\n return parts.slice(0, parts.length-1).join(\"/\")\n}\n\n//----------------------------------------------------------------------------\n// normalize a 'file name' with . and .. with a 'directory name'\n//----------------------------------------------------------------------------\nfunction normalize(module, file) {\n var modulePath = getModulePath(module)\n var dirParts = (\"\" == modulePath) ? [] : modulePath.split(\"/\")\n var fileParts = file.split(\"/\")\n\n for (var i=0; i<fileParts.length; i++) {\n var filePart = fileParts[i]\n\n if (filePart == \".\") {\n }\n\n else if (filePart == \"..\") {\n if (dirParts.length > 0) {\n dirParts.pop()\n }\n else {\n // error(\"error normalizing '\" + module + \"' and '\" + file + \"'\")\n // eat non-valid .. paths\n }\n }\n\n else {\n dirParts.push(filePart)\n }\n }\n\n return dirParts.join(\"/\")\n}\n\n//----------------------------------------------------------------------------\n// throw an error\n//----------------------------------------------------------------------------\nfunction error(message) {\n throw new Error(PROGRAM + \": \" + message)\n}\n\n//----------------------------------------------------------------------------\n// get a list of loaded modules\n//----------------------------------------------------------------------------\nfunction modjewel_getLoadedModuleIds() {\n var result = []\n\n for (moduleId in ModuleStore) {\n result.push(moduleId)\n }\n\n return result\n}\n\n//----------------------------------------------------------------------------\n// get a list of the preloaded module ids\n//----------------------------------------------------------------------------\nfunction modjewel_getPreloadedModuleIds() {\n var result = []\n\n for (moduleId in ModulePreloadStore) {\n result.push(moduleId)\n }\n\n return result\n}\n\n//----------------------------------------------------------------------------\n// get a module by module id\n//----------------------------------------------------------------------------\nfunction modjewel_getModule(moduleId) {\n if (null == moduleId) return MainModule\n\n return ModuleStore[moduleId]\n}\n\n//----------------------------------------------------------------------------\n// get a list of module ids which have been required by the specified module id\n//----------------------------------------------------------------------------\nfunction modjewel_getModuleIdsRequired(moduleId) {\n var module = modjewel_getModule(moduleId)\n if (null == module) return null\n\n return module.moduleIdsRequired.slice()\n}\n\n//----------------------------------------------------------------------------\n// set the WarnOnRecursiveRequireFlag\n// - if you make use of \"module.exports =\" in your code, you will want this on\n//----------------------------------------------------------------------------\nfunction modjewel_warnOnRecursiveRequire(value) {\n if (arguments.length == 0) return WarnOnRecursiveRequire\n WarnOnRecursiveRequire = !!value\n}\n\n//----------------------------------------------------------------------------\n// the modjewel module\n//----------------------------------------------------------------------------\nfunction modjewel_module(require, exports, module) {\n exports.VERSION = VERSION\n exports.require = null // filled in later\n exports.define = null // filled in later\n exports.getLoadedModuleIds = modjewel_getLoadedModuleIds\n exports.getPreloadedModuleIds = modjewel_getPreloadedModuleIds\n exports.getModule = modjewel_getModule\n exports.getModuleIdsRequired = modjewel_getModuleIdsRequired\n exports.warnOnRecursiveRequire = modjewel_warnOnRecursiveRequire\n}\n\n//----------------------------------------------------------------------------\n// log a message\n//----------------------------------------------------------------------------\nfunction log(message) {\n console.log(\"modjewel: \" + message)\n}\n\n//----------------------------------------------------------------------------\n// make the require function a global\n//----------------------------------------------------------------------------\nrequire_reset()\n\n//----------------------------------------------------------------------------\n})();\n\n//@ sourceURL=modjewel.js")
modjewel.require('modjewel').warnOnRecursiveRequire(true);
;eval(";modjewel.define(\"weinre/common/Binding\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar Binding, Ex;\n\nEx = require('./Ex');\n\nmodule.exports = Binding = (function() {\n function Binding(receiver, method) {\n if (!receiver) {\n throw new Ex(arguments, \"receiver argument for Binding constructor was null\");\n }\n if (typeof method === \"string\") {\n method = receiver[method];\n }\n if (typeof method === !\"function\") {\n throw new Ex(arguments, \"method argument didn't specify a function\");\n }\n return function() {\n return method.apply(receiver, [].slice.call(arguments));\n };\n }\n\n return Binding;\n\n})();\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/Binding.amd.js")
;eval(";modjewel.define(\"weinre/common/Callback\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar Callback, CallbackIndex, CallbackTable, ConnectorChannel, Ex;\n\nEx = require('./Ex');\n\nCallbackTable = {};\n\nCallbackIndex = 1;\n\nConnectorChannel = \"???\";\n\nmodule.exports = Callback = (function() {\n function Callback() {\n throw new Ex(arguments, \"this class is not intended to be instantiated\");\n }\n\n Callback.setConnectorChannel = function(connectorChannel) {\n return ConnectorChannel = \"\" + connectorChannel;\n };\n\n Callback.register = function(callback) {\n var data, func, index, receiver;\n if (typeof callback === \"function\") {\n callback = [null, callback];\n }\n if (typeof callback.slice !== \"function\") {\n throw new Ex(arguments, \"callback must be an array or function\");\n }\n receiver = callback[0];\n func = callback[1];\n data = callback.slice(2);\n if (typeof func === \"string\") {\n func = receiver[func];\n }\n if (typeof func !== \"function\") {\n throw new Ex(arguments, \"callback function was null or not found\");\n }\n index = ConnectorChannel + \"::\" + CallbackIndex;\n CallbackIndex++;\n if (CallbackIndex >= 65536 * 65536) {\n CallbackIndex = 1;\n }\n CallbackTable[index] = [receiver, func, data];\n return index;\n };\n\n Callback.deregister = function(index) {\n return delete CallbackTable[index];\n };\n\n Callback.invoke = function(index, args) {\n var callback, e, func, funcName, receiver;\n callback = CallbackTable[index];\n if (!callback) {\n throw new Ex(arguments, \"callback \" + index + \" not registered or already invoked\");\n }\n receiver = callback[0];\n func = callback[1];\n args = callback[2].concat(args);\n try {\n return func.apply(receiver, args);\n } catch (_error) {\n e = _error;\n funcName = func.name || func.signature;\n if (!funcName) {\n funcName = \"<unnamed>\";\n }\n return require(\"./Weinre\").logError(arguments.callee.signature + (\" exception invoking callback: \" + funcName + \"(\" + (args.join(',')) + \"): \") + e);\n } finally {\n Callback.deregister(index);\n }\n };\n\n return Callback;\n\n})();\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/Callback.amd.js")
;eval(";modjewel.define(\"weinre/common/Debug\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar Debug;\n\nmodule.exports = new (Debug = (function() {\n function Debug() {\n this._printCalledArgs = {};\n }\n\n Debug.prototype.log = function(message) {\n var console;\n console = window.console.__original || window.console;\n return console.log(\"\" + (this.timeStamp()) + \": \" + message);\n };\n\n Debug.prototype.logCall = function(context, intf, method, args, message) {\n var printArgs, signature;\n if (message) {\n message = \": \" + message;\n } else {\n message = \"\";\n }\n signature = this.signature(intf, method);\n printArgs = this._printCalledArgs[signature];\n if (printArgs) {\n args = JSON.stringify(args, null, 4);\n } else {\n args = \"\";\n }\n return this.log(\"\" + context + \" \" + signature + \"(\" + args + \")\" + message);\n };\n\n Debug.prototype.logCallArgs = function(intf, method) {\n return this._printCalledArgs[this.signature(intf, method)] = true;\n };\n\n Debug.prototype.signature = function(intf, method) {\n return \"\" + intf + \".\" + method;\n };\n\n Debug.prototype.timeStamp = function() {\n var date, mins, secs;\n date = new Date();\n mins = \"\" + (date.getMinutes());\n secs = \"\" + (date.getSeconds());\n if (mins.length === 1) {\n mins = \"0\" + mins;\n }\n if (secs.length === 1) {\n secs = \"0\" + secs;\n }\n return \"\" + mins + \":\" + secs;\n };\n\n return Debug;\n\n})());\n\n});\n\n//@ sourceURL=weinre/common/Debug.amd.js")
;eval(";modjewel.define(\"weinre/common/EventListeners\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar EventListeners, Ex, Weinre;\n\nEx = require('./Ex');\n\nWeinre = require('./Weinre');\n\nmodule.exports = EventListeners = (function() {\n function EventListeners() {\n this.listeners = [];\n }\n\n EventListeners.prototype.add = function(listener, useCapture) {\n return this.listeners.push([listener, useCapture]);\n };\n\n EventListeners.prototype.remove = function(listener, useCapture) {\n var listeners, _i, _len, _listener;\n listeners = this.listeners.slice();\n for (_i = 0, _len = listeners.length; _i < _len; _i++) {\n _listener = listeners[_i];\n if (_listener[0] !== listener) {\n continue;\n }\n if (_listener[1] !== useCapture) {\n continue;\n }\n this._listeners.splice(i, 1);\n return;\n }\n };\n\n EventListeners.prototype.fire = function(event) {\n var e, listener, listeners, _i, _len, _results;\n listeners = this.listeners.slice();\n _results = [];\n for (_i = 0, _len = listeners.length; _i < _len; _i++) {\n listener = listeners[_i];\n listener = listener[0];\n if (typeof listener === \"function\") {\n try {\n listener.call(null, event);\n } catch (_error) {\n e = _error;\n Weinre.logError(\"\" + arguments.callee.name + \" invocation exception: \" + e);\n }\n continue;\n }\n if (typeof (listener != null ? listener.handleEvent : void 0) !== \"function\") {\n throw new Ex(arguments, \"listener does not implement the handleEvent() method\");\n }\n try {\n _results.push(listener.handleEvent.call(listener, event));\n } catch (_error) {\n e = _error;\n _results.push(Weinre.logError(\"\" + arguments.callee.name + \" invocation exception: \" + e));\n }\n }\n return _results;\n };\n\n return EventListeners;\n\n})();\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/EventListeners.amd.js")
;eval(";modjewel.define(\"weinre/common/Ex\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar Ex, StackTrace, prefix;\n\nStackTrace = require('./StackTrace');\n\nmodule.exports = Ex = (function() {\n Ex.catching = function(func) {\n var e;\n try {\n return func.call(this);\n } catch (_error) {\n e = _error;\n console.log(\"runtime error: \" + e);\n return StackTrace.dump(arguments);\n }\n };\n\n function Ex(args, message) {\n if (!args || !args.callee) {\n throw Ex(arguments, \"first parameter must be an Arguments object\");\n }\n StackTrace.dump(args);\n if (message instanceof Error) {\n message = \"threw error: \" + message;\n }\n message = prefix(args, message);\n message;\n }\n\n return Ex;\n\n})();\n\nprefix = function(args, string) {\n if (args.callee.signature) {\n return args.callee.signature + \": \" + string;\n }\n if (args.callee.displayName) {\n return args.callee.displayName + \": \" + string;\n }\n if (args.callee.name) {\n return args.callee.name + \": \" + string;\n }\n return \"<anonymous>\" + \": \" + string;\n};\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/Ex.amd.js")
;eval(";modjewel.define(\"weinre/common/HookLib\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar HookLib, HookSite, HookSites, IgnoreHooks, callAfterHooks, callBeforeHooks, callExceptHooks, getHookSite, getHookedFunction;\n\nHookLib = exports;\n\nHookSites = [];\n\nIgnoreHooks = 0;\n\nmodule.exports = HookLib = (function() {\n function HookLib() {}\n\n HookLib.addHookSite = function(object, property) {\n return getHookSite(object, property, true);\n };\n\n HookLib.getHookSite = function(object, property) {\n return getHookSite(object, property, false);\n };\n\n HookLib.ignoreHooks = function(func) {\n var result;\n try {\n IgnoreHooks++;\n result = func.call();\n } finally {\n IgnoreHooks--;\n }\n return result;\n };\n\n return HookLib;\n\n})();\n\ngetHookSite = function(object, property, addIfNotFound) {\n var hookSite, i, _i, _len;\n i = 0;\n for (_i = 0, _len = HookSites.length; _i < _len; _i++) {\n hookSite = HookSites[_i];\n if (hookSite.object !== object) {\n continue;\n }\n if (hookSite.property !== property) {\n continue;\n }\n return hookSite;\n }\n if (!addIfNotFound) {\n return null;\n }\n hookSite = new HookSite(object, property);\n HookSites.push(hookSite);\n return hookSite;\n};\n\nHookSite = (function() {\n function HookSite(object, property) {\n var hookedFunction;\n this.object = object;\n this.property = property;\n this.target = object[property];\n this.hookss = [];\n if (typeof this.target === 'undefined') {\n return;\n } else {\n hookedFunction = getHookedFunction(this.target, this);\n if (!(navigator.userAgent.match(/MSIE/i) && (object === localStorage || object === sessionStorage))) {\n object[property] = hookedFunction;\n }\n }\n }\n\n HookSite.prototype.addHooks = function(hooks) {\n return this.hookss.push(hooks);\n };\n\n HookSite.prototype.removeHooks = function(hooks) {\n var i, _i, _ref;\n for (i = _i = 0, _ref = this.hookss.length; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {\n if (this.hookss[i] === hooks) {\n this.hookss.splice(i, 1);\n return;\n }\n }\n };\n\n return HookSite;\n\n})();\n\ngetHookedFunction = function(func, hookSite) {\n var hookedFunction;\n hookedFunction = function() {\n var e, result;\n callBeforeHooks(hookSite, this, arguments);\n try {\n result = func.apply(this, arguments);\n } catch (_error) {\n e = _error;\n callExceptHooks(hookSite, this, arguments, e);\n throw e;\n } finally {\n callAfterHooks(hookSite, this, arguments, result);\n }\n return result;\n };\n hookedFunction.displayName = func.displayName || func.name;\n return hookedFunction;\n};\n\ncallBeforeHooks = function(hookSite, receiver, args) {\n var hooks, _i, _len, _ref, _results;\n if (IgnoreHooks > 0) {\n return;\n }\n _ref = hookSite.hookss;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n hooks = _ref[_i];\n if (hooks.before) {\n _results.push(hooks.before.call(hooks, receiver, args));\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n};\n\ncallAfterHooks = function(hookSite, receiver, args, result) {\n var hooks, _i, _len, _ref, _results;\n if (IgnoreHooks > 0) {\n return;\n }\n _ref = hookSite.hookss;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n hooks = _ref[_i];\n if (hooks.after) {\n _results.push(hooks.after.call(hooks, receiver, args, result));\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n};\n\ncallExceptHooks = function(hookSite, receiver, args, e) {\n var hooks, _i, _len, _ref, _results;\n if (IgnoreHooks > 0) {\n return;\n }\n _ref = hookSite.hookss;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n hooks = _ref[_i];\n if (hooks.except) {\n _results.push(hooks.except.call(hooks, receiver, args, e));\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n};\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/HookLib.amd.js")
;eval(";modjewel.define(\"weinre/common/IDGenerator\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar IDGenerator, idName, nextId, nextIdValue;\n\nnextIdValue = 1;\n\nidName = \"__weinre__id\";\n\nmodule.exports = IDGenerator = (function() {\n function IDGenerator() {}\n\n IDGenerator.checkId = function(object) {\n return object[idName];\n };\n\n IDGenerator.getId = function(object, map) {\n var id;\n id = IDGenerator.checkId(object);\n if (!id) {\n id = nextId();\n object[idName] = id;\n }\n if (map) {\n map[id] = object;\n }\n return id;\n };\n\n IDGenerator.next = function() {\n return nextId();\n };\n\n return IDGenerator;\n\n})();\n\nnextId = function() {\n var result;\n result = nextIdValue;\n nextIdValue += 1;\n return result;\n};\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/IDGenerator.amd.js")
;eval(";modjewel.define(\"weinre/common/IDLTools\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar Callback, Ex, IDLTools, IDLs, getProxyMethod;\n\nEx = require('./Ex');\n\nCallback = require('./Callback');\n\nIDLs = {};\n\nmodule.exports = IDLTools = (function() {\n function IDLTools() {\n throw new Ex(arguments, \"this class is not intended to be instantiated\");\n }\n\n IDLTools.addIDLs = function(idls) {\n var idl, intf, _i, _len, _results;\n _results = [];\n for (_i = 0, _len = idls.length; _i < _len; _i++) {\n idl = idls[_i];\n _results.push((function() {\n var _j, _len1, _ref, _results1;\n _ref = idl.interfaces;\n _results1 = [];\n for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {\n intf = _ref[_j];\n IDLs[intf.name] = intf;\n _results1.push(intf.module = idl.name);\n }\n return _results1;\n })());\n }\n return _results;\n };\n\n IDLTools.getIDL = function(name) {\n return IDLs[name];\n };\n\n IDLTools.getIDLsMatching = function(regex) {\n var intf, intfName, results;\n results = [];\n for (intfName in IDLs) {\n intf = IDLs[intfName];\n if (intfName.match(regex)) {\n results.push(intf);\n }\n }\n return results;\n };\n\n IDLTools.validateAgainstIDL = function(klass, interfaceName) {\n var classMethod, error, errors, intf, intfMethod, messagePrefix, printName, propertyName, _i, _j, _len, _len1, _ref, _results;\n intf = IDLTools.getIDL(interfaceName);\n messagePrefix = \"IDL validation for \" + interfaceName + \": \";\n if (null === intf) {\n throw new Ex(arguments, messagePrefix + (\"idl not found: '\" + interfaceName + \"'\"));\n }\n errors = [];\n _ref = intf.methods;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n intfMethod = _ref[_i];\n classMethod = klass.prototype[intfMethod.name];\n printName = klass.name + \"::\" + intfMethod.name;\n if (null === classMethod) {\n errors.push(messagePrefix + (\"method not implemented: '\" + printName + \"'\"));\n continue;\n }\n if (classMethod.length !== intfMethod.parameters.length) {\n if (classMethod.length !== intfMethod.parameters.length + 1) {\n errors.push(messagePrefix + (\"wrong number of parameters: '\" + printName + \"'\"));\n continue;\n }\n }\n }\n for (propertyName in klass.prototype) {\n if (klass.prototype.hasOwnProperty(propertyName)) {\n continue;\n }\n if (propertyName.match(/^_.*/)) {\n continue;\n }\n printName = klass.name + \"::\" + propertyName;\n if (!intf.methods[propertyName]) {\n errors.push(messagePrefix + (\"method should not be implemented: '\" + printName + \"'\"));\n continue;\n }\n }\n if (!errors.length) {\n return;\n }\n _results = [];\n for (_j = 0, _len1 = errors.length; _j < _len1; _j++) {\n error = errors[_j];\n _results.push(require(\"./Weinre\").logError(error));\n }\n return _results;\n };\n\n IDLTools.buildProxyForIDL = function(proxyObject, interfaceName) {\n var intf, intfMethod, messagePrefix, _i, _len, _ref, _results;\n intf = IDLTools.getIDL(interfaceName);\n messagePrefix = \"building proxy for IDL \" + interfaceName + \": \";\n if (null === intf) {\n throw new Ex(arguments, messagePrefix + (\"idl not found: '\" + interfaceName + \"'\"));\n }\n _ref = intf.methods;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n intfMethod = _ref[_i];\n _results.push(proxyObject[intfMethod.name] = getProxyMethod(intf, intfMethod));\n }\n return _results;\n };\n\n return IDLTools;\n\n})();\n\ngetProxyMethod = function(intf, method) {\n var proxyMethod, result;\n result = proxyMethod = function() {\n var args, callbackId;\n callbackId = null;\n args = [].slice.call(arguments);\n if (args.length > 0) {\n if (typeof args[args.length - 1] === \"function\") {\n callbackId = Callback.register(args[args.length - 1]);\n args = args.slice(0, args.length - 1);\n }\n }\n while (args.length < method.parameters.length) {\n args.push(null);\n }\n args.push(callbackId);\n return this.__invoke(intf.name, method.name, args);\n };\n result.displayName = intf.name + \"__\" + method.name;\n return result;\n};\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/IDLTools.amd.js")
;eval(";modjewel.define(\"weinre/common/MessageDispatcher\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar Binding, Callback, Ex, IDLTools, InspectorBackend, MessageDispatcher, Verbose, WebSocketXhr, Weinre,\n __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\nWeinre = require('./Weinre');\n\nWebSocketXhr = require('./WebSocketXhr');\n\nIDLTools = require('./IDLTools');\n\nBinding = require('./Binding');\n\nEx = require('./Ex');\n\nCallback = require('./Callback');\n\nVerbose = false;\n\nInspectorBackend = null;\n\nmodule.exports = MessageDispatcher = (function() {\n function MessageDispatcher(url, id) {\n if (!id) {\n id = \"anonymous\";\n }\n this._url = url;\n this._id = id;\n this.error = null;\n this._opening = false;\n this._opened = false;\n this._closed = false;\n this._interfaces = {};\n this._open();\n }\n\n MessageDispatcher.setInspectorBackend = function(inspectorBackend) {\n return InspectorBackend = inspectorBackend;\n };\n\n MessageDispatcher.verbose = function(value) {\n if (arguments.length >= 1) {\n Verbose = !!value;\n }\n return Verbose;\n };\n\n MessageDispatcher.prototype._open = function() {\n if (this._opened || this._opening) {\n return;\n }\n if (this._closed) {\n throw new Ex(arguments, \"socket has already been closed\");\n }\n this._opening = true;\n this._socket = new WebSocketXhr(this._url, this._id);\n this._socket.addEventListener(\"open\", Binding(this, \"_handleOpen\"));\n this._socket.addEventListener(\"error\", Binding(this, \"_handleError\"));\n this._socket.addEventListener(\"message\", Binding(this, \"_handleMessage\"));\n return this._socket.addEventListener(\"close\", Binding(this, \"_handleClose\"));\n };\n\n MessageDispatcher.prototype.close = function() {\n if (this._closed) {\n return;\n }\n this._opened = false;\n this._closed = true;\n return this._socket.close();\n };\n\n MessageDispatcher.prototype.send = function(data) {\n return this._socket.send(data);\n };\n\n MessageDispatcher.prototype.getWebSocket = function() {\n return this._socket;\n };\n\n MessageDispatcher.prototype.registerInterface = function(intfName, intf, validate) {\n if (validate) {\n IDLTools.validateAgainstIDL(intf.constructor, intfName);\n }\n if (this._interfaces[intfName]) {\n throw new Ex(arguments, \"interface \" + intfName + \" has already been registered\");\n }\n return this._interfaces[intfName] = intf;\n };\n\n MessageDispatcher.prototype.createProxy = function(intfName) {\n var proxy, self, __invoke;\n proxy = {};\n IDLTools.buildProxyForIDL(proxy, intfName);\n self = this;\n proxy.__invoke = __invoke = function(intfName, methodName, args) {\n return self._sendMethodInvocation(intfName, methodName, args);\n };\n return proxy;\n };\n\n MessageDispatcher.prototype._sendMethodInvocation = function(intfName, methodName, args) {\n var data;\n if (typeof intfName !== \"string\") {\n throw new Ex(arguments, \"expecting intf parameter to be a string\");\n }\n if (typeof methodName !== \"string\") {\n throw new Ex(arguments, \"expecting method parameter to be a string\");\n }\n data = {\n \"interface\": intfName,\n method: methodName,\n args: args\n };\n data = JSON.stringify(data);\n this._socket.send(data);\n if (Verbose) {\n return Weinre.logDebug(this.constructor.name + (\"[\" + this._url + \"]: send \" + intfName + \".\" + methodName + \"(\" + (JSON.stringify(args)) + \")\"));\n }\n };\n\n MessageDispatcher.prototype.getState = function() {\n if (this._opening) {\n return \"opening\";\n }\n if (this._opened) {\n return \"opened\";\n }\n if (this._closed) {\n return \"closed\";\n }\n return \"unknown\";\n };\n\n MessageDispatcher.prototype.isOpen = function() {\n return this._opened === true;\n };\n\n MessageDispatcher.prototype._handleOpen = function(event) {\n this._opening = false;\n this._opened = true;\n this.channel = event.channel;\n Callback.setConnectorChannel(this.channel);\n if (Verbose) {\n return Weinre.logDebug(this.constructor.name + (\"[\" + this._url + \"]: opened\"));\n }\n };\n\n MessageDispatcher.prototype._handleError = function(message) {\n this.error = message;\n this.close();\n if (Verbose) {\n return Weinre.logDebug(this.constructor.name + (\"[\" + this._url + \"]: error: \") + message);\n }\n };\n\n MessageDispatcher.prototype._handleMessage = function(message) {\n var args, data, e, intf, intfName, method, methodName, methodSignature, skipErrorForMethods;\n skipErrorForMethods = ['domContentEventFired', 'loadEventFired', 'childNodeRemoved'];\n try {\n data = JSON.parse(message.data);\n } catch (_error) {\n e = _error;\n throw new Ex(arguments, \"invalid JSON data received: \" + e + \": '\" + message.data + \"'\");\n }\n intfName = data[\"interface\"];\n methodName = data.method;\n args = data.args;\n methodSignature = \"\" + intfName + \".\" + methodName + \"()\";\n intf = this._interfaces.hasOwnProperty(intfName) && this._interfaces[intfName];\n if (!intf && InspectorBackend && intfName.match(/.*Notify/)) {\n intf = InspectorBackend.getRegisteredDomainDispatcher(intfName.substr(0, intfName.length - 6));\n }\n if (!intf) {\n Weinre.notImplemented(\"weinre: request for non-registered interface: \" + methodSignature);\n return;\n }\n methodSignature = intf.constructor.name + (\".\" + methodName + \"()\");\n method = intf[methodName];\n if (typeof method !== \"function\") {\n Weinre.notImplemented(methodSignature);\n return;\n }\n try {\n method.apply(intf, args);\n } catch (_error) {\n e = _error;\n if (__indexOf.call(skipErrorForMethods, methodName) < 0) {\n Weinre.logError((\"weinre: invocation exception on \" + methodSignature + \": \") + e);\n }\n }\n if (Verbose) {\n return Weinre.logDebug(this.constructor.name + (\"[\" + this._url + \"]: recv \" + intfName + \".\" + methodName + \"(\" + (JSON.stringify(args)) + \")\"));\n }\n };\n\n MessageDispatcher.prototype._handleClose = function() {\n this._reallyClosed = true;\n if (Verbose) {\n return Weinre.logDebug(this.constructor.name + (\"[\" + this._url + \"]: closed\"));\n }\n };\n\n return MessageDispatcher;\n\n})();\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/MessageDispatcher.amd.js")
;eval(";modjewel.define(\"weinre/common/MethodNamer\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar MethodNamer,\n __hasProp = {}.hasOwnProperty;\n\nmodule.exports = MethodNamer = (function() {\n function MethodNamer() {}\n\n MethodNamer.setNamesForClass = function(aClass) {\n var key, val, _ref, _results;\n for (key in aClass) {\n if (!__hasProp.call(aClass, key)) continue;\n val = aClass[key];\n if (typeof val === \"function\") {\n val.signature = \"\" + aClass.name + \"::\" + key;\n val.displayName = key;\n val.name = key;\n }\n }\n _ref = aClass.prototype;\n _results = [];\n for (key in _ref) {\n if (!__hasProp.call(_ref, key)) continue;\n val = _ref[key];\n if (typeof val === \"function\") {\n val.signature = \"\" + aClass.name + \".\" + key;\n val.displayName = key;\n _results.push(val.name = key);\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n };\n\n return MethodNamer;\n\n})();\n\nMethodNamer.setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/MethodNamer.amd.js")
;eval(";modjewel.define(\"weinre/common/StackTrace\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar StackTrace, getTrace;\n\nmodule.exports = StackTrace = (function() {\n function StackTrace(args) {\n if (!args || !args.callee) {\n throw Error(\"first parameter to \" + arguments.callee.signature + \" must be an Arguments object\");\n }\n this.trace = getTrace(args);\n }\n\n StackTrace.dump = function(args) {\n var stackTrace;\n args = args || arguments;\n stackTrace = new StackTrace(args);\n return stackTrace.dump();\n };\n\n StackTrace.prototype.dump = function() {\n var frame, _i, _len, _ref, _results;\n console.log(\"StackTrace:\");\n _ref = this.trace;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n frame = _ref[_i];\n _results.push(console.log(\" \" + frame));\n }\n return _results;\n };\n\n return StackTrace;\n\n})();\n\ngetTrace = function(args) {\n var err, func, result, visitedFuncs;\n result = [];\n visitedFuncs = [];\n func = args.callee;\n while (func) {\n if (func.signature) {\n result.push(func.signature);\n } else if (func.displayName) {\n result.push(func.displayName);\n } else if (func.name) {\n result.push(func.name);\n } else {\n result.push(\"<anonymous>\");\n }\n if (-1 !== visitedFuncs.indexOf(func)) {\n result.push(\"... recursion\");\n return result;\n }\n visitedFuncs.push(func);\n try {\n func = func.caller;\n } catch (_error) {\n err = _error;\n func = null;\n }\n }\n return result;\n};\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/StackTrace.amd.js")
;eval(";modjewel.define(\"weinre/common/WebSocketXhr\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar EventListeners, Ex, HookLib, WebSocketXhr, Weinre, _xhrEventHandler;\n\nEx = require('./Ex');\n\nWeinre = require('./Weinre');\n\nHookLib = require('./HookLib');\n\nEventListeners = require('./EventListeners');\n\nmodule.exports = WebSocketXhr = (function() {\n WebSocketXhr.CONNECTING = 0;\n\n WebSocketXhr.OPEN = 1;\n\n WebSocketXhr.CLOSING = 2;\n\n WebSocketXhr.CLOSED = 3;\n\n function WebSocketXhr(url, id) {\n this.initialize(url, id);\n }\n\n WebSocketXhr.prototype.initialize = function(url, id) {\n if (!id) {\n id = \"anonymous\";\n }\n this.readyState = WebSocketXhr.CONNECTING;\n this._url = url;\n this._id = id;\n this._urlChannel = null;\n this._queuedSends = [];\n this._sendInProgress = true;\n this._listeners = {\n open: new EventListeners(),\n message: new EventListeners(),\n error: new EventListeners(),\n close: new EventListeners()\n };\n return this._getChannel();\n };\n\n WebSocketXhr.prototype._getChannel = function() {\n var body;\n body = JSON.stringify({\n id: this._id\n });\n return this._xhr(this._url, \"POST\", body, this._handleXhrResponseGetChannel);\n };\n\n WebSocketXhr.prototype._handleXhrResponseGetChannel = function(xhr) {\n var e, object;\n if (xhr.status !== 200) {\n return this._handleXhrResponseError(xhr);\n }\n try {\n object = JSON.parse(xhr.responseText);\n } catch (_error) {\n e = _error;\n this._fireEventListeners(\"error\", {\n message: \"non-JSON response from channel open request\"\n });\n this.close();\n return;\n }\n if (!object.channel) {\n this._fireEventListeners(\"error\", {\n message: \"channel open request did not include a channel\"\n });\n this.close();\n return;\n }\n this._urlChannel = this._url + \"/\" + object.channel;\n this.readyState = WebSocketXhr.OPEN;\n this._fireEventListeners(\"open\", {\n message: \"open\",\n channel: object.channel\n });\n this._sendInProgress = false;\n this._sendQueued();\n return this._readLoop();\n };\n\n WebSocketXhr.prototype._readLoop = function() {\n if (this.readyState === WebSocketXhr.CLOSED) {\n return;\n }\n if (this.readyState === WebSocketXhr.CLOSING) {\n return;\n }\n return this._xhr(this._urlChannel, \"GET\", \"\", this._handleXhrResponseGet);\n };\n\n WebSocketXhr.prototype._handleXhrResponseGet = function(xhr) {\n var data, datum, e, self, _i, _len, _results;\n self = this;\n if (xhr.status !== 200) {\n return this._handleXhrResponseError(xhr);\n }\n try {\n datum = JSON.parse(xhr.responseText);\n } catch (_error) {\n e = _error;\n this.readyState = WebSocketXhr.CLOSED;\n this._fireEventListeners(\"error\", {\n message: \"non-JSON response from read request\"\n });\n return;\n }\n HookLib.ignoreHooks(function() {\n return setTimeout((function() {\n return self._readLoop();\n }), 0);\n });\n _results = [];\n for (_i = 0, _len = datum.length; _i < _len; _i++) {\n data = datum[_i];\n _results.push(self._fireEventListeners(\"message\", {\n data: data\n }));\n }\n return _results;\n };\n\n WebSocketXhr.prototype.send = function(data) {\n if (typeof data !== \"string\") {\n throw new Ex(arguments, this.constructor.name + \".send\");\n }\n this._queuedSends.push(data);\n if (this._sendInProgress) {\n return;\n }\n return this._sendQueued();\n };\n\n WebSocketXhr.prototype._sendQueued = function() {\n var datum;\n if (this._queuedSends.length === 0) {\n return;\n }\n if (this.readyState === WebSocketXhr.CLOSED) {\n return;\n }\n if (this.readyState === WebSocketXhr.CLOSING) {\n return;\n }\n datum = JSON.stringify(this._queuedSends);\n this._queuedSends = [];\n this._sendInProgress = true;\n return this._xhr(this._urlChannel, \"POST\", datum, this._handleXhrResponseSend);\n };\n\n WebSocketXhr.prototype._handleXhrResponseSend = function(xhr) {\n var httpSocket;\n httpSocket = this;\n if (xhr.status !== 200) {\n return this._handleXhrResponseError(xhr);\n }\n this._sendInProgress = false;\n return HookLib.ignoreHooks(function() {\n return setTimeout((function() {\n return httpSocket._sendQueued();\n }), 0);\n });\n };\n\n WebSocketXhr.prototype.close = function() {\n this._sendInProgress = true;\n this.readyState = WebSocketXhr.CLOSING;\n this._fireEventListeners(\"close\", {\n message: \"closing\",\n wasClean: true\n });\n return this.readyState = WebSocketXhr.CLOSED;\n };\n\n WebSocketXhr.prototype.addEventListener = function(type, listener, useCapture) {\n return this._getListeners(type).add(listener, useCapture);\n };\n\n WebSocketXhr.prototype.removeEventListener = function(type, listener, useCapture) {\n return this._getListeners(type).remove(listener, useCapture);\n };\n\n WebSocketXhr.prototype._fireEventListeners = function(type, event) {\n if (this.readyState === WebSocketXhr.CLOSED) {\n return;\n }\n event.target = this;\n return this._getListeners(type).fire(event);\n };\n\n WebSocketXhr.prototype._getListeners = function(type) {\n var listeners;\n listeners = this._listeners[type];\n if (null === listeners) {\n throw new Ex(arguments, \"invalid event listener type: '\" + type + \"'\");\n }\n return listeners;\n };\n\n WebSocketXhr.prototype._handleXhrResponseError = function(xhr) {\n if (xhr.status === 404) {\n this.close();\n return;\n }\n this._fireEventListeners(\"error\", {\n target: this,\n status: xhr.status,\n message: \"error from XHR invocation: \" + xhr.statusText\n });\n return Weinre.logError((\"error from XHR invocation: \" + xhr.status + \": \") + xhr.statusText);\n };\n\n WebSocketXhr.prototype._xhr = function(url, method, data, handler) {\n var xhr;\n if (null === handler) {\n throw new Ex(arguments, \"handler must not be null\");\n }\n xhr = (XMLHttpRequest.noConflict ? new XMLHttpRequest.noConflict() : new XMLHttpRequest());\n xhr.httpSocket = this;\n xhr.httpSocketHandler = handler;\n xhr.onreadystatechange = function() {\n return _xhrEventHandler(xhr);\n };\n HookLib.ignoreHooks(function() {\n return xhr.open(method, url, true);\n });\n xhr.setRequestHeader(\"Content-Type\", \"text/plain\");\n return HookLib.ignoreHooks(function() {\n return xhr.send(data);\n });\n };\n\n return WebSocketXhr;\n\n})();\n\n_xhrEventHandler = function(xhr) {\n if (xhr.readyState !== 4) {\n return;\n }\n return xhr.httpSocketHandler.call(xhr.httpSocket, xhr);\n};\n\nrequire(\"../common/MethodNamer\").setNamesForClass(module.exports);\n\n});\n\n//@ sourceURL=weinre/common/WebSocketXhr.amd.js")
;eval(";modjewel.define(\"weinre/common/Weinre\", function(require, exports, module) { // Generated by CoffeeScript 1.8.0\nvar ConsoleLogger, Ex, IDLTools, StackTrace, Weinre, consoleLogger, getLogger, logger, _notImplemented, _showNotImplemented;\n\nEx = require('./Ex');\n\nIDLTools = require('./IDLTools');\n\nStackTrace = require('./StackTrace');\n\n_notImplemented = {};\n\n_showNotImplemented = false;\n\nlogger = null;\n\nmodule.exports = Weinre = (function() {\n function Weinre() {\n throw new Ex(arguments, \"this class is not intended to be instantiated\");\n }\n\n Weinre.addIDLs = function(idls) {\n return IDLTools.addIDLs(idls);\n };\n\n Weinre.deprecated = function() {\n return StackTrace.dump(arguments);\n };\n\n Weinre.notImplemented = function(thing) {\n if (_notImplemented[thing]) {\n return;\n }\n _notImplemented[thing]